From 18e8b6b4c15e15a8aaaa7d8d25f2363622449f28 Mon Sep 17 00:00:00 2001 From: Gunar Schorcht Date: Thu, 20 Feb 2020 17:37:44 +0100 Subject: [PATCH] fixup! boards/esp32: Heltec WiFi LoRa 32 V2 board added --- .../esp32-heltec-lora32-v2/Makefile.features | 1 + boards/esp32-heltec-lora32-v2/doc.txt | 11 ++--- boards/esp32-heltec-lora32-v2/include/board.h | 45 ++++++++++++++++--- 3 files changed, 47 insertions(+), 10 deletions(-) diff --git a/boards/esp32-heltec-lora32-v2/Makefile.features b/boards/esp32-heltec-lora32-v2/Makefile.features index 80aab0d1d32d3..d84ddb288ac40 100644 --- a/boards/esp32-heltec-lora32-v2/Makefile.features +++ b/boards/esp32-heltec-lora32-v2/Makefile.features @@ -7,5 +7,6 @@ FEATURES_PROVIDED += periph_dac FEATURES_PROVIDED += periph_i2c FEATURES_PROVIDED += periph_pwm FEATURES_PROVIDED += periph_spi +FEATURES_PROVIDED += esp_rtc_timer_32k FEATURES_PROVIDED += arduino diff --git a/boards/esp32-heltec-lora32-v2/doc.txt b/boards/esp32-heltec-lora32-v2/doc.txt index 1423854244fe4..e36c60cc1c810 100644 --- a/boards/esp32-heltec-lora32-v2/doc.txt +++ b/boards/esp32-heltec-lora32-v2/doc.txt @@ -27,15 +27,16 @@ Heltec WiFi LoRa 32 V2 is an ESP32 development board with 8 MB Flash that uses the EPS32 chip directly. It integrates -- a SemTech SX1276 or SX1278 for LoRaWAN communication and -- an OLED display connected via I2C. +- a SemTech SX1276 or SX1278 for LoRaWAN communication, +- an OLED display connected via I2C and +- an external 32.768 kHz crystal for RTC. Since the board is [open source hardware](https://github.com/Heltec-Aaron-Lee/WiFi_Kit_series), a number of clones are available. -\htmlonly\endhtmlonly -\image html "https://github.com/Heltec-Aaron-Lee/WiFi_Kit_series/raw/master/InstallGuide/win-screenshots/WIFI_LoRa_32.png" "Heltec WiFi Lora 32 V2" +\htmlonly\endhtmlonly +\image html "https://heltec.org/wp-content/uploads/2019/07/SAM_0748_800X800.png" "Heltec WiFi Lora 32 V2" ## Hardware    [[TOC](#toc)] @@ -92,7 +93,7 @@ overridden by \ref esp32_app_spec_conf "application-specific configurations". \anchor esp32_heltec_lora_32_v2_table_board_configuration Function | GPIOs | Remarks |Configuration :---------------|:-------|:--------|:---------------------------------- -BUTTON0 | GPIO0 | low active | | +BTN0 | GPIO0 | low active | | LED0 | GPIO25 | high active | | ADC | GPIO36, GPIO39, GPIO37, GPIO38,
GPIO0, GPIO2, GPIO12, GPIO13,
GPIO4, GPIO15 | | \ref esp32_adc_channels "ADC Channels" DAC | | | \ref esp32_dac_channels "DAC Channels" diff --git a/boards/esp32-heltec-lora32-v2/include/board.h b/boards/esp32-heltec-lora32-v2/include/board.h index 2e5416e334029..c31db12925505 100644 --- a/boards/esp32-heltec-lora32-v2/include/board.h +++ b/boards/esp32-heltec-lora32-v2/include/board.h @@ -32,15 +32,34 @@ #include -#ifdef __cplusplus - extern "C" { -#endif - /** * @name Button pin definitions * @{ */ -#define BUTTON0_PIN GPIO0 + +/** + * @brief Default button GPIO pin definition + * + * Generic ESP32 boards have a BOOT button connected to GPIO0, which can be + * used as button during normal operation. Since the GPIO0 pin is pulled up, + * the button signal is inverted, i.e., pressing the button will give a + * low signal. + */ +#define BTN0_PIN GPIO0 + +/** + * @brief Default button GPIO mode definition + * + * Since the GPIO of the button is pulled up with an external resistor, the + * mode for the GPIO pin has to be GPIO_IN. + */ +#define BTN0_MODE GPIO_IN + +/** + * @brief Definition for compatibility with previous versions + */ +#define BUTTON0_PIN BTN0_PIN + /** @} */ /** @@ -75,5 +94,21 @@ /* include common board definitions as last step */ #include "board_common.h" +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Initialize the board specific hardware + */ +static inline void board_init(void) { + /* there is nothing special to initialize on this board */ + board_init_common(); +} + +#ifdef __cplusplus +} /* end extern "C" */ +#endif + #endif /* BOARD_H */ /** @} */