simplify board API, adding stm32f3 discovery
- remove board header since it is not used
This commit is contained in:
@@ -40,53 +40,33 @@
|
||||
|
||||
#include "ansi_escape.h"
|
||||
|
||||
// NXP LPC
|
||||
#if defined BOARD_LPCXPRESSO11U14
|
||||
#include "lpcxpresso11u14/board_lpcxpresso11u14.h"
|
||||
#elif defined BOARD_LPCXPRESSO1347
|
||||
#include "lpcxpresso1347/board_lpcxpresso1347.h"
|
||||
#elif defined BOARD_LPCXPRESSO11U68
|
||||
#include "lpcxpresso11u68/board_lpcxpresso11u68.h"
|
||||
#elif defined BOARD_LPCXPRESSO1769
|
||||
#include "lpcxpresso1769/board_lpcxpresso1769.h"
|
||||
#elif defined BOARD_MCB1800
|
||||
#include "mcb1800/board_mcb1800.h"
|
||||
#elif defined BOARD_EA4088QS
|
||||
#include "ea4088qs/board_ea4088qs.h"
|
||||
#elif defined BOARD_EA4357
|
||||
#include "ea4357/board_ea4357.h"
|
||||
|
||||
// Nordic nRF
|
||||
#elif defined BOARD_PCA10056
|
||||
#include "pca10056/board_pca10056.h"
|
||||
|
||||
// Atmel SAM
|
||||
#elif defined BOARD_METRO_M4_EXPRESS
|
||||
#include "metro_m4_express/board_metro_m4_express.h"
|
||||
#elif defined BOARD_METRO_M0_EXPRESS
|
||||
#include "metro_m0_express/board_metro_m0_express.h"
|
||||
|
||||
// ST STM32
|
||||
#elif defined BOARD_STM32F407G_DISC1
|
||||
#include "stm32f407g_disc1/board_stm32f407g_disc1.h"
|
||||
#else
|
||||
#error BOARD is not defined or supported yet
|
||||
#endif
|
||||
|
||||
#define CFG_UART_BAUDRATE 115200
|
||||
#define BOARD_TICKS_HZ 1000
|
||||
#define board_tick2ms(tck) ( ( ((uint64_t)(tck)) * 1000) / BOARD_TICKS_HZ )
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// Board Porting API
|
||||
//--------------------------------------------------------------------+
|
||||
|
||||
// Initialize on-board peripherals
|
||||
// Initialize on-board peripherals : led, button, uart and USB
|
||||
void board_init(void);
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// LED
|
||||
// Board layer use only 1 LED for indicator
|
||||
//--------------------------------------------------------------------+
|
||||
// Turn LED on or off
|
||||
void board_led_control(bool state);
|
||||
|
||||
// Get the current state of buttons on the board
|
||||
// \return Bitmask where a '1' means active (pressed), a '0' means inactive.
|
||||
uint32_t board_buttons(void);
|
||||
|
||||
// Get characters from UART
|
||||
int board_uart_read(uint8_t* buf, int len);
|
||||
|
||||
// Send characters to UART
|
||||
int board_uart_write(void const * buf, int len);
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// Helper functions
|
||||
//--------------------------------------------------------------------+
|
||||
static inline void board_led_on(void)
|
||||
{
|
||||
board_led_control(true);
|
||||
@@ -97,26 +77,6 @@ static inline void board_led_off(void)
|
||||
board_led_control(false);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// Buttons
|
||||
// TODO refractor later
|
||||
//--------------------------------------------------------------------+
|
||||
/** Get the current state of the buttons on the board
|
||||
* \return Bitmask where a '1' means active (pressed), a '0' means inactive.
|
||||
*/
|
||||
uint32_t board_buttons(void);
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// UART
|
||||
//--------------------------------------------------------------------+
|
||||
|
||||
// Get characters from UART
|
||||
int board_uart_read(uint8_t* buf, int len);
|
||||
|
||||
// Send characters to UART
|
||||
int board_uart_write(void const * buf, int len);
|
||||
|
||||
|
||||
static inline int8_t board_uart_getchar(void)
|
||||
{
|
||||
uint8_t c;
|
||||
|
Reference in New Issue
Block a user