PDL for FM0+  Version1.0
Peripheral Driverl Library for FM0+
Base Timer (BT)

Data Structures

struct  stc_bt_pwm_config
 Structure of PWM configuration. More...
struct  stc_pwm_int_sel
 structure to select the PWM interrupt More...
struct  stc_pwm_int_cb
 structure to set the PWM interrupt callback function More...
struct  stc_bt_ppg_config
 Structure of PPG configuration. More...
struct  stc_ppg_int_sel
 structure to select the PPG interrupt More...
struct  stc_ppg_int_cb
 structure to set the PPG interrupt callback function More...
struct  stc_bt_rt_config
 Structure of Reload timer configuration. More...
struct  stc_rt_int_sel
 structure to select the Reload timer interrupt More...
struct  stc_rt_int_cb
 structure to set the Reload timer interrupt callback function More...
struct  stc_bt_pwc_config
 Structure of PWC timer configuration. More...
struct  stc_pwc_int_sel
 structure to select the PWC timer interrupt More...
struct  stc_pwc_int_cb
 structure to set the PWC timer interrupt callback function More...
struct  stc_bt_intern_data
 BT internal data. More...
struct  stc_bt_instance_data
 BT instance data. More...

Defines

#define stc_btn_t   FM0P_BT_PWM_TypeDef
#define BT0   (*((volatile stc_btn_t *) FM0P_BT0_PWM_BASE))
#define BT1   (*((volatile stc_btn_t *) FM0P_BT1_PWM_BASE))
#define BT2   (*((volatile stc_btn_t *) FM0P_BT2_PWM_BASE))
#define BT3   (*((volatile stc_btn_t *) FM0P_BT3_PWM_BASE))
#define BT4   (*((volatile stc_btn_t *) FM0P_BT4_PWM_BASE))
#define BT5   (*((volatile stc_btn_t *) FM0P_BT5_PWM_BASE))
#define BT6   (*((volatile stc_btn_t *) FM0P_BT6_PWM_BASE))
#define BT7   (*((volatile stc_btn_t *) FM0P_BT7_PWM_BASE))
#define BT_INSTANCE_COUNT

Typedefs

typedef enum en_bt_instance_index en_bt_instance_index_t
 Enumeration to define an index for each BT instance.
typedef enum en_bt_io_mode en_bt_io_mode_t
 Enumeration to define BT IO mode.
typedef enum en_bt_timer_mode en_bt_timer_mode_t
 Enumeration to define timer mode of BT.
typedef enum en_pwm_clock_pres en_pwm_clock_pres_t
 Enumeration to define clock prescaler of PWM timer.
typedef enum en_pwm_restart_enable en_pwm_restart_enable_t
 Enumeration to define the configuration of PWM restart option.
typedef enum en_pwm_output_mask en_pwm_output_mask_t
 Enumeration to define the configuration of PWM output mask.
typedef enum en_pwm_ext_trig en_pwm_ext_trig_t
 Enumeration to define external trigger of PWM.
typedef enum en_pwm_output_polarity en_pwm_output_polarity_t
 Enumeration to define PWM initial polarity.
typedef enum en_pwm_mode en_pwm_mode_t
 Enumeration to define PWM timer mode.
typedef struct stc_bt_pwm_config stc_bt_pwm_config_t
 Structure of PWM configuration.
typedef enum en_bt_pwm_int en_bt_pwm_int_t
 Enumeration to define PWM interrupt type.
typedef struct stc_pwm_int_sel stc_pwm_int_sel_t
 structure to select the PWM interrupt
typedef struct stc_pwm_int_cb stc_pwm_int_cb_t
 structure to set the PWM interrupt callback function
typedef enum en_ppg_clock_pres en_ppg_clock_pres_t
 Enumeration to define clock prescaler of PPG timer.
typedef enum en_ppg_restart_enable en_ppg_restart_enable_t
 Enumeration to define the configuration of PPG restart option.
typedef enum en_ppg_output_mask en_ppg_output_mask_t
 Enumeration to define the configuration of PPG output mask.
typedef enum en_ppg_ext_trig en_ppg_ext_trig_t
 Enumeration to define external trigger of PPG.
typedef enum en_ppg_output_polarity en_ppg_output_polarity_t
 Enumeration to define PWM initial polarity.
typedef enum en_ppg_mode en_ppg_mode_t
 Enumeration to define PWM timer mode.
typedef struct stc_bt_ppg_config stc_bt_ppg_config_t
 Structure of PPG configuration.
typedef enum en_bt_ppg_int en_bt_ppg_int_t
 Enumeration to define PPG interrupt type.
typedef struct stc_ppg_int_sel stc_ppg_int_sel_t
 structure to select the PPG interrupt
typedef struct stc_ppg_int_cb stc_ppg_int_cb_t
 structure to set the PPG interrupt callback function
typedef enum en_rt_clock_pres en_rt_clock_pres_t
 Enumeration to define clock prescaler of Reload timer.
typedef enum en_rt_ext_trigger en_rt_ext_trigger_t
 Enumeration to define external trigger of Reload timer.
typedef enum en_rt_output_polarity en_rt_output_polarity_t
 Enumeration to define Reload timer output initial polarity.
typedef enum en_rt_mode en_rt_mode_t
 Enumeration to define Reload timer mode.
typedef enum en_rt_timer_size en_rt_timer_size_t
 Enumeration to define Reload timer size.
typedef struct stc_bt_rt_config stc_bt_rt_config_t
 Structure of Reload timer configuration.
typedef enum en_bt_rt_int en_bt_rt_int_t
 Enumeration to define Reload timer interrupt type.
typedef struct stc_rt_int_sel stc_rt_int_sel_t
 structure to select the Reload timer interrupt
typedef struct stc_rt_int_cb stc_rt_int_cb_t
 structure to set the Reload timer interrupt callback function
typedef enum en_pwc_clock_pres en_pwc_clock_pres_t
 Enumeration to define clock prescaler of PWC timer.
typedef enum en_pwc_measure_edge en_pwc_measure_edge_t
 Enumeration to define measure mode of PWC timer.
typedef enum en_pwc_mode en_pwc_mode_t
 Enumeration to define PWC timer mode.
typedef enum en_pwc_timer_size en_pwc_timer_size_t
 Enumeration to define Reload timer size.
typedef struct stc_bt_pwc_config stc_bt_pwc_config_t
 Structure of PWC timer configuration.
typedef enum en_bt_pwc_int en_bt_pwc_int_t
 Enumeration to define PWC timer interrupt type.
typedef struct stc_pwc_int_sel stc_pwc_int_sel_t
 structure to select the PWC timer interrupt
typedef struct stc_pwc_int_cb stc_pwc_int_cb_t
 structure to set the PWC timer interrupt callback function
typedef struct stc_bt_intern_data stc_bt_intern_data_t
 BT internal data.
typedef struct stc_bt_instance_data stc_bt_instance_data_t
 BT instance data.

Enumerations

enum  en_bt_instance_index {
  BtInstanceIndexBt0, BtInstanceIndexBt1, BtInstanceIndexBt2, BtInstanceIndexBt3,
  BtInstanceIndexBt4, BtInstanceIndexBt5, BtInstanceIndexBt6, BtInstanceIndexBt7,
  BtInstanceIndexMax
}
 Enumeration to define an index for each BT instance. More...
enum  en_bt_io_mode {
  BtIoMode0 = 0u, BtIoMode1, BtIoMode2, BtIoMode3,
  BtIoMode4, BtIoMode5, BtIoMode6, BtIoMode7,
  BtIoMode8
}
 Enumeration to define BT IO mode. More...
enum  en_bt_timer_mode {
  BtResetMode = 0, BtPwmMode, BtPpgMode, BtRtMode,
  BtPwcMode
}
 Enumeration to define timer mode of BT. More...
enum  en_pwm_clock_pres {
  PwmPresNone = 0u, PwmPres1Div4, PwmPres1Div16, PwmPres1Div128,
  PwmPres1Div256, PwmPres1ExtClkRising, PwmPres1ExtClkFalling, PwmPres1ExtClkBoth,
  PwmPres1Div512, PwmPres1Div1024, PwmPres1Div2048
}
 Enumeration to define clock prescaler of PWM timer. More...
enum  en_pwm_restart_enable { PwmRestartDisable = 0, PwmRestartEnable }
 Enumeration to define the configuration of PWM restart option. More...
enum  en_pwm_output_mask { PwmOutputNormal = 0, PwmOutputMask }
 Enumeration to define the configuration of PWM output mask. More...
enum  en_pwm_ext_trig { PwmExtTrigDisable = 0, PwmExtTrigRising, PwmExtTrigFalling, PwmExtTrigBoth }
 Enumeration to define external trigger of PWM. More...
enum  en_pwm_output_polarity { PwmPolarityLow = 0, PwmPolarityHigh }
 Enumeration to define PWM initial polarity. More...
enum  en_pwm_mode { PwmContinuous = 0, PwmOneshot }
 Enumeration to define PWM timer mode. More...
enum  en_bt_pwm_int { PwmTrigInt = 0, PwmDutyMatchInt, PwmUnderflowInt }
 Enumeration to define PWM interrupt type. More...
enum  en_ppg_clock_pres {
  PpgPresNone = 0, PpgPres1Div4, PpgPres1Div16, PpgPres1Div128,
  PpgPres1Div256, PpgPres1ExtClkRising, PpgPres1ExtClkFalling, PpgPres1ExtClkBoth,
  PpgPres1Div512, PpgPres1Div1024, PpgPres1Div2048
}
 Enumeration to define clock prescaler of PPG timer. More...
enum  en_ppg_restart_enable { PpgRestartDisable = 0, PpgRestartEnable }
 Enumeration to define the configuration of PPG restart option. More...
enum  en_ppg_output_mask { PpgOutputNormal = 0, PpgOutputMask }
 Enumeration to define the configuration of PPG output mask. More...
