Skip to content

Commit 815dbb2

Browse files
proofreading
1 parent a147a6b commit 815dbb2

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

docs/reference/contributing/connectivity/NFCEEPROMDriver.md

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,13 @@ Your implementation will inherit from `NFCEEPROMDriver` and implement all the pu
1010

1111
### Required methods
1212

13-
`NFCEEPROMDriver` defines the following pure virtual functions:
13+
`NFCEEPROMDriver` defines the following pure virtual methods.
1414

15+
These must return synchronously:
1516
- `void reset()`
1617
- `size_t read_max_size()`
18+
19+
These must return their results through calling methods in the `Delegate`:
1720
- `void start_session(bool force = false)`
1821
- `void end_session()`
1922
- `void read_bytes(uint32_t address, uint8_t* bytes, size_t count)`
@@ -28,21 +31,21 @@ This will be called during initialisation and may be called repeatedly. This mus
2831

2932
#### Implementing `read_max_size`
3033

31-
This must return synchronously the (effective) size of the EEPROM memory available to NDEF messages (not including the memory required by other files).
34+
This must synchronously return the (effective) size of the EEPROM memory available to NDEF messages (not including the memory required by other files or headers).
3235

3336
#### Implementing `start_session` and `end_session`
3437

35-
These open and close the communication wit the device. The `start_session` has an extra parameter that indicates the session should be started even if it would kill the RF session in the process if one is already opened. Otherwise the `open_session` should trigger the `on_session_opened` with the parameter set to false (failure) if an RF session is already opened.
38+
These open and close the communication with the device. The `start_session` has an extra parameter that indicates the session should be started even if it would kill the RF session in the process. Otherwise the `open_session` should trigger the `on_session_opened` with the parameter set to false (failure) if an RF session is already opened.
3639

3740
#### Implementing `read_bytes` and `write_bytes`
3841

3942
Both methods contain the `address` which is to be used as the starting offset in the file. This starts at the beginning of the body of the file where NDEF messages may be written. Any headers must be accounted for in the offset and size calculations. The `count` parameters are the maximum sizes of the operations but the operation may return less than the requested counts.
4043

41-
The events `on_bytes_read` and `on_bytes_written` must return the number of bytes successfully read or written in case the maximum size of the operation the device allows is smaller than the request operation. It's up to the caller to call these function multiple times with appropriate offsets as required.
44+
The events `on_bytes_read` and `on_bytes_written` must return the number of bytes successfully read or written in case the maximum size of the operation the device allows is smaller than the request operation. It's up to the caller to call these methods multiple times with appropriate offsets as required.
4245

4346
#### Implementing `read_size` and `write_size`
4447

45-
These read and write the limits used by the write and read operations. Writing beyond the set size must be truncated to the set size.
48+
These read and write the limits used by the write and read operations. Writing or reading beyond the set size must be truncated to the current size.
4649

4750
#### Implementing `erase_bytes`
4851

@@ -52,7 +55,7 @@ This is the equivalent of calling `write_bytes` with a buffer filled with `0`. L
5255

5356
Depending on your hardware you may support synchronous or asynchronous operation.
5457

55-
The `NFCEEPROMDriver` is designed with asynchronous operation in mind and the results of long operation are communicated through events. These must be used even if your implementation is synchronous.
58+
The `NFCEEPROMDriver` is designed with asynchronous operation in mind and the results of long operations are communicated through events. These must be used even if your implementation is synchronous.
5659

5760
In asynchronous implementations you may use an `EventQueue` to schedule processing caused by interrupts. The `NFCTarget` has set up your event queue which you can get by calling:
5861
`EventQueue* event_queue()`
@@ -61,11 +64,13 @@ You may initiate your event processing by calling `call()` on the event queue.
6164

6265
For example:
6366

64-
if your event management is done in a function called `manage_event` then you should call `event_queue()->call(&manage_event);`. The `EventQueue` also accepts passed in parameters and objects for non-static method calls - please see the `EventQueue` documentation for details on calling function on the queue.
67+
if your event management is done in a function called `manage_event` then you should call:
68+
`event_queue()->call(&manage_event);`.
69+
The `EventQueue` also accepts passed in parameters and objects for non-static method calls - please see the `EventQueue` documentation for details on calling functions on the queue.
6570

6671
#### Communicating events back to the NFCTarget
6772

68-
All events shall call function in the `Delegate` class object that has been set by the `NFCTarget`. Delegate is accessible through:
73+
All events shall call methods in the `Delegate` class object that has been set by the `NFCTarget`. Delegate is accessible through:
6974
`Delegate* delegate()`
7075

7176
It implements the following methods:
@@ -78,6 +83,8 @@ It implements the following methods:
7883
- `void on_size_read(bool success, size_t size)`
7984
- `void on_bytes_erased(size_t count)`
8085

86+
These must be used to communicate the results of all asynchronous calls.
87+
8188
### Testing
8289

8390
Run tests with:

0 commit comments

Comments
 (0)