move heatlh struct into header (#842)

This commit is contained in:
Adeeb Shihadeh 2022-01-27 18:12:25 -08:00 committed by GitHub
parent 00138a7f66
commit 3ddec2d221
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 26 deletions

25
board/health.h Normal file
View File

@ -0,0 +1,25 @@
// When changing this struct, boardd and python/__init__.py needs to be kept up to date!
#define HEALTH_PACKET_VERSION 3
struct __attribute__((packed)) health_t {
uint32_t uptime_pkt;
uint32_t voltage_pkt;
uint32_t current_pkt;
uint32_t can_rx_errs_pkt;
uint32_t can_send_errs_pkt;
uint32_t can_fwd_errs_pkt;
uint32_t gmlan_send_errs_pkt;
uint32_t faults_pkt;
uint8_t ignition_line_pkt;
uint8_t ignition_can_pkt;
uint8_t controls_allowed_pkt;
uint8_t gas_interceptor_detected_pkt;
uint8_t car_harness_status_pkt;
uint8_t usb_power_mode_pkt;
uint8_t safety_mode_pkt;
int16_t safety_param_pkt;
uint8_t fault_status_pkt;
uint8_t power_save_enabled_pkt;
uint8_t heartbeat_lost_pkt;
uint16_t unsafe_mode_pkt;
uint32_t blocked_msg_cnt_pkt;
};

View File

@ -1,33 +1,8 @@
#include "usb_protocol.h" #include "usb_protocol.h"
#include "health.h"
extern int _app_start[0xc000]; // Only first 3 sectors of size 0x4000 are used extern int _app_start[0xc000]; // Only first 3 sectors of size 0x4000 are used
// When changing this struct, boardd and python/__init__.py needs to be kept up to date!
#define HEALTH_PACKET_VERSION 3
struct __attribute__((packed)) health_t {
uint32_t uptime_pkt;
uint32_t voltage_pkt;
uint32_t current_pkt;
uint32_t can_rx_errs_pkt;
uint32_t can_send_errs_pkt;
uint32_t can_fwd_errs_pkt;
uint32_t gmlan_send_errs_pkt;
uint32_t faults_pkt;
uint8_t ignition_line_pkt;
uint8_t ignition_can_pkt;
uint8_t controls_allowed_pkt;
uint8_t gas_interceptor_detected_pkt;
uint8_t car_harness_status_pkt;
uint8_t usb_power_mode_pkt;
uint8_t safety_mode_pkt;
int16_t safety_param_pkt;
uint8_t fault_status_pkt;
uint8_t power_save_enabled_pkt;
uint8_t heartbeat_lost_pkt;
uint16_t unsafe_mode_pkt;
uint32_t blocked_msg_cnt_pkt;
};
// Prototypes // Prototypes
void set_safety_mode(uint16_t mode, int16_t param); void set_safety_mode(uint16_t mode, int16_t param);
bool is_car_safety_mode(uint16_t mode); bool is_car_safety_mode(uint16_t mode);