I am using multilink (version doesn't matter)
In main.c, certain variables, i.e., m_lbs_c, are declared and used in, i.e., led_status_send_to_all.
BLE_LBS_C_ARRAY_DEF(m_lbs_c, NRF_SDH_BLE_CENTRAL_LINK_COUNT); /**< LED button client instances. */
These are defined in ble_lbs_c.h
static ble_lbs_c_t _name[_cnt]; \
NRF_SDH_BLE_OBSERVERS(_name ## _obs, \
BLE_LBS_C_BLE_OBSERVER_PRIO, \
ble_lbs_c_on_ble_evt, &_name, _cnt)
I want to pull code out of main and put into other sub.c file for better organization,
for example, pull led_status_send_to_all into sub.c file, yet I must access m_lbs_c.
static ret_code_t led_status_send_to_all(uint8_t button_action)
{
ret_code_t err_code;
for (uint32_t i = 0; i< NRF_SDH_BLE_CENTRAL_LINK_COUNT; i++)
{
err_code = ble_lbs_led_status_send(&m_lbs_c[i], button_action);
if (err_code != NRF_SUCCESS &&
err_code != BLE_ERROR_INVALID_CONN_HANDLE &&
err_code != NRF_ERROR_INVALID_STATE)
{
return err_code;
}
}
return NRF_SUCCESS;
}
I do not know how to define an external definition of m_lbs_c so that I can put led_status_send_to_all into sub.c?
I do not know what I have to #include in sub.c?
Can you help?
thanks,
Richard