47 uint32_t successive_faults;
55 APP_TIMER_DEF(m_reset_nof_consecutive_latching_fault_count_timer_id);
88 static uint8_t load_var_detect_count = 0;
92 load_var_detect_count = 0;
98 load_var_detect_count = 0;
125 APP_ERROR_CHECK(err_code);
128 APP_ERROR_CHECK(err_code);
131 APP_ERROR_CHECK(err_code);
139 APP_ERROR_CHECK(err_code);
142 APP_ERROR_CHECK(err_code);
145 APP_ERROR_CHECK(err_code);
150 APP_ERROR_CHECK(err_code);
185 return NRF_ERROR_INVALID_STATE;
191 APP_ERROR_CHECK(err_code);
194 APP_ERROR_CHECK(err_code);
199 APP_ERROR_CHECK(err_code);
216 if(sm_handler == NULL)
218 return NRF_ERROR_INVALID_PARAM;
225 err_code = app_timer_create(&m_clear_latching_fault_timer_id,
226 APP_TIMER_MODE_SINGLE_SHOT,
228 APP_ERROR_CHECK(err_code);
230 err_code = app_timer_create(&m_short_beacon_timer_id,
231 APP_TIMER_MODE_SINGLE_SHOT,
233 APP_ERROR_CHECK(err_code);
235 err_code = app_timer_create(&m_reset_nof_consecutive_latching_fault_count_timer_id,
236 APP_TIMER_MODE_SINGLE_SHOT,
238 APP_ERROR_CHECK(err_code);
#define PTU_BEACON_DURATION_SHORT_MS
void(* ptu_sm_handler_t)(ptu_sm_signal_type_t signal)
uint32_t ptu_sensors_read(void)
Read sensors. This function should typically be called regularly by a timer and can generate events b...
#define PTU_BEACON_CYCLE_PERIOD_MS
#define PTU_LATCH_FAULT_NO_LOAD_VAR_NO_DEVICES_MS
#define PTU_POWERAMP_INPUT_BEACON_SHORT
static lf_status_t m_lf_status
uint32_t ptu_tmux_poweramp_enable_set(bool enable)
Test wrapper for ptu_hal_poweramp_enable_set().
APP_TIMER_DEF(m_clear_latching_fault_timer_id)
uint32_t ptu_power_ctrl_set_poweramp_input(uint16_t level)
Perform power control adjustments.
static ptu_sm_handler_t m_ptu_sm_execute
lf_timer_state_t
Enumerator describing what m_short_beacon_timer_id is being used for.
static bool m_no_devices_on_pad(const ptu_sensor_data_t *p_sensor_data)
Check if no load variation has been seen for PTU_PRU_NO_LOAD_VAR_NO_DEVICES_MS milliseconds, implying that no devices are on the pad.
uint32_t ptu_latching_fault_init(ptu_sm_handler_t sm_handler)
Initialize latching fault module.
ptu_sm_state_t
PTU states.
#define PTU_LATCH_FAULT_ENTRY_DELAY_MS
static void m_reset_nof_consecutive_latching_fault_count_timer_handler(void *p_context)
Clear number of consecutive latching faults timer handler.
#define TIMER_START(timer_id, ms, p_ctx)
#define PTU_LATCH_FAULT_NO_ERR_CLR_TIMEOUT_MS
uint32_t ptu_sensors_data_get(const ptu_sensor_data_t **sensors_data)
Get the latest data read from the PTU sensors.
#define PTU_LATCH_FAULT_EXIT_ATTEMPT_DELAY_MS
#define PTU_Z_TX_IN_NO_LOAD
static void m_latch_fault_attempt_to_clear_timer_handler(void *p_context)
Latch fault entry handler.
#define PTU_SM_CURRENT_STATE()
#define PTU_LATCH_FAULT_MAX_AUTO_CLR_ATTEMPTS
uint32_t ptu_latching_fault_entered(ptu_sm_state_t previous)
Handle the entry of latching fault state.
static void m_latch_fault_short_beacon_timer_handler(void *p_context)
Latch fault short beacon timer handler.
Definition of PTU sensor data.