PDL for FM4  Version1.2
Peripheral Driverl Library for FM4
bt.h File Reference
#include "pdl.h"
Include dependency graph for bt.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

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...
 

Macros

#define stc_btn_t   FM4_BT_PWM_TypeDef
 
#define BT0   (*((volatile stc_btn_t *) FM4_BT0_PWM_BASE))
 
#define BT1   (*((volatile stc_btn_t *) FM4_BT1_PWM_BASE))
 
#define BT2   (*((volatile stc_btn_t *) FM4_BT2_PWM_BASE))
 
#define BT3   (*((volatile stc_btn_t *) FM4_BT3_PWM_BASE))
 
#define BT4   (*((volatile stc_btn_t *) FM4_BT4_PWM_BASE))
 
#define BT5   (*((volatile stc_btn_t *) FM4_BT5_PWM_BASE))
 
#define BT6   (*((volatile stc_btn_t *) FM4_BT6_PWM_BASE))
 
#define BT7   (*((volatile stc_btn_t *) FM4_BT7_PWM_BASE))
 
#define BT8   (*((volatile stc_btn_t *) FM4_BT8_PWM_BASE))
 
#define BT9   (*((volatile stc_btn_t *) FM4_BT9_PWM_BASE))
 
#define BT10   (*((volatile stc_btn_t *) FM4_BT10_PWM_BASE))
 
#define BT11   (*((volatile stc_btn_t *) FM4_BT11_PWM_BASE))
 
#define BT12   (*((volatile stc_btn_t *) FM4_BT12_PWM_BASE))
 
#define BT13   (*((volatile stc_btn_t *) FM4_BT13_PWM_BASE))
 
#define BT14   (*((volatile stc_btn_t *) FM4_BT14_PWM_BASE))
 
#define BT15   (*((volatile stc_btn_t *) FM4_BT15_PWM_BASE))
 

Typedefs

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

Enumerations

enum  en_bt_instance_index {
  BtInstanceIndexBt0 = 0,
  BtInstanceIndexBt1,
  BtInstanceIndexBt2,
  BtInstanceIndexBt3,
  BtInstanceIndexBt4,
  BtInstanceIndexBt5,
  BtInstanceIndexBt6,
  BtInstanceIndexBt7,
  BtInstanceIndexBt8,
  BtInstanceIndexBt9,
  BtInstanceIndexBt10,
  BtInstanceIndexBt11,
  BtInstanceIndexBt12,
  BtInstanceIndexBt13,
  BtInstanceIndexBt14,
  BtInstanceIndexBt15,
  BtInstanceIndexMax
}
 Enumeration to define an index for each BT instance. More...
 
enum  en_bt_io_mode {
  BtIoMode0 = 0,
  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 = 0,
  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,
  PwcPres1Div16,
  PwcPres1Div128,
  PwcPres1Div256,
  PwcPres1Div512 = 8,
  PwcPres1Div1024,
  PwcPres1Div2048
}
 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

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

Variables

stc_bt_instance_data_t m_astcBtInstanceDataLut []
 Look-up table for all enabled BT instances and their internal data. More...
 

Detailed Description

Headerfile for BT functions

History:

  • 2013-05-10 0.1 Edison Zhang First version.

Definition in file bt.h.