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