kopia lustrzana https://github.com/jgromes/RadioLib
[HAL] Add macro guards to PicoHal
rodzic
d0624f7b85
commit
faa5ab11d2
|
@ -5,9 +5,8 @@ file(GLOB_RECURSE RADIOLIB_SOURCES
|
|||
"src/*.cpp"
|
||||
)
|
||||
|
||||
# exclude all HAL source files, except the default Arduino HAL
|
||||
# exclude all HAL source files
|
||||
list(FILTER RADIOLIB_SOURCES EXCLUDE REGEX "src/hal/.*\\.cpp")
|
||||
list(APPEND RADIOLIB_SOURCES "src/hal/Arduino/ArduinoHal.cpp")
|
||||
|
||||
if(ESP_PLATFORM)
|
||||
# Build RadioLib as an ESP-IDF component
|
||||
|
|
|
@ -22,11 +22,11 @@ add_executable(${PROJECT_NAME}
|
|||
main.cpp
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/../../../../RadioLib/src/hal/RPiPico/PicoHal.cpp"
|
||||
)
|
||||
target_compile_definitions(${PROJECT_NAME} PUBLIC RADIOLIB_BUILD_RPI_PICO)
|
||||
|
||||
# Pull in common dependencies
|
||||
target_link_libraries(${PROJECT_NAME} pico_stdlib hardware_spi hardware_gpio hardware_timer pico_multicore hardware_pwm RadioLib)
|
||||
|
||||
|
||||
pico_enable_stdio_usb(${PROJECT_NAME} 1)
|
||||
pico_enable_stdio_uart(${PROJECT_NAME} 0)
|
||||
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
#include "PicoHal.h"
|
||||
|
||||
#if defined(RADIOLIB_BUILD_RPI_PICO)
|
||||
|
||||
// pre-calculated pulse-widths for 1200 and 2200Hz
|
||||
// we do this to save calculation time (see https://github.com/khoih-prog/RP2040_PWM/issues/6)
|
||||
#define SLEEP_1200 416.666
|
||||
|
@ -43,3 +45,5 @@ void PicoHal::tone(uint32_t pin, unsigned int frequency, unsigned long duration)
|
|||
toneLoopDuration = duration;
|
||||
multicore_launch_core1(toneLoop);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
#ifndef PICO_HAL_H
|
||||
#define PICO_HAL_H
|
||||
|
||||
#if defined(RADIOLIB_BUILD_RPI_PICO)
|
||||
|
||||
// include RadioLib
|
||||
#include <RadioLib.h>
|
||||
|
||||
|
@ -153,3 +155,5 @@ private:
|
|||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
Ładowanie…
Reference in New Issue