enum  en_ppg_ext_trig { PpgExtTrigDisable = 0, PpgExtTrigRising, PpgExtTrigFalling, PpgExtTrigBoth }
 Enumeration to define external trigger of PPG. More...
enum  en_ppg_output_polarity { PpgPolarityLow = 0, PpgPolarityHigh }
 Enumeration to define PWM initial polarity. More...
enum  en_ppg_mode { PpgContinuous = 0, PpgOneshot }
 Enumeration to define PWM timer mode. More...
enum  en_bt_ppg_int { PpgTrigInt = 0, PpgUnderflowInt }
 Enumeration to define PPG interrupt type. More...
enum  en_rt_clock_pres {
  RtPresNone = 0, RtPres1Div4, RtPres1Div16, RtPres1Div128,
  RtPres1Div256, RtPres1ExtClkRising, RtPres1ExtClkFalling, RtPres1ExtClkBoth,
  RtPres1Div512, RtPres1Div1024, RtPres1Div2048
}
 Enumeration to define clock prescaler of Reload timer. More...
enum  en_rt_ext_trigger {
  RtExtTiggerDisable = 0, RtExtTiggerRisingEdge, RtExtTiggerFallingEdge, RtExtTiggerBothEdge,
  RtExtTiggerLowLevel, RtExtTiggerHighLevel
}
 Enumeration to define external trigger of Reload timer. More...
enum  en_rt_output_polarity { RtPolarityLow = 0, RtPolarityHigh }
 Enumeration to define Reload timer output initial polarity. More...
enum  en_rt_mode { RtReload = 0, RtOneshot }
 Enumeration to define Reload timer mode. More...
enum  en_rt_timer_size { RtSize16Bit = 0, RtSize32Bit }
 Enumeration to define Reload timer size. More...
enum  en_bt_rt_int { RtTrigInt = 0, RtUnderflowInt }
 Enumeration to define Reload timer interrupt type. More...
enum  en_pwc_clock_pres {
  PwcPresNone = 0, PwcPres1Div4 = 1, PwcPres1Div16 = 2, PwcPres1Div128 = 3,
  PwcPres1Div256 = 4, PwcPres1Div512 = 8, PwcPres1Div1024 = 9, PwcPres1Div2048 = 10
}
 Enumeration to define clock prescaler of PWC timer. More...
enum  en_pwc_measure_edge {
  PwcMeasureRisingToFalling = 0, PwcMeasureRisingToRising, PwcMeasureFallingToFalling, PwcMeasureEitherToEither,
  PwcMeasureFallingToRising
}
 Enumeration to define measure mode of PWC timer. More...
enum  en_pwc_mode { PwcContinuous = 0, PwcOneshot }
 Enumeration to define PWC timer mode. More...
enum  en_pwc_timer_size { PwcSize16Bit = 0, PwcSize32Bit }
 Enumeration to define Reload timer size. More...
enum  en_bt_pwc_int { PwcMeasureCompleteInt = 0, PwcMeasureOverflowInt }
 Enumeration to define PWC timer interrupt type. More...

Functions

static stc_bt_intern_data_tBtGetInternDataPtr (volatile FM0P_BT_PWM_TypeDef *pstcBt)
 Return the internal data for a certain BT instance.
void Bt_IrqHandler (volatile FM0P_BT_PWM_TypeDef *pstcBt, stc_bt_intern_data_t *pstcBtInternData)
 BT interrupt service routine.
static void Bt_InitNvic (volatile FM0P_BT_PWM_TypeDef *pstcBt)
 Set NVIC Interrupt depending on BT instance.
static void Bt_DeInitNvic (volatile FM0P_BT_PWM_TypeDef *pstcBt)
 Clear NVIC Interrupt depending on BT instance.
en_result_t Bt_ConfigIOMode (volatile FM0P_BT_PWM_TypeDef *pstcBt, en_bt_io_mode_t enIoMode)
 Configure BT IO mode.
en_result_t Bt_SelTimerMode (volatile FM0P_BT_PWM_TypeDef *pstcBt, en_bt_timer_mode_t enTimerMode)
 Select timer function of BT.
en_result_t Bt_Pwm_Init (volatile FM0P_BT_PWM_TypeDef *pstcBt, stc_bt_pwm_config_t *pstcPwmConfig)
 Initialize PWM function of BT.
en_result_t Bt_Pwm_DeInit (volatile FM0P_BT_PWM_TypeDef *pstcBt)
 De-Initialize PWM function of BT.
en_result_t Bt_Pwm_EnableCount (volatile FM0P_BT_PWM_TypeDef *pstcBt)
 Enable PWM timer counting.
en_result_t Bt_Pwm_DisableCount (volatile FM0P_BT_PWM_TypeDef *pstcBt)
 Disable PWM timer counting.
en_result_t Bt_Pwm_EnableSwTrig (volatile FM0P_BT_PWM_TypeDef *pstcBt)
 Start PWM timer by software.
en_result_t Bt_Pwm_EnableInt (volatile FM0P_BT_PWM_TypeDef *pstcBt, stc_pwm_int_sel_t *pstcIntSel, stc_pwm_int_cb_t *pstcIntCallback)
 Enable PWM timer interrupt.
en_result_t Bt_Pwm_DisableInt (volatile FM0P_BT_PWM_TypeDef *pstcBt, stc_pwm_int_sel_t *pstcIntSel)
 Disable PWM timer interrupt.
en_int_flag_t Bt_Pwm_GetIntFlag (volatile FM0P_BT_PWM_TypeDef *pstcBt, en_bt_pwm_int_t enIntType)
 Get interrupt flag of PWM timer.
en_result_t Bt_Pwm_ClrIntFlag (volatile FM0P_BT_PWM_TypeDef *pstcBt, en_bt_pwm_int_t enIntType)
 Clear interrupt flag of PWM timer.
en_result_t Bt_Pwm_WriteCycleVal (volatile FM0P_BT_PWM_TypeDef *pstcBt, uint16_t u16Cycle)
 Write Cycle value of PWM timer.
en_result_t Bt_Pwm_WriteDutyVal (volatile FM0P_BT_PWM_TypeDef *pstcBt, uint16_t u16Duty)
 Write duty value of PWM timer.
uint16_t Bt_Pwm_ReadCurCnt (volatile FM0P_BT_PWM_TypeDef *pstcBt)
 Read current count value of PWM timer.
en_result_t Bt_Ppg_Init (volatile FM0P_BT_PWM_TypeDef *pstcBt, stc_bt_ppg_config_t *pstcPpgConfig)
 Initialize PPG function of BT.
en_result_t Bt_Ppg_DeInit (volatile FM0P_BT_PWM_TypeDef *pstcBt)
 De-Initialize PPG function of BT.
en_result_t Bt_Ppg_EnableCount (volatile FM0P_BT_PWM_TypeDef *pstcBt)
 Enable PPG timer counting.
en_result_t Bt_Ppg_DisableCount (volatile FM0P_BT_PWM_TypeDef *pstcBt)
 Disable PPG timer counting.
en_result_t Bt_Ppg_EnableSwTrig (volatile FM0P_BT_PWM_TypeDef *pstcBt)
 Start PPG timer by software.
en_result_t Bt_Ppg_EnableInt (volatile FM0P_BT_PWM_TypeDef *pstcBt, stc_ppg_int_sel_t *pstcIntSel, stc_ppg_int_cb_t *pstcIntCallback)
 Enable PPG timer interrupt.
en_result_t Bt_Ppg_DisableInt (volatile FM0P_BT_PWM_TypeDef *pstcBt, stc_ppg_int_sel_t *pstcIntSel)
 Disable PPG timer interrupt.
en_int_flag_t Bt_Ppg_GetIntFlag (volatile FM0P_BT_PWM_TypeDef *pstcBt, en_bt_ppg_int_t enIntType)
 Get interrupt flag of PPG timer.
en_result_t Bt_Ppg_ClrIntFlag (volatile FM0P_BT_PWM_TypeDef *pstcBt, en_bt_ppg_int_t enIntType)
 Clear interrupt flag of PPG timer.
en_result_t Bt_Ppg_WriteLowWidthVal (volatile FM0P_BT_PWM_TypeDef *pstcBt, uint16_t u16Val)
 Write low width count value of PPG timer.
en_result_t Bt_Ppg_WriteHighWidthVal (volatile FM0P_BT_PWM_TypeDef *pstcBt, uint16_t u16Val)
 Write high width count value of PPG timer.
uint16_t Bt_Ppg_ReadCurCnt (volatile FM0P_BT_PWM_TypeDef *pstcBt)
 Read current count value of PPG timer.
en_result_t Bt_Rt_Init (volatile FM0P_BT_PWM_TypeDef *pstcBt, stc_bt_rt_config_t *pstcRtConfig)
 Initialize RT function of BT.
en_result_t Bt_Rt_DeInit (volatile FM0P_BT_PWM_TypeDef *pstcBt)
 De-Initialize RT function of BT.
en_result_t Bt_Rt_EnableCount (volatile FM0P_BT_PWM_TypeDef *pstcBt)
 Enable Reload timer counting.
en_result_t Bt_Rt_DisableCount (volatile FM0P_BT_PWM_TypeDef *pstcBt)
 Disable Reload timer counting.
en_result_t Bt_Rt_EnableSwTrig (volatile FM0P_BT_PWM_TypeDef *pstcBt)
 Start Reload timer by software.
en_result_t Bt_Rt_EnableInt (volatile FM0P_BT_PWM_TypeDef *pstcBt, stc_rt_int_sel_t *pstcIntSel, stc_rt_int_cb_t *pstcIntCallback)
 Enable Reload timer interrupt.
en_result_t Bt_Rt_DisableInt (volatile FM0P_BT_PWM_TypeDef *pstcBt, stc_rt_int_sel_t *pstcIntSel)
 Disable Reload timer interrupt.
