EFM32 Happy Gecko Software Documentation  efm32hg-doc-4.2.1
bsp.h
Go to the documentation of this file.
1 /***************************************************************************/
18 #ifndef __BSP_H
19 #define __BSP_H
20 
21 #include <stdbool.h>
22 #include "bspconfig.h"
23 #if defined( BSP_STK ) || defined( BSP_WSTK )
24 #include "em_usart.h"
25 #endif
26 
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 
31 /***************************************************************************/
35 /***************************************************************************/
40 #define BSP_STATUS_OK 0
41 #define BSP_STATUS_ILLEGAL_PARAM (-1)
42 #define BSP_STATUS_NOT_IMPLEMENTED (-2)
43 #define BSP_STATUS_UNSUPPORTED_MODE (-3)
45 /* Initialization flag bitmasks for BSP_Init(). */
46 #define BSP_INIT_DK_SPI 0x01
47 #define BSP_INIT_DK_EBI 0x02
48 #define BSP_INIT_BCC 0x04
52 #if defined( BSP_DK )
53 
56 typedef enum
57 {
68 
70 typedef enum
71 {
78 
79 #if defined( BSP_DK_BRD3200 ) /* Gxxx_DK */
80 
82 typedef enum
83 {
84  BSP_ACCEL = BC_PERCTRL_ACCEL,
85  BSP_AMBIENT = BC_PERCTRL_AMBIENT,
86  BSP_POTMETER = BC_PERCTRL_POTMETER,
87  BSP_RS232A = BC_PERCTRL_RS232A,
88  BSP_RS232B = BC_PERCTRL_RS232B,
89  BSP_SPI = BC_PERCTRL_SPI,
90  BSP_I2C = BC_PERCTRL_I2C,
91  BSP_IRDA = BC_PERCTRL_IRDA,
92  BSP_ANALOG_SE = BC_PERCTRL_ANALOG_SE,
93  BSP_ANALOG_DIFF = BC_PERCTRL_ANALOG_DIFF,
94  BSP_AUDIO_OUT = BC_PERCTRL_AUDIO_OUT,
95  BSP_AUDIO_IN = BC_PERCTRL_AUDIO_IN,
96  BSP_ACCEL_GSEL = BC_PERCTRL_ACCEL_GSEL,
97  BSP_ACCEL_SELFTEST = BC_PERCTRL_ACCEL_SELFTEST,
98  BSP_RS232_SHUTDOWN = BC_PERCTRL_RS232_SHUTDOWN,
99  BSP_IRDA_SHUTDOWN = BC_PERCTRL_IRDA_SHUTDOWN
100 #ifdef DOXY_DOC_ONLY
101 } BSP_Peripheral_Typedef; /* Hack for doxygen doc ! */
102 #else
103 } BSP_Peripheral_TypeDef;
104 #endif
105 #endif /* BSP_DK_BRD3200 */
106 
107 #if defined( BSP_DK_BRD3201 ) /* DK3x50 DK's */
108 
110 typedef enum
111 {
112  BSP_RS232_SHUTDOWN,
113  BSP_RS232_UART,
114  BSP_RS232_LEUART,
115  BSP_I2C,
116  BSP_ETH,
117  BSP_I2S,
118  BSP_TRACE,
119  BSP_TOUCH,
120  BSP_AUDIO_IN,
121  BSP_AUDIO_OUT,
122  BSP_ANALOG_DIFF,
123  BSP_ANALOG_SE,
124  BSP_MICROSD,
125  BSP_TFT,
126 } BSP_Peripheral_TypeDef;
127 #endif /* BSP_DK_BRD3201 */
128 
130 #endif /* BSP_DK */
131 
132 /************************** The BSP API *******************************/
133 /***************************************************************************/
138 int BSP_Disable ( void );
139 int BSP_Init ( uint32_t flags );
140 int BSP_LedClear ( int ledNo );
141 int BSP_LedGet ( int ledNo );
142 int BSP_LedSet ( int ledNo );
143 uint32_t BSP_LedsGet ( void );
144 int BSP_LedsInit ( void );
145 int BSP_LedsSet ( uint32_t leds );
146 int BSP_LedToggle ( int ledNo ); /* endgroup BSPCOMMON */
148 
149 
150 #if defined( BSP_DK )
151 /***************************************************************************/
155 BSP_BusControl_TypeDef BSP_BusControlModeGet( void );
156 int BSP_BusControlModeSet ( BSP_BusControl_TypeDef mode );
157 uint32_t BSP_DipSwitchGet ( void );
158 int BSP_DisplayControl ( BSP_Display_TypeDef option );
159 int BSP_EbiExtendedAddressRange ( bool enable );
160 int BSP_EnergyModeSet ( uint16_t energyMode );
161 int BSP_InterruptDisable ( uint16_t flags );
162 int BSP_InterruptEnable ( uint16_t flags );
163 int BSP_InterruptFlagsClear ( uint16_t flags );
164 int BSP_InterruptFlagsSet ( uint16_t flags );
165 uint16_t BSP_InterruptFlagsGet ( void );
166 uint16_t BSP_JoystickGet ( void );
167 int BSP_McuBoard_DeInit ( void );
168 int BSP_McuBoard_Init ( void );
169 int BSP_McuBoard_UsbStatusLedEnable ( bool enable );
170 bool BSP_McuBoard_UsbVbusOcFlagGet ( void );
171 int BSP_McuBoard_UsbVbusPowerEnable ( bool enable );
172 int BSP_PeripheralAccess ( BSP_Peripheral_TypeDef perf, bool enable );
173 uint16_t BSP_PushButtonsGet ( void );
174 uint16_t BSP_RegisterRead ( volatile uint16_t *addr );
175 int BSP_RegisterWrite ( volatile uint16_t *addr, uint16_t data ); /* endgroup BSP_DK */
177 #endif
178 
179 #if defined( BSP_STK ) || defined( BSP_WSTK )
180 /***************************************************************************/
184 int BSP_BccDeInit ( void );
185 int BSP_BccInit ( void );
186 bool BSP_BccPacketReceive ( BCP_Packet *pkt );
187 int BSP_BccPacketSend ( BCP_Packet *pkt );
188 void BSP_BccPinsEnable ( bool enable );
189 float BSP_CurrentGet ( void );
190 int BSP_EbiDeInit ( void );
191 int BSP_EbiInit ( void );
192 float BSP_VoltageGet ( void ); /* endgroup BSP_STK */
194 #endif
195  /* endgroup BSP */
197 
198 #ifdef __cplusplus
199 }
200 #endif
201 
202 #endif /* __BSP_H */
int BSP_McuBoard_Init(void)
Enable MCU plugin board peripherals.
#define BC_PERCTRL_ACCEL
#define BC_PERCTRL_AUDIO_OUT
float BSP_CurrentGet(void)
Request AEM (Advanced Energy Monitoring) current from board controller.
Definition: bsp_stk.c:196
BCP Packet Structure - Board controller communication protocol version 2.
Definition: bsp_bcp.h:95
#define BC_PERCTRL_AUDIO_IN
#define BC_PERCTRL_AMBIENT
Universal synchronous/asynchronous receiver/transmitter (USART/UART) peripheral API.
int BSP_McuBoard_UsbVbusPowerEnable(bool enable)
Enable MCU plugin board VBUS power switch.
bool BSP_McuBoard_UsbVbusOcFlagGet(void)
Get state MCU plugin board VBUS overcurrent flag.
#define BC_PERCTRL_ACCEL_GSEL
void BSP_BccPinsEnable(bool enable)
Enable GPIO pins for the USART/LEUART used for board communication.
Definition: bsp_bcc.c:230
BSP_BusControl_TypeDef
Definition: bsp.h:70
int BSP_BccInit(void)
Initialize board controller communication support (BCC) functionality.
Definition: bsp_bcc.c:89
#define BC_PERCTRL_ACCEL_SELFTEST
int BSP_McuBoard_DeInit(void)
Disable MCU plugin board peripherals.
int BSP_BccPacketSend(BCP_Packet *pkt)
Send a packet to the board controller.
Definition: bsp_bcc.c:195
#define BC_PERCTRL_SPI
float BSP_VoltageGet(void)
Request AEM (Advanced Energy Monitoring) voltage from board controller.
Definition: bsp_stk.c:228
int BSP_EbiDeInit(void)
Deinitialize the EBI interface for accessing the onboard nandflash.
Definition: bsp_stk.c:157
BSP_Display_TypeDef
Definition: bsp.h:56
#define BC_PERCTRL_IRDA_SHUTDOWN
#define BC_PERCTRL_POTMETER
#define BC_PERCTRL_IRDA
#define BC_PERCTRL_RS232B
int BSP_EbiInit(void)
Initialize the EBI interface for accessing the onboard nandflash.
Definition: bsp_stk.c:64
#define BC_PERCTRL_RS232_SHUTDOWN
#define BC_PERCTRL_RS232A
#define BC_PERCTRL_I2C
#define BC_PERCTRL_ANALOG_SE
bool BSP_BccPacketReceive(BCP_Packet *pkt)
Get a packet from the board controller.
Definition: bsp_bcc.c:137
int BSP_McuBoard_UsbStatusLedEnable(bool enable)
Set state of MCU plugin board USB status LED.
int BSP_BccDeInit(void)
Deinitialize board controller communication support (BCC) functionality. Reverse actions performed by...
Definition: bsp_bcc.c:61
#define BC_PERCTRL_ANALOG_DIFF