EFM32 Gecko Software Documentation  efm32g-doc-5.1.2
API for STKs and WSTKs

Detailed Description

Data Structures

struct  BCP_Packet
 BCP Packet Structure - Board controller communication protocol version 2. More...
 
struct  BCP_Packet_
 BCP Packet Structure - Board controller communication protocol version 1. More...
 
struct  BCP_PacketHeader
 BCP Packet Header definition. More...
 

Macros

#define BSP_BCP_ACK   5
 
#define BSP_BCP_CURRENT_REPLY   16
 
#define BSP_BCP_CURRENT_REQ   14
 
#define BSP_BCP_ECHO_REPLY   11
 
#define BSP_BCP_ECHO_REQ   10
 
#define BSP_BCP_ENERGYMODE   22
 
#define BSP_BCP_FIRST   1
 
#define BSP_BCP_INVALID   0
 
#define BSP_BCP_LAST   100
 
#define BSP_BCP_MAGIC   0xF1
 
#define BSP_BCP_NET_REPLY   65
 
#define BSP_BCP_NET_REQUEST   64
 
#define BSP_BCP_PACKET_SIZe   30
 
#define BSP_BCP_PACKET_SIZE   132
 
#define BSP_BCP_STDERR   26
 
#define BSP_BCP_STDOUT   24
 
#define BSP_BCP_TEST   32
 
#define BSP_BCP_TEST_REPLY   33
 
#define BSP_BCP_VOLTAGE_REPLY   20
 
#define BSP_BCP_VOLTAGE_REQ   18
 

Enumerations

enum  BSP_Peripheral_TypeDef {
  BSP_RS232_SHUTDOWN,
  BSP_RS232_UART,
  BSP_RS232_LEUART,
  BSP_I2C,
  BSP_ETH,
  BSP_I2S,
  BSP_TRACE,
  BSP_TOUCH,
  BSP_AUDIO_IN,
  BSP_AUDIO_OUT,
  BSP_ANALOG_DIFF,
  BSP_ANALOG_SE,
  BSP_MICROSD,
  BSP_TFT,
  BSP_IOEXP_LEDS,
  BSP_IOEXP_SENSORS,
  BSP_IOEXP_DISPLAY,
  BSP_IOEXP_VCOM
}
 

Functions

int BSP_BccDeInit (void)
 Deinitialize board controller communication support (BCC) functionality. Reverse actions performed by BSP_BccInit(). More...
 
int BSP_BccInit (void)
 Initialize board controller communication support (BCC) functionality. More...
 
bool BSP_BccPacketReceive (BCP_Packet *pkt)
 Get a packet from the board controller. More...
 
int BSP_BccPacketSend (BCP_Packet *pkt)
 Send a packet to the board controller. More...
 
void BSP_BccPinsEnable (bool enable)
 Enable GPIO pins for the USART/LEUART used for board communication. More...
 
float BSP_CurrentGet (void)
 Request AEM (Advanced Energy Monitoring) current from board controller. More...
 
int BSP_EbiDeInit (void)
 Deinitialize the EBI interface for accessing the onboard nandflash. More...
 
int BSP_EbiInit (void)
 Initialize the EBI interface for accessing the onboard nandflash. More...
 
uint32_t BSP_IOExpGetDeviceId (void)
 Get IO Expander Device id. More...
 
float BSP_VoltageGet (void)
 Request AEM (Advanced Energy Monitoring) voltage from board controller. More...
 

Macro Definition Documentation

#define BSP_BCP_ACK   5

Generic ACK for one way packages

Definition at line 42 of file bsp_bcp.h.

#define BSP_BCP_CURRENT_REPLY   16

BC Response AEM current

Definition at line 46 of file bsp_bcp.h.

Referenced by BSP_CurrentGet().

#define BSP_BCP_CURRENT_REQ   14

EFM32 Request AEM current

Definition at line 45 of file bsp_bcp.h.

Referenced by BSP_CurrentGet().

#define BSP_BCP_ECHO_REPLY   11

BC alive response

Definition at line 44 of file bsp_bcp.h.

#define BSP_BCP_ECHO_REQ   10

