Skip to content

Commit ad31ac9

Browse files
maciejbocianski0xc0170
authored andcommitted
I2C design doc - misspelling fixes
1 parent 5ebeafb commit ad31ac9

File tree

1 file changed

+69
-69
lines changed

1 file changed

+69
-69
lines changed

docs/design-documents/hal/0001-i2c-overhaul.md

Lines changed: 69 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ List of drivers and examples currently using the I2C interface:
8989

9090
- **Add** `i2c_set_clock_stretching` function to the API.
9191

92-
Enables or disables clock stretching for the I2C peripheral when in slave mode
92+
Enables or disables clock stretching for the I2C peripheral when in slave mode.
9393

9494
- **Add** `i2c_timeout` function to the API.
9595

@@ -109,7 +109,7 @@ List of drivers and examples currently using the I2C interface:
109109

110110
- **Add** a return value to the `i2c_frequency` which indicates the frequency that the peripheral was configured to.
111111

112-
The frequency requested may not be supported by the I2C peripheral, the peripheral will select the nearest supported frequency instead (but not greater then requested), this selected frequency will be returned to inform the caller of the difference.
112+
The frequency requested may not be supported by the I2C peripheral, the peripheral will select the nearest supported frequency instead (but not greater then requested), the selected frequency will be returned to inform the caller of the difference.
113113

114114
- **Change** the `stop` parameter for the transfer function from an `int` value to a `bool` value.
115115

@@ -149,7 +149,7 @@ The main changes involve removing the slave specific read/write functions and ro
149149

150150
- **Remove** the `i2c_slave_mode` function, add an `is_slave` parameter to the `i2c_init` function.
151151

152-
The decision to initialise the peripheral in master or slave mode should be decided at construction time. This simplifies the API as it removes the need for two separate functions to initialise slave mode `i2c_slave_mode` and `i2c_slave_address` .
152+
The decision to initialize the peripheral in master or slave mode should be decided at construction time. This simplifies the API as it removes the need for two separate functions to initialize slave mode `i2c_slave_mode` and `i2c_slave_address`.
153153

154154
- **Remove** the I2C slave specific transfer functions: `i2c_slave_read`, `i2c_slave_write`.
155155

@@ -175,15 +175,15 @@ The main changes involve removing the slave specific read/write functions and ro
175175

176176
- **Remove** the `i2c_irq_handler_asynch` function from the API.
177177

178-
The event is now passed as an argument to the callback this method is no longer required.
178+
The event is now passed as an argument to the callback, this method is no longer required.
179179

180180
- **Remove** the `event` parameter from the `i2c_transfer_async` function.
181181

182-
The callback will now be invoked on any event with the event as an argument.
182+
The callback is now invoked on any event with the event as an argument.
183183

184184
- **Remove** the `i2c_active` function from the API.
185185

186-
The async callback is now always invoked on async operation termination (unless cancelled), this status can be tracked from driver layer without any HAL request.
186+
The async callback is now always invoked on async operation termination (unless canceled), this status can be tracked from driver layer without any HAL request.
187187

188188
### The new API
189189

