Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Harmonize type definitions #970

Merged
merged 1 commit into from
Nov 4, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions core/MySensorsCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion core/MySensorsCore.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
6 changes: 3 additions & 3 deletions hal/architecture/MyHw.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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.
Expand All @@ -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
Expand Down
14 changes: 7 additions & 7 deletions hal/architecture/MyHwAVR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
Expand Down Expand Up @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions hal/architecture/MyHwESP8266.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
10 changes: 5 additions & 5 deletions hal/architecture/MyHwLinuxGeneric.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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();
}
Expand All @@ -100,15 +100,15 @@ bool hwUniqueID(unique_id_t *uniqueID)
}

// Not supported!
int8_t hwSleep(unsigned long ms)
int8_t hwSleep(uint32_t ms)
{
(void)ms;

return MY_SLEEP_NOT_POSSIBLE;
}

// 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;
Expand All @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions hal/architecture/MyHwLinuxGeneric.h
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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;
Expand Down
10 changes: 5 additions & 5 deletions hal/architecture/MyHwNRF5.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand All @@ -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()
Expand Down
6 changes: 3 additions & 3 deletions hal/architecture/MyHwSAMD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions hal/architecture/MyHwSTM32F1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions hal/architecture/MyHwTeensy3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down