43 lines
1.6 KiB
C
43 lines
1.6 KiB
C
/**
|
|
* @file adc_mux.h
|
|
* @brief Helpers for external photodiode ADCs and internal STM32 ADC channels.
|
|
*/
|
|
|
|
#ifndef ADC_MUX_H
|
|
#define ADC_MUX_H
|
|
|
|
#include <stdbool.h>
|
|
#include <stdint.h>
|
|
|
|
/**
|
|
* @brief Snapshot of all internal STM32 ADC channels exported through telemetry.
|
|
*
|
|
* The firmware keeps the UART telemetry frame fixed at 30 bytes, so the host
|
|
* and the board agree on a stable slot order. These fields are captured from
|
|
* the MCU ADC peripherals once per telemetry refresh and then packed into that
|
|
* frame by the application core.
|
|
*/
|
|
typedef struct adc_internal_telemetry_t {
|
|
/** @brief Raw 12-bit code for external temperature sensor channel 1. */
|
|
uint16_t external_temperature_1_raw;
|
|
/** @brief Raw 12-bit code for external temperature sensor channel 2. */
|
|
uint16_t external_temperature_2_raw;
|
|
/** @brief Raw 12-bit code for the monitored 3.3V rail. */
|
|
uint16_t rail_3v3_raw;
|
|
/** @brief Raw 12-bit code for the monitored 5V1 rail. */
|
|
uint16_t rail_5v1_raw;
|
|
/** @brief Raw 12-bit code for the monitored 5V2 rail. */
|
|
uint16_t rail_5v2_raw;
|
|
/** @brief Raw 12-bit code read from free analog input PF3 / ADC3_IN9. */
|
|
uint16_t input_pf3_raw;
|
|
/** @brief Raw 12-bit code read from free analog input PF4 / ADC3_IN14. */
|
|
uint16_t input_pf4_raw;
|
|
/** @brief Raw 12-bit code for the monitored 7V rail. */
|
|
uint16_t rail_7v0_raw;
|
|
} adc_internal_telemetry_t;
|
|
|
|
uint16_t adc_mux_read_external_channel(uint8_t channel_index);
|
|
bool adc_mux_capture_internal_telemetry(adc_internal_telemetry_t *telemetry);
|
|
|
|
#endif /* ADC_MUX_H */
|