Add second stage to frequency hopping
This commit is contained in:
@ -16,12 +16,15 @@
|
||||
#define MASTER_HEARTBEAT_DESYNC_THRESH \
|
||||
(2 * MASTER_HEARTBEAT_SANITY_INTERVAL_MAX)
|
||||
#define FREQ_HOPPING_TRIM_STEPS 2
|
||||
#define FREQ_HOPPING_STAGE2_FRAMES 3
|
||||
#define FREQ_HOPPING_STAGE2_MAX_ATTEMPTS 6
|
||||
#define RCC_CR_HSITRIM_MAX 31
|
||||
#define CLOCK_SYNC_MAX_TRANSMIT_ERRORS 64
|
||||
|
||||
typedef enum {
|
||||
CLOCK_SYNC_NORMAL_OPERATION,
|
||||
CLOCK_SYNC_FREQ_HOPPING
|
||||
CLOCK_SYNC_FREQ_HOPPING_STAGE1,
|
||||
CLOCK_SYNC_FREQ_HOPPING_STAGE2
|
||||
} ClockSyncState;
|
||||
|
||||
extern ClockSyncState clock_sync_state;
|
||||
@ -29,9 +32,11 @@ extern ClockSyncState clock_sync_state;
|
||||
void clock_sync_init(CAN_HandleTypeDef* can_handle);
|
||||
void clock_sync_update();
|
||||
ClockSyncState clock_sync_update_normal_operation();
|
||||
ClockSyncState clock_sync_update_freq_hopping();
|
||||
ClockSyncState clock_sync_update_freq_hopping_stage1();
|
||||
ClockSyncState clock_sync_update_freq_hopping_stage2();
|
||||
void clock_sync_start_normal_operation();
|
||||
void clock_sync_start_freq_hopping();
|
||||
void clock_sync_start_freq_hopping_stage1();
|
||||
void clock_sync_start_freq_hopping_stage2();
|
||||
void clock_sync_handle_clock_sync_frame(uint8_t counter);
|
||||
void clock_sync_handle_master_heartbeat();
|
||||
void clock_sync_startup_check();
|
||||
@ -39,4 +44,6 @@ uint8_t get_hsi_trim();
|
||||
void set_hsi_trim(uint8_t trim);
|
||||
void trim_hsi_by(int32_t delta);
|
||||
|
||||
uint8_t calculate_freq_hopping_trim(uint32_t freq_hopping_iteration);
|
||||
|
||||
#endif // INC_CLOCK_SYNC_H_
|
||||
|
||||
Reference in New Issue
Block a user