I think my pointer game is rusty, I can't seem to get the for loop implementation to work. It's like the pointer isn't incremented along with the array. Any suggestions?
I implemented a "manual" version of what i want the loop to do. It worked as expected.
typedef struct txstruct_t
{
uint8_t tx[8];
void(*send)(struct txstruct_t *cthis, uint8_t arr[8]);
}txstruct_t;
void send(txstruct_t *cthis, uint8_t arr[8]);
void loop()
{
txstruct_t txobj;
uint8_t buf[8] = { 1, 0, 1, 0, 1, 0, 1, …Run Code Online (Sandbox Code Playgroud) 所以我正在研究一些BLE 实现的教程代码,我遇到了这个我以前从未见过的语法。
&p_ble_evt->evt.gatts_evt.params.write;
Run Code Online (Sandbox Code Playgroud)
这是我不确定的 &foo;bar-&baz 部分。
我尝试“搜索”代码部分,然后尝试通过https://cdecl.org/运行它。但是没有了解这段代码的作用/是什么。
/**@brief Function for handling the Write event.
*
* @param[in] p_midi_service LED Button Service structure.
* @param[in] p_ble_evt Event received from the BLE stack.
*/
static void on_write(ble_midi_service_t * p_midi_service, ble_evt_t const * p_ble_evt)
{
ble_gatts_evt_write_t * p_evt_write = (ble_gatts_evt_write_t *) &p_ble_evt->evt.gatts_evt.params.write;
if ((p_evt_write->handle == p_midi_service->data_io_char_handles.value_handle) &&
(p_evt_write->len == 1) &&
(p_midi_service->evt_handler != NULL))
{
// Handle what happens on a write event to the characteristic value
}
// …Run Code Online (Sandbox Code Playgroud)