I have two functions, which both try reading incoming data for a characteristic.
I would expect
*databe the same address in both functions, since the p_ble_evt write struct should just be copied byte by byte to the memory allocated for write_evt in the broken case.
Am I understanding the = operator wrong?
Does
struct copy = existingStructInstance;not copy the contents from existingInstance to copy?
Does this have something to do with data being declared as
void read_broken(ble_evt_t *p_ble_evt) {
ble_gatts_evt_write_t write_evt = p_ble_evt
->evt
.gatts_evt
.params
.write;
NRF_LOG_DEBUG("broken write address: %x\n", (uint32_t) write_evt.data);
}
void read_working(ble_evt_t *p_ble_evt){
ble_gatts_evt_write_t *write_evt = &p_ble_evt
->evt
.gatts_evt
.params
.write;
NRF_LOG_DEBUG("working data address: %x\n", (uint32_t) write_evt->data);
}