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

: This file provides code for the configuration of the TIM instances. More...

#include "tim.h"

Macros

#define ABS(x)   (x>0?x:-x)
 Absolute value macro. More...
 
#define DECAY_LEVEL   34
 

Functions

void MX_TIM6_Init (void)
 
void HAL_TIM_Base_MspInit (TIM_HandleTypeDef *tim_baseHandle)
 
void HAL_TIM_Base_MspDeInit (TIM_HandleTypeDef *tim_baseHandle)
 
void SdkEvalTimersFindFactors (uint32_t lCycles, uint16_t *pnPrescaler, uint16_t *pnCounter)
 Computes two integer value prescaler and period such that Cycles = prescaler * period. More...
 
void SdkEvalTimersTimConfig (TIM_HandleTypeDef *TIM_TimeBaseStructure, uint16_t nPrescaler, uint16_t nPeriod)
 Configures the specified timer to raise an interrupt every time the counter reaches the nPeriod value counting with a prescaler of nPrescaler. More...
 
void ST_MCU_API_TimerCalibration (uint16_t duration_ms)
 
sfx_u8 MCU_API_timer_start_carrier_sense (sfx_u16 time_duration_in_ms)
 Start timer for : More...
 
sfx_u8 MCU_API_timer_start (sfx_u32 time_duration_in_s)
 Start timer for in second duration. More...
 
sfx_u8 MCU_API_timer_stop (void)
 Stop the timer (started with MCU_API_timer_start) More...
 
sfx_u8 MCU_API_timer_stop_carrier_sense (void)
 Stop the timer (started with MCU_API_timer_start_carrier_sense) More...
 
sfx_u8 MCU_API_timer_wait_for_end (void)
 Blocking function to wait for interrupt indicating timer elapsed.
This function is only used for the 20 seconds wait in downlink. More...
 
void ST_MCU_API_WaitForInterrupt (void)
 Microcontroller waits for interrupt. This function is continously called by the library each time it waits for an event. This is useful if the application must trigger a state machine and not block the CPU waiting for an event from the library. For example, this can be a null implementation or can activate a low power mode of the microcontroller, tick a stack for dual radio applications or other type of state machines. More...
 
void setNotifyEndFlag (uint8_t notifyEnd)
 Set notify end flag. More...
 
void setNIntermediateTimIrqFlag (uint8_t nIntermediateTimeIrq)
 Set N intermediate TIM IRQ flag. More...
 
uint8_t getNotifyEndFlag (void)
 Get notify end flag. More...
 
uint32_t getNIntermediateTimIrqFlag (void)
 Get N intermediate TIM IRQ flag. More...
 

Variables

volatile uint32_t lSystickCounter = 0
 
RTC_HandleTypeDef * rtcHandler
 
TIM_HandleTypeDef htim6
 

Detailed Description

: This file provides code for the configuration of the TIM instances.

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

Macro Definition Documentation

◆ ABS

#define ABS (   x)    (x>0?x:-x)

Absolute value macro.

Parameters
xValue on which apply the abs function.
Return values
None

Function Documentation

◆ getNIntermediateTimIrqFlag()

uint32_t getNIntermediateTimIrqFlag ( void  )

Get N intermediate TIM IRQ flag.


Parameters
[in]none
[out]none
Return values
n_intermediate_tim_irq1 or 0

◆ getNotifyEndFlag()

uint8_t getNotifyEndFlag ( void  )

Get notify end flag.


Parameters
[in]none
[out]none
Return values
notify_end1 or 0

◆ MCU_API_timer_start()

sfx_u8 MCU_API_timer_start ( sfx_u32  time_duration_in_s)

Start timer for in second duration.


Parameters
[in]sfx_u32time_duration_in_s Timer value in seconds
[out]none
Return values
SFX_ERR_NONENo error
MCU_ERR_API_TIMER_STARTStart timer error

◆ MCU_API_timer_start_carrier_sense()

sfx_u8 MCU_API_timer_start_carrier_sense ( sfx_u16  time_duration_in_ms)

Start timer for :


  • carrier sense maximum window (used in ARIB standard)
Parameters
[in]sfx_u16time_duration_in_ms Timer value in milliseconds
[out]none
Return values
SFX_ERR_NONENo error
MCU_ERR_API_TIMER_START_CSStart CS timer error

◆ MCU_API_timer_stop()

sfx_u8 MCU_API_timer_stop ( void  )

Stop the timer (started with MCU_API_timer_start)


Parameters
[in]none
[out]none
Return values
SFX_ERR_NONENo error
MCU_ERR_API_TIMER_STOPStop timer error

◆ MCU_API_timer_stop_carrier_sense()

sfx_u8 MCU_API_timer_stop_carrier_sense ( void  )

Stop the timer (started with MCU_API_timer_start_carrier_sense)


Parameters
[in]none
[out]none
Return values
SFX_ERR_NONENo error
MCU_ERR_API_TIMER_STOP_CSStop timer error

◆ MCU_API_timer_wait_for_end()

sfx_u8 MCU_API_timer_wait_for_end ( void  )

Blocking function to wait for interrupt indicating timer elapsed.
This function is only used for the 20 seconds wait in downlink.


Parameters
[in]none
[out]none
Return values
SFX_ERR_NONENo error
MCU_ERR_API_TIMER_ENDWait end of timer error

◆ setNIntermediateTimIrqFlag()

void setNIntermediateTimIrqFlag ( uint8_t  nIntermediateTimeIrq)

Set N intermediate TIM IRQ flag.


Parameters
[in]nIntermediateTimeIrq1 or 0
[out]none
Return values
none

◆ setNotifyEndFlag()

void setNotifyEndFlag ( uint8_t  notifyEnd)

Set notify end flag.


Parameters
[in]notifyEnd1 or 0
[out]none
Return values
none

◆ ST_MCU_API_WaitForInterrupt()

void ST_MCU_API_WaitForInterrupt ( void  )

Microcontroller waits for interrupt. This function is continously called by the library each time it waits for an event. This is useful if the application must trigger a state machine and not block the CPU waiting for an event from the library. For example, this can be a null implementation or can activate a low power mode of the microcontroller, tick a stack for dual radio applications or other type of state machines.


Parameters
[in]None.
Note
This is a function that is not required by the SIGFOX_API nor by the RF_API library.
Return values
None.