preliminary support for the two RGB status leds
Note: pin assignments not final
This commit is contained in:
10
Core/Inc/status_led.h
Normal file
10
Core/Inc/status_led.h
Normal file
@ -0,0 +1,10 @@
|
||||
#ifndef INC_STATUS_LED_H
|
||||
#define INC_STATUS_LED_H
|
||||
|
||||
#include "ts_state_machine.h"
|
||||
|
||||
void status_led_init();
|
||||
|
||||
void status_led_state(TSState state, TSErrorKind error);
|
||||
|
||||
#endif // INC_STATUS_LED_H
|
||||
@ -4,6 +4,7 @@
|
||||
#include "stm32f3xx_hal.h"
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
// Minimum vehicle side voltage to exit precharge
|
||||
#define MIN_VEHICLE_SIDE_VOLTAGE 150000 // mV
|
||||
@ -37,13 +38,17 @@ typedef enum {
|
||||
TS_ERRORKIND_SHUNT_OVERCURRENT = 0x04,
|
||||
TS_ERRORKIND_SHUNT_OVERTEMP = 0x05
|
||||
} TSErrorKind;
|
||||
#define TS_ERROR_SOURCE_SHUNT (1 << 0)
|
||||
#define TS_ERROR_SOURCE_SLAVES (1 << 1)
|
||||
|
||||
typedef enum {
|
||||
TS_ERROR_SOURCE_SHUNT = (1 << 0),
|
||||
TS_ERROR_SOURCE_SLAVES = (1 << 1)
|
||||
} TSErrorSource;
|
||||
|
||||
typedef struct {
|
||||
TSState current_state;
|
||||
TSState target_state;
|
||||
uint32_t error;
|
||||
uint16_t error_source; // TSErrorSource (bitmask)
|
||||
uint16_t error_type; // TSErrorKind
|
||||
} TSStateHandle;
|
||||
|
||||
extern TSStateHandle ts_state;
|
||||
@ -66,6 +71,6 @@ void ts_sm_check_close_wait(int *is_closed, int should_close);
|
||||
|
||||
void ts_sm_handle_ams_in(const uint8_t *data);
|
||||
|
||||
void ts_sm_set_error_source(uint32_t flag, int state);
|
||||
void ts_sm_set_error_source(TSErrorSource source, TSErrorKind error_type, bool is_errored);
|
||||
|
||||
#endif // INC_TS_STATE_MACHINE_H
|
||||
|
||||
Reference in New Issue
Block a user