[core] Fix return types for some methods, check feature flags

This commit is contained in:
Kuba Szczodrzyński
2022-06-26 16:03:30 +02:00
parent 35d5ec03a3
commit 582eed3be8
6 changed files with 14 additions and 8 deletions

View File

@@ -17,11 +17,11 @@ void delayMicroseconds(unsigned int us) {
}
}
uint32_t millis() {
unsigned long millis() {
return xTaskGetTickCount() * portTICK_PERIOD_MS;
}
uint32_t micros() {
unsigned long micros() {
// TODO implement this properly
return millis() * 1000;
}

View File

@@ -10,6 +10,7 @@ bool WiFiClass::getNetworkInfo(
rssi = RSSI(networkItem);
bssid = BSSID(networkItem);
channel = this->channel(networkItem);
return true;
}
int16_t WiFiClass::scanComplete() {

View File

@@ -10,7 +10,11 @@ int _analogWritePeriod = 20000; // 50 Hz
* @brief Check if pin is invalid (too low or too high).
*/
bool pinInvalid(pin_size_t pinNumber) {
#ifdef PINS_COUNT
return pinNumber < 0 || pinNumber >= PINS_COUNT;
#else
return false;
#endif
}
/**

View File

@@ -4,7 +4,7 @@
#include <Arduino.h>
#if LT_LOGGER_TASK
#if LT_LOGGER_TASK && LT_HAS_FREERTOS
#include <FreeRTOS.h>
#include <task.h>
#endif
@@ -57,7 +57,7 @@ void lt_log(const uint8_t level, const char *format, ...) {
#endif
#endif
#if LT_LOGGER_TASK
#if LT_LOGGER_TASK && LT_HAS_FREERTOS
char task_colon = ':';
TaskHandle_t task = xTaskGetCurrentTaskHandle();
char *task_name = pcTaskGetTaskName(task);
@@ -90,7 +90,7 @@ void lt_log(const uint8_t level, const char *format, ...) {
#if LT_LOGGER_CALLER
"%s():%hu: "
#endif
#if LT_LOGGER_TASK
#if LT_LOGGER_TASK && LT_HAS_FREERTOS
"%s%c "
#endif
,
@@ -112,7 +112,7 @@ void lt_log(const uint8_t level, const char *format, ...) {
caller,
line
#endif
#if LT_LOGGER_TASK
#if LT_LOGGER_TASK && LT_HAS_FREERTOS
,
task_name,
task_colon // printing outside of tasks

View File

@@ -127,6 +127,7 @@ size_t UpdateClass::writeStream(Stream &data) {
// return on errors
return written;
}
return written;
}
/**

View File

@@ -59,11 +59,11 @@ void delayMicroseconds(unsigned int us) {
}
}
uint32_t millis(void) {
unsigned long millis(void) {
return (__get_ipsr__() == 0) ? xTaskGetTickCount() : xTaskGetTickCountFromISR();
}
uint32_t micros(void) {
unsigned long micros(void) {
uint32_t tick1, tick2;
uint32_t us;
uint32_t tick_per_us = F_CPU / 1000;