Skip to content

Commit 946b953

Browse files
author
Nicolasdejean
committed
changed the examples and api for port_t
1 parent 45422a4 commit 946b953

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

API.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,12 @@ See the [DeviceInfo](https://github.com/TheThingsNetwork/arduino-device-lib/blob
4242
Sets a function which will be called to process incoming messages.
4343

4444
```c
45-
void onMessage(void (*cb)(const byte* payload, size_t length, uint8_t port));
45+
void onMessage(void (*cb)(const byte* payload, size_t length, port_t port));
4646
```
4747
4848
- `const byte* payload`: Bytes received.
4949
- `size_t length`: Number of bytes.
50-
- `uint8_t port`: The port addressed.
50+
- `port_t port`: The port addressed.
5151
5252
See the [Receive](https://github.com/TheThingsNetwork/arduino-device-lib/blob/master/examples/Receive/Receive.ino) example.
5353
@@ -90,12 +90,12 @@ See the [ABP](https://github.com/TheThingsNetwork/arduino-device-lib/blob/master
9090
Send a message to the application using raw bytes.
9191
9292
```c
93-
int sendBytes(const byte* payload, size_t length, uint8_t port = 1, bool confirm = false);
93+
int sendBytes(const byte* payload, size_t length, port_t port = 1, bool confirm = false);
9494
```
9595

9696
- `const byte* payload `: Bytes to send.
9797
- `size_t length`: The number of bytes. Use `sizeof(payload)` to get it.
98-
- `uint8_t port = 1`: The port to address. Defaults to `1`.
98+
- `port_t port = 1`: The port to address. Defaults to `1`.
9999
- `bool confirm = false`: Whether to ask for confirmation. Defaults to `false`.
100100

101101
Returns a success or error code and logs the related error message:
@@ -113,7 +113,7 @@ Also in sendBytes, due to TTN's 30 second fair access policy, we update the airt
113113
## Method: poll
114114
Calls `sendBytes()` with `{ 0x00 }` as payload to poll for incoming messages.
115115

116-
- `uint8_t port = 1`: The port to address. Defaults to `1`.
116+
- `port_t port = 1`: The port to address. Defaults to `1`.
117117
- `bool confirm = false`: Whether to ask for confirmation.
118118

119119
Returns the result of `sendBytes()`.

examples/QuickStart/QuickStart.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ void loop() {
3939
delay(10000);
4040
}
4141

42-
void message(const byte* payload, size_t length, uint8_t port) {
42+
void message(const byte* payload, size_t length, port_t port) {
4343
debugSerial.println("-- MESSAGE");
4444

4545
// Only handle messages of a single byte

examples/Receive/Receive.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ void loop() {
3535
delay(10000);
3636
}
3737

38-
void message(const byte* payload, size_t length, uint8_t port) {
38+
void message(const byte* payload, size_t length, port_t port) {
3939
debugSerial.println("-- MESSAGE");
4040
debugSerial.print("Received " + String(length) + " bytes on port " + String(port) + ":");
4141

0 commit comments

Comments
 (0)