Skip to content

Commit 669f272

Browse files
authored
Fix: Use only camel case for class member functions. (#69)
This fixes #63.
1 parent 34071c7 commit 669f272

22 files changed

+44
-43
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ As a result this interruption by the scheduler will break Wire I/O access for bo
4949
The mechanisms implemented in this library allow any thread to dispatch an I/O request asynchronously and either continue its operation or [yield](https://en.wikipedia.org/wiki/Yield_(multithreading)) control to the next scheduled thread. All I/O requests are stored in a queue and are executed within a high-priority I/O thread after a [context-switch](https://en.wikipedia.org/wiki/Context_switch). An example of this can be seen [here](examples/Threadsafe_IO/Threadsafe_SPI/Threadsafe_SPI.ino).
5050

5151
### :relieved: Convenient API
52-
Although you are free to directly manipulate I/O requests and responses (e.g. [Threadsafe_Wire](examples/Threadsafe_IO/Threadsafe_Wire/Threadsafe_Wire.ino)) there are convenient `read`/`write`/`write_then_read` abstractions inspired by the [Adafruit_BusIO](https://github.com/adafruit/Adafruit_BusIO) library (e.g. [Threadsafe_Wire_BusIO](examples/Threadsafe_IO/Threadsafe_Wire_BusIO/Threadsafe_Wire_BusIO.ino)).
52+
Although you are free to directly manipulate I/O requests and responses (e.g. [Threadsafe_Wire](examples/Threadsafe_IO/Threadsafe_Wire/Threadsafe_Wire.ino)) there are convenient `read`/`write`/`writeThenRead` abstractions inspired by the [Adafruit_BusIO](https://github.com/adafruit/Adafruit_BusIO) library (e.g. [Threadsafe_Wire_BusIO](examples/Threadsafe_IO/Threadsafe_Wire_BusIO/Threadsafe_Wire_BusIO.ino)).
5353

5454
## :zap: Caveats
5555

docs/04-threadsafe-wire.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,18 +52,18 @@ byte lsm6dsox_read_reg(byte const reg_addr)
5252
}
5353
```
5454

55-
### Synchronous thread-safe `Wire` access with `transfer_and_wait`
55+
### Synchronous thread-safe `Wire` access with `transferAndWait`
5656
([`examples/Threadsafe_IO/Wire`](../examples/Threadsafe_IO/Wire))
5757

58-
As the use of the `transfer` API might be difficult to grasp there's also a synchronous API call combining the request of the transfer and waiting for its result using `transfer_and_wait`.
58+
As the use of the `transfer` API might be difficult to grasp there's also a synchronous API call combining the request of the transfer and waiting for its result using `transferAndWait`.
5959
```C++
6060
byte lsm6dsox_read_reg(byte const reg_addr)
6161
{
6262
byte write_buffer = reg_addr;
6363
byte read_buffer = 0;
6464

6565
IoRequest request(write_buffer, read_buffer);
66-
IoResponse response = transfer_and_wait(lsm6dsox, request); /* Transmit IO request for execution and wait for completion of request. */
66+
IoResponse response = transferAndWait(lsm6dsox, request); /* Transmit IO request for execution and wait for completion of request. */
6767

6868
return read_buffer;
6969
}
@@ -78,7 +78,7 @@ For further simplification [Adafruit_BusIO](https://github.com/adafruit/Adafruit
7878
byte lsm6dsox_read_reg(byte reg_addr)
7979
{
8080
byte read_buffer = 0;
81-
lsm6dsox.wire().write_then_read(&reg_addr, 1, &read_buffer, 1);
81+
lsm6dsox.wire().writeThenRead(&reg_addr, 1, &read_buffer, 1);
8282
return read_buffer;
8383
}
8484
```

docs/05-threadsafe-spi.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,18 +44,18 @@ byte bmp388_read_reg(byte const reg_addr)
4444
}
4545
```
4646
47-
### Synchronous thread-safe `SPI` access with `transfer_and_wait`
47+
### Synchronous thread-safe `SPI` access with `transferAndWait`
4848
([`examples/Threadsafe_IO/SPI`](../examples/Threadsafe_IO/SPI))
4949
50-
As the use of the `transfer` API might be difficult to grasp there's also a synchronous API call combining the request of the transfer and waiting for its result using `transfer_and_wait`.
50+
As the use of the `transfer` API might be difficult to grasp there's also a synchronous API call combining the request of the transfer and waiting for its result using `transferAndWait`.
5151
```C++
5252
byte bmp388_read_reg(byte const reg_addr)
5353
{
5454
/* REG_ADDR | DUMMY_BYTE | REG_VAL is on SDO */
5555
byte read_write_buffer[] = {0x80 | reg_addr, 0, 0};
5656
5757
IoRequest request(read_write_buffer, sizeof(read_write_buffer), nullptr, 0);
58-
IoResponse response = transfer_and_wait(bmp388, request);
58+
IoResponse response = transferAndWait(bmp388, request);
5959
6060
auto value = read_write_buffer[2];
6161
return value;
@@ -74,7 +74,7 @@ byte bmp388_read_reg(byte const reg_addr)
7474
byte write_buffer[2] = {0x80 | reg_addr, 0};
7575
byte read_buffer = 0;
7676

77-
bmp388.spi().write_then_read(write_buffer, sizeof(write_buffer), &read_buffer, sizeof(read_buffer));
77+
bmp388.spi().writeThenRead(write_buffer, sizeof(write_buffer), &read_buffer, sizeof(read_buffer));
7878
return read_buffer;
7979
}
8080
```

examples/Breaks_4/Thread.inot

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ BusDevice lsm6dsox(Wire, LSM6DSOX_ADDRESS);
2121
byte lsm6dsox_read_reg(byte reg_addr)
2222
{
2323
byte read_buf = 0;
24-
lsm6dsox.wire().write_then_read(&reg_addr, 1, &read_buf, 1);
24+
lsm6dsox.wire().writeThenRead(&reg_addr, 1, &read_buf, 1);
2525
return read_buf;
2626
}
2727

examples/Threadsafe_IO/SPI/SPI.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ byte bmp388_read_reg(byte const reg_addr)
7070
byte read_write_buf[] = {static_cast<byte>(0x80 | reg_addr), 0, 0};
7171

7272
IoRequest req(read_write_buf, sizeof(read_write_buf), nullptr, 0);
73-
IoResponse rsp = transfer_and_wait(bmp388, req);
73+
IoResponse rsp = transferAndWait(bmp388, req);
7474

7575
return read_write_buf[2];
7676
}

examples/Threadsafe_IO/SPI_BusIO/SPI_BusIO.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* with different client devices on the same SPI bus.
55
*
66
* This example uses Adafruit_BusIO style read(), write(),
7-
* write_then_read() APIs.
7+
* writeThenRead() APIs.
88
*/
99

1010
/**************************************************************************************
@@ -70,7 +70,7 @@ byte bmp388_read_reg(byte const reg_addr)
7070
byte write_buf[2] = {static_cast<byte>(0x80 | reg_addr), 0};
7171
byte read_buf = 0;
7272

73-
bmp388.spi().write_then_read(write_buf, sizeof(write_buf), &read_buf, sizeof(read_buf));
73+
bmp388.spi().writeThenRead(write_buf, sizeof(write_buf), &read_buf, sizeof(read_buf));
7474
return read_buf;
7575
}
7676

examples/Threadsafe_IO/Serial_GlobalPrefixSuffix/Serial_GlobalPrefixSuffix.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ void setup()
2626
Serial.begin(9600);
2727
while (!Serial) { }
2828

29-
Serial.global_prefix(serial_log_message_prefix);
30-
Serial.global_suffix(serial_log_message_suffix);
29+
Serial.globalPrefix(serial_log_message_prefix);
30+
Serial.globalSuffix(serial_log_message_suffix);
3131

3232
Thread_1.start();
3333
Thread_2.start();

examples/Threadsafe_IO/Wire/Wire.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ byte lsm6dsox_read_reg(byte const reg_addr)
6767
byte read_buf = 0;
6868

6969
IoRequest req(write_buf, read_buf);
70-
IoResponse rsp = transfer_and_wait(lsm6dsox, req);
70+
IoResponse rsp = transferAndWait(lsm6dsox, req);
7171

7272
return read_buf;
7373
}

examples/Threadsafe_IO/Wire_BusIO/Wire_BusIO.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* with different client devices on the same Wire bus.
55
*
66
* This example uses Adafruit_BusIO style read(), write(),
7-
* write_then_read() APIs.
7+
* writeThenRead() APIs.
88
*/
99

1010
/**************************************************************************************
@@ -64,7 +64,7 @@ void loop()
6464
byte lsm6dsox_read_reg(byte reg_addr)
6565
{
6666
byte read_buf = 0;
67-
lsm6dsox.wire().write_then_read(&reg_addr, 1, &read_buf, 1);
67+
lsm6dsox.wire().writeThenRead(&reg_addr, 1, &read_buf, 1);
6868
return read_buf;
6969
}
7070

keywords.txt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,14 @@ block KEYWORD2
3434
unblock KEYWORD2
3535
prefix KEYWORD2
3636
suffix KEYWORD2
37-
global_prefix KEYWORD2
38-
global_suffix KEYWORD2
37+
globalPrefix KEYWORD2
38+
globalSuffix KEYWORD2
3939
spi KEYWORD2
4040
wire KEYWORD2
4141
read KEYWORD2
4242
write KEYWORD2
43-
write_then_read KEYWORD2
43+
writeThenRead KEYWORD2
44+
transferAndWait KEYWORD2
4445

4546
#######################################
4647
# Constants (LITERAL1)

0 commit comments

Comments
 (0)