2019-07-24 06:07:06 +08:00
|
|
|
// ******************** Prototypes ********************
|
2022-11-30 14:55:10 +08:00
|
|
|
void print(const char *a);
|
2019-07-24 06:07:06 +08:00
|
|
|
void puth(unsigned int i);
|
|
|
|
void puth2(unsigned int i);
|
2021-09-26 12:46:19 +08:00
|
|
|
void puth4(unsigned int i);
|
2022-11-10 10:46:20 +08:00
|
|
|
void hexdump(const void *a, int l);
|
2019-07-24 06:07:06 +08:00
|
|
|
typedef struct board board;
|
|
|
|
typedef struct harness_configuration harness_configuration;
|
|
|
|
void can_flip_buses(uint8_t bus1, uint8_t bus2);
|
2021-07-14 05:12:07 +08:00
|
|
|
void pwm_init(TIM_TypeDef *TIM, uint8_t channel);
|
|
|
|
void pwm_set(TIM_TypeDef *TIM, uint8_t channel, uint8_t percentage);
|
2019-07-24 06:07:06 +08:00
|
|
|
|
|
|
|
// ********************* Globals **********************
|
|
|
|
uint8_t hw_type = 0;
|
|
|
|
const board *current_board;
|
2019-12-06 06:19:29 +08:00
|
|
|
uint32_t uptime_cnt = 0;
|
2023-01-11 07:09:51 +08:00
|
|
|
bool green_led_enabled = false;
|
2021-09-08 06:19:42 +08:00
|
|
|
|
|
|
|
// heartbeat state
|
|
|
|
uint32_t heartbeat_counter = 0;
|
2021-06-05 13:07:45 +08:00
|
|
|
bool heartbeat_lost = false;
|
2021-12-16 09:28:57 +08:00
|
|
|
bool heartbeat_disabled = false; // set over USB
|
2021-09-08 06:19:42 +08:00
|
|
|
|
2022-03-08 06:24:04 +08:00
|
|
|
// Enter deep sleep mode
|
2022-08-02 08:25:48 +08:00
|
|
|
bool deepsleep_allowed = false;
|
2022-08-12 18:43:36 +08:00
|
|
|
bool ignition_seen = false;
|
2022-03-08 06:24:04 +08:00
|
|
|
|
2021-09-08 06:19:42 +08:00
|
|
|
// siren state
|
2020-08-17 21:04:01 +08:00
|
|
|
bool siren_enabled = false;
|
2021-09-08 06:19:42 +08:00
|
|
|
uint32_t siren_countdown = 0; // siren plays while countdown > 0
|
|
|
|
uint32_t controls_allowed_countdown = 0;
|
|
|
|
|