Detect under-voltage on GPIO1/11, persist UV state in NVS, enter a minimal power mode without ESP-NOW, and recover after charge; expose LED mode 6 battery-low for host testing via goTool. Co-authored-by: Cursor <cursoragent@cursor.com>
35 lines
863 B
C
35 lines
863 B
C
#ifndef BOARD_INPUT_H
|
|
#define BOARD_INPUT_H
|
|
|
|
#include <stdbool.h>
|
|
#include <stdint.h>
|
|
|
|
#include "esp_err.h"
|
|
|
|
typedef struct {
|
|
bool lipo1_valid;
|
|
bool lipo2_valid;
|
|
uint32_t lipo1_mv;
|
|
uint32_t lipo2_mv;
|
|
} board_lipo_reading_t;
|
|
|
|
/**
|
|
* Button (log on press) and LiPo ADC sampling (background log every 10 s).
|
|
* TODO: Pin assignments come from powerpod.h and may not match final hardware yet.
|
|
*/
|
|
esp_err_t board_input_init(void);
|
|
|
|
/** LiPo ADC channels only (no button, no background task). */
|
|
esp_err_t board_input_init_adc_only(void);
|
|
|
|
/** Start 10 s LiPo monitor task (normal boot only). */
|
|
esp_err_t board_input_start_lipo_monitor(void);
|
|
|
|
/** Front-panel button debounce task. */
|
|
esp_err_t board_input_init_button(void);
|
|
|
|
/** On-demand ADC read of both LiPo sense inputs (if configured). */
|
|
void board_input_read_lipo(board_lipo_reading_t *out);
|
|
|
|
#endif
|