EFM32 BC alive request

Definition at line 43 of file bsp_bcp.h.

#define BSP_BCP_ENERGYMODE   22

EFM32 Report Energy Mode (for AEM)

Definition at line 49 of file bsp_bcp.h.

#define BSP_BCP_FIRST   1

Smallest numerical value of message type

Definition at line 40 of file bsp_bcp.h.

Referenced by BSP_BccPacketReceive().

#define BSP_BCP_INVALID   0

Invalid packet received

Definition at line 38 of file bsp_bcp.h.

#define BSP_BCP_LAST   100

Last defined message type

Definition at line 57 of file bsp_bcp.h.

Referenced by BSP_BccPacketReceive().

#define BSP_BCP_MAGIC   0xF1

Magic byte to indicate start of packet

Definition at line 59 of file bsp_bcp.h.

Referenced by BSP_BccPacketReceive(), and BSP_BccPacketSend().

#define BSP_BCP_NET_REPLY   65

Net gateway reply packet

Definition at line 55 of file bsp_bcp.h.

#define BSP_BCP_NET_REQUEST   64

Net gateway request packet

Definition at line 54 of file bsp_bcp.h.

#define BSP_BCP_PACKET_SIZe   30

Max packet size for version 1 of the protocol.

Definition at line 68 of file bsp_bcp.h.

#define BSP_BCP_PACKET_SIZE   132

Max packet size for version 2 of the protocol.

Definition at line 92 of file bsp_bcp.h.

Referenced by BSP_BccPacketReceive().

#define BSP_BCP_STDERR   26

Debug packet (not used)

Definition at line 51 of file bsp_bcp.h.

#define BSP_BCP_STDOUT   24

Debug packet (not used)

Definition at line 50 of file bsp_bcp.h.

#define BSP_BCP_TEST   32

Reserved type for test

Definition at line 52 of file bsp_bcp.h.

#define BSP_BCP_TEST_REPLY   33

Reserved type for test (reply)

Definition at line 53 of file bsp_bcp.h.

#define BSP_BCP_VOLTAGE_REPLY   20

BC Response AEM voltage

Definition at line 48 of file bsp_bcp.h.

Referenced by BSP_VoltageGet().

#define BSP_BCP_VOLTAGE_REQ   18

EFM32 Request AEM voltage

Definition at line 47 of file bsp_bcp.h.

Referenced by BSP_VoltageGet().

Enumeration Type Documentation

Peripherals control structure for WSTK's with onboard I/O expander.

Enumerator
BSP_RS232_SHUTDOWN 

Disable RS232

BSP_RS232_UART 

UART control of RS232

BSP_RS232_LEUART 

LEUART control of RS232

BSP_I2C 

I2C interface

BSP_ETH 

Ethernet

BSP_I2S 

Audio I2S

BSP_TRACE 

ETM Trace

BSP_TOUCH 

Display touch interface

BSP_AUDIO_IN 

Audio In

BSP_AUDIO_OUT 

Audio Out

BSP_ANALOG_DIFF 

Differential analog input

BSP_ANALOG_SE 

Single ended analog input

BSP_MICROSD 

MicroSD SPI interace

BSP_TFT 

SSD2119 TFT controller

BSP_IOEXP_LEDS 

LED control

BSP_IOEXP_SENSORS 

Humidity & temperature sensor control

BSP_IOEXP_DISPLAY 

Memory LCD control

BSP_IOEXP_VCOM 

VCOM (virtual com port) control

Definition at line 143 of file bsp.h.

Function Documentation

int BSP_BccDeInit ( void  )

Deinitialize board controller communication support (BCC) functionality. Reverse actions performed by BSP_BccInit().

Returns
BSP_STATUS_OK.

Definition at line 61 of file bsp_bcc.c.

References BSP_BccPinsEnable(), BSP_STATUS_OK, CMU_ClockEnable(), LEUART_Reset(), and USART_Reset().

int BSP_BccInit ( void  )
bool BSP_BccPacketReceive ( BCP_Packet pkt)

Get a packet from the board controller.

Parameters
[in]pktPointer to a BCP_Packet instance.
Returns
True if packet received without errors, false otherwise.