en_int_flag_t Bt_Rt_GetIntFlag (volatile FM0P_BT_PWM_TypeDef *pstcBt, en_bt_rt_int_t enIntType)
 Get interrupt flag of Reload timer.
en_result_t Bt_Rt_ClrIntFlag (volatile FM0P_BT_PWM_TypeDef *pstcBt, en_bt_rt_int_t enIntType)
 Clear interrupt flag of Reload timer.
en_result_t Bt_Rt_WriteCycleVal (volatile FM0P_BT_PWM_TypeDef *pstcBt, uint16_t u16Val)
 Write count cycle of Reload timer.
uint16_t Bt_Rt_ReadCurCnt (volatile FM0P_BT_PWM_TypeDef *pstcBt)
 Read current count value of Reload timer.
en_result_t Bt_Pwc_Init (volatile FM0P_BT_PWM_TypeDef *pstcBt, stc_bt_pwc_config_t *pstcPwcConfig)
 Initialize PWC function of BT.
en_result_t Bt_Pwc_DeInit (volatile FM0P_BT_PWM_TypeDef *pstcBt)
 De-Initialize PWC function of BT.
en_result_t Bt_Pwc_EnableCount (volatile FM0P_BT_PWM_TypeDef *pstcBt)
 Enable PWC timer counting.
en_result_t Bt_Pwc_DisableCount (volatile FM0P_BT_PWM_TypeDef *pstcBt)
 Disable PWC timer counting.
en_result_t Bt_Pwc_EnableInt (volatile FM0P_BT_PWM_TypeDef *pstcBt, stc_pwc_int_sel_t *pstcIntSel, stc_pwc_int_cb_t *pstcIntCallback)
 Enable PWC timer interrupt.
en_result_t Bt_Pwc_DisableInt (volatile FM0P_BT_PWM_TypeDef *pstcBt, stc_pwc_int_sel_t *pstcIntSel)
 Disable PWC timer interrupt.
en_int_flag_t Bt_Pwc_GetIntFlag (volatile FM0P_BT_PWM_TypeDef *pstcBt, en_bt_pwc_int_t enIntType)
 Get interrupt flag of PWC timer.
en_result_t Bt_Pwc_ClrIntFlag (volatile FM0P_BT_PWM_TypeDef *pstcBt, en_bt_pwc_int_t enIntType)
 Clear interrupt flag of PWC timer.
en_stat_flag_t Bt_Pwc_GetErrorFlag (volatile FM0P_BT_PWM_TypeDef *pstcBt)
 Get error flag of PWC timer.
uint16_t Bt_Pwc_Get16BitMeasureData (volatile FM0P_BT_PWM_TypeDef *pstcBt)
 Get 16 bits measure data of PWC timer.
uint32_t Bt_Pwc_Get32BitMeasureData (volatile FM0P_BT_PWM_TypeDef *pstcBt)
 Get 32 bits measure data of PWC timer.
void Bt_SetSimultaneousStart (uint16_t u16Value)
 Set the Simultaneous Start register of Base timer.

Variables

stc_bt_instance_data_t m_astcBtInstanceDataLut [((PDL_PERIPHERAL_ENABLE_BT0==PDL_ON)?1:0)+((PDL_PERIPHERAL_ENABLE_BT1==PDL_ON)?1:0)+((PDL_PERIPHERAL_ENABLE_BT2==PDL_ON)?1:0)+((PDL_PERIPHERAL_ENABLE_BT3==PDL_ON)?1:0)+((PDL_PERIPHERAL_ENABLE_BT4==PDL_ON)?1:0)+((PDL_PERIPHERAL_ENABLE_BT5==PDL_ON)?1:0)+((PDL_PERIPHERAL_ENABLE_BT6==PDL_ON)?1:0)+((PDL_PERIPHERAL_ENABLE_BT7==PDL_ON)?1:0)]
 Look-up table for all enabled BT instances and their internal data.
stc_bt_instance_data_t m_astcBtInstanceDataLut [((PDL_PERIPHERAL_ENABLE_BT0==PDL_ON)?1:0)+((PDL_PERIPHERAL_ENABLE_BT1==PDL_ON)?1:0)+((PDL_PERIPHERAL_ENABLE_BT2==PDL_ON)?1:0)+((PDL_PERIPHERAL_ENABLE_BT3==PDL_ON)?1:0)+((PDL_PERIPHERAL_ENABLE_BT4==PDL_ON)?1:0)+((PDL_PERIPHERAL_ENABLE_BT5==PDL_ON)?1:0)+((PDL_PERIPHERAL_ENABLE_BT6==PDL_ON)?1:0)+((PDL_PERIPHERAL_ENABLE_BT7==PDL_ON)?1:0)]
 Look-up table for all enabled BT instances and their internal data.

Detailed Description

Provided BT module functions:

How to use PWM timer function of BT module?

Bt_ConfigIOMode() must be used to configure BT I/O mode to I/O mode 0 first.

Bt_SelTimerMode() must be used to configure BT mode to PWM function then.

Bt_Pwm_Init() is used to initialize PWM timer source clock, output polarity, operation mode and so on. Following operation mode can set:

A PWM interrupt can be enabled by the function Bt_Pwm_EnableInt(). This function can set callback function for each channel too.

With Bt_Pwm_WriteCycleVal() the PWM cycle counter is set to the value given in the parameter Bt_Pwm_WriteCycleVal::u16Cycle.

With Bt_Pwm_WriteDutyVal() the PWM duty counter is set to the value given in the parameter Bt_Pwm_WriteDutyVal::u16Duty.

Note:
that PWM can be only set to 16-bit mode, so above two parameters should be 16-bit.

Bt_Pwm_EnableCount() is used to enable PWM counter.

After above setting is done, calling Bt_Pwm_EnableSwTrig() will start PWM timer.

With Bt_Pwm_ReadCurCnt() the current PWM count can be read when PWM timer is running.

With interrupt mode, when the interrupt occurs, the interrupt flag will be cleared and run into user interrupt callback function.

With polling mode, user can use Bt_Pwm_GetIntFlag() to check if the interrupt occurs, and clear the interrupt flag by Bt_Pwm_ClrIntFlag().

When stopping the PWM timer, use Bt_Pwm_DisableCount() to disable PWM counter and Bt_Pwm_DisableInt() to disable PWM interrupt.

How to use PPG timer function of BT module?

Bt_ConfigIOMode() must be used to configure BT I/O mode to I/O mode 0 first.

Bt_SelTimerMode() must be used to configure BT mode to PPG function then.

Bt_Ppg_Init() is used to initialize PPG timer source clock, output polarity, operation mode and so on. Following operation mode can set:

A PPG interrupt can be enabled by the function Bt_Ppg_EnableInt(). This function can set callback function for each channel too.

With Bt_Ppg_WriteLowWidthVal() the PPG low width is set to the value given in the parameter Bt_Ppg_WriteLowWidthVal::u16Cycle.

With Bt_Ppg_WriteHighWidthVal() the PPG high width is set to the value given in the parameter Bt_Ppg_WriteHighWidthVal::u16Cycle.

Note:
PPG can be only set to 16-bit mode, so above two parameters should be 16-bit.

Bt_Ppg_EnableCount() is used to enable PPG counter.

After above setting is done, calling Bt_Ppg_EnableSwTrig() will start PPG timer.

With Bt_Ppg_ReadCurCnt() the current PPG count can be read when PPG timer is running.

With interrupt mode, when the interrupt occurs, the interrupt flag will be cleared and run into user interrupt callback function.

With polling mode, user can use Bt_Ppg_GetIntFlag() to check if the interrupt occurs, and clear the interrupt flag by Bt_Ppg_ClrIntFlag().

When stopping the PPG timer, use Bt_Ppg_DisableCount() to disable PPG counter and Bt_Ppg_DisableInt() to disable PPG interrupt.

How to use Reload Timer (RT) function of BT module?

Bt_ConfigIOMode() must be used to configure BT I/O mode to I/O mode 0 first.

Bt_SelTimerMode() must be used to configure BT mode to Reload Timer function then.

Bt_Rt_Init() is used to initialize RT source clock, output polarity, operation mode and so on. Following operation mode can set:

A RT interrupt can be enabled by the function Bt_Rt_EnableInt(). This function can set callback function for each channel too.

RT can be set to 16-bit mode or 32-bit mode. In 16-bit mode, Bt_Rt_WriteCycleVal() set the RT counter cycle of according channel. In the 32-bit mode, Bt_Rt_WriteCycleVal() with even channel register pointer as parameter set the low 16-bit cycle value and Bt_Rt_WriteCycleVal() with odd channel register pointer as paremater set the high 16-bit cycle value.

Bt_Rt_EnableCount() is used to enable RT counter.

After above setting is done, calling Bt_Rt_EnableSwTrig() will start Reload Timer.

With Bt_Rt_ReadCurCnt() the current RT count can be read when Reload Timer is running.

With interrupt mode, when the interrupt occurs, the interrupt flag will be cleared and run into user interrupt callback function.

With polling mode, user can use Bt_Rt_GetIntFlag() to check if the interrupt occurs, and clear the interrupt flag by Rt_Ppg_ClrIntFlag().

When stopping the PPG timer, use Bt_Rt_DisableCount() to disable RT counter and Bt_Rt_DisableInt() to disable RT interrupt.

How to use PWC timer function of BT module?

Bt_ConfigIOMode() must be used to configure BT I/O mode to I/O mode 0 first.

Bt_SelTimerMode() must be used to configure BT mode to PWC function then.

Bt_Pwc_Init() is used to initialize PWC timer source clock, measurement mode and so on.

Following measurement mode can set:

Following operation mode can be set:

A PWC interrupt can be enabled by the function Bt_Pwc_EnableInt(). This function can set callback function for each channel too.

Bt_Pwc_EnableCount() is used to enabe PWC counter.

After above setting is done, when the valid edge (1st) is detected, the measurement starts, and the valid edge (2nd) is detected, the measurement ends, the interrupt request flag is set at the same time.

