Harmonize type definitions (#970)
This commit is contained in:
@@ -686,7 +686,7 @@ void _nodeLock(const char* str)
|
||||
CORE_DEBUG(PSTR("MCO:NLK:TSL\n")); // sleep transport
|
||||
#endif
|
||||
setIndication(INDICATION_SLEEP);
|
||||
(void)hwSleep((unsigned long)1000*60*30); // Sleep for 30 min before resending LOCKED message
|
||||
(void)hwSleep((uint32_t)1000*60*30); // Sleep for 30 min before resending LOCKED message
|
||||
setIndication(INDICATION_WAKEUP);
|
||||
}
|
||||
#else
|
||||
@@ -702,7 +702,7 @@ void _checkNodeLock(void)
|
||||
// Node is locked, check if unlock pin is asserted, else hang the node
|
||||
hwPinMode(MY_NODE_UNLOCK_PIN, INPUT_PULLUP);
|
||||
// Make a short delay so we are sure any large external nets are fully pulled
|
||||
unsigned long enter = hwMillis();
|
||||
uint32_t enter = hwMillis();
|
||||
while (hwMillis() - enter < 2) {}
|
||||
if (hwDigitalRead(MY_NODE_UNLOCK_PIN) == 0) {
|
||||
// Pin is grounded, reset lock counter
|
||||
|
||||
@@ -411,7 +411,7 @@ void receive(const MyMessage &message) __attribute__((weak));
|
||||
/**
|
||||
* @brief Callback for incoming time messages
|
||||
*/
|
||||
void receiveTime(unsigned long) __attribute__((weak));
|
||||
void receiveTime(uint32_t) __attribute__((weak));
|
||||
/**
|
||||
* @brief Node presenation
|
||||
*/
|
||||
|
||||
@@ -65,7 +65,7 @@ typedef uint8_t unique_id_t[16];
|
||||
* @param ms Time to sleep, in [ms].
|
||||
* @return MY_WAKE_UP_BY_TIMER.
|
||||
*/
|
||||
int8_t hwSleep(unsigned long ms);
|
||||
int8_t hwSleep(uint32_t ms);
|
||||
|
||||
/**
|
||||
* Sleep for a defined time, using minimum power, or until woken by interrupt.
|
||||
@@ -74,7 +74,7 @@ int8_t hwSleep(unsigned long ms);
|
||||
* @param ms Time to sleep, in [ms].
|
||||
* @return MY_WAKE_UP_BY_TIMER when woken by timer, or interrupt number when woken by interrupt.
|
||||
*/
|
||||
int8_t hwSleep(uint8_t interrupt, uint8_t mode, unsigned long ms);
|
||||
int8_t hwSleep(uint8_t interrupt, uint8_t mode, uint32_t ms);
|
||||
|
||||
/**
|
||||
* 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);
|
||||
* @return MY_WAKE_UP_BY_TIMER when woken by timer, or interrupt number when woken by interrupt.
|
||||
*/
|
||||
int8_t hwSleep(uint8_t interrupt1, uint8_t mode1, uint8_t interrupt2, uint8_t mode2,
|
||||
unsigned long ms);
|
||||
uint32_t ms);
|
||||
|
||||
/**
|
||||
* Retrieve unique hardware ID
|
||||
|
||||
@@ -119,7 +119,7 @@ void hwPowerDown(const uint8_t wdto)
|
||||
ADCSRA |= (1 << ADEN);
|
||||
}
|
||||
|
||||
void hwInternalSleep(unsigned long ms)
|
||||
void hwInternalSleep(uint32_t ms)
|
||||
{
|
||||
// Sleeping with watchdog only supports multiples of 16ms.
|
||||
// Round up to next multiple of 16ms, to assure we sleep at least the
|
||||
@@ -138,19 +138,19 @@ void hwInternalSleep(unsigned long ms)
|
||||
}
|
||||
}
|
||||
|
||||
int8_t hwSleep(unsigned long ms)
|
||||
int8_t hwSleep(uint32_t ms)
|
||||
{
|
||||
hwInternalSleep(ms);
|
||||
return MY_WAKE_UP_BY_TIMER;
|
||||
}
|
||||
|
||||
int8_t hwSleep(uint8_t interrupt, uint8_t mode, unsigned long ms)
|
||||
int8_t hwSleep(uint8_t interrupt, uint8_t mode, uint32_t ms)
|
||||
{
|
||||
return hwSleep(interrupt,mode,INVALID_INTERRUPT_NUM,0u,ms);
|
||||
}
|
||||
|
||||
int8_t hwSleep(uint8_t interrupt1, uint8_t mode1, uint8_t interrupt2, uint8_t mode2,
|
||||
unsigned long ms)
|
||||
uint32_t ms)
|
||||
{
|
||||
// ATMega328P supports following modes to wake from sleep: LOW, CHANGE, RISING, FALLING
|
||||
// Datasheet states only LOW can be used with INT0/1 to wake from sleep, which is incorrect.
|
||||
@@ -208,9 +208,9 @@ inline void hwRandomNumberInit()
|
||||
// This function initializes the random number generator with a seed
|
||||
// of 32 bits. This method is good enough to earn FIPS 140-2 conform
|
||||
// random data. This should reach to generate 32 Bit for randomSeed().
|
||||
unsigned long seed = 0;
|
||||
unsigned long start = millis();
|
||||
unsigned long timeout = start + 20;
|
||||
uint32_t seed = 0;
|
||||
uint32_t start = millis();
|
||||
uint32_t timeout = start + 20;
|
||||
|
||||
// Trigger floating effect of an unconnected pin
|
||||
pinMode(MY_SIGNING_SOFT_RANDOMSEED_PIN, INPUT_PULLUP);
|
||||
|
||||
@@ -89,14 +89,14 @@ ssize_t hwGetentropy(void *__buffer, size_t __length)
|
||||
return __length;
|
||||
}
|
||||
|
||||
int8_t hwSleep(unsigned long ms)
|
||||
int8_t hwSleep(uint32_t ms)
|
||||
{
|
||||
// TODO: Not supported!
|
||||
(void)ms;
|
||||
return MY_SLEEP_NOT_POSSIBLE;
|
||||
}
|
||||
|
||||
int8_t hwSleep(uint8_t interrupt, uint8_t mode, unsigned long ms)
|
||||
int8_t hwSleep(uint8_t interrupt, uint8_t mode, uint32_t ms)
|
||||
{
|
||||
// TODO: Not supported!
|
||||
(void)interrupt;
|
||||
@@ -106,7 +106,7 @@ int8_t hwSleep(uint8_t interrupt, uint8_t mode, unsigned long ms)
|
||||
}
|
||||
|
||||
int8_t hwSleep(uint8_t interrupt1, uint8_t mode1, uint8_t interrupt2, uint8_t mode2,
|
||||
unsigned long ms)
|
||||
uint32_t ms)
|
||||
{
|
||||
// TODO: Not supported!
|
||||
(void)interrupt1;
|
||||
|
||||
@@ -68,7 +68,7 @@ void hwWriteConfig(int addr, uint8_t value)
|
||||
|
||||
void hwRandomNumberInit()
|
||||
{
|
||||
unsigned long seed=0;
|
||||
uint32_t seed=0;
|
||||
|
||||
if (randomFp != NULL) {
|
||||
fclose(randomFp);
|
||||
@@ -87,7 +87,7 @@ ssize_t hwGetentropy(void *__buffer, size_t __length)
|
||||
return(fread(__buffer, 1, __length, randomFp));
|
||||
}
|
||||
|
||||
unsigned long hwMillis()
|
||||
uint32_t hwMillis()
|
||||
{
|
||||
return millis();
|
||||
}
|
||||
@@ -100,7 +100,7 @@ bool hwUniqueID(unique_id_t *uniqueID)
|
||||
}
|
||||
|
||||
// Not supported!
|
||||
int8_t hwSleep(unsigned long ms)
|
||||
int8_t hwSleep(uint32_t ms)
|
||||
{
|
||||
(void)ms;
|
||||
|
||||
@@ -108,7 +108,7 @@ int8_t hwSleep(unsigned long ms)
|
||||
}
|
||||
|
||||
// Not supported!
|
||||
int8_t hwSleep(uint8_t interrupt, uint8_t mode, unsigned long ms)
|
||||
int8_t hwSleep(uint8_t interrupt, uint8_t mode, uint32_t ms)
|
||||
{
|
||||
(void)interrupt;
|
||||
(void)mode;
|
||||
@@ -119,7 +119,7 @@ int8_t hwSleep(uint8_t interrupt, uint8_t mode, unsigned long ms)
|
||||
|
||||
// Not supported!
|
||||
int8_t hwSleep(uint8_t interrupt1, uint8_t mode1, uint8_t interrupt2, uint8_t mode2,
|
||||
unsigned long ms)
|
||||
uint32_t ms)
|
||||
{
|
||||
(void)interrupt1;
|
||||
(void)mode1;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
* The MySensors Arduino library handles the wireless radio link and protocol
|
||||
* between your home built sensors/actuators and HA controller of choice.
|
||||
* The sensors forms a self healing radio network with optional repeaters. Each
|
||||
@@ -59,7 +59,7 @@ inline void hwWriteConfig(int addr, uint8_t value);
|
||||
inline void hwRandomNumberInit();
|
||||
ssize_t hwGetentropy(void *__buffer, size_t __length);
|
||||
#define MY_HW_HAS_GETENTROPY
|
||||
inline unsigned long hwMillis();
|
||||
inline uint32_t hwMillis();
|
||||
|
||||
#ifdef MY_RF24_IRQ_PIN
|
||||
static pthread_mutex_t hw_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
|
||||
@@ -210,7 +210,7 @@ void hwReboot()
|
||||
static volatile bool nrf5_rtc_event_triggered;
|
||||
static volatile bool nrf5_pwr_hfclk;
|
||||
|
||||
void hwSleepPrepare(unsigned long ms)
|
||||
void hwSleepPrepare(uint32_t ms)
|
||||
{
|
||||
// Enable low power sleep mode
|
||||
NRF_POWER->TASKS_LOWPWR = 1;
|
||||
@@ -271,7 +271,7 @@ void hwSleepPrepare(unsigned long ms)
|
||||
}
|
||||
}
|
||||
|
||||
void hwSleepEnd(unsigned long ms)
|
||||
void hwSleepEnd(uint32_t ms)
|
||||
{
|
||||
// Start HFCLK
|
||||
if (nrf5_pwr_hfclk) {
|
||||
@@ -319,7 +319,7 @@ inline void hwSleep()
|
||||
__WFE();
|
||||
}
|
||||
|
||||
int8_t hwSleep(unsigned long ms)
|
||||
int8_t hwSleep(uint32_t ms)
|
||||
{
|
||||
hwSleepPrepare(ms);
|
||||
while (nrf5_rtc_event_triggered == false) {
|
||||
@@ -329,13 +329,13 @@ int8_t hwSleep(unsigned long ms)
|
||||
return MY_WAKE_UP_BY_TIMER;
|
||||
}
|
||||
|
||||
int8_t hwSleep(uint8_t interrupt, uint8_t mode, unsigned long ms)
|
||||
int8_t hwSleep(uint8_t interrupt, uint8_t mode, uint32_t ms)
|
||||
{
|
||||
return hwSleep(interrupt, mode, INVALID_INTERRUPT_NUM, 0u, ms);
|
||||
}
|
||||
|
||||
int8_t hwSleep(uint8_t interrupt1, uint8_t mode1, uint8_t interrupt2,
|
||||
uint8_t mode2, unsigned long ms)
|
||||
uint8_t mode2, uint32_t ms)
|
||||
{
|
||||
// Disable interrupts until going to sleep, otherwise interrupts occurring
|
||||
// between attachInterrupt()
|
||||
|
||||
@@ -95,14 +95,14 @@ void hwReboot(void)
|
||||
while (true);
|
||||
}
|
||||
|
||||
int8_t hwSleep(unsigned long ms)
|
||||
int8_t hwSleep(uint32_t ms)
|
||||
{
|
||||
// TODO: Not supported!
|
||||
(void)ms;
|
||||
return MY_SLEEP_NOT_POSSIBLE;
|
||||
}
|
||||
|
||||
int8_t hwSleep(uint8_t interrupt, uint8_t mode, unsigned long ms)
|
||||
int8_t hwSleep(uint8_t interrupt, uint8_t mode, uint32_t ms)
|
||||
{
|
||||
// TODO: Not supported!
|
||||
(void)interrupt;
|
||||
@@ -112,7 +112,7 @@ int8_t hwSleep(uint8_t interrupt, uint8_t mode, unsigned long ms)
|
||||
}
|
||||
|
||||
int8_t hwSleep(uint8_t interrupt1, uint8_t mode1, uint8_t interrupt2, uint8_t mode2,
|
||||
unsigned long ms)
|
||||
uint32_t ms)
|
||||
{
|
||||
// TODO: Not supported!
|
||||
(void)interrupt1;
|
||||
|
||||
@@ -89,14 +89,14 @@ void hwWriteConfig(const int addr, uint8_t value)
|
||||
hwWriteConfigBlock(&value, reinterpret_cast<void*>(addr), 1);
|
||||
}
|
||||
|
||||
int8_t hwSleep(unsigned long ms)
|
||||
int8_t hwSleep(uint32_t ms)
|
||||
{
|
||||
// TODO: Not supported!
|
||||
(void)ms;
|
||||
return MY_SLEEP_NOT_POSSIBLE;
|
||||
}
|
||||
|
||||
int8_t hwSleep(uint8_t interrupt, uint8_t mode, unsigned long ms)
|
||||
int8_t hwSleep(uint8_t interrupt, uint8_t mode, uint32_t ms)
|
||||
{
|
||||
// TODO: Not supported!
|
||||
(void)interrupt;
|
||||
@@ -106,7 +106,7 @@ int8_t hwSleep(uint8_t interrupt, uint8_t mode, unsigned long ms)
|
||||
}
|
||||
|
||||
int8_t hwSleep(uint8_t interrupt1, uint8_t mode1, uint8_t interrupt2, uint8_t mode2,
|
||||
unsigned long ms)
|
||||
uint32_t ms)
|
||||
{
|
||||
// TODO: Not supported!
|
||||
(void)interrupt1;
|
||||
|
||||
@@ -60,14 +60,14 @@ void hwReboot(void)
|
||||
while (true);
|
||||
}
|
||||
|
||||
int8_t hwSleep(unsigned long ms)
|
||||
int8_t hwSleep(uint32_t ms)
|
||||
{
|
||||
// TODO: Not supported!
|
||||
(void)ms;
|
||||
return MY_SLEEP_NOT_POSSIBLE;
|
||||
}
|
||||
|
||||
int8_t hwSleep(uint8_t interrupt, uint8_t mode, unsigned long ms)
|
||||
int8_t hwSleep(uint8_t interrupt, uint8_t mode, uint32_t ms)
|
||||
{
|
||||
// TODO: Not supported!
|
||||
(void)interrupt;
|
||||
@@ -77,7 +77,7 @@ int8_t hwSleep(uint8_t interrupt, uint8_t mode, unsigned long ms)
|
||||
}
|
||||
|
||||
int8_t hwSleep(uint8_t interrupt1, uint8_t mode1, uint8_t interrupt2, uint8_t mode2,
|
||||
unsigned long ms)
|
||||
uint32_t ms)
|
||||
{
|
||||
// TODO: Not supported!
|
||||
(void)interrupt1;
|
||||
|
||||
Reference in New Issue
Block a user