@@ -21,7 +21,7 @@ using namespace mbed;
21
21
using namespace mbed ::nfc;
22
22
23
23
NFCEEPROM::NFCEEPROM (NFCEEPROMDriver *driver, events::EventQueue *queue, const Span<uint8_t > &ndef_buffer) : NFCTarget(ndef_buffer),
24
- _delegate(NULL ), _driver(driver), _initialized(false ), _current_op(nfc_eeprom_idle), _ndef_buffer_read_sz(0 ), _eeprom_address(0 ), _operation_result(NFC_ERR_UNKNOWN)
24
+ _delegate(NULL ), _driver(driver), _event_queue(queue), _initialized(false ), _current_op(nfc_eeprom_idle), _ndef_buffer_read_sz(0 ), _eeprom_address(0 ), _operation_result(NFC_ERR_UNKNOWN)
25
25
{
26
26
_driver->set_delegate (this );
27
27
_driver->set_event_queue (queue);
@@ -68,7 +68,6 @@ void NFCEEPROM::write_ndef_message()
68
68
69
69
// Reset EEPROM address
70
70
_eeprom_address = 0 ;
71
-
72
71
// Go through the steps!
73
72
_driver->start_session ();
74
73
@@ -87,7 +86,6 @@ void NFCEEPROM::read_ndef_message()
87
86
}
88
87
return ;
89
88
}
90
-
91
89
_current_op = nfc_eeprom_read_start_session;
92
90
93
91
// Reset EEPROM address
@@ -114,7 +112,6 @@ void NFCEEPROM::erase_ndef_message()
114
112
}
115
113
return ;
116
114
}
117
-
118
115
_current_op = nfc_eeprom_erase_start_session;
119
116
120
117
// Reset EEPROM address
@@ -230,7 +227,7 @@ void NFCEEPROM::on_bytes_read(size_t count)
230
227
ac_buffer_builder_write_n_skip (buffer_builder, count);
231
228
232
229
// Continue reading
233
- continue_read ( );
230
+ _event_queue-> call ( this , &NFCEEPROM::continue_read );
234
231
break ;
235
232
}
236
233
default :
@@ -254,7 +251,7 @@ void NFCEEPROM::on_bytes_written(size_t count)
254
251
ac_buffer_read_n_skip (&_ndef_buffer_reader, count);
255
252
256
253
// Continue writing
257
- continue_write ( );
254
+ _event_queue-> call ( this , &NFCEEPROM::continue_write );
258
255
break ;
259
256
default :
260
257
// Should not happen, state machine is broken or driver is doing something wrong
@@ -331,7 +328,7 @@ void NFCEEPROM::on_size_read(bool success, size_t size)
331
328
332
329
// Start reading bytes
333
330
_current_op = nfc_eeprom_read_read_bytes;
334
- continue_read ( );
331
+ _event_queue-> call ( this , &NFCEEPROM::continue_read );
335
332
break ;
336
333
}
337
334
default :
@@ -343,6 +340,7 @@ void NFCEEPROM::on_size_read(bool success, size_t size)
343
340
344
341
void NFCEEPROM::on_bytes_erased (size_t count)
345
342
{
343
+
346
344
switch (_current_op) {
347
345
case nfc_eeprom_erase_erase_bytes:
348
346
if (count == 0 ) {
@@ -354,7 +352,7 @@ void NFCEEPROM::on_bytes_erased(size_t count)
354
352
_eeprom_address += count;
355
353
356
354
// Continue erasing
357
- continue_erase ( );
355
+ _event_queue-> call ( this , &NFCEEPROM::continue_erase );
358
356
break ;
359
357
default :
360
358
// Should not happen, state machine is broken or driver is doing something wrong
0 commit comments