EFM32 Happy Gecko Software Documentation  efm32hg-doc-5.1.2
Common BSP for all kits

Detailed Description

Macros

#define BSP_INIT_BCC   0x04
 
#define BSP_INIT_DK_EBI   0x02
 
#define BSP_INIT_DK_SPI   0x01
 
#define BSP_INIT_IOEXP   0x08
 
#define BSP_STATUS_ILLEGAL_PARAM   (-1)
 
#define BSP_STATUS_IOEXP_FAILURE   (-4)
 
#define BSP_STATUS_NOT_IMPLEMENTED   (-2)
 
#define BSP_STATUS_OK   0
 
#define BSP_STATUS_UNSUPPORTED_MODE   (-3)
 

Functions

int BSP_Disable (void)
 Deinitialize board support package functionality. Reverse actions performed by BSP_Init(). This function is a dummy on STK's. More...
 
int BSP_Init (uint32_t flags)
 Initialize board support package functionality. More...
 
int BSP_LedClear (int ledNo)
 Turn off a single LED. More...
 
int BSP_LedGet (int ledNo)
 Get current status of a single LED. More...
 
int BSP_LedSet (int ledNo)
 Turn on a single LED. More...
 
uint32_t BSP_LedsGet (void)
 Get status of all LED's. More...
 
int BSP_LedsInit (void)
 Initialize LED drivers. More...
 
int BSP_LedsSet (uint32_t leds)
 Update all LED's. More...
 
int BSP_LedToggle (int ledNo)
 Toggle a single LED. More...
 
int BSP_PeripheralAccess (BSP_Peripheral_TypeDef perf, bool enable)
 DK Peripheral Access Control Enable or disable access to on-board peripherals through switches and SPI switch where applicable. Turn off conflicting peripherals when enabling another. More...
 

Macro Definition Documentation

#define BSP_INIT_BCC   0x04

Mode flag for BSP_Init(), init board controller communication.

Definition at line 54 of file bsp.h.

#define BSP_INIT_DK_EBI   0x02

Mode flag for BSP_Init(), init DK in EBI mode (DK3x50 only).

Definition at line 53 of file bsp.h.

Referenced by BSP_Disable(), BSP_Init(), BSP_RegisterRead(), and BSP_RegisterWrite().

#define BSP_INIT_DK_SPI   0x01

Mode flag for BSP_Init(), init DK in SPI mode (DK3x50 only).

Definition at line 52 of file bsp.h.

Referenced by BSP_Disable(), and BSP_Init().

#define BSP_INIT_IOEXP   0x08

Mode flag for BSP_Init(), init io-expander on some radio boards

Definition at line 55 of file bsp.h.

#define BSP_STATUS_ILLEGAL_PARAM   (-1)

BSP API return code, illegal input parameter.

Definition at line 46 of file bsp.h.

Referenced by BSP_BusControlModeSet(), BSP_LedClear(), BSP_LedGet(), BSP_LedSet(), and BSP_LedToggle().

#define BSP_STATUS_IOEXP_FAILURE   (-4)

BSP API return code, io-expander communication failed

Definition at line 49 of file bsp.h.

#define BSP_STATUS_NOT_IMPLEMENTED   (-2)

BSP API return code, function not implemented (dummy).

Definition at line 47 of file bsp.h.

Referenced by BSP_EbiDeInit(), BSP_EbiInit(), BSP_McuBoard_UsbStatusLedEnable(), and BSP_McuBoard_UsbVbusPowerEnable().

#define BSP_STATUS_UNSUPPORTED_MODE   (-3)

BSP API return code, unsupported BSP mode.

Definition at line 48 of file bsp.h.

Function Documentation

int BSP_Disable ( void  )

Deinitialize board support package functionality. Reverse actions performed by BSP_Init(). This function is a dummy on STK's.

Returns
BSP_STATUS_OK on DK's, BSP_STATUS_NOT_IMPLEMENTED on STK's.

Definition at line 97 of file bsp_dk_3201.c.

References BSP_BusControl_OFF, BSP_BusControlModeSet(), BSP_INIT_DK_EBI, BSP_INIT_DK_SPI, and BSP_STATUS_OK.

int BSP_Init ( uint32_t  flags)

Initialize board support package functionality.

Parameters
[in]flagsDK3x50: Initialize in EBI or SPI mode using BSP_INIT_DK_EBI or BSP_INIT_DK_SPI. Gxxx_DK: Use 0. STK: Use BSP_INIT_BCC to initialize board controller UART, 0 otherwise.

The value BSP_INIT_DEFAULT is defined and is: BSP_INIT_DK_EBI on DK3x50, 0 on all other kits.

Returns
BSP_STATUS_OK

Definition at line 127 of file bsp_dk_3201.c.

