EFM32 Leopard Gecko Software Documentation  efm32lg-doc-4.2.1
API for STKs and WSTKs

Data Structures

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

Macros

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

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...
 
float BSP_VoltageGet (void)
 Request AEM (Advanced Energy Monitoring) voltage from board controller. More...
 

Detailed Description

Macro Definition Documentation

#define BSP_BCP_INVALID   0

Invalid packet received

Definition at line 38 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_ACK   5

Generic ACK for one way packages

Definition at line 42 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_ECHO_REPLY   11

BC alive response

Definition at line 44 of file bsp_bcp.h.

#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_CURRENT_REPLY   16

BC Response AEM current

Definition at line 46 of file bsp_bcp.h.

Referenced by BSP_CurrentGet().

#define BSP_BCP_VOLTAGE_REQ   18

EFM32 Request AEM voltage

Definition at line 47 of file bsp_bcp.h.

Referenced by BSP_VoltageGet().

#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_ENERGYMODE   22

EFM32 Report Energy Mode (for AEM)

Definition at line 49 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_STDERR   26

Debug packet (not used)

Definition at line 51 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_NET_REQUEST   64

Net gateway request packet

Definition at line 54 of file bsp_bcp.h.

#define BSP_BCP_NET_REPLY   65

Net gateway reply packet

Definition at line 55 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_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().

Function Documentation

int BSP_BccDeInit ( void  )
bool BSP_BccPacketReceive ( BCP_Packet pkt)
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)
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)
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  )
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 196 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  )
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 157 of file bsp_stk.c.

References BSP_STATUS_NOT_IMPLEMENTED, and BSP_STATUS_OK.

float BSP_VoltageGet ( void  )
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 228 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.