Definition at line 137 of file bsp_bcc.c.

References BSP_BCP_FIRST, BSP_BCP_LAST, BSP_BCP_MAGIC, BSP_BCP_PACKET_SIZE, BCP_Packet::magic, BCP_Packet::payloadLength, and BCP_Packet::type.

Referenced by BSP_CurrentGet(), and BSP_VoltageGet().

int BSP_BccPacketSend ( BCP_Packet pkt)

Send a packet to the board controller.

Parameters
[in]pktPointer to a BCP_Packet instance.
Returns
BSP_STATUS_OK.

Definition at line 195 of file bsp_bcc.c.

References BSP_BCP_MAGIC, BSP_STATUS_OK, BCP_Packet::data, BCP_Packet::magic, BCP_Packet::payloadLength, BCP_Packet::reserved, and BCP_Packet::type.

Referenced by BSP_CurrentGet(), and BSP_VoltageGet().

void BSP_BccPinsEnable ( bool  enable)

Enable GPIO pins for the USART/LEUART used for board communication.

Parameters
[in]enableSet to true to enable pins, set to false to disable.

Definition at line 230 of file bsp_bcc.c.

References GPIO_PinModeSet(), gpioModeDisabled, gpioModeInput, gpioModePushPull, LEUART_ROUTE_RXPEN, LEUART_ROUTE_TXPEN, USART_ROUTE_RXPEN, and USART_ROUTE_TXPEN.

Referenced by BSP_BccDeInit(), and BSP_BccInit().

float BSP_CurrentGet ( void  )

Request AEM (Advanced Energy Monitoring) current from board controller.

Note
Assumes that BSP_Init() has been called with BSP_INIT_BCC bitmask.
Returns
The current expressed in milliamperes. Returns 0.0 on board controller communication error.

Definition at line 317 of file bsp_stk.c.

References BSP_BccPacketReceive(), BSP_BccPacketSend(), BSP_BCP_CURRENT_REPLY, BSP_BCP_CURRENT_REQ, BCP_Packet::data, BCP_Packet::payloadLength, and BCP_Packet::type.

int BSP_EbiDeInit ( void  )

Deinitialize the EBI interface for accessing the onboard nandflash.

Note
This function is not relevant for Gxxx_STK's. This function is provided for API completeness, it does not perform an actual EBI deinitialization.
Returns
BSP_STATUS_OK or BSP_STATUS_NOT_IMPLEMENTED

Definition at line 161 of file bsp_stk.c.

References BSP_STATUS_NOT_IMPLEMENTED, and BSP_STATUS_OK.

int BSP_EbiInit ( void  )

Initialize the EBI interface for accessing the onboard nandflash.

Note
This function is not relevant for Gxxx_STK's.
Returns
BSP_STATUS_OK or BSP_STATUS_NOT_IMPLEMENTED

Definition at line 68 of file bsp_stk.c.

References BSP_STATUS_NOT_IMPLEMENTED, BSP_STATUS_OK, CMU_ClockEnable(), cmuClock_EBI, cmuClock_GPIO, cmuClock_HFPER, EBI, EBI_BANK0, EBI_Init(), ebiActiveLow, ebiModeD8A8, GPIO_PinModeSet(), gpioModeInput, and gpioModePushPull.

uint32_t BSP_IOExpGetDeviceId ( void  )

Get IO Expander Device id.

Returns
The device id of a connected IO Expander Device id or 0 if no IO expander is connected.

Definition at line 177 of file bsp_stk.c.

float BSP_VoltageGet ( void  )

Request AEM (Advanced Energy Monitoring) voltage from board controller.

Note
Assumes that BSP_Init() has been called with BSP_INIT_BCC bitmask.
Returns
The voltage. Returns 0.0 on board controller communication error.

Definition at line 349 of file bsp_stk.c.

References BSP_BccPacketReceive(), BSP_BccPacketSend(), BSP_BCP_VOLTAGE_REPLY, BSP_BCP_VOLTAGE_REQ, BCP_Packet::data, BCP_Packet::payloadLength, and BCP_Packet::type.