Merge pull request #13076 from gschorcht/boards/esp32/ttgo_t_beam_gps
boards/esp32: enable GPS module on ESP32 TTGO T-Beam V1.0
This commit is contained in:
commit
5d1bf26f0c
@ -30,7 +30,7 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void board_init(void)
|
||||
void board_init_common(void)
|
||||
{
|
||||
#ifdef LED0_PIN
|
||||
gpio_init (LED0_PIN, GPIO_OUT);
|
||||
@ -54,7 +54,7 @@ extern void spi_print_config(void);
|
||||
extern void uart_print_config(void);
|
||||
extern void can_print_config(void);
|
||||
|
||||
void print_board_config (void)
|
||||
void print_board_config(void)
|
||||
{
|
||||
ets_printf("\nBoard configuration:\n");
|
||||
|
||||
|
||||
@ -150,23 +150,37 @@ extern mtd_dev_t *mtd0;
|
||||
|
||||
|
||||
/**
|
||||
* @brief Initialize board specific hardware
|
||||
* @brief Initialize the hardware that is common for all ESP32 boards.
|
||||
*
|
||||
* Since all features of ESP32 boards are provided by the SOC, almost all
|
||||
* initializations are done during the CPU initialization that is called from
|
||||
* boot loader.
|
||||
* This function has to be called from the board specific `board_init` function.
|
||||
*/
|
||||
void board_init (void);
|
||||
void board_init_common(void);
|
||||
|
||||
/**
|
||||
* @brief Print the board configuration in a human readable format
|
||||
*/
|
||||
void print_board_config (void);
|
||||
void print_board_config(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* end extern "C" */
|
||||
#endif
|
||||
|
||||
#else /* ESP32_IDF_CODE */
|
||||
|
||||
#ifndef DOXYGEN
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
|
||||
/* declaration of `board_init_common` is required when compiling vendor code */
|
||||
extern void board_init_common(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* DOXYGEN */
|
||||
#endif /* ESP32_IDF_CODE */
|
||||
#endif /* BOARD_COMMON_H */
|
||||
/** @} */
|
||||
|
||||
@ -58,5 +58,13 @@
|
||||
/* include definitions for optional hardware modules */
|
||||
#include "board_modules.h"
|
||||
|
||||
/**
|
||||
* @brief Initialize the board specific hardware
|
||||
*/
|
||||
static inline void board_init(void) {
|
||||
/* there is nothing special to initialize on this board */
|
||||
board_init_common();
|
||||
}
|
||||
|
||||
#endif /* BOARD_H */
|
||||
/** @} */
|
||||
|
||||
@ -98,6 +98,14 @@ extern "C" {
|
||||
/* include common board definitions as last step */
|
||||
#include "board_common.h"
|
||||
|
||||
/**
|
||||
* @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
|
||||
|
||||
@ -1 +1,5 @@
|
||||
ifneq (,$(filter esp32_ttgo_t_beam_v1_0,$(USEMODULE)))
|
||||
FEATURES_REQUIRED += periph_i2c
|
||||
endif
|
||||
|
||||
include $(RIOTBOARD)/common/esp32/Makefile.dep
|
||||
|
||||
56
boards/esp32-ttgo-t-beam/board.c
Normal file
56
boards/esp32-ttgo-t-beam/board.c
Normal file
@ -0,0 +1,56 @@
|
||||
/*
|
||||
* Copyright (C) 2019 Gunar Schorcht
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU Lesser
|
||||
* General Public License v2.1. See the file LICENSE in the top level
|
||||
* directory for more details.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ingroup boards_esp32_ttgo-t-beam
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief Board specific definitions for TTGO T-Beam board
|
||||
*
|
||||
* @author Gunar Schorcht <gunar@schorcht.net>
|
||||
*/
|
||||
|
||||
#include "board.h"
|
||||
|
||||
#if MODULE_ESP32_TTGO_T_BEAM_V1_0
|
||||
#include "periph/i2c.h"
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define AXP192_I2C_ADDR (0x34)
|
||||
#define AXP192_LDO234_DC23_CTL (0x12)
|
||||
#define AXP192_LDO3OUT_VOL (0x29)
|
||||
#define AXP192_LDO3_ON_BIT (1 << 3)
|
||||
|
||||
void board_init(void)
|
||||
{
|
||||
board_init_common();
|
||||
|
||||
#if MODULE_ESP32_TTGO_T_BEAM_V1_0
|
||||
uint8_t reg;
|
||||
|
||||
i2c_acquire(I2C_DEV(0));
|
||||
/* enable the LDO3 power control */
|
||||
i2c_read_reg(I2C_DEV(0), AXP192_I2C_ADDR, AXP192_LDO234_DC23_CTL, ®, 0);
|
||||
reg |= AXP192_LDO3_ON_BIT;
|
||||
i2c_write_reg(I2C_DEV(0), AXP192_I2C_ADDR, AXP192_LDO234_DC23_CTL, reg, 0);
|
||||
/* set the output voltage to 3V3 */
|
||||
i2c_write_reg(I2C_DEV(0), AXP192_I2C_ADDR, AXP192_LDO3OUT_VOL, 0xff, 0);
|
||||
i2c_release(I2C_DEV(0));
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* end extern "C" */
|
||||
#endif
|
||||
|
||||
/** @} */
|
||||
@ -79,5 +79,10 @@
|
||||
/* include common board definitions as last step */
|
||||
#include "board_common.h"
|
||||
|
||||
/**
|
||||
* @brief Initialize the board specific hardware
|
||||
*/
|
||||
void board_init(void);
|
||||
|
||||
#endif /* BOARD_H */
|
||||
/** @} */
|
||||
|
||||
@ -80,5 +80,13 @@
|
||||
/* include common board definitions as last step */
|
||||
#include "board_common.h"
|
||||
|
||||
/**
|
||||
* @brief Initialize the board specific hardware
|
||||
*/
|
||||
static inline void board_init(void) {
|
||||
/* there is nothing special to initialize on this board */
|
||||
board_init_common();
|
||||
}
|
||||
|
||||
#endif /* BOARD_H */
|
||||
/** @} */
|
||||
|
||||
@ -64,5 +64,13 @@
|
||||
/* include common board definitions as last step */
|
||||
#include "board_common.h"
|
||||
|
||||
/**
|
||||
* @brief Initialize the board specific hardware
|
||||
*/
|
||||
static inline void board_init(void) {
|
||||
/* there is nothing special to initialize on this board */
|
||||
board_init_common();
|
||||
}
|
||||
|
||||
#endif /* BOARD_H */
|
||||
/** @} */
|
||||
|
||||
@ -108,5 +108,13 @@
|
||||
/* include common board definitions as last step */
|
||||
#include "board_common.h"
|
||||
|
||||
/**
|
||||
* @brief Initialize the board specific hardware
|
||||
*/
|
||||
static inline void board_init(void) {
|
||||
/* there is nothing special to initialize on this board */
|
||||
board_init_common();
|
||||
}
|
||||
|
||||
#endif /* BOARD_H */
|
||||
/** @} */
|
||||
|
||||
@ -319,9 +319,6 @@ static NORETURN void IRAM system_init (void)
|
||||
LOG_STARTUP("Heap free: %u bytes\n", get_free_heap_size());
|
||||
uart_tx_wait_idle(CONFIG_CONSOLE_UART_NUM);
|
||||
|
||||
/* initialize the board */
|
||||
board_init();
|
||||
|
||||
/* initialize stdio */
|
||||
stdio_init();
|
||||
|
||||
@ -346,6 +343,9 @@ static NORETURN void IRAM system_init (void)
|
||||
spi_flash_drive_init();
|
||||
#endif
|
||||
|
||||
/* initialize the board */
|
||||
board_init();
|
||||
|
||||
/* route a software interrupt source to CPU as trigger for thread yields */
|
||||
intr_matrix_set(PRO_CPU_NUM, ETS_FROM_CPU_INTR0_SOURCE, CPU_INUM_SOFTWARE);
|
||||
/* set thread yield handler and enable the software interrupt */
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user