@@ -219,13 +219,13 @@ typedef struct {
219219
*/
220220
void i2c_get_capabilities(i2c_capabilities_t *capabilities);
221221

222-
/** Initialize the I2C peripheral. It sets the default parameters for I2C
223-
* peripheral, and configures its pins.
222+
/** Initialize the I2C peripheral. It sets the default parameters for the I2C
223+
* peripheral and configures its pins.
224224
*
225225
* @param obj The I2C object
226226
* @param sda The sda pin
227227
* @param scl The scl pin
228-
* @param is_slave Choose whether the peripheral is initialised as master or
228+
* @param is_slave Choose whether the peripheral is initialized as master or
229229
* slave.
230230
*/
231231
void i2c_init(i2c_t *obj, PinName sda, PinName scl, bool is_slave);
@@ -236,13 +236,13 @@ void i2c_init(i2c_t *obj, PinName sda, PinName scl, bool is_slave);
236236
*/
237237
void i2c_free(i2c_t *obj);
238238

239-
/** Configure the frequency in Hz the I2C peripheral should operate at.
239+
/** Configure the frequency in Hz at which I2C peripheral should operate.
240240
*
241241
* @param obj The I2C object
242242
* @param frequency Frequency in Hz
243243
*
244-
* @returns The actual frequency that the peripheral will be generating to
245-
* allow a user adjust its strategy in case the target cannot be
244+
* @returns The actual frequency that the peripheral generates to
245+
* allow a user to adjust its strategy in case the target cannot be
246246
* reached.
247247
*/
248248
uint32_t i2c_frequency(i2c_t *obj, uint32_t frequency);
@@ -260,10 +260,10 @@ void i2c_set_clock_stretching(i2c_t *obj, bool enabled);
260260
* @param obj The I2C object
261261
* @param timeout Transmission timeout in microseconds.
262262
*
263-
* @note If no timeout is set the default timeout is used.
263+
* @note If no timeout is set, the default timeout is used.
264264
* Default timeout value is based on I2C frequency.
265265
* Byte timeout is computed as triple amount of time it would take
266-
* to send 10bit over I2C and is expressed by the formula:
266+
* to send 10 bit over I2C and is expressed by the formula:
267267
* byte_timeout = 3 * (1/frequency * 10 * 1000000)
268268
*/
269269
void i2c_timeout(i2c_t *obj, uint32_t timeout);
@@ -282,85 +282,85 @@ void i2c_stop(i2c_t *obj);
282282

283283
/** Blocking sending data
284284
*
285-
* This function transmits data, when the peripheral is configured as Master to
286-
* the selected slave, and when configured as Slave transmits data to the
285+
* This function transmits data when the peripheral is configured as Master to
286+
* the selected slave and when configured as Slave transmits data to the
287287
* Master.
288288
*
289-
* This function is blocking, it will return when the transfer is complete or a
289+
* This function is blocking; it returns when the transfer is complete or a
290290
* timeout event is triggered. The number of bytes transmitted is returned by
291291
* the function after the operation is completed. Transmit operation cannot be
292-
* cancelled or aborted.
292+
* canceled or aborted.
293293
*
294-
* The data buffer must stay allocated during the duration of the transfer and
294+
* The data buffer must stay allocated during the duration of the transfer, and
295295
* the contents must not be modified. The value of the specified `address` is
296-
* ignored when configured in slave mode, in master mode it contains the
296+
* ignored when configured in slave mode. In master mode, it contains the
297297
* address of the target peripheral. This is a 7-bit value unless 10-bit
298-
* addressing is configured and supported by the target.
298+
* addressing is configured, and the target supports it.
299299
*
300300
* When in master mode the operation consists of:
301-
* - Address the slave as a Master transmitter.
302-
* - Transmit data to the addressed slave.
303-
* - Generate a STOP condition if the specified `stop` field is true.
301+
* - Addressing the slave as a Master transmitter.
302+
* - Transmitting data to the addressed slave.
303+
* - Generating a STOP condition if the specified `stop` field is true.
304304
*
305305
* @param obj The I2C object
306306
* @param address 7/10-bit address (last bit is 0)
307307
* @param data The buffer for sending
308308
* @param length Number of bytes to write
309-
* @param stop If true, stop will be generated after the transfer is done
309+
* @param stop If true, stop is generated after the transfer is done
310310
*
311311
* @note If the current platform supports multimaster operation the peripheral
312-
* will perform arbitration automatically when detecting collisions and
313-
* complete the transfer or return I2C_ERROR_ARBITRATION_LOST
314-
* when loses arbitration.
312+
* performs arbitration automatically when detecting collisions and
313+
* completes the transfer or returns I2C_ERROR_ARBITRATION_LOST
314+
* when it loses arbitration.
315315
*
316316
* Additional time for arbitration or clock stretching should by count
317317
* by setting appropriate timeout value.
318318
*
319-
* When no transmision timeout was set by the user the default timeout value will
320-
* be used. It will count one additional byte for addressing stage:
319+
* When no transmission timeout is set by the user the default timeout value is
320+
* used. It counts one additional byte for addressing stage:
321321
* default_timeout = (length + 1) * byte_timeout.
322322
*
323323
* @return
324-
* zero or non-zero - Number of written bytes
324+
* zero or nonzero - Number of written bytes
325325
* negative - I2C_ERROR_XXX status
326326
*/
327327
int32_t i2c_write(i2c_t *obj, uint16_t address, const uint8_t *data, uint32_t length, bool stop);
328328

329329
/** Blocking reading data
330330
*
331-
* This function receives data, when the peripheral is configured as Master
332-
* from the selected slave, and when configured as Slave from the Master.
331+
* This function receives data when the peripheral is configured as Master
332+
* from the selected slave and when configured as Slave from the Master.
333333
*
334-
* This function is blocking, it will return when the transfer is complete or a
334+
* This function is blocking; it returns when the transfer is complete or a
335335
* timeout event is triggered. The number of bytes received is returned by
336336
* the function after the operation is completed. Receive operation cannot be
337-
* cancelled or aborted.
337+
* canceled or aborted.
338338
*
339-
* When in master mode the operation consists of:
340-
* - Address the slave as a Master receiver.
341-
* - Receive data from the addressed slave.
342-
* - Generate a STOP condition if the specified `stop` field is true.
339+
* When in master mode, the operation consists of:
340+
* - Addressing the slave as a Master receiver.
341+
* - Receiving data from the addressed slave.
342+
* - Generating a STOP condition if the specified `stop` field is true.
343343
*
344344
* @param obj The I2C object
345345
* @param address 7/10-bit address (last bit is 1)
346346
* @param data The buffer for receiving
347347
* @param length Number of bytes to read
348-
* @param stop If true, stop will be generated after the transfer is done
348+
* @param stop If true, stop is generated after the transfer is done
349349
*
350350
* @note If the current platform supports multimaster operation the peripheral
351-
* will perform arbitration automatically when detecting collisions and
352-
* complete the transfer or return I2C_ERROR_ARBITRATION_LOST
353-
* when loses arbitration.
351+
* performs arbitration automatically when detecting collisions and
352+
* completes the transfer or returns I2C_ERROR_ARBITRATION_LOST
353+
* when it loses arbitration.
354354
*
355355
* Additional time for arbitration or clock stretching should by count
356356
* by setting appropriate timeout value.
357357
*
358-
* When no transmision timeout was set by the user the default timeout value will
359-
* be used. It will count one additional byte for addressing stage:
358+
* When no transmission timeout is set by the user the default timeout value is
359+
* used. It counts one additional byte for addressing stage:
360360
* default_timeout = (length + 1) * byte_timeout.
361361
*
362362
* @return
363-
* zero or non-zero - Number of written bytes
363+
* zero or nonzero - Number of written bytes
364364
* negative - I2C_ERROR_XXX status
365365
*/
366366
int32_t i2c_read(i2c_t *obj, uint16_t address, uint8_t *data, uint32_t length, bool stop);
@@ -389,7 +389,7 @@ i2c_slave_status_t i2c_slave_status(i2c_t *obj);
389389
* @note This function does nothing when configured in master mode.
390390
*
391391
* @param obj The I2C object
392-
* @param address The address to be set - 7bit or 10bit
392+
* @param address The address to be set - 7 bit or 10 bit
393393
*/
394394
void i2c_slave_address(i2c_t *obj, uint16_t address);
395395

@@ -418,8 +418,8 @@ typedef void (*i2c_async_handler_f)(i2c_t *obj, i2c_async_event_t *event, void *
418418
* @param tx_length The number of bytes to transmit
419419
* @param rx The receive buffer
420420
* @param rx_length The number of bytes to receive
421-
* @param address The address to be set - 7bit or 10bit
422-
* @param stop If true, stop will be generated after the transfer is done
421+
* @param address The address to be set - 7 bit or 10 bit
422+
* @param stop If true, stop is generated after the transfer is done
423423
* @param handler The I2C IRQ handler to be set
424424
* @param ctx The context pointer
425425
* @return true if the transfer was successfully scheduled, false otherwise
@@ -440,42 +440,42 @@ void i2c_abort_async(i2c_t *obj);
440440
441441
## Behaviours
442442
443-
### Defined behaviours
443+
### Defined behaviour
444444
445445
- `i2c_init`:
446-
- Initialises the peripheral pins specified in the input parameters.
447-
- Initialises the peripheral in master mode if `is_slave` is false.
448-
- Initialises the peripheral in slave mode if `is_slave` is true and `supports_slave_mode` is true.
446+
- Initializes the peripheral pins specified in the input parameters.
447+
- Initializes the peripheral in master mode if `is_slave` is false.
448+
- Initializes the peripheral in slave mode if `is_slave` is true and `supports_slave_mode` is true.
449449
- `i2c_free`:
450-
- Resets the pins used to initialise the peripheral to their default state.
450+
- Resets the pins used to initialize the peripheral to their default state.
451451
- Disables the peripheral clock.
452452
- `i2c_get_capabilities`:
453-
- Fills the contents of the `i2c_capabilities_t` parameter
453+
- Fills the contents of the `i2c_capabilities_t` parameter.
454454
- `i2c_frequency`:
455-
- Returns the actual frequency that will be used.
455+
- Returns the actual frequency used.
456456
- Sets the frequency to use for the transfer.
457457
- Must leave all other configuration unchanged.
458458
- `i2c_set_clock_stretching`:
459459
- Enables or disables clock stretching for the peripheral when in slave mode.
460460
- Does nothing when called in master mode.
461461
- `i2c_timeout`:
462-
- Sets the transmision timeout to use for the following blocking transfers.
463-
- If the timeout is not set the default timeout is used.
464-
- Default timeout value is based on I2C frequency. Is computed as triple amount of time it would take to send data over I2C
462+
- Sets the transmission timeout to use for the following blocking transfers.
463+
- If the timeout is not set, the default timeout is used.
464+
- The default timeout value is based on I2C frequency. It's computed as triple the amount of time it would take to send data over I2C
465465
- `i2c_write`:
466466
- Writes `length` number of symbols to the bus.
467467
- Returns the number of symbols sent to the bus.
468-
- Returns an error code if transfer fails.
468+
- Returns an error code if the transfer fails.
469469
- Generates a stop condition on the bus at the end of the transfer if `stop` parameter is true.
470470
- Handles transfer collisions and loss of arbitration if the platform supports multimaster in hardware.
471-
- The transfer will timeout and return `I2C_ERROR_TIMEOUT ` if the transfer takes longer than the configured timeout duration.
471+
- The transfer times out and returns `I2C_ERROR_TIMEOUT ` if the transfer takes longer than the configured timeout duration.
472472
- `i2c_read`:
473473
- Reads `length` symbols from the bus.
474474
- Returns the number of symbols received from the bus.
475-
- Returns an error code if transfer fails.
475+
- Returns an error code if the transfer fails.
476476
- Generates a stop condition on the bus at the end of the transfer if `stop` parameter is true.
477477
- Handles transfer collisions and loss of arbitration if the platform supports multimaster in hardware.
478-
- The transfer will timeout and return `I2C_ERROR_TIMEOUT ` if the transfer takes longer than the configured timeout duration.
478+
- The transfer timeouts and returns `I2C_ERROR_TIMEOUT ` if the transfer takes longer than the configured timeout duration.
479479
- `i2c_start`:
480480
- Generates I2C START condition on the bus in master mode.
481481
- Does nothing if called when the peripheral is configured in slave mode.
@@ -497,16 +497,16 @@ void i2c_abort_async(i2c_t *obj);
497497
- May handle transfer collisions and loss of arbitration if the platform supports multimaster in hardware and enabled in API.
498498
- `i2c_async_event_t` must be filled with the number of symbols sent to the bus during transfer.
499499
- `i2c_abort_async`:
500-
- Aborts any on-going async transfers.
500+
- Aborts any ongoing async transfers.
501501
502-
### Undefined behaviours
502+
### Undefined behaviour
503503
504504
- Use of a `null` pointer as an argument to any function.
505505
- Calling any `I2C` function before calling `i2c_init` or after calling `i2c_free`.
506-
- Initialising the `I2C` peripheral with invalid `SDA` and `SCL` pins.
507-
- Initialising the peripheral in slave mode if slave mode is not supported, indicated by `i2c_get_capabilities`.
508-
- Operating the peripheral in slave mode without first specifying and address using `i2c_slave_address`
509-
- Setting an address using `i2c_slave_address` after initialising the peripheral in master mode.
506+
- Initializing the `I2C` peripheral with invalid `SDA` and `SCL` pins.
507+
- Initializing the peripheral in slave mode if slave mode is not supported, indicated by `i2c_get_capabilities`.
508+
- Operating the peripheral in slave mode without first specifying an address using `i2c_slave_address`
509+
- Setting an address using `i2c_slave_address` after initializing the peripheral in master mode.
510510
- Setting an address to an `I2C` reserved value.
511511
- Setting an address larger than the 7-bit supported maximum if 10-bit addressing is not supported.
512512
- Setting an address larger than the 10-bit supported maximum.

0 commit comments

Comments
 (0)