Skip to content

Commit 9663d4c

Browse files
authored
Harmonize type definitions (#970)
1 parent 30516cf commit 9663d4c

File tree

11 files changed

+37
-37
lines changed

11 files changed

+37
-37
lines changed

core/MySensorsCore.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -686,7 +686,7 @@ void _nodeLock(const char* str)
686686
CORE_DEBUG(PSTR("MCO:NLK:TSL\n")); // sleep transport
687687
#endif
688688
setIndication(INDICATION_SLEEP);
689-
(void)hwSleep((unsigned long)1000*60*30); // Sleep for 30 min before resending LOCKED message
689+
(void)hwSleep((uint32_t)1000*60*30); // Sleep for 30 min before resending LOCKED message
690690
setIndication(INDICATION_WAKEUP);
691691
}
692692
#else
@@ -702,7 +702,7 @@ void _checkNodeLock(void)
702702
// Node is locked, check if unlock pin is asserted, else hang the node
703703
hwPinMode(MY_NODE_UNLOCK_PIN, INPUT_PULLUP);
704704
// Make a short delay so we are sure any large external nets are fully pulled
705-
unsigned long enter = hwMillis();
705+
uint32_t enter = hwMillis();
706706
while (hwMillis() - enter < 2) {}
707707
if (hwDigitalRead(MY_NODE_UNLOCK_PIN) == 0) {
708708
// Pin is grounded, reset lock counter

core/MySensorsCore.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ void receive(const MyMessage &message) __attribute__((weak));
411411
/**
412412
* @brief Callback for incoming time messages
413413
*/
414-
void receiveTime(unsigned long) __attribute__((weak));
414+
void receiveTime(uint32_t) __attribute__((weak));
415415
/**
416416
* @brief Node presenation
417417
*/

hal/architecture/MyHw.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ typedef uint8_t unique_id_t[16];
6565
* @param ms Time to sleep, in [ms].
6666
* @return MY_WAKE_UP_BY_TIMER.
6767
*/
68-
int8_t hwSleep(unsigned long ms);
68+
int8_t hwSleep(uint32_t ms);
6969

7070
/**
7171
* Sleep for a defined time, using minimum power, or until woken by interrupt.
@@ -74,7 +74,7 @@ int8_t hwSleep(unsigned long ms);
7474
* @param ms Time to sleep, in [ms].
7575
* @return MY_WAKE_UP_BY_TIMER when woken by timer, or interrupt number when woken by interrupt.
7676
*/
77-
int8_t hwSleep(uint8_t interrupt, uint8_t mode, unsigned long ms);
77+
int8_t hwSleep(uint8_t interrupt, uint8_t mode, uint32_t ms);
7878

7979
/**
8080
* Sleep for a defined time, using minimum power, or until woken by one of the interrupts.
@@ -86,7 +86,7 @@ int8_t hwSleep(uint8_t interrupt, uint8_t mode, unsigned long ms);
8686
* @return MY_WAKE_UP_BY_TIMER when woken by timer, or interrupt number when woken by interrupt.
8787
*/
8888
int8_t hwSleep(uint8_t interrupt1, uint8_t mode1, uint8_t interrupt2, uint8_t mode2,
89-
unsigned long ms);
89+
uint32_t ms);
9090

