14 void AutoExposure(
void);
15 void GetAutoExposeConfig(
void);
16 void SetAutoExposeConfig(
void);
17 void GetSensorHash(
void);
24 bool AutoExposeConfigIsValid(uint8_t, uint16_t, uint16_t, uint16_t);
26 void LisReadout(uint16_t num_pixels);
27 void S13131Readout(
void);
29 uint16_t
GetPeak(uint16_t
const _start_pixel, uint16_t
const _stop_pixel)
51 if (_stop_pixel < _start_pixel)
return peak;
60 uint16_t byte_index = (_start_pixel-1) * 2;
63 uint8_t * pframe =
frame + byte_index;
66 for (uint16_t pixnum = _start_pixel; pixnum++ <= _stop_pixel;)
68 uint16_t pixval = (*(pframe++)) << 8;
69 pixval |= (*(pframe++));
70 if (pixval > peak) peak = pixval;
76 #define LisExpose LisExpose_fake
77 #define LisReadout LisReadout_fake
78 #define S13131Expose S13131Expose_fake
79 #define S13131Readout S13131Readout_fake
247 bool success =
false;
267 uint8_t iterations = 0;
289 LisReadout(num_pixels);
328 else if (peak > max_peak)
338 else if (peak < min_peak)
352 big_result = big_result / peak;
370 if (++iterations ==
max_tries) done =
true;
373 uint16_t result = (uint16_t)(success << 8) | iterations;
uint16_t max_exposure
max_exposure is 1.31 seconds (65535 20µs-cycles) This is the 16-bit limit, UINT16_MAX,...
uint16_t start_pixel
AutoExpose() ignores pixels below start_pixel.
uint8_t max_tries
maximum number of tries before AutoExpose() gives up
uint16_t stop_pixel
AutoExpose() ignores pixels above stop_pixel.
uint16_t target_tolerance
target ± target_tolerance is the target peak counts range for AutoExpose().
uint16_t max_dark
max_dark is a conservative estimate on the largest dark offset
uint16_t target
target peak counts for AutoExpose().
uint16_t min_exposure
min_exposure is 100 microseconds (five 20µs-cycles) This is a safe lower limit to avoid dead frames.
void BiColorLedGreen(bicolorled_num led)
void BiColorLedRed(bicolorled_num led)
uint8_t const bicolorled_num
Indicator LED numbers in the JSON file are not necessarily the same as the corresponding bit number i...
uint16_t exposure_ticks
LIS-770i exposure time.
#define MAX_NUM_PIXELS
LIS-770i maximum number of pixels.
void GetSensorConfig(void)
uint8_t ReadLedState(void)
void SetSensorConfig(void)
uint8_t frame[]
One frame of pixel data is, at most, 1568 bytes.
uint16_t GetPeak(uint16_t const, uint16_t const)
bool LedNumIsValid(bicolorled_num led_num)
uint16_t AutoExpose(void)