Skip to content

Commit 179e0c0

Browse files
TMRh202bndy5
andauthored
Modifications for 64-bit OS (#218)
* Modifications for 64-bit OS * Change unsigned long to uint32_t in examples * Modify printf in example: Change %lu to %u * run clang-format v12.0.1 on unchanged some files --------- Co-authored-by: Brendan <[email protected]>
1 parent 4e804ee commit 179e0c0

File tree

5 files changed

+24
-16
lines changed

5 files changed

+24
-16
lines changed

RF24Network.cpp

+12-4
Original file line numberDiff line numberDiff line change
@@ -1181,14 +1181,22 @@ template<class radio_t>
11811181
uint64_t ESBNetwork<radio_t>::pipe_address(uint16_t node, uint8_t pipe)
11821182
{
11831183

1184-
static uint8_t address_translation[] = {0xc3, 0x3c, 0x33, 0xce, 0x3e, 0xe3, 0xec
1184+
static uint8_t address_translation[] = { 0xc3,
1185+
0x3c,
1186+
0x33,
1187+
0xce,
1188+
0x3e,
1189+
0xe3,
1190+
0xec
11851191
#if NUM_PIPES > 6
1186-
, 0xee
1192+
,
1193+
0xee
11871194
#if NUM_PIPES > 7
1188-
, 0xed
1195+
,
1196+
0xed
11891197
#endif
11901198
#endif
1191-
};
1199+
};
11921200
uint64_t result = 0xCCCCCCCCCCLL;
11931201
uint8_t* out = reinterpret_cast<uint8_t*>(&result);
11941202

RF24Network_config.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@
8181
/** Enable dynamic payloads - If using different types of nRF24L01 modules, some may be incompatible when using this feature **/
8282
#define ENABLE_DYNAMIC_PAYLOADS
8383
#endif // DISABLE_DYNAMIC_PAYLOADS
84-
84+
8585
/** The number of 'pipes' available for addressing in the current device
8686
* Networks with NRF24L01 devices only have 6 pipes
8787
* NRF52x networks support up to 8 pipes

examples_RPi/helloworld_rx.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ const uint16_t other_node = 01;
2929

3030
struct payload_t
3131
{ // Structure of our payload
32-
unsigned long ms;
33-
unsigned long counter;
32+
uint32_t ms;
33+
uint32_t counter;
3434
};
3535

3636
int main(int argc, char** argv)
@@ -56,7 +56,7 @@ int main(int argc, char** argv)
5656
payload_t payload;
5757
network.read(header, &payload, sizeof(payload));
5858

59-
printf("Received payload: counter=%lu, origin timestamp=%lu\n", payload.counter, payload.ms);
59+
printf("Received payload: counter=%u, origin timestamp=%u\n", payload.counter, payload.ms);
6060
}
6161
//sleep(2);
6262
delay(2000);

examples_RPi/helloworld_tx.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@ const uint16_t other_node = 00;
3232
// How often (in milliseconds) to send a message to the `other_node`
3333
const unsigned long interval = 2000;
3434

35-
unsigned long last_sent; // When did we last send?
36-
unsigned long packets_sent; // How many have we sent already
35+
uint32_t last_sent; // When did we last send?
36+
uint32_t packets_sent; // How many have we sent already
3737

3838
struct payload_t
3939
{ // Structure of our payload
40-
unsigned long ms;
41-
unsigned long counter;
40+
uint32_t ms;
41+
uint32_t counter;
4242
};
4343

4444
int main(int argc, char** argv)
@@ -58,7 +58,7 @@ int main(int argc, char** argv)
5858
while (1) {
5959

6060
network.update();
61-
unsigned long now = millis(); // If it's time to send a message, send it!
61+
uint32_t now = millis(); // If it's time to send a message, send it!
6262
if (now - last_sent >= interval) {
6363
last_sent = now;
6464

examples_RPi/rx-test.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,17 @@ const uint16_t other_node = 01;
2727

2828
struct payload_power_t
2929
{ // Structure of our payload
30-
unsigned long nodeId;
30+
uint32_t nodeId;
3131
float power;
3232
float current;
3333
};
3434

3535
struct payload_weather_t
3636
{
37-
unsigned long nodeId;
37+
uint32_t nodeId;
3838
float temperature;
3939
float humidity;
40-
unsigned long lux;
40+
uint32_t lux;
4141
};
4242

4343
int main(int argc, char** argv)

0 commit comments

Comments
 (0)