9191
/**
9292
* Retrieve unique hardware ID

hal/architecture/MyHwAVR.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ void hwPowerDown(const uint8_t wdto)
119119
ADCSRA |= (1 << ADEN);
120120
}
121121

122-
void hwInternalSleep(unsigned long ms)
122+
void hwInternalSleep(uint32_t ms)
123123
{
124124
// Sleeping with watchdog only supports multiples of 16ms.
125125
// Round up to next multiple of 16ms, to assure we sleep at least the
@@ -138,19 +138,19 @@ void hwInternalSleep(unsigned long ms)
138138
}
139139
}
140140

141-
int8_t hwSleep(unsigned long ms)
141+
int8_t hwSleep(uint32_t ms)
142142
{
143143
hwInternalSleep(ms);
144144
return MY_WAKE_UP_BY_TIMER;
145145
}
146146

147-
int8_t hwSleep(uint8_t interrupt, uint8_t mode, unsigned long ms)
147+
int8_t hwSleep(uint8_t interrupt, uint8_t mode, uint32_t ms)
148148
{
149149
return hwSleep(interrupt,mode,INVALID_INTERRUPT_NUM,0u,ms);
150150
}
151151

152152
int8_t hwSleep(uint8_t interrupt1, uint8_t mode1, uint8_t interrupt2, uint8_t mode2,
153-
unsigned long ms)
153+
uint32_t ms)
154154
{
155155
// ATMega328P supports following modes to wake from sleep: LOW, CHANGE, RISING, FALLING
156156
// Datasheet states only LOW can be used with INT0/1 to wake from sleep, which is incorrect.
@@ -208,9 +208,9 @@ inline void hwRandomNumberInit()
208208
// This function initializes the random number generator with a seed
209209
// of 32 bits. This method is good enough to earn FIPS 140-2 conform
210210
// random data. This should reach to generate 32 Bit for randomSeed().
211-
unsigned long seed = 0;
212-
unsigned long start = millis();
213-
unsigned long timeout = start + 20;
211+
uint32_t seed = 0;
212+
uint32_t start = millis();
213+
uint32_t timeout = start + 20;
214214

215215
// Trigger floating effect of an unconnected pin
216216
pinMode(MY_SIGNING_SOFT_RANDOMSEED_PIN, INPUT_PULLUP);

hal/architecture/MyHwESP8266.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,14 +89,14 @@ ssize_t hwGetentropy(void *__buffer, size_t __length)
8989
return __length;
9090
}
9191

92-
int8_t hwSleep(unsigned long ms)
92+
int8_t hwSleep(uint32_t ms)
9393
{
9494
// TODO: Not supported!
9595
(void)ms;
9696
return MY_SLEEP_NOT_POSSIBLE;
9797
}
9898

99-
int8_t hwSleep(uint8_t interrupt, uint8_t mode, unsigned long ms)
99+
int8_t hwSleep(uint8_t interrupt, uint8_t mode, uint32_t ms)
100100
{
101101
// TODO: Not supported!
102102
(void)interrupt;
@@ -106,7 +106,7 @@ int8_t hwSleep(uint8_t interrupt, uint8_t mode, unsigned long ms)
106106
}
107107

108108
int8_t hwSleep(uint8_t interrupt1, uint8_t mode1, uint8_t interrupt2, uint8_t mode2,
109-
unsigned long ms)
109+
uint32_t ms)
110110
{
111111
// TODO: Not supported!
112112
(void)interrupt1;

hal/architecture/MyHwLinuxGeneric.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ void hwWriteConfig(int addr, uint8_t value)
6868

6969
void hwRandomNumberInit()
7070
{
71-
unsigned long seed=0;
71+
uint32_t seed=0;
7272

7373
if (randomFp != NULL) {
7474
fclose(randomFp);
@@ -87,7 +87,7 @@ ssize_t hwGetentropy(void *__buffer, size_t __length)
8787
return(fread(__buffer, 1, __length, randomFp));
8888
}
8989

90-
unsigned long hwMillis()
90+
uint32_t hwMillis()
9191
{
9292
return millis();
9393
}
@@ -100,15 +100,15 @@ bool hwUniqueID(unique_id_t *uniqueID)
100100
}
101101

102102
// Not supported!
103-
int8_t hwSleep(unsigned long ms)
103+
int8_t hwSleep(uint32_t ms)
104104
{
105105
(void)ms;
106106

107107
return MY_SLEEP_NOT_POSSIBLE;
108108
}
109109

110110
// Not supported!
111-
int8_t hwSleep(uint8_t interrupt, uint8_t mode, unsigned long ms)
111+
int8_t hwSleep(uint8_t interrupt, uint8_t mode, uint32_t ms)
112112
{
113113
(void)interrupt;
114114
(void)mode;
@@ -119,7 +119,7 @@ int8_t hwSleep(uint8_t interrupt, uint8_t mode, unsigned long ms)
119119

120120
// Not supported!
121121
int8_t hwSleep(uint8_t interrupt1, uint8_t mode1, uint8_t interrupt2, uint8_t mode2,
122-
unsigned long ms)
122+
uint32_t ms)
123123
{
124124
(void)interrupt1;
125125
(void)mode1;

hal/architecture/MyHwLinuxGeneric.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*
1+
/*
22
* The MySensors Arduino library handles the wireless radio link and protocol
33
* between your home built sensors/actuators and HA controller of choice.
44
* The sensors forms a self healing radio network with optional repeaters. Each
@@ -59,7 +59,7 @@ inline void hwWriteConfig(int addr, uint8_t value);
5959
inline void hwRandomNumberInit();
6060
ssize_t hwGetentropy(void *__buffer, size_t __length);
6161
#define MY_HW_HAS_GETENTROPY
62-
inline unsigned long hwMillis();
62+
inline uint32_t hwMillis();
6363

6464
#ifdef MY_RF24_IRQ_PIN
6565
static pthread_mutex_t hw_mutex = PTHREAD_MUTEX_INITIALIZER;

hal/architecture/MyHwNRF5.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ void hwReboot()
210210
static volatile bool nrf5_rtc_event_triggered;
211211
static volatile bool nrf5_pwr_hfclk;
212212

213-
void hwSleepPrepare(unsigned long ms)
213+
void hwSleepPrepare(uint32_t ms)
214214
{
215215
// Enable low power sleep mode
216216
NRF_POWER->TASKS_LOWPWR = 1;
@@ -271,7 +271,7 @@ void hwSleepPrepare(unsigned long ms)
271271
}
272272
}
273273

274-
void hwSleepEnd(unsigned long ms)
274+
void hwSleepEnd(uint32_t ms)
275275
{
276276
// Start HFCLK
277277
if (nrf5_pwr_hfclk) {
@@ -319,7 +319,7 @@ inline void hwSleep()
319319
__WFE();
320320
}
321321

322-
int8_t hwSleep(unsigned long ms)
322+
int8_t hwSleep(uint32_t ms)
323323
{
324324
hwSleepPrepare(ms);
325325
while (nrf5_rtc_event_triggered == false) {
@@ -329,13 +329,13 @@ int8_t hwSleep(unsigned long ms)
329329
return MY_WAKE_UP_BY_TIMER;
330330
}
331331

332-
int8_t hwSleep(uint8_t interrupt, uint8_t mode, unsigned long ms)
332+
int8_t hwSleep(uint8_t interrupt, uint8_t mode, uint32_t ms)
333333
{
334334
return hwSleep(interrupt, mode, INVALID_INTERRUPT_NUM, 0u, ms);
335335
}
336336

337337
int8_t hwSleep(uint8_t interrupt1, uint8_t mode1, uint8_t interrupt2,
338-
uint8_t mode2, unsigned long ms)
338+
uint8_t mode2, uint32_t ms)
339339
{
340340
// Disable interrupts until going to sleep, otherwise interrupts occurring
341341
// between attachInterrupt()

hal/architecture/MyHwSAMD.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,14 +95,14 @@ void hwReboot(void)
9595
while (true);
9696
}
9797

98-
int8_t hwSleep(unsigned long ms)
98+
int8_t hwSleep(uint32_t ms)
9999
{
100100
// TODO: Not supported!
101101
(void)ms;
102102
return MY_SLEEP_NOT_POSSIBLE;
103103
}
104104

105-
int8_t hwSleep(uint8_t interrupt, uint8_t mode, unsigned long ms)
105+
int8_t hwSleep(uint8_t interrupt, uint8_t mode, uint32_t ms)
106106
{
107107
// TODO: Not supported!
108108
(void)interrupt;
@@ -112,7 +112,7 @@ int8_t hwSleep(uint8_t interrupt, uint8_t mode, unsigned long ms)
112112
}
113113

114114
int8_t hwSleep(uint8_t interrupt1, uint8_t mode1, uint8_t interrupt2, uint8_t mode2,
115-
unsigned long ms)
115+
uint32_t ms)
116116
{
117117
// TODO: Not supported!
118118
(void)interrupt1;

hal/architecture/MyHwSTM32F1.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,14 +89,14 @@ void hwWriteConfig(const int addr, uint8_t value)
8989
hwWriteConfigBlock(&value, reinterpret_cast<void*>(addr), 1);
9090
}
9191

92-
int8_t hwSleep(unsigned long ms)
92+
int8_t hwSleep(uint32_t ms)
9393
{
9494
// TODO: Not supported!
9595
(void)ms;
9696
return MY_SLEEP_NOT_POSSIBLE;
9797
}
9898

99-
int8_t hwSleep(uint8_t interrupt, uint8_t mode, unsigned long ms)
99+
int8_t hwSleep(uint8_t interrupt, uint8_t mode, uint32_t ms)
100100
{
101101
// TODO: Not supported!
102102
(void)interrupt;
@@ -106,7 +106,7 @@ int8_t hwSleep(uint8_t interrupt, uint8_t mode, unsigned long ms)
106106
}
107107

108108
int8_t hwSleep(uint8_t interrupt1, uint8_t mode1, uint8_t interrupt2, uint8_t mode2,
109-
unsigned long ms)
109+
uint32_t ms)
110110
{
111111
// TODO: Not supported!
112112
(void)interrupt1;

0 commit comments

Comments
 (0)