HT32SX Monarch Scan
Monarch Scan application for HT32SX
gpio.c File Reference

: This file provides code for the configuration of all used GPIO pins. More...

#include "gpio.h"

Functions

void MX_GPIO_Init (void)
 
void S2LPShutdownEnter (void)
 Puts at logic 1 the SDN pin. More...
 
void S2LPShutdownInit (void)
 Init shutdown pin on the uC and set it to 1 (Shutdown active). More...
 
void S2LPShutdownExit (void)
 Put at logic 0 the SDN pin. More...
 
uint8_t S2LPShutdownCheck (void)
 check the logic (0 or 1) at the SDN pin. More...
 
void ST_MCU_API_Shutdown (sfx_u8 value)
 Set on or off the S2-LP by GPIO. More...
 
void S2LPIRQInit (void)
 Configures MCU GPIO and EXTI Line for GPIOs. More...
 
void S2LPIRQEnable (uint8_t state, uint8_t edge_direction)
 Enables or disables the interrupt on GPIO . More...
 
void ST_MCU_API_GpioIRQ (sfx_u8 pin, sfx_u8 new_state, sfx_u8 trigger)
 Enables or Disables the external interrupt on the microcontroller side. The interrupt must be set on the rising or falling edge of the input signal according to the trigger_flag. The pin number passed represents the GPIO number of the S2-LP. More...
 
void ST_MCU_API_LowPower (sfx_u8 low_power_flag)
 This function instructs the mcu_api to send the microcontroller in sleep or not during the protocol operations. It is mainly used for debugging purposes. More...
 
uint8_t getLowPowerFlag (void)
 Get low power flag to check the S2LP state. More...
 
void HAL_GPIO_EXTI_Callback (uint16_t GPIO_Pin)
 
void setS2lpIrqRaisedFlag (uint8_t s2lpIrqRaised)
 Get low power flag to check the S2LP state. More...
 
uint8_t getS2lpIrqRaisedFlag (void)
 Get S2LP IRQ raised flag. More...
 

Variables

GPIO_PinState csd_pin_inst
 
GPIO_PinState cps_pin_inst
 
GPIO_PinState ctx_pin_inst
 

Detailed Description

: This file provides code for the configuration of all used GPIO pins.

Attention

© Copyright (c) 2019 STMicroelectronics. All rights reserved.

This software component is licensed by ST under BSD 3-Clause license, the "License"; You may not use this file except in compliance with the License. You may obtain a copy of the License at: opensource.org/licenses/BSD-3-Clause

Function Documentation

◆ getLowPowerFlag()

uint8_t getLowPowerFlag ( void  )

Get low power flag to check the S2LP state.


Parameters
[in]none
[out]none
Return values
low_power1 if it's low power, else 0

◆ getS2lpIrqRaisedFlag()

uint8_t getS2lpIrqRaisedFlag ( void  )

Get S2LP IRQ raised flag.


Parameters
[in]none
[out]none
Return values
s2lp_irq_raised1 if it's raised, else 0

◆ MX_GPIO_Init()

void MX_GPIO_Init ( void  )

Configure pins as Analog Input Output EVENT_OUT EXTI

◆ S2LPIRQEnable()

void S2LPIRQEnable ( uint8_t  state,
uint8_t  edge_direction 
)

Enables or disables the interrupt on GPIO .

Parameters
stateSpecifies the State. This parameter can be one of following parameters:
  • 0: disable
  • >0: enable
edge_directionSpecifies the sensitive edge. This parameter can be one of following parameters:
  • 0: falling edge
  • 1: rising edge
Return values
None.

◆ S2LPIRQInit()

void S2LPIRQInit ( void  )

Configures MCU GPIO and EXTI Line for GPIOs.

Parameters
None.
Return values
None.

◆ S2LPShutdownCheck()

uint8_t S2LPShutdownCheck ( void  )

check the logic (0 or 1) at the SDN pin.

Parameters
None.
Return values
FlagStatus.

◆ S2LPShutdownEnter()

void S2LPShutdownEnter ( void  )

Puts at logic 1 the SDN pin.

Parameters
None.
Return values
None.

◆ S2LPShutdownExit()

void S2LPShutdownExit ( void  )

Put at logic 0 the SDN pin.

Parameters
None.
Return values
None.

◆ S2LPShutdownInit()

void S2LPShutdownInit ( void  )

Init shutdown pin on the uC and set it to 1 (Shutdown active).

Parameters
None.
Return values
None.

◆ setS2lpIrqRaisedFlag()

void setS2lpIrqRaisedFlag ( uint8_t  s2lpIrqRaised)

Get low power flag to check the S2LP state.


Parameters
[in]s2lpIrqRaised1 if it's raised, else 0
[out]none
Return values
none

◆ ST_MCU_API_GpioIRQ()

void ST_MCU_API_GpioIRQ ( sfx_u8  pin,
sfx_u8  new_state,
sfx_u8  trigger 
)

Enables or Disables the external interrupt on the microcontroller side. The interrupt must be set on the rising or falling edge of the input signal according to the trigger_flag. The pin number passed represents the GPIO number of the S2-LP.


Parameters
[in]uint8_tpin: the GPIO pin of the S2-LP (integer from 0 to 3).
[in]uint8_tnew_state: enable or disable the EXTI (can be 0 or 1).
[in]uint8_ttrigger: trigger_flag: 1: rising edge 0: falling edge
Note
This is a function that is not required by the SIGFOX_API nor by the RF_API library.
Return values
None

◆ ST_MCU_API_LowPower()

void ST_MCU_API_LowPower ( sfx_u8  low_power_flag)

This function instructs the mcu_api to send the microcontroller in sleep or not during the protocol operations. It is mainly used for debugging purposes.


Parameters
[in]uint8_tlow_power_flag : enable the low power (1, default setting) or not (0).
Note
This is a function that is not required by the SIGFOX_API nor by the RF_API library.
Return values
None.

◆ ST_MCU_API_Shutdown()

void ST_MCU_API_Shutdown ( sfx_u8  value)

Set on or off the S2-LP by GPIO.


Parameters
[in]sfx_u8value: if 1, the device should enter shutdown (OFF). if 0, the device should exit from shutdown (ON).
Return values
None