RadioLib/src/Hal.cpp

36 wiersze
723 B
C++

2023-04-11 02:51:29 +00:00
#include "Hal.h"
RadioLibHal::RadioLibHal(const uint32_t input, const uint32_t output, const uint32_t low, const uint32_t high, const uint32_t rising, const uint32_t falling)
2023-04-11 02:51:29 +00:00
: GpioModeInput(input),
GpioModeOutput(output),
2023-04-12 23:42:19 +00:00
GpioLevelLow(low),
GpioLevelHigh(high),
2023-04-11 02:51:29 +00:00
GpioInterruptRising(rising),
GpioInterruptFalling(falling) {}
void RadioLibHal::init() {
}
void RadioLibHal::term() {
}
Use RadioLibTime_t (aka unsigned long) when dealing with millis() and micros() (#1075) * Use unsigned long when dealing with millis() and micros(). Although sizeof(uint32_t) == sizeof(unsigned long) on Arduino, this is not the case on 64-bit Linux, where sizeof(unsigned long) == sizeof(uint64_t). Most timestamp arithmetic and comparisons have been left alone, to reduce code churn. This is fine, as uint32_t is perfectly wide to store most timestamp deltas this library will deal with, and C will promote the integer rather than do a narrowing conversion. The real problem arises with narrowing conversions being done by assuming timestamps are 32-bit. No functional changes intended for platforms where sizeof(uint32_t) == sizeof(unsigned long) (so most 8/16/32-bit platforms). Signed-off-by: Elizabeth Myers <elizabeth.jennifer.myers@gmail.com> * Change most timestamps to use RadioLibTime_t. This makes it obvious what is and isn't a timestamp. Not everything has been converted; anything dealing with protocol and chip-level timestamps has been left alone on purpose, to make it clear that these functions do require 32-bit timestamps. No functional changes intended on platforms where sizeof(uint32_t) == sizeof(unsigned long). Signed-off-by: Elizabeth Myers <elizabeth.jennifer.myers@gmail.com> * Use uint32_t internally in getTimeOnAir. We need to not overflow the integers with the shifts and multiplications, so this is correct behaviour. Signed-off-by: Elizabeth Myers <elizabeth.jennifer.myers@gmail.com> --------- Signed-off-by: Elizabeth Myers <elizabeth.jennifer.myers@gmail.com>
2024-04-25 19:50:58 +00:00
void RadioLibHal::tone(uint32_t pin, unsigned int frequency, RadioLibTime_t duration) {
2023-04-16 19:01:55 +00:00
(void)pin;
(void)frequency;
(void)duration;
2023-06-26 17:36:45 +00:00
}
void RadioLibHal::noTone(uint32_t pin) {
2023-04-16 19:01:55 +00:00
(void)pin;
2023-06-26 17:36:45 +00:00
}
void RadioLibHal::yield() {
2023-06-26 17:36:45 +00:00
}
uint32_t RadioLibHal::pinToInterrupt(uint32_t pin) {
return(pin);
2023-06-26 17:36:45 +00:00
}