Appiko
Data Structures | Enumerations | Functions
S2LP_Gpio.h File Reference

Configuration and management of S2-LP GPIO. More...

#include "S2LP_Regs.h"
#include "S2LP_Types.h"

Go to the source code of this file.

Data Structures

struct  SGpioInit
 S2LP GPIO Init structure definition. More...
 
struct  ClockOutputInit
 S2LP Clock Output initialization structure definition. More...
 
struct  S2LPIrqs
 IRQ bitfield structure for S2LP. This structure is used to read or write the single IRQ bit. During the initialization the user has to fill this structure setting to one the single field related to the IRQ he wants to enable, and to zero the single field related to all the IRQs he wants to disable. The same structure can be used to retrieve all the IRQ events from the IRQ registers IRQ_STATUS[3:0], and read if one or more specific IRQ raised. More...
 

Enumerations

enum  S2LPGpioPin { S2LP_GPIO_0 = GPIO0_CONF_ADDR, S2LP_GPIO_1 = GPIO1_CONF_ADDR, S2LP_GPIO_2 = GPIO2_CONF_ADDR, S2LP_GPIO_3 = GPIO3_CONF_ADDR }
 S2LP GPIO pin enumeration. More...
 
enum  S2LPGpioMode { S2LP_GPIO_MODE_DIGITAL_INPUT = 0x01, S2LP_GPIO_MODE_DIGITAL_OUTPUT_LP, S2LP_GPIO_MODE_DIGITAL_OUTPUT_HP }
 S2LP GPIO mode enumeration. More...
 
enum  S2LPGpioIO {
  S2LP_GPIO_DIG_OUT_IRQ = 0x00, S2LP_GPIO_DIG_OUT_POR_INV = 0x08, S2LP_GPIO_DIG_OUT_WUT_EXP = 0x10, S2LP_GPIO_DIG_OUT_LBD = 0x18,
  S2LP_GPIO_DIG_OUT_TX_DATA = 0x20, S2LP_GPIO_DIG_OUT_TX_STATE = 0x28, S2LP_GPIO_DIG_OUT_TXRX_FIFO_ALMOST_EMPTY = 0x30, S2LP_GPIO_DIG_OUT_TXRX_FIFO_ALMOST_FULL = 0x38,
  S2LP_GPIO_DIG_OUT_RX_DATA = 0x40, S2LP_GPIO_DIG_OUT_RX_CLOCK = 0x48, S2LP_GPIO_DIG_OUT_RX_STATE = 0x50, S2LP_GPIO_DIG_OUT_NOT_STANDBY_SLEEP = 0x58,
  S2LP_GPIO_DIG_OUT_STANDBY = 0x60, S2LP_GPIO_DIG_OUT_ANTENNA_SWITCH = 0x68, S2LP_GPIO_DIG_OUT_VALID_PREAMBLE = 0x70, S2LP_GPIO_DIG_OUT_SYNC_DETECTED = 0x78,
  S2LP_GPIO_DIG_OUT_RSSI_THRESHOLD = 0x80, S2LP_GPIO_DIG_OUT_MCU_CLOCK = 0x88, S2LP_GPIO_DIG_OUT_TX_RX_MODE = 0x90, S2LP_GPIO_DIG_OUT_VDD = 0x98,
  S2LP_GPIO_DIG_OUT_GND = 0xA0, S2LP_GPIO_DIG_OUT_SMPS_EXT = 0xA8, S2LP_GPIO_DIG_OUT_SLEEP = 0xB0, S2LP_GPIO_DIG_OUT_READY = 0xB8,
  S2LP_GPIO_DIG_OUT_LOCK = 0xC0, S2LP_GPIO_DIG_OUT_WAIT_FOR_LOCK_SIG = 0xC8
}
 S2LP I/O selection enumeration. More...
 
enum  OutputLevel
 S2LP OutputLevel enumeration.
 
enum  ClockOutputXOPrescaler {
  XO_RATIO_1 = 0x00, XO_RATIO_1_2 = 0x02, XO_RATIO_1_4 = 0x04, XO_RATIO_1_8 = 0x06,
  XO_RATIO_1_16 = 0x08, XO_RATIO_1_32 = 0x0A, XO_RATIO_1_64 = 0x0C, XO_RATIO_1_128 = 0x0E,
  XO_RATIO_1_256 = 0x10
}
 S2LP clock output XO prescaler enumeration. More...
 
enum  ClockOutputRCOPrescaler { RCO_RATIO_1 = 0x00, RCO_RATIO_1_128 }
 S2LP Clock Output RCO prescaler enumeration. More...
 
