Harmonize type definitions (#970)

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