Skip to content

Commit

Permalink
Merge pull request #11108 from gschorcht/cpu/esp8266/esp-idf/pr
Browse files Browse the repository at this point in the history
cpu/esp8266: complete reimplementation based on ESP8266 RTOS SDK
  • Loading branch information
MrKevinWeiss authored Nov 18, 2019
2 parents cd0b975 + 555a704 commit be39169
Show file tree
Hide file tree
Showing 242 changed files with 31,537 additions and 11,300 deletions.
12 changes: 3 additions & 9 deletions boards/common/esp32/include/periph_conf_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ static const gpio_t pwm1_channels[] = PWM1_GPIOS;
*/

/**
* @brief Static array with configuration for declared I2C devices
* @brief Static array with configuration for declared SPI devices
*/
static const spi_conf_t spi_config[] = {
#ifdef SPI0_CTRL
Expand Down Expand Up @@ -220,7 +220,7 @@ static const spi_conf_t spi_config[] = {
#endif

/**
* @brief Static array with configuration for declared I2C devices
* @brief Static array with configuration for declared UART devices
*/
static const uart_conf_t uart_config[] = {
{
Expand Down Expand Up @@ -249,13 +249,7 @@ static const uart_conf_t uart_config[] = {
*
* @note UART_NUMOF definition must not be changed.
*/
#if defined(UART1_TXD) && defined(UART1_RXD) && defined(UART2_TXD) && defined(UART2_RXD)
#define UART_NUMOF 3
#elif (defined(UART1_TXD) && defined(UART1_RXD)) || (defined(UART2_TXD) && defined(UART2_RXD))
#define UART_NUMOF 2
#else
#define UART_NUMOF 1
#endif
#define UART_NUMOF ARRAY_SIZE(uart_config)
/** @} */

#ifdef __cplusplus
Expand Down
1 change: 1 addition & 0 deletions boards/common/esp8266/Makefile.features
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ FEATURES_PROVIDED += periph_i2c
FEATURES_PROVIDED += periph_pwm
FEATURES_PROVIDED += periph_spi
FEATURES_PROVIDED += periph_uart
FEATURES_PROVIDED += periph_uart_modecfg
4 changes: 2 additions & 2 deletions boards/common/esp8266/Makefile.include
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.SLAB_USBtoUART*)))
include $(RIOTMAKE)/tools/serial.inc.mk

# reset tool configuration
RESET ?= esptool.py
RESET_FLAGS ?= --port $(PROG_DEV) --before default_reset run
RESET ?= $(RIOTTOOLS)/esptool/espreset.py
RESET_FLAGS ?= --port $(PROG_DEV)
53 changes: 45 additions & 8 deletions boards/common/esp8266/board_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,12 @@
* @author Gunar Schorcht <gunar@schorcht.net>
*/

#include "board_common.h"
#include "board.h"
#include "esp_common.h"
#include "log.h"
#include "periph/gpio.h"
#include "esp_libc.h"
#include "rom/ets_sys.h"

#ifdef __cplusplus
extern "C" {
Expand All @@ -40,35 +43,69 @@ void board_init(void)
#endif
}

extern void adc_print_config(void);
extern void dac_print_config(void);
extern void pwm_print_config(void);
extern void i2c_print_config(void);
extern void spi_print_config(void);
extern void uart_print_config(void);
extern void timer_print_config(void);
extern void can_print_config(void);

void board_print_config (void)
{
LOG_INFO("\nBoard configuration:\n");
ets_printf("\nBoard configuration:\n");

#if MODULE_PERIPH_ADC
adc_print_config();
#endif
#if MODULE_PERIPH_DAC
dac_print_config();
#endif
#if MODULE_PERIPH_PWM
pwm_print_config();
#endif
#if MODULE_PERIPH_I2C
i2c_print_config();
#endif
#if MODULE_PERIPH_SPI
spi_print_config();
#endif
#if MODULE_PERIPH_UART
uart_print_config();
#endif
#if MODULE_PERIPH_TIMER
timer_print_config();
#endif
#ifdef MODULE_ESP_CAN
can_print_config();
#endif

LOG_INFO("\tLED: pins=[ ");
ets_printf("\tLED\t\tpins=[ ");
#ifdef LED0_PIN
LOG_INFO("%d ", LED0_PIN);
ets_printf("%d ", LED0_PIN);
#endif
#ifdef LED1_PIN
LOG_INFO("%d ", LED1_PIN);
ets_printf("%d ", LED1_PIN);
#endif
#ifdef LED2_PIN
LOG_INFO("%d ", LED2_PIN);
ets_printf("%d ", LED2_PIN);
#endif
ets_printf("]\n");

ets_printf("\tBUTTON\t\tpins=[ ");
#ifdef BUTTON0_PIN
ets_printf("%d ", BUTTON0_PIN);
#endif
#ifdef BUTTON2_PIN
ets_printf("%d ", BUTTON1_PIN);
#endif
#ifdef BUTTON3_PIN
ets_printf("%d ", BUTTON2_PIN);
#endif
LOG_INFO("]\n");
ets_printf("]\n");

LOG_INFO("\n\n");
ets_printf("\n");
}

#ifdef __cplusplus
Expand Down
6 changes: 5 additions & 1 deletion boards/common/esp8266/include/board_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
* @{
*/

/* not required when compiling ESP vendor code parts */
#ifndef ESP_PLATFORM

#include <stdint.h>

#include "cpu.h"
Expand Down Expand Up @@ -124,7 +127,7 @@ extern mtd_dev_t *mtd0;
* initializations are done during the CPU initialization that is called from
* boot loader.
*/
extern void board_init(void);
void board_init (void);

/**
* @brief Print the board configuration in a human readable format
Expand All @@ -140,4 +143,5 @@ void board_print_config (void);

/** @} */

#endif /* ESP_PLATFORM */
#endif /* BOARD_COMMON_H */
26 changes: 13 additions & 13 deletions boards/common/esp8266/include/board_modules.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,13 @@ extern "C" {
#define ENC28J60_PARAM_SPI SPI_DEV(0) /**< SPI_DEV(0) is used (fixed) */

#ifndef ENC28J60_PARAM_CS
#define ENC28J60_PARAM_CS GPIO4 /**< ENC28J60 CS signal (can be overriden) */
#define ENC28J60_PARAM_CS GPIO4 /**< ENC28J60 CS signal (can be overridden) */
#endif
#ifndef ENC28J60_PARAM_INT
#define ENC28J60_PARAM_INT GPIO9 /**< ENC28J60 INT signal (can be overriden) */
#define ENC28J60_PARAM_INT GPIO9 /**< ENC28J60 INT signal (can be overridden) */
#endif
#ifndef ENC28J60_PARAM_RESET
#define ENC28J60_PARAM_RESET GPIO10 /**< ENC28J60 RESET signal (can be overriden) */
#define ENC28J60_PARAM_RESET GPIO10 /**< ENC28J60 RESET signal (can be overridden) */
#endif
/** @} */
#endif /* defined(MODULE_ENC28J60) || defined(DOXYGEN) */
Expand All @@ -82,16 +82,16 @@ extern "C" {
#define MRF24J40_PARAM_SPI SPI_DEV(0) /**< SPI_DEV(0) is used (fixed) */

#ifndef MRF24J40_PARAM_SPI_CLK
#define MRF24J40_PARAM_SPI_CLK SPI_CLK_1MHZ /**< SPI bus speed used (can be overriden) */
#define MRF24J40_PARAM_SPI_CLK SPI_CLK_1MHZ /**< SPI bus speed used (can be overridden) */
#endif
#ifndef MRF24J40_PARAM_CS
#define MRF24J40_PARAM_CS GPIO16 /**< MRF24J40 CS signal (can be overriden) */
#define MRF24J40_PARAM_CS GPIO16 /**< MRF24J40 CS signal (can be overridden) */
#endif
#ifndef MRF24J40_PARAM_INT
#define MRF24J40_PARAM_INT GPIO0 /**< MRF24J40 INT signal (can be overriden) */
#define MRF24J40_PARAM_INT GPIO0 /**< MRF24J40 INT signal (can be overridden) */
#endif
#ifndef MRF24J40_PARAM_RESET
#define MRF24J40_PARAM_RESET GPIO2 /**< MRF24J40 RESET signal (can be overriden) */
#define MRF24J40_PARAM_RESET GPIO2 /**< MRF24J40 RESET signal (can be overridden) */
#endif
/** @} */
#endif /* defined(MODULE_MRF24J40) || defined(DOXYGEN) */
Expand All @@ -109,14 +109,14 @@ extern "C" {
* If not defined, the default CS signal of SPI_DEV(0) is used.
* @{
*/
#define SDCARD_SPI_PARAM_SPI SPI_DEV(0) /**< SPI_DEV(0) is used (fixed) */
#define SDCARD_SPI_PARAM_CLK SPI0_SCK_GPIO /**< SPI_DEV(0) SCK is used (fixed) */
#define SDCARD_SPI_PARAM_MOSI SPI0_MOSI_GPIO /**< SPI_DEV(0) MOSI is used (fixed) */
#define SDCARD_SPI_PARAM_MISO SPI0_MISO_GPIO /**< SPI_DEV(0) MISO is used (fixed) */
#define SDCARD_SPI_PARAM_POWER GPIO_UNDEF /**< power control is not used (fixed) */
#define SDCARD_SPI_PARAM_SPI SPI_DEV(0) /**< SPI_DEV(0) is used (fixed) */
#define SDCARD_SPI_PARAM_CLK SPI0_SCK /**< SPI_DEV(0) SCK is used (fixed) */
#define SDCARD_SPI_PARAM_MOSI SPI0_MOSI /**< SPI_DEV(0) MOSI is used (fixed) */
#define SDCARD_SPI_PARAM_MISO SPI0_MISO /**< SPI_DEV(0) MISO is used (fixed) */
#define SDCARD_SPI_PARAM_POWER GPIO_UNDEF /**< power control is not used (fixed) */

#ifndef SDCARD_SPI_PARAM_CS
#define SDCARD_SPI_PARAM_CS SPI0_CS0_GPIO /**< SD-Card CS signal (can be overridden) */
#define SDCARD_SPI_PARAM_CS SPI0_CS0 /**< SD-Card CS signal (can be overridden) */
#endif
/** @} */
#endif /* defined(MODULE_SDCARD_SPI) || defined(DOXYGEN) */
Expand Down
Loading

0 comments on commit be39169

Please sign in to comment.