enum  ExtraClockCycles { EXTRA_CLOCK_CYCLES_0 = 0x00, EXTRA_CLOCK_CYCLES_128 = 0x20, EXTRA_CLOCK_CYCLES_256 = 0x40, EXTRA_CLOCK_CYCLES_512 = 0x60 }
 S2LP ExtraClockCycles enumeration. More...
 
enum  IrqList {
  RX_DATA_READY = 0x00000001, RX_DATA_DISC = 0x00000002, TX_DATA_SENT = 0x00000004, MAX_RE_TX_REACH = 0x00000008,
  CRC_ERROR = 0x00000010, TX_FIFO_ERROR = 0x00000020, RX_FIFO_ERROR = 0x00000040, TX_FIFO_ALMOST_FULL = 0x00000080,
  TX_FIFO_ALMOST_EMPTY = 0x00000100, RX_FIFO_ALMOST_FULL = 0x00000200, RX_FIFO_ALMOST_EMPTY = 0x00000400, MAX_BO_CCA_REACH = 0x00000800,
  VALID_PREAMBLE = 0x00001000, VALID_SYNC = 0x00002000, RSSI_ABOVE_TH = 0x00004000, WKUP_TOUT_LDC = 0x00008000,
  READY = 0x00010000, STANDBY_DELAYED = 0x00020000, LOW_BATT_LVL = 0x00040000, POR = 0x00080000,
  BOR = 0x00100000, LOCK = 0x00200000, VCO_CALIBRATION_END = 0x00400000, PA_CALIBRATION_END = 0x00800000,
  PM_COUNT_EXPIRED = 0x01000000, XO_COUNT_EXPIRED = 0x02000000, TX_START_TIME = 0x04000000, RX_START_TIME = 0x08000000,
  RX_TIMEOUT = 0x10000000, RX_SNIFF_TIMEOUT = 0x20000000, ALL_IRQ = 0x7FFFFFFF
}
 IRQ list enumeration for S2LP. This enumeration type can be used to address a specific IRQ. More...
 

Functions

void S2LPGpioInit (SGpioInit *pxGpioInitStruct)
 Initialize the S2LP GPIOx according to the specified parameters in the pxGpioInitStruct. More...
 
void S2LPGpioSetLevel (S2LPGpioPin xGpioX, OutputLevel xLevel)
 Force S2LP GPIO_x configured as digital output, to VDD or GND. More...
 
OutputLevel S2LPGpioGetLevel (S2LPGpioPin xGpioX)
 Return output value (VDD or GND) of S2LP GPIO_x, when it is configured as digital output. More...
 
void S2LPGpioIrqDeInit (S2LPIrqs *pxIrqInit)
 Deinit the S2LPIrqs structure setting all the bitfield to 0. Moreover, it sets the IRQ mask registers to 0x00000000, disabling all IRQs. More...
 
void S2LPGpioIrqInit (S2LPIrqs *pxIrqInit)
 Enable the IRQs according to the user defined pxIrqInit structure. More...
 
void S2LPGpioIrqConfig (IrqList xIrq, SFunctionalState xNewState)
 Enable or disables a specific IRQ. More...
 
void S2LPGpioIrqGetMask (S2LPIrqs *pxIrqMask)
 Fill a pointer to a structure of S2LPIrqs type reading the IRQ_MASK registers. More...
 
void S2LPGpioIrqGetStatus (S2LPIrqs *pxIrqStatus)
 Fill a pointer to a structure of S2LPIrqs type reading the IRQ_STATUS registers. More...
 
void S2LPGpioIrqClearStatus (void)
 Clear the IRQ status registers. More...
 
SBool S2LPGpioIrqCheckFlag (IrqList xFlag)
 Verifie if a specific IRQ has been generated. The call resets all the IRQ status, so it can't be used in case of multiple raising interrupts. More...
 

Detailed Description

Author
LowPower RF BU - AMG
Version
1.2.1
Date
16-April-2018

This module can be used to configure the S2-LP GPIO pins to perform specific functions. The structure gpioIRQ can be used to specify these features for one of the four S2-LP Gpio pin. The following example shows how to configure a pin (GPIO 3) to be used as an IRQ source for a microcontroller using the S2LPGpioInit() function.

Example:

Note
Please read the functions documentation for the other GPIO features.

THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.

THIS SOURCE CODE IS PROTECTED BY A LICENSE. FOR MORE INFORMATION PLEASE CAREFULLY READ THE LICENSE AGREEMENT FILE LOCATED IN THE ROOT DIRECTORY OF THIS FIRMWARE PACKAGE.

© COPYRIGHT 2016 STMicroelectronics

Definition in file S2LP_Gpio.h.