References BC_REGISTER, BSP_BusControl_EBI, BSP_BusControl_SPI, BSP_BusControlModeSet(), BSP_INIT_DK_EBI, BSP_INIT_DK_SPI, BSP_RegisterRead(), BSP_RegisterWrite(), and BSP_STATUS_OK.

int BSP_LedClear ( int  ledNo)

Turn off a single LED.

Parameters
[in]ledNoThe number of the LED (counting from zero) to turn off.
Returns
BSP_STATUS_OK or BSP_STATUS_ILLEGAL_PARAM if illegal LED number.

Definition at line 72 of file bsp_dk_leds.c.

References BSP_RegisterRead(), BSP_RegisterWrite(), BSP_STATUS_ILLEGAL_PARAM, and BSP_STATUS_OK.

int BSP_LedGet ( int  ledNo)

Get current status of a single LED.

Parameters
[in]ledNoThe number of the LED (counting from zero) to check.
Returns
1 if LED is on, 0 if LED is off, BSP_STATUS_ILLEGAL_PARAM if illegal LED number.

Definition at line 93 of file bsp_dk_leds.c.

References BSP_RegisterRead(), and BSP_STATUS_ILLEGAL_PARAM.

int BSP_LedSet ( int  ledNo)

Turn on a single LED.

Parameters
[in]ledNoThe number of the LED (counting from zero) to turn on.
Returns
BSP_STATUS_OK or BSP_STATUS_ILLEGAL_PARAM if illegal LED number.

Definition at line 111 of file bsp_dk_leds.c.

References BSP_RegisterRead(), BSP_RegisterWrite(), BSP_STATUS_ILLEGAL_PARAM, and BSP_STATUS_OK.

uint32_t BSP_LedsGet ( void  )

Get status of all LED's.

Returns
Bitmask with current status for all LED's.

Definition at line 48 of file bsp_dk_leds.c.

References BSP_RegisterRead().

int BSP_LedsInit ( void  )

Initialize LED drivers.

Note
LED's are initially turned off.
Returns
BSP_STATUS_OK

Definition at line 37 of file bsp_dk_leds.c.

References BSP_RegisterWrite(), and BSP_STATUS_OK.

int BSP_LedsSet ( uint32_t  leds)

Update all LED's.

Parameters
[in]ledsBitmask representing new status for all LED's. A 1 turns a LED on, a 0 turns a LED off.
Returns
BSP_STATUS_OK

Definition at line 60 of file bsp_dk_leds.c.

References BSP_RegisterWrite(), and BSP_STATUS_OK.

int BSP_LedToggle ( int  ledNo)

Toggle a single LED.

Parameters
[in]ledNoThe number of the LED (counting from zero) to toggle.
Returns
BSP_STATUS_OK or BSP_STATUS_ILLEGAL_PARAM if illegal LED number.

Definition at line 131 of file bsp_dk_leds.c.

References BSP_RegisterRead(), BSP_RegisterWrite(), BSP_STATUS_ILLEGAL_PARAM, and BSP_STATUS_OK.

int BSP_PeripheralAccess ( BSP_Peripheral_TypeDef  perf,
bool  enable 
)

DK Peripheral Access Control Enable or disable access to on-board peripherals through switches and SPI switch where applicable. Turn off conflicting peripherals when enabling another.

Parameters
[in]perfWhich peripheral to configure. Use enum BSP_Peripheral_TypeDef or BSP_Peripheral_Typedef according to DK type.
[in]enableIf true, set up access to peripheral, if false disable access.
Returns
BSP_STATUS_OK.

Definition at line 461 of file bsp_dk_3201.c.

References BC_PERICON_ANALOG_DIFF_SHIFT, BC_PERICON_ANALOG_SE_SHIFT, BC_PERICON_AUDIO_IN_SHIFT, BC_PERICON_AUDIO_OUT_SEL_SHIFT, BC_PERICON_AUDIO_OUT_SHIFT, BC_PERICON_I2C_SHIFT, BC_PERICON_I2S_ETH_SEL_SHIFT, BC_PERICON_I2S_ETH_SHIFT, BC_PERICON_RS232_LEUART_SHIFT, BC_PERICON_RS232_SHUTDOWN_SHIFT, BC_PERICON_RS232_UART_SHIFT, BC_PERICON_SPI_SHIFT, BC_PERICON_TOUCH_SHIFT, BC_PERICON_TRACE_SHIFT, BC_REGISTER, BSP_ANALOG_DIFF, BSP_ANALOG_SE, BSP_AUDIO_IN, BSP_AUDIO_OUT, BSP_ETH, BSP_I2C, BSP_I2S, BSP_MICROSD, BSP_RegisterRead(), BSP_RegisterWrite(), BSP_RS232_LEUART, BSP_RS232_SHUTDOWN, BSP_RS232_UART, BSP_STATUS_OK, BSP_TFT, BSP_TOUCH, and BSP_TRACE.

Referenced by TFT_DirectInit(), and TOUCH_Init().