PWC timer can be set to 16-bit mode and 32-bit mode. In the 16-bit mode, with Bt_Pwc_Get16BitMeasureData() the measured value can be read after measurement completes, in the 32-bit mode, with Bt_Pwc_Get32BitMeasureData() the measured value can be read.

With interrupt mode, when the interrupt occurs, the interrupt flag will be cleared and the code runs into user interrupt callback function.

With polling mode, user can use Bt_Pwc_GetIntFlag() to check if the completion interrupt occurs, and clear the interrupt flag by Bt_Pwc_ClrIntFlag(). Bt_Pwc_GetErrorFlag() is used to get the error flag of PWC measurement.

When stopping the PWC timer, use Bt_Pwc_DisableCount() to disable PWC counter and Bt_Pwc_DisableInt() to disable PWC interrupt.


Define Documentation

#define BT0   (*((volatile stc_btn_t *) FM0P_BT0_PWM_BASE))

Definition at line 288 of file bt.h.

Referenced by BT0_7_FLASH_IRQHandler(), Bt_ConfigIOMode(), Bt_DeInitNvic(), and Bt_InitNvic().

#define BT1   (*((volatile stc_btn_t *) FM0P_BT1_PWM_BASE))
#define BT2   (*((volatile stc_btn_t *) FM0P_BT2_PWM_BASE))

Definition at line 290 of file bt.h.

Referenced by BT0_7_FLASH_IRQHandler(), Bt_ConfigIOMode(), Bt_DeInitNvic(), and Bt_InitNvic().

#define BT3   (*((volatile stc_btn_t *) FM0P_BT3_PWM_BASE))
#define BT4   (*((volatile stc_btn_t *) FM0P_BT4_PWM_BASE))

Definition at line 292 of file bt.h.

Referenced by BT0_7_FLASH_IRQHandler(), Bt_ConfigIOMode(), Bt_DeInitNvic(), and Bt_InitNvic().

#define BT5   (*((volatile stc_btn_t *) FM0P_BT5_PWM_BASE))
#define BT6   (*((volatile stc_btn_t *) FM0P_BT6_PWM_BASE))

Definition at line 294 of file bt.h.

Referenced by BT0_7_FLASH_IRQHandler(), Bt_ConfigIOMode(), Bt_DeInitNvic(), and Bt_InitNvic().

#define BT7   (*((volatile stc_btn_t *) FM0P_BT7_PWM_BASE))
Value:

Definition at line 298 of file bt.h.

Referenced by BtGetInternDataPtr().

#define stc_btn_t   FM0P_BT_PWM_TypeDef

Definition at line 286 of file bt.h.

Referenced by BT0_7_FLASH_IRQHandler(), Bt_DeInitNvic(), and Bt_InitNvic().


Typedef Documentation

Enumeration to define an index for each BT instance.

Enumeration to define BT IO mode.

Enumeration to define PPG interrupt type.

Enumeration to define PWC timer interrupt type.

Enumeration to define PWM interrupt type.

Enumeration to define Reload timer interrupt type.

Enumeration to define timer mode of BT.

Enumeration to define clock prescaler of PPG timer.

Enumeration to define external trigger of PPG.

typedef enum en_ppg_mode en_ppg_mode_t

Enumeration to define PWM timer mode.

Enumeration to define the configuration of PPG output mask.

Enumeration to define PWM initial polarity.

Enumeration to define the configuration of PPG restart option.

Enumeration to define clock prescaler of PWC timer.

Enumeration to define measure mode of PWC timer.

typedef enum en_pwc_mode en_pwc_mode_t

Enumeration to define PWC timer mode.

Enumeration to define Reload timer size.

Enumeration to define clock prescaler of PWM timer.

Enumeration to define external trigger of PWM.

typedef enum en_pwm_mode en_pwm_mode_t

Enumeration to define PWM timer mode.

Enumeration to define the configuration of PWM output mask.

Enumeration to define PWM initial polarity.

Enumeration to define the configuration of PWM restart option.

Enumeration to define clock prescaler of Reload timer.

Enumeration to define external trigger of Reload timer.

typedef enum en_rt_mode en_rt_mode_t

Enumeration to define Reload timer mode.

Enumeration to define Reload timer output initial polarity.

Enumeration to define Reload timer size.

BT instance data.

BT internal data.

Structure of PPG configuration.

Structure of PWC timer configuration.

Structure of PWM configuration.

Structure of Reload timer configuration.

structure to set the PPG interrupt callback function

structure to select the PPG interrupt

structure to set the PWC timer interrupt callback function

structure to select the PWC timer interrupt

structure to set the PWM interrupt callback function

structure to select the PWM interrupt

structure to set the Reload timer interrupt callback function

structure to select the Reload timer interrupt


Enumeration Type Documentation

Enumeration to define an index for each BT instance.

Enumerator:
BtInstanceIndexBt0 

Instance index of BT0.

BtInstanceIndexBt1 

Instance index of BT1.

BtInstanceIndexBt2 

Instance index of BT2.

BtInstanceIndexBt3 

Instance index of BT3.

BtInstanceIndexBt4 

Instance index of BT4.

BtInstanceIndexBt5 

Instance index of BT5.

BtInstanceIndexBt6 

Instance index of BT6.

BtInstanceIndexBt7 

Instance index of BT7.

BtInstanceIndexMax 

Maximum instance index.

Definition at line 314 of file bt.h.

Enumeration to define BT IO mode.

Enumerator:
BtIoMode0 

BT IO mode 0.

BtIoMode1 

BT IO mode 1.

BtIoMode2 

BT IO mode 2.

BtIoMode3 

BT IO mode 3.

BtIoMode4 

BT IO mode 4.

BtIoMode5 

BT IO mode 5.

BtIoMode6 

BT IO mode 6.

BtIoMode7 

BT IO mode 7.

BtIoMode8 

BT IO mode 8.

Definition at line 347 of file bt.h.

Enumeration to define PPG interrupt type.

Enumerator:
PpgTrigInt 

Trigger interrupt.

PpgUnderflowInt 

Underflow interrupt.

Definition at line 599 of file bt.h.

Enumeration to define PWC timer interrupt type.

Enumerator:
PwcMeasureCompleteInt 

Measure complete interrupt.

PwcMeasureOverflowInt 

Measure overflow interrupt.

Definition at line 813 of file bt.h.

Enumeration to define PWM interrupt type.

Enumerator:
PwmTrigInt 

Trigger interrupt.

PwmDutyMatchInt 

Duty match interrupt.

PwmUnderflowInt 

Underflow interrupt.

Definition at line 471 of file bt.h.

Enumeration to define Reload timer interrupt type.

Enumerator:
RtTrigInt 

Trigger interrupt.

RtUnderflowInt 

Underflow interrupt.

Definition at line 714 of file bt.h.

Enumeration to define timer mode of BT.

Enumerator:
BtResetMode 

Reset mode.

BtPwmMode 

PWM timer mode.

BtPpgMode 

PPG timer mode.

BtRtMode 

Reload timer mode.

BtPwcMode 

PWC timer mode.

Definition at line 365 of file bt.h.

Enumeration to define clock prescaler of PPG timer.

Enumerator:
PpgPresNone 

PPG prescaler clock: no division.

PpgPres1Div4 

PPG prescaler clock: 1/4.

PpgPres1Div16 

PPG prescaler clock: 1/16.

PpgPres1Div128 

PPG prescaler clock: 1/128.

PpgPres1Div256 

PPG prescaler clock: 1/256.

PpgPres1ExtClkRising 

Use external clock and count at rising edge.

PpgPres1ExtClkFalling 

Use external clock and count at falling edge.

PpgPres1ExtClkBoth 

Use external clock and count at both edge.

PpgPres1Div512 

PPG prescaler clock: 1/512.

PpgPres1Div1024 

PPG prescaler clock: 1/1024.

PpgPres1Div2048 

PPG prescaler clock: 1/2048.

Definition at line 507 of file bt.h.

Enumeration to define external trigger of PPG.

Enumerator:
PpgExtTrigDisable 

Disable external trigger.

PpgExtTrigRising 

Enable external trigger with rising edge.

PpgExtTrigFalling 

Enable external trigger with falling edge.

PpgExtTrigBoth 

Enable external trigger with both edge.

Definition at line 549 of file bt.h.

Enumeration to define PWM timer mode.

Enumerator:
PpgContinuous 

Continuous mode.

PpgOneshot 

One-shot mode.

Definition at line 573 of file bt.h.

Enumeration to define the configuration of PPG output mask.

Enumerator:
PpgOutputNormal 

Output normal PPG wave.

PpgOutputMask 

Mask PPG wave.

Definition at line 538 of file bt.h.

Enumeration to define PWM initial polarity.

Enumerator:
PpgPolarityLow 

Initial polarity: low.

PpgPolarityHigh 

Initial polarity: high.

Definition at line 562 of file bt.h.

Enumeration to define the configuration of PPG restart option.

Enumerator:
PpgRestartDisable 

Disable PPG restart.

PpgRestartEnable 

Enable PPG restart.

Definition at line 527 of file bt.h.

Enumeration to define clock prescaler of PWC timer.

Enumerator:
PwcPresNone 

PWC timer prescaler clock: no division.

PwcPres1Div4 

PWC timer prescaler clock: 1/4.

PwcPres1Div16 

PWC timer prescaler clock: 1/16.

PwcPres1Div128 

PWC timer prescaler clock: 1/128.

PwcPres1Div256 

PWC timer prescaler clock: 1/256.

PwcPres1Div512 

PWC timer prescaler clock: 1/512.

PwcPres1Div1024 

PWC timer prescaler clock: 1/1024.

PwcPres1Div2048 

PWC timer prescaler clock: 1/2048.

Definition at line 747 of file bt.h.

Enumeration to define measure mode of PWC timer.

Enumerator:
PwcMeasureRisingToFalling 

Measure between rising edge with falling edge.

PwcMeasureRisingToRising 

Measure between rising edge with rising edge.

PwcMeasureFallingToFalling 

Measure between falling edge with falling edge.

PwcMeasureEitherToEither 

Measure between either edge with either edge.

PwcMeasureFallingToRising 

Measure between falling edge with falling edge.

Definition at line 764 of file bt.h.

Enumeration to define PWC timer mode.

Enumerator:
PwcContinuous 

Continuous mode.

PwcOneshot 

One-shot mode.

Definition at line 778 of file bt.h.

Enumeration to define Reload timer size.

Enumerator:
PwcSize16Bit 

16-bit mode

PwcSize32Bit 

32-bit mode

Definition at line 789 of file bt.h.

Enumeration to define clock prescaler of PWM timer.

Enumerator:
PwmPresNone 

PWM prescaler clock: no division.

PwmPres1Div4 

PWM prescaler clock: 1/4.

PwmPres1Div16 

PWM prescaler clock: 1/16.

PwmPres1Div128 

PWM prescaler clock: 1/128.

PwmPres1Div256 

PWM prescaler clock: 1/256.

PwmPres1ExtClkRising 

Use external clock and count at rising edge.

PwmPres1ExtClkFalling 

Use external clock and count at falling edge.

PwmPres1ExtClkBoth 

Use external clock and count at both edge.

PwmPres1Div512 

PWM prescaler clock: 1/512.

PwmPres1Div1024 

PWM prescaler clock: 1/1024.

PwmPres1Div2048 

PWM prescaler clock: 1/2048.

Definition at line 379 of file bt.h.

Enumeration to define external trigger of PWM.

Enumerator:
PwmExtTrigDisable 

Disable external trigger.

PwmExtTrigRising 

Enable external trigger with rising edge.

PwmExtTrigFalling 

Enable external trigger with falling edge.

PwmExtTrigBoth 

Enable external trigger with both edge.

Definition at line 421 of file bt.h.

Enumeration to define PWM timer mode.

Enumerator:
PwmContinuous 

Continuous mode.

PwmOneshot 

One-shot mode.

Definition at line 445 of file bt.h.

Enumeration to define the configuration of PWM output mask.

Enumerator:
PwmOutputNormal 

Output normal PWM wave.

PwmOutputMask 

Mask PWM wave.

Definition at line 410 of file bt.h.

Enumeration to define PWM initial polarity.

Enumerator:
PwmPolarityLow 

Initial polarity: low.

PwmPolarityHigh 

Initial polarity: high.

Definition at line 434 of file bt.h.

Enumeration to define the configuration of PWM restart option.

Enumerator:
PwmRestartDisable 

Disable PWM restart.

PwmRestartEnable 

Enable PWM restart.

Definition at line 399 of file bt.h.

Enumeration to define clock prescaler of Reload timer.

Enumerator:
RtPresNone 

Reload timer prescaler clock: no division.

RtPres1Div4 

Reload timer prescaler clock: 1/4.

RtPres1Div16 

Reload timer prescaler clock: 1/16.

RtPres1Div128 

Reload timer prescaler clock: 1/128.

RtPres1Div256 

Reload timer prescaler clock: 1/256.

RtPres1ExtClkRising 

Use external clock and count at rising edge.

RtPres1ExtClkFalling 

Use external clock and count at falling edge.

RtPres1ExtClkBoth 

Use external clock and count at both edge.

RtPres1Div512 

Reload timer prescaler clock: 1/512.

RtPres1Div1024 

Reload timer prescaler clock: 1/1024.

RtPres1Div2048 

Reload timer prescaler clock: 1/2048.

Definition at line 632 of file bt.h.

Enumeration to define external trigger of Reload timer.

Enumerator:
RtExtTiggerDisable 

Disable external trigger.

RtExtTiggerRisingEdge 

Enable external trigger with rising edge.

RtExtTiggerFallingEdge 

Enable external trigger with falling edge.

RtExtTiggerBothEdge 

Enable external trigger with both edge.

RtExtTiggerLowLevel 

Enable external trigger with low level.

RtExtTiggerHighLevel 

Enable external trigger with high level.

Definition at line 652 of file bt.h.

enum en_rt_mode

Enumeration to define Reload timer mode.

Enumerator:
RtReload 

Reload mode.

RtOneshot 

One-shot mode.

Definition at line 678 of file bt.h.

Enumeration to define Reload timer output initial polarity.

Enumerator:
RtPolarityLow 

Initial polarity: low.

RtPolarityHigh 

Initial polarity: high.

Definition at line 667 of file bt.h.

Enumeration to define Reload timer size.

Enumerator:
RtSize16Bit 

16-bit mode

RtSize32Bit 

32-bit mode

Definition at line 689 of file bt.h.


Function Documentation

en_result_t Bt_ConfigIOMode ( volatile FM0P_BT_PWM_TypeDef *  pstcBt,
en_bt_io_mode_t  enIoMode 
)

Configure BT IO mode.

Parameters:
[in]pstcBtBT instance
[in]enIoModeBT IO mode
  • BtIoMode0 BT IO mode 0
  • BtIoMode1 BT IO mode 1
  • BtIoMode2 BT IO mode 2
  • BtIoMode3 BT IO mode 3
  • BtIoMode4 BT IO mode 4
  • BtIoMode5 BT IO mode 5
  • BtIoMode6 BT IO mode 6
  • BtIoMode7 BT IO mode 7
  • BtIoMode8 BT IO mode 8
Return values:
OkBT IO mode has been set successfully
ErrorInvalidParameterpstcBt == NULL Other invalid configuration

Definition at line 312 of file bt.c.

References BT0, BT1, BT2, BT3, BT4, BT5, BT6, BT7, BtGetInternDataPtr(), BtIoMode8, ErrorInvalidParameter, and Ok.

Here is the call graph for this function:

static void Bt_DeInitNvic ( volatile FM0P_BT_PWM_TypeDef *  pstcBt) [static]

Clear NVIC Interrupt depending on BT instance.

Parameters:
pstcBtPointer to BT instance

Definition at line 238 of file bt.c.

References BT0, BT1, BT2, BT3, BT4, BT5, BT6, BT7, PDL_DEFAULT_INTERRUPT_LEVEL, and stc_btn_t.

Referenced by Bt_Ppg_DeInit(), Bt_Ppg_DisableInt(), Bt_Pwc_DeInit(), Bt_Pwc_DisableInt(), Bt_Pwm_DeInit(), Bt_Pwm_DisableInt(), Bt_Rt_DeInit(), and Bt_Rt_DisableInt().

Here is the caller graph for this function:

static void Bt_InitNvic ( volatile FM0P_BT_PWM_TypeDef *  pstcBt) [static]

Set NVIC Interrupt depending on BT instance.

Parameters:
pstcBtPointer to BT instance

Definition at line 218 of file bt.c.

References BT0, BT1, BT2, BT3, BT4, BT5, BT6, BT7, PDL_IRQ_LEVEL_BT0_7_FLASH, and stc_btn_t.

Referenced by Bt_Ppg_EnableInt(), Bt_Pwc_EnableInt(), Bt_Pwm_EnableInt(), and Bt_Rt_EnableInt().

Here is the caller graph for this function:

void Bt_IrqHandler ( volatile FM0P_BT_PWM_TypeDef *  pstcBt,
stc_bt_intern_data_t pstcBtInternData 
)

BT interrupt service routine.

Parameters:
pstcBtBT instance
pstcBtInternDataPointer to BT internal data

Definition at line 157 of file bt.c.

References stc_bt_intern_data::pfnBit0IntCallback, stc_bt_intern_data::pfnBit1IntCallback, and stc_bt_intern_data::pfnBit2IntCallback.

Referenced by BT0_7_FLASH_IRQHandler().

Here is the caller graph for this function:

en_result_t Bt_Ppg_ClrIntFlag ( volatile FM0P_BT_PWM_TypeDef *  pstcBt,
en_bt_ppg_int_t  enIntType 
)

Clear interrupt flag of PPG timer.

Parameters:
[in]pstcBtBT instance
[in]enIntTypePPG timer interrupt type
  • PpgTrigInt PPG trigger detection interrupt
  • PpgUnderflowInt PPG underflow interrupt
Return values:
ErrorInvalidParameterIf one of following cases match:
  • pstcBt == NULL
  • enIntType > PwmUnderflowInt
OkClear interrupt flag successfully

Definition at line 1189 of file bt.c.

References ErrorInvalidParameter, Ok, PpgTrigInt, and PpgUnderflowInt.

en_result_t Bt_Ppg_DeInit ( volatile FM0P_BT_PWM_TypeDef *  pstcBt)

De-Initialize PPG function of BT.

Parameters:
[in]pstcBtBT instance
Return values:
OkPPG function has been de-initialized successfully
ErrorInvalidParameterIf one of following cases matchs:
  • pstcBt == NULL
  • Other invalid configuration

Definition at line 931 of file bt.c.

References Bt_DeInitNvic(), BtGetInternDataPtr(), ErrorInvalidParameter, and Ok.

Here is the call graph for this function:

en_result_t Bt_Ppg_DisableCount ( volatile FM0P_BT_PWM_TypeDef *  pstcBt)

Disable PPG timer counting.

Parameters:
[in]pstcBtBT instance
Return values:
OkDisable PPG timer counting successfully
ErrorInvalidParameterpstcBt == NULL

Definition at line 995 of file bt.c.

References ErrorInvalidParameter, and Ok.

en_result_t Bt_Ppg_DisableInt ( volatile FM0P_BT_PWM_TypeDef *  pstcBt,
stc_ppg_int_sel_t pstcIntSel 
)

Disable PPG timer interrupt.

Parameters:
[in]pstcBtBT instance
[in]pstcIntSelPointer to interrupt selection structure
Return values:
OkDisable PPG timer interrupt successfully
ErrorInvalidParameterIf one of following cases matchs:
  • pstcBt == NULL
  • Other invalid configuration

Definition at line 1096 of file bt.c.

References stc_ppg_int_sel::bPpgTrigInt, stc_ppg_int_sel::bPpgUnderflowInt, Bt_DeInitNvic(), BtGetInternDataPtr(), ErrorInvalidParameter, Ok, stc_bt_intern_data::pfnBit0IntCallback, and stc_bt_intern_data::pfnBit2IntCallback.

Here is the call graph for this function:

en_result_t Bt_Ppg_EnableCount ( volatile FM0P_BT_PWM_TypeDef *  pstcBt)

Enable PPG timer counting.

Parameters:
[in]pstcBtBT instance
Return values:
OkEnable PPG timer counting successfully
ErrorInvalidParameterpstcBt == NULL

Definition at line 974 of file bt.c.

References ErrorInvalidParameter, and Ok.

en_result_t Bt_Ppg_EnableInt ( volatile FM0P_BT_PWM_TypeDef *  pstcBt,
stc_ppg_int_sel_t pstcIntSel,
stc_ppg_int_cb_t pstcIntCallback 
)

Enable PPG timer interrupt.

Parameters:
[in]pstcBtBT instance
[in]pstcIntSelPointer to interrupt selection structure
[in]pstcIntCallbackPointer to interrupt callback function
Return values:
OkEnable PPG timer interrupt successfully
ErrorInvalidParameterIf one of following cases matchs:
  • pstcBt == NULL
  • pfnIntCallback == NULL
  • Other invalid configuration

Definition at line 1046 of file bt.c.

References stc_ppg_int_sel::bPpgTrigInt, stc_ppg_int_sel::bPpgUnderflowInt, Bt_InitNvic(), BtGetInternDataPtr(), ErrorInvalidParameter, Ok, stc_bt_intern_data::pfnBit0IntCallback, stc_bt_intern_data::pfnBit2IntCallback, stc_ppg_int_cb::pfnPpgTrigIntCallback, and stc_ppg_int_cb::pfnPpgUnderflowIntCallback.

Here is the call graph for this function:

en_result_t Bt_Ppg_EnableSwTrig ( volatile FM0P_BT_PWM_TypeDef *  pstcBt)

Start PPG timer by software.

Parameters:
[in]pstcBtBT instance
Return values:
OkStart PPG timer successfully
ErrorInvalidParameterpstcBt == NULL

Definition at line 1016 of file bt.c.

References ErrorInvalidParameter, and Ok.

en_int_flag_t Bt_Ppg_GetIntFlag ( volatile FM0P_BT_PWM_TypeDef *  pstcBt,
en_bt_ppg_int_t  enIntType 
)

Get interrupt flag of PPG timer.

Parameters:
[in]pstcBtBT instance
[in]enIntTypePPG timer interrupt type
  • PpgTrigInt PPG trigger detection interrupt
  • PpgUnderflowInt PPG underflow interrupt
Return values:
PdlSetInterrupt flag is set
PdlClrInterrupt flag is clear

Definition at line 1156 of file bt.c.

References PdlClr, PdlSet, PpgTrigInt, and PpgUnderflowInt.

en_result_t Bt_Ppg_Init ( volatile FM0P_BT_PWM_TypeDef *  pstcBt,
stc_bt_ppg_config_t pstcPpgConfig 
)

Initialize PPG function of BT.

Parameters:
[in]pstcBtBT instance
[in]pstcPpgConfigPointer to PPG configuration
Return values:
OkPPG function has been configured successfully
ErrorInvalidParameterIf one of following cases matchs:
  • pstcBt == NULL
  • Other invalid configuration

Definition at line 863 of file bt.c.

References BtGetInternDataPtr(), stc_bt_ppg_config::enExtTrig, stc_bt_ppg_config::enMode, stc_bt_ppg_config::enOutputMask, stc_bt_ppg_config::enOutputPolarity, stc_bt_ppg_config::enPres, stc_bt_ppg_config::enRestartEn, ErrorInvalidParameter, Ok, PpgExtTrigBoth, PpgOneshot, PpgOutputMask, PpgPolarityHigh, PpgPres1Div2048, PpgPres1Div512, and PpgRestartEnable.

Here is the call graph for this function:

uint16_t Bt_Ppg_ReadCurCnt ( volatile FM0P_BT_PWM_TypeDef *  pstcBt)

Read current count value of PPG timer.

Parameters:
[in]pstcBtBT instance
Return values:
Currentcount value

Definition at line 1263 of file bt.c.

en_result_t Bt_Ppg_WriteHighWidthVal ( volatile FM0P_BT_PWM_TypeDef *  pstcBt,
uint16_t  u16Val 
)

Write high width count value of PPG timer.

Parameters:
[in]pstcBtBT instance
[in]u16ValHigh width count value
Return values:
OkWrite high width count value successfully
ErrorInvalidParameterpstcBt == NULL

Definition at line 1243 of file bt.c.

References ErrorInvalidParameter, and Ok.

en_result_t Bt_Ppg_WriteLowWidthVal ( volatile FM0P_BT_PWM_TypeDef *  pstcBt,
uint16_t  u16Val 
)

Write low width count value of PPG timer.

Parameters:
[in]pstcBtBT instance
[in]u16ValLow width count value
Return values:
OkWrite low width count value successfully
ErrorInvalidParameterpstcBt == NULL

Definition at line 1221 of file bt.c.

References ErrorInvalidParameter, and Ok.

en_result_t Bt_Pwc_ClrIntFlag ( volatile FM0P_BT_PWM_TypeDef *  pstcBt,
en_bt_pwc_int_t  enIntType 
)

Clear interrupt flag of PWC timer.

Parameters:
[in]pstcBtBT instance
[in]enIntTypePWC timer interrupt type
  • PwcMeasureCompleteInt PWC measure complete interrupt
  • PwcMeasureOverflowInt PWC overflow interrupt
Return values:
ErrorInvalidParameterIf one of followng cases matchs:
  • pstcBt == NULL
  • enIntType > PwcMeasureOverflowInt
OkClear interrupt flag successfully

Definition at line 1980 of file bt.c.

References ErrorInvalidParameter, Ok, PwcMeasureCompleteInt, and PwcMeasureOverflowInt.

en_result_t Bt_Pwc_DeInit ( volatile FM0P_BT_PWM_TypeDef *  pstcBt)

De-Initialize PWC function of BT.

Parameters:
[in]pstcBtBT instance
Return values:
OkPWC function has been de-initialized successfully
ErrorInvalidParameterIf one of followng cases matchs:
  • pstcBt == NULL
  • Other invalid configuration

Definition at line 1746 of file bt.c.

References Bt_DeInitNvic(), BtGetInternDataPtr(), ErrorInvalidParameter, and Ok.

Here is the call graph for this function:

en_result_t Bt_Pwc_DisableCount ( volatile FM0P_BT_PWM_TypeDef *  pstcBt)

Disable PWC timer counting.

Parameters:
[in]pstcBtBT instance
Return values:
OkDisable PWC timer counting successfully
ErrorInvalidParameterpstcBt == NULL

Definition at line 1808 of file bt.c.

References ErrorInvalidParameter, and Ok.

en_result_t Bt_Pwc_DisableInt ( volatile FM0P_BT_PWM_TypeDef *  pstcBt,
stc_pwc_int_sel_t pstcIntSel 
)

Disable PWC timer interrupt.

Parameters:
[in]pstcBtBT instance
[in]pstcIntSelPointer to interrupt selection structure
Return values:
OkDisable PWC timer interrupt successfully
ErrorInvalidParameterIf one of following cases match:
  • pstcBt == NULL
  • Other invalid configuration

Definition at line 1888 of file bt.c.

References stc_pwc_int_sel::bPwcMeasCmpInt, stc_pwc_int_sel::bPwcMeasOverflowInt, Bt_DeInitNvic(), BtGetInternDataPtr(), ErrorInvalidParameter, Ok, stc_bt_intern_data::pfnBit0IntCallback, and stc_bt_intern_data::pfnBit2IntCallback.

Here is the call graph for this function:

en_result_t Bt_Pwc_EnableCount ( volatile FM0P_BT_PWM_TypeDef *  pstcBt)

Enable PWC timer counting.

Parameters:
[in]pstcBtBT instance
Return values:
OkEnable PWC timer counting successfully
ErrorInvalidParameterpstcBt == NULL

Definition at line 1787 of file bt.c.

References ErrorInvalidParameter, and Ok.

en_result_t Bt_Pwc_EnableInt ( volatile FM0P_BT_PWM_TypeDef *  pstcBt,
stc_pwc_int_sel_t pstcIntSel,
stc_pwc_int_cb_t pstcIntCallback 
)

Enable PWC timer interrupt.

Parameters:
[in]pstcBtBT instance
[in]pstcIntSelPointer to interrupt selection structure
[in]pstcIntCallbackPointer to interrupt callback function
Return values:
OkEnable PWC timer interrupt successfully
ErrorInvalidParameterIf one of following cases matchs:
  • pstcBt == NULL
  • pfnIntCallback == NULL
  • Other invalid configuration

Definition at line 1838 of file bt.c.

References stc_pwc_int_sel::bPwcMeasCmpInt, stc_pwc_int_sel::bPwcMeasOverflowInt, Bt_InitNvic(), BtGetInternDataPtr(), ErrorInvalidParameter, Ok, stc_bt_intern_data::pfnBit0IntCallback, stc_bt_intern_data::pfnBit2IntCallback, stc_pwc_int_cb::pfnPwcMeasCmpCallback, and stc_pwc_int_cb::pfnPwcMeasOverflowCallback.

Here is the call graph for this function:

uint16_t Bt_Pwc_Get16BitMeasureData ( volatile FM0P_BT_PWM_TypeDef *  pstcBt)

Get 16 bits measure data of PWC timer.

This function reads measure data in 16-bit timer mode.

Parameters:
[in]pstcBtBT instance
Return values:
Measuredata

Definition at line 2032 of file bt.c.

uint32_t Bt_Pwc_Get32BitMeasureData ( volatile FM0P_BT_PWM_TypeDef *  pstcBt)

Get 32 bits measure data of PWC timer.

This function reads measure data in 32-bit timer mode, the input BT instance should point to register base address of even channel.

Parameters:
[in]pstcBtBT instance
Return values:
Measuredata

Definition at line 2050 of file bt.c.

References BT1, BT3, BT5, and BT7.

en_stat_flag_t Bt_Pwc_GetErrorFlag ( volatile FM0P_BT_PWM_TypeDef *  pstcBt)

Get error flag of PWC timer.

If the measured data is not read out when the next data is coming, the error flag will be set.

Parameters:
[in]pstcBtBT instance
Return values:
PdlSetError flag is set
PdlClrError flag is clear

Definition at line 2013 of file bt.c.

References PdlClr, and PdlSet.

en_int_flag_t Bt_Pwc_GetIntFlag ( volatile FM0P_BT_PWM_TypeDef *  pstcBt,
en_bt_pwc_int_t  enIntType 
)

Get interrupt flag of PWC timer.

Parameters:
[in]pstcBtBT instance
[in]enIntTypePWC timer interrupt type
  • PwcMeasureCompleteInt PWC measure complete interrupt
  • PwcMeasureOverflowInt PWC overflow interrupt
Return values:
PdlSetInterrupt flag is set
PdlClrInterrupt flag is clear

Definition at line 1947 of file bt.c.

References PdlClr, PdlSet, PwcMeasureCompleteInt, and PwcMeasureOverflowInt.

en_result_t Bt_Pwc_Init ( volatile FM0P_BT_PWM_TypeDef *  pstcBt,
stc_bt_pwc_config_t pstcPwcConfig 
)

Initialize PWC function of BT.

Parameters:
[in]pstcBtBT instance
[in]pstcPwcConfigPointer to PWC configuration
Return values:
OkPWC function has been configured successfully
ErrorInvalidParameterIf one of following cases matchs:
  • pstcBt == NULL
  • Other invalid configuration

Definition at line 1683 of file bt.c.

References BtGetInternDataPtr(), stc_bt_pwc_config::enMeasureEdge, stc_bt_pwc_config::enMode, stc_bt_pwc_config::enPres, stc_bt_pwc_config::enSize, ErrorInvalidParameter, Ok, PwcMeasureFallingToRising, PwcOneshot, PwcPres1Div2048, PwcPres1Div512, and PwcSize32Bit.

Here is the call graph for this function:

en_result_t Bt_Pwm_ClrIntFlag ( volatile FM0P_BT_PWM_TypeDef *  pstcBt,
en_bt_pwm_int_t  enIntType 
)

Clear interrupt flag of PWM timer.

Parameters:
[in]pstcBtBT instance
[in]enIntTypePWM timer interrupt type
  • PwmTrigInt PWM trigger detection interrupt
  • PwmDutyMatchInt PWM duty match interrupt
  • PwmUnderflowInt PWM underflow interrupt
Return values:
ErrorInvalidParameterpstcBt == NULL enIntType > PwmUnderflowInt
OkClear interrupt flag successfully

Definition at line 769 of file bt.c.

References ErrorInvalidParameter, Ok, PwmDutyMatchInt, PwmTrigInt, and PwmUnderflowInt.

en_result_t Bt_Pwm_DeInit ( volatile FM0P_BT_PWM_TypeDef *  pstcBt)

De-Initialize PWM function of BT.

Parameters:
[in]pstcBtBT instance
Return values:
OkPWM function has been de-initialized successfully
ErrorInvalidParameterpstcBt == NULL Other invalid configuration

Definition at line 491 of file bt.c.

References Bt_DeInitNvic(), BtGetInternDataPtr(), ErrorInvalidParameter, and Ok.

Here is the call graph for this function:

en_result_t Bt_Pwm_DisableCount ( volatile FM0P_BT_PWM_TypeDef *  pstcBt)

Disable PWM timer counting.

Parameters:
[in]pstcBtBT instance
Return values:
OkDisable PWM timer counting successfully
ErrorInvalidParameterpstcBt == NULL

Definition at line 555 of file bt.c.

References ErrorInvalidParameter, and Ok.

en_result_t Bt_Pwm_DisableInt ( volatile FM0P_BT_PWM_TypeDef *  pstcBt,
stc_pwm_int_sel_t pstcIntSel 
)

Disable PWM timer interrupt.

Parameters:
[in]pstcBtBT instance
[in]pstcIntSelPointer to interrupt selection structure
Return values:
OkDisable PWM timer interrupt successfully
ErrorInvalidParameterpstcBt == NULL Other invalid configuration

Definition at line 661 of file bt.c.

References stc_pwm_int_sel::bPwmDutyMatchInt, stc_pwm_int_sel::bPwmTrigInt, stc_pwm_int_sel::bPwmUnderflowInt, Bt_DeInitNvic(), BtGetInternDataPtr(), ErrorInvalidParameter, Ok, stc_bt_intern_data::pfnBit0IntCallback, stc_bt_intern_data::pfnBit1IntCallback, and stc_bt_intern_data::pfnBit2IntCallback.

Here is the call graph for this function:

en_result_t Bt_Pwm_EnableCount ( volatile FM0P_BT_PWM_TypeDef *  pstcBt)

Enable PWM timer counting.

Parameters:
[in]pstcBtBT instance
Return values:
OkEnable PWM timer counting successfully
ErrorInvalidParameterpstcBt == NULL

Definition at line 534 of file bt.c.

References ErrorInvalidParameter, and Ok.

en_result_t Bt_Pwm_EnableInt ( volatile FM0P_BT_PWM_TypeDef *  pstcBt,
stc_pwm_int_sel_t pstcIntSel,
stc_pwm_int_cb_t pstcIntCallback 
)

Enable PWM timer interrupt.

Parameters:
[in]pstcBtBT instance
[in]pstcIntSelPointer to interrupt selection structure
[in]pstcIntCallbackPointer to interrupt callback function
Return values:
OkEnable PWM timer interrupt successfully
ErrorInvalidParameterIf one of following cases matchs:
  • pstcBt == NULL
  • pfnIntCallback == NULL
  • Other invalid configuration

Definition at line 606 of file bt.c.

References stc_pwm_int_sel::bPwmDutyMatchInt, stc_pwm_int_sel::bPwmTrigInt, stc_pwm_int_sel::bPwmUnderflowInt, Bt_InitNvic(), BtGetInternDataPtr(), ErrorInvalidParameter, Ok, stc_bt_intern_data::pfnBit0IntCallback, stc_bt_intern_data::pfnBit1IntCallback, stc_bt_intern_data::pfnBit2IntCallback, stc_pwm_int_cb::pfnPwmDutyMatchIntCallback, stc_pwm_int_cb::pfnPwmTrigIntCallback, and stc_pwm_int_cb::pfnPwmUnderflowIntCallback.

Here is the call graph for this function:

en_result_t Bt_Pwm_EnableSwTrig ( volatile FM0P_BT_PWM_TypeDef *  pstcBt)

Start PWM timer by software.

Parameters:
[in]pstcBtBT instance
Return values:
OkStart PWM timer successfully
ErrorInvalidParameterpstcBt == NULL

Definition at line 576 of file bt.c.

References ErrorInvalidParameter, and Ok.

en_int_flag_t Bt_Pwm_GetIntFlag ( volatile FM0P_BT_PWM_TypeDef *  pstcBt,
en_bt_pwm_int_t  enIntType 
)

Get interrupt flag of PWM timer.

Parameters:
[in]pstcBtBT instance
[in]enIntTypePWM timer interrupt type
  • PwmTrigInt PWM trigger detection interrupt
  • PwmDutyMatchInt PWM duty match interrupt
  • PwmUnderflowInt PWM underflow interrupt
Return values:
PdlSetInterrupt flag is set
PdlClrInterrupt flag is clear

Definition at line 733 of file bt.c.

References PdlClr, PdlSet, PwmDutyMatchInt, PwmTrigInt, and PwmUnderflowInt.

en_result_t Bt_Pwm_Init ( volatile FM0P_BT_PWM_TypeDef *  pstcBt,
stc_bt_pwm_config_t pstcPwmConfig 
)

Initialize PWM function of BT.

Parameters:
[in]pstcBtBT instance
[in]pstcPwmConfigPointer to PWM configuration
Return values:
OkPWM function has been configured successfully
ErrorInvalidParameterpstcBt == NULL Other invalid configuration

Definition at line 424 of file bt.c.

References BtGetInternDataPtr(), stc_bt_pwm_config::enExtTrig, stc_bt_pwm_config::enMode, stc_bt_pwm_config::enOutputMask, stc_bt_pwm_config::enOutputPolarity, stc_bt_pwm_config::enPres, stc_bt_pwm_config::enRestartEn, ErrorInvalidParameter, Ok, PwmExtTrigBoth, PwmOneshot, PwmOutputMask, PwmPolarityHigh, PwmPres1Div2048, PwmPres1Div512, and PwmRestartEnable.

Here is the call graph for this function:

uint16_t Bt_Pwm_ReadCurCnt ( volatile FM0P_BT_PWM_TypeDef *  pstcBt)

Read current count value of PWM timer.

Parameters:
[in]pstcBtBT instance
Return values:
Currentcount value

Definition at line 846 of file bt.c.

en_result_t Bt_Pwm_WriteCycleVal ( volatile FM0P_BT_PWM_TypeDef *  pstcBt,
uint16_t  u16Cycle 
)

Write Cycle value of PWM timer.

Parameters:
[in]pstcBtBT instance
[in]u16CycleCycle value
Return values:
OkWrite Cycle value successfully
ErrorInvalidParameterpstcBt == NULL

Definition at line 804 of file bt.c.

References ErrorInvalidParameter, and Ok.

en_result_t Bt_Pwm_WriteDutyVal ( volatile FM0P_BT_PWM_TypeDef *  pstcBt,
uint16_t  u16Duty 
)

Write duty value of PWM timer.

Parameters:
[in]pstcBtBT instance
[in]u16DutyDury value
Return values:
OkWrite duty value successfully
ErrorInvalidParameterpstcBt == NUL

Definition at line 826 of file bt.c.

References ErrorInvalidParameter, and Ok.

en_result_t Bt_Rt_ClrIntFlag ( volatile FM0P_BT_PWM_TypeDef *  pstcBt,
en_bt_rt_int_t  enIntType 
)

Clear interrupt flag of Reload timer.

Parameters:
[in]pstcBtBT instance
[in]enIntTypeReload timer interrupt type
  • RtTrigInt Reload timer trigger detection flag
  • RtUnderflowInt Reload timer underflow interrupt flag
Return values:
ErrorInvalidParameterIf one of following cases matchs:
  • pstcBt == NULL
  • enIntType > RtUnderflowInt
OkClear interrupt flag successfully

Definition at line 1614 of file bt.c.

References ErrorInvalidParameter, Ok, RtTrigInt, and RtUnderflowInt.

en_result_t Bt_Rt_DeInit ( volatile FM0P_BT_PWM_TypeDef *  pstcBt)

De-Initialize RT function of BT.

Parameters:
[in]pstcBtBT instance
Return values:
OkRT function has been de-initialized successfully
ErrorInvalidParameterIf one of following cases matchs:
  • pstcBt == NULL
  • Other invalid configuration

Definition at line 1366 of file bt.c.

References Bt_DeInitNvic(), BtGetInternDataPtr(), ErrorInvalidParameter, and Ok.

Here is the call graph for this function:

en_result_t Bt_Rt_DisableCount ( volatile FM0P_BT_PWM_TypeDef *  pstcBt)

Disable Reload timer counting.

Parameters:
[in]pstcBtBT instance
Return values:
OkDisable RT timer counting successfully
ErrorInvalidParameterpstcBt == NULL

Definition at line 1430 of file bt.c.

References ErrorInvalidParameter, and Ok.

en_result_t Bt_Rt_DisableInt ( volatile FM0P_BT_PWM_TypeDef *  pstcBt,
stc_rt_int_sel_t pstcIntSel 
)

Disable Reload timer interrupt.

Parameters:
[in]pstcBtBT instance
[in]pstcIntSelPointer to interrupt select structure
Return values:
OkDisable Reload timer interrupt successfully
ErrorInvalidParameterIf one of followng cases matchs:
  • pstcBt == NULL
  • Other invalid configuration

Definition at line 1531 of file bt.c.

References stc_rt_int_sel::bRtTrigInt, stc_rt_int_sel::bRtUnderflowInt, Bt_DeInitNvic(), BtGetInternDataPtr(), ErrorInvalidParameter, Ok, stc_bt_intern_data::pfnBit0IntCallback, and stc_bt_intern_data::pfnBit2IntCallback.

Here is the call graph for this function:

en_result_t Bt_Rt_EnableCount ( volatile FM0P_BT_PWM_TypeDef *  pstcBt)

Enable Reload timer counting.

Parameters:
[in]pstcBtBT instance
Return values:
OkEnable RT timer counting successfully
ErrorInvalidParameterpstcBt == NULL

Definition at line 1409 of file bt.c.

References ErrorInvalidParameter, and Ok.

en_result_t Bt_Rt_EnableInt ( volatile FM0P_BT_PWM_TypeDef *  pstcBt,
stc_rt_int_sel_t pstcIntSel,
stc_rt_int_cb_t pstcIntCallback 
)

Enable Reload timer interrupt.

Parameters:
[in]pstcBtBT instance
[in]pstcIntSelPointer to interrupt select structure
[in]pstcIntCallbackPointer to interrupt callback function
Return values:
OkEnable Reload timer interrupt successfully
ErrorInvalidParameterIf one of followng cases matchs:
  • pstcBt == NULL
  • pfnIntCallback == NULL
  • Other invalid configuration

Definition at line 1481 of file bt.c.

References stc_rt_int_sel::bRtTrigInt, stc_rt_int_sel::bRtUnderflowInt, Bt_InitNvic(), BtGetInternDataPtr(), ErrorInvalidParameter, Ok, stc_bt_intern_data::pfnBit0IntCallback, stc_bt_intern_data::pfnBit2IntCallback, stc_rt_int_cb::pfnRtTrigIntCallback, and stc_rt_int_cb::pfnRtUnderflowIntCallback.

Here is the call graph for this function:

en_result_t Bt_Rt_EnableSwTrig ( volatile FM0P_BT_PWM_TypeDef *  pstcBt)

Start Reload timer by software.

Parameters:
[in]pstcBtBT instance
Return values:
OkStart Reload timer successfully
ErrorInvalidParameterpstcBt == NULL

Definition at line 1451 of file bt.c.

References ErrorInvalidParameter, and Ok.

en_int_flag_t Bt_Rt_GetIntFlag ( volatile FM0P_BT_PWM_TypeDef *  pstcBt,
en_bt_rt_int_t  enIntType 
)

Get interrupt flag of Reload timer.

Parameters:
[in]pstcBtBT instance
[in]enIntTypeReload timer interrupt type
  • RtTrigInt Reload timer trigger detection flag
  • RtUnderflowInt Reload timer underflow interrupt flag
Return values:
PdlSetInterrupt flag is set
PdlClrInterrupt flag is clear

Definition at line 1581 of file bt.c.

References PdlClr, PdlSet, RtTrigInt, and RtUnderflowInt.

en_result_t Bt_Rt_Init ( volatile FM0P_BT_PWM_TypeDef *  pstcBt,
stc_bt_rt_config_t pstcRtConfig 
)

Initialize RT function of BT.

Parameters:
[in]pstcBtBT instance
[in]pstcRtConfigPointer to RT configuration
Return values:
OkRT function has been configured successfully
ErrorInvalidParameterIf one of following cases matchs:
  • pstcBt == NULL
  • Other invalid configuration

Definition at line 1280 of file bt.c.

References BtGetInternDataPtr(), stc_bt_rt_config::enExtTrig, stc_bt_rt_config::enMode, stc_bt_rt_config::enOutputPolarity, stc_bt_rt_config::enPres, stc_bt_rt_config::enSize, ErrorInvalidParameter, Ok, RtExtTiggerBothEdge, RtExtTiggerHighLevel, RtExtTiggerLowLevel, RtOneshot, RtPolarityHigh, RtPres1Div2048, RtPres1Div512, and RtSize32Bit.

Here is the call graph for this function:

uint16_t Bt_Rt_ReadCurCnt ( volatile FM0P_BT_PWM_TypeDef *  pstcBt)

Read current count value of Reload timer.

Parameters:
[in]pstcBtBT instance
Return values:
Currentcount value

Definition at line 1666 of file bt.c.

en_result_t Bt_Rt_WriteCycleVal ( volatile FM0P_BT_PWM_TypeDef *  pstcBt,
uint16_t  u16Val 
)

Write count cycle of Reload timer.

Parameters:
[in]pstcBtBT instance
[in]u16ValCycle value
Return values:
OkWrite count cycle successfully
ErrorInvalidParameterpstcBt == NULL

Definition at line 1646 of file bt.c.

References ErrorInvalidParameter, and Ok.

en_result_t Bt_SelTimerMode ( volatile FM0P_BT_PWM_TypeDef *  pstcBt,
en_bt_timer_mode_t  enTimerMode 
)

Select timer function of BT.

Parameters:
[in]pstcBtBT instance
[in]enTimerModeTimer mode
  • BtResetMode Reset mode (Initial mode)
  • BtPwmMode PWM mode
  • BtPpgMode PPG mode
  • BtRtMode Reload timer mode
  • BtPwcMode PWC mode
Return values:
OkBT timer mode has been selected successfully
ErrorInvalidParameterpstcBt == NULL Other invalid configuration

Definition at line 366 of file bt.c.

References BtGetInternDataPtr(), BtPpgMode, BtPwcMode, BtPwmMode, BtResetMode, BtRtMode, ErrorInvalidParameter, and Ok.

Here is the call graph for this function:

void Bt_SetSimultaneousStart ( uint16_t  u16Value)

Set the Simultaneous Start register of Base timer.

This function is only valid in BTIO mode 5 and mode 6, otherwise don't use this function!

Parameters:
[in]u16ValueThe bit map is shown as following:
  • Bit0 ----- Ch.0
  • Bit1 ----- Ch.1
  • ...
  • Bit15 ----- Ch.15
Return values:
None

Definition at line 2078 of file bt.c.

static stc_bt_intern_data_t* BtGetInternDataPtr ( volatile FM0P_BT_PWM_TypeDef *  pstcBt) [static]

Return the internal data for a certain BT instance.

Parameters:
pstcBtPointer to BT instance
Returns:
Pointer to internal data or NULL if instance is not enabled (or not known)

Definition at line 130 of file bt.c.

References BT_INSTANCE_COUNT, and stc_bt_instance_data::stcInternData.

Referenced by Bt_ConfigIOMode(), Bt_Ppg_DeInit(), Bt_Ppg_DisableInt(), Bt_Ppg_EnableInt(), Bt_Ppg_Init(), Bt_Pwc_DeInit(), Bt_Pwc_DisableInt(), Bt_Pwc_EnableInt(), Bt_Pwc_Init(), Bt_Pwm_DeInit(), Bt_Pwm_DisableInt(), Bt_Pwm_EnableInt(), Bt_Pwm_Init(), Bt_Rt_DeInit(), Bt_Rt_DisableInt(), Bt_Rt_EnableInt(), Bt_Rt_Init(), and Bt_SelTimerMode().

Here is the caller graph for this function:


Variable Documentation