1. Overview
The lepton_cci module provides high-level command functions for configuring and controlling the Lepton thermal sensor via the CCI (Command and Control Interface). This module abstracts the low-level CCI protocol and provides convenient API functions.
1.1. Key Features
-
Temperature reading (FPA and AUX sensors)
-
AGC (Automatic Gain Control) management
-
Emissivity configuration for radiometric measurements
-
ROI (Region of Interest) configuration
-
Scene statistics and spotmeter control
-
TLinear resolution settings
-
Video source and format control
-
Flux linear parameters management
2. Supported Functions
2.1. Temperature Reading
-
Lepton_GetTemperature(): Read FPA and AUX temperatures
2.2. AGC Control
-
Lepton_EnableAGC(): Enable/disable AGC-
When enabled: Provides 8-bit contrast-enhanced images
-
When disabled: Provides 14-bit raw radiometric data (with TLinear on radiometric sensors)
-
2.3. Radiometric Configuration (Lepton 3.5 only)
-
Lepton_SetEmissivity(): Configure material emissivity (0-100%) -
Lepton_GetFluxLinearParameters()/Lepton_SetFluxLinearParameters(): Scene calibration -
Lepton_GetTLinearResolution()/Lepton_SetTLinearResolution(): Temperature resolution mode
2.4. ROI Management
-
Spotmeter:
Lepton_GetSpotmeterROI()/Lepton_SetSpotmeterROI() -
Scene:
Lepton_GetSceneROI()/Lepton_SetSceneROI() -
AGC:
Lepton_GetAGCROI()/Lepton_SetAGCROI() -
Video Focus:
Lepton_GetVideoFocusROI()/Lepton_SetVideoFocusROI()
2.5. Scene Data
-
Lepton_GetSpotmeter(): Read spotmeter statistics -
Lepton_GetSceneStatistics(): Read scene min/max/avg -
Lepton_GetUptime(): Sensor uptime in milliseconds
2.6. Video Control
-
Lepton_SetVideoFormat(): RAW14 or RGB888 -
Lepton_SetVideoSource(): Normal, ramp, or constant test patterns -
Lepton_FreezeVideo(): Freeze/unfreeze output -
Lepton_EnableTelemetry(): Enable/disable telemetry data
3. Implementation Details
This module wraps low-level CCI functions (see CCI Low-Level) with device state management:
-
Validates device initialization
-
Manages radiometric/non-radiometric modes
-
Synchronizes AGC and TLinear states
-
Provides error checking and logging
3.1. Example: AGC vs TLinear
// Non-radiometric sensors: AGC only
if (!device.Internal.isRadiometric) {
Lepton_EnableAGC(&device, true, &status); // Enable AGC
}
// Radiometric sensors: AGC or TLinear
if (device.Internal.isRadiometric) {
Lepton_EnableAGC(&device, false, &status); // Disable AGC → enables TLinear
// Now get 14-bit temperature data
}
4. Error Handling
All functions return Lepton_Error_t:
-
LEPTON_ERR_OK: Success -
LEPTON_ERR_INVALID_ARG: Invalid parameters -
LEPTON_ERR_NOT_INITIALIZED: Device not initialized -
LEPTON_ERR_NOT_SUPPORTED: Feature not available (e.g., TLinear on Lepton 3.0)
5. Usage Example
Lepton_Result_t status;
// Read temperatures
uint16_t fpa, aux;
Lepton_GetTemperature(&device, &fpa, &aux, &status);
float fpa_celsius = Lepton_KelvinToCelsius(fpa);
// Configure for radiometric mode
Lepton_EnableAGC(&device, false, &status); // Disable AGC
Lepton_SetEmissivity(&device, 98, &status); // Human skin
Lepton_SetTLinearResolution(&device, TLINEAR_RES_0_1, &status);
// Set spotmeter ROI (center of image)
Lepton_ROI_t roi = {
.Start = {.X = 70, .Y = 50},
.End = {.X = 90, .Y = 70}
};
Lepton_SetSpotmeterROI(&device, &roi, &status);
// Read spotmeter
Lepton_Spotmeter_t spot;
Lepton_GetSpotmeter(&device, &spot, &status);
float temp = Lepton_KelvinToCelsius(spot.Value);
6. See Also
-
CCI Low-Level - Low-level I2C protocol implementation
-
Main Driver - High-level API overview
7. License
Copyright © Daniel Kampert, 2026 | GNU GPL v3.0
Website: https://www.kampis-elektroecke.de