Hi, I'm porting my project from SDK8.1 to SDK10.
I replace static app_timer_id_t m_beacon_timer_id;
to APP_TIMER_DEF(m_beacon_timer_id);
to avoid hardfault when creat timer.
But I have a struct like this
typedef struct
{
a4wp_ptu_reg_item_state_t state; /**< Item state */
uint8_t adv_flags; /**< ADV flags */
ble_gap_addr_t address; /**< Device peer address */
ble_a4wps_c_t ble_a4wps_c; /**< Collection of handles */
a4wp_pru_static_t prev_pru_static; /**< Previous received PRU static parameters */
a4wp_pru_dynamic_t prev_pru_dynamic; /**< Previous received PRU dynamic parameters */
a4wp_pru_control_t prev_ctl; /**< Previous control packet being sent to PRU */
app_timer_id_t timer_id; /**< Registration / reconnection timer for this item */
a4wp_ctl_adj_power_t prev_adj_power; /**< Previous power adjustment level. */
uint8_t idle_conn_cnt; /**< Idle connection counter */
uint8_t age; /**< Number of devices items being added after this one */
uint8_t pre_connect_cnt; /**< Number of adv packets ignored due to only 1 of 2 criterie fullfilled. */
uint8_t connect_attmepts; /**< Number of connection attempts. */
uint32_t p_adj_time; /**< Current TICKS value of RTC at time of sending power adjust command. */
int32_t p_rect_before_p_adj; /**< PRECT in the PRU before we send the power adjust command. */
uint8_t active_p_adj_cooldown:1; /**< Does this PRU have an active cooldown from a previous power adjust command? */
uint8_t adjusted_power:1; /**< Has this PRU responded to the previous adjust power command? */
uint8_t pending_dyn_read:1; /**< Waiting for response on dyn param read */
uint8_t pending_ctl_write:1; /**< Waiting for response on control write */
uint8_t charged:1; /**< True when PRU charged, false otherwise */
uint8_t pending_charge_disable:1; /**< We are waiting on a Charge disable command to be acknowledged. */
uint8_t link_encrypted:1; /**< Link is encrypted. */
uint8_t p_adj_disabled:1; /**< No more power adjust commands should be sent to PRU. */
} a4wp_ptu_reg_item_t;
And initial the item like this
static void m_reg_item_init(a4wp_ptu_reg_item_t * item)
{
app_timer_id_t temp;
temp = item->timer_id;
memset(item, 0, sizeof(a4wp_ptu_reg_item_t));
item->ble_a4wps_c.conn_handle = BLE_CONN_HANDLE_INVALID;
item->timer_id = temp;
}
Then it will get HardFault in app_timer_create p_node->is_running = false;
// Instantiate registration and connection timers
for(i = 0; i < A4WP_PTU_MAX_CONNECTIONS; i++)
{
err_code = a4wp_ptu_reg_item_get_from_index(i, ®_item);
APP_ERROR_CHECK(err_code);
err_code = app_timer_create(&(reg_item->timer_id), \
APP_TIMER_MODE_SINGLE_SHOT,
m_reg_timer_handle);
APP_ERROR_CHECK(err_code);
}
I know the app_timer_id_t cause the HardFault, But I have no idea how fix it when there is a struct have app_timer_id_t.
Please give me some tips to solve it >"<