|
SmartSnippets DA1459x SDK
|
Go to the documentation of this file.
45 #if dg_configUSE_HW_QUAD
60 HW_QUAD_REG_CLK_OFF = 0,
61 HW_QUAD_REG_CLK_ON = 1
69 HW_QUAD_REG_CTRL_IRQ_STATUS_OFF_NO_CLR = 0,
70 HW_QUAD_REG_CTRL_IRQ_STATUS_ON_CLR = 1
78 HW_QUAD_REG_CTRL_EVENT_CNT_CLR_OFF = 0,
79 HW_QUAD_REG_CTRL_EVENT_CNT_CLR_ON = 1
87 HW_QUAD_REG_CTRL_IRQ_EN_OFF = 0,
88 HW_QUAD_REG_CTRL_IRQ_EN_ON = 1
96 HW_QUAD_REG_CTRL2_CHANNEL_EVENT_MODE_NORMAL_CNT = 0,
97 HW_QUAD_REG_CTRL2_CHANNEL_EVENT_MODE_EDGE_CNT = 1
105 HW_QUAD_REG_INPUT_NONE = 0,
106 HW_QUAD_REG_INPUT_A_P000_B_P001 = 1,
107 HW_QUAD_REG_INPUT_A_P002_B_P003 = 2,
108 HW_QUAD_REG_INPUT_A_P004_B_P005 = 3,
109 HW_QUAD_REG_INPUT_A_P008_B_P009 = 4,
110 HW_QUAD_REG_INPUT_A_P010_B_P011 = 5,
111 HW_QUAD_REG_INPUT_A_P100_B_P102 = 6,
112 HW_QUAD_REG_INPUT_A_P103_B_P105 = 7,
113 HW_QUAD_REG_INPUT_A_P106_B_P107 = 8,
114 HW_QUAD_REG_INPUT_A_P108_B_P109 = 9,
115 HW_QUAD_REG_INPUT_A_P110_B_P111 = 10,
116 HW_QUAD_REG_INPUT_A_P112_B_P101 = 11,
117 HW_QUAD_REG_INPUT_A_P104_B_P115 = 12
125 HW_QUAD_REG_CLOCKDIV_PRESCALER_OFF = 0,
126 HW_QUAD_REG_CLOCKDIV_PRESCALER_ON = 1
133 int16_t hw_quad_xcnt_raw;
134 int16_t hw_quad_ycnt_raw;
135 int16_t hw_quad_zcnt_raw;
136 uint8_t hw_quad_event_cnt_raw;
137 int16_t hw_quad_xcnt_delta;
138 int16_t hw_quad_ycnt_delta;
139 int16_t hw_quad_zcnt_delta;
191 return QUADEC->QDEC_XCNT_REG;
202 return QUADEC->QDEC_YCNT_REG;
213 return QUADEC->QDEC_ZCNT_REG;
224 return QUADEC->QDEC_EVENT_CNT_REG;
240 REG_SETF(CRG_TOP, CLK_AMBA_REG, QDEC_CLK_ENABLE, enable);
254 REG_SETF(QUADEC, QDEC_CTRL_REG, QDEC_EVENT_CNT_CLR, HW_QUAD_REG_CTRL_EVENT_CNT_CLR_ON);
265 REG_SETF(QUADEC, QDEC_CTRL_REG, QDEC_IRQ_STATUS, HW_QUAD_REG_CTRL_IRQ_STATUS_ON_CLR);
276 return REG_GETF(QUADEC, QDEC_CTRL_REG, QDEC_IRQ_STATUS);
__STATIC_FORCEINLINE void hw_quad_clr_irq_status(void)
Clear IRQ.
Definition: hw_quad_v2.h:263
#define REG_SETF(base, reg, field, new_val)
Set the value of a register field.
Definition: sdk_defs.h:738
HW_QUAD_REG_CTRL_IRQ_EN
Quadrature Decoder CTRL Register IRQ Status.
Definition: hw_quad_v2.h:86
__STATIC_FORCEINLINE void hw_quad_clr_event_cnt(void)
Clear Event Count Register.
Definition: hw_quad_v2.h:252
__STATIC_FORCEINLINE int16_t hw_quad_get_ycnt_reg(void)
Get YCNT Register.
Definition: hw_quad_v2.h:200
HW_QUAD_REG_CTRL2_CHANNEL_EVENT_MODE
Quadrature Decoder CTRL2 Register Channel X-Y-Z Event Mode.
Definition: hw_quad_v2.h:95
void hw_quad_disable(void)
Disable Quadrature Decoder.
Central include header file with platform definitions.
Local Quadrature Decoder Counter and Deltas repository definition.
Definition: hw_quad_v2.h:132
HW_QUAD_GPIO_INPUT
Quadrature Decoder CTRL2 Register Channel X-Y-Z Port Selection.
Definition: hw_quad_v2.h:104
void hw_quad_init(const hw_quad_config_t *init_data)
Initialize Quadrature Decoder.
void(* hw_quad_handler_cb)(const volatile hw_quad_values_t *quad_values, void *user_data)
Quadrature Decoder Interrupt Callback.
Definition: hw_quad_v2.h:147
HW_QUAD_REG_CTRL_EVENT_CNT_CLR
Quadrature Decoder CTRL Register Event Counter Clear.
Definition: hw_quad_v2.h:77
void hw_quad_interrupt_enable_and_register(hw_quad_handler_cb cb, uint8_t thres_num, void *user_data_p)
Enable Interrupt.
void hw_quad_interrupt_disable_and_unregister(void)
Disable Interrupt.
__STATIC_FORCEINLINE HW_QUAD_REG_CTRL_IRQ_EN hw_quad_return_irq_status(void)
Return IRQ Status.
Definition: hw_quad_v2.h:274
__STATIC_FORCEINLINE int16_t hw_quad_get_xcnt_reg(void)
Get XCNT Register.
Definition: hw_quad_v2.h:189
Initialization Struct for use with "hw_quad_init()".
Definition: hw_quad_v2.h:172
HW_QUAD_REG_CLK
Quadrature Decoder CTRL Clock Enable Status.
Definition: hw_quad_v2.h:59
HW_QUAD_REG_CTRL_IRQ_STATUS
Quadrature Decoder CTRL Register IRQ Status.
Definition: hw_quad_v2.h:68
#define GLOBAL_INT_RESTORE()
Macro to restore all interrupts.
Definition: sdk_defs.h:477
#define REG_GETF(base, reg, field)
Return the value of a register field.
Definition: sdk_defs.h:711
__STATIC_FORCEINLINE int16_t hw_quad_get_zcnt_reg(void)
Get ZCNT Register.
Definition: hw_quad_v2.h:211
HW_QUAD_REG_CLOCKDIV_PRESCALER
Quadrature Decoder CLOCKDIV Register Prescaler.
Definition: hw_quad_v2.h:124
void hw_quad_stop(void)
Stop Quadrature Decoder.
__STATIC_FORCEINLINE void hw_quad_qdec_clk_en(HW_QUAD_REG_CLK enable)
Quadrature Decoder Clock Enable/Disable.
Definition: hw_quad_v2.h:237
void hw_quad_start(void)
Start Quadrature Decoder.
__STATIC_FORCEINLINE uint8_t hw_quad_get_event_cnt_reg(void)
Get Event Count Register.
Definition: hw_quad_v2.h:222
#define GLOBAL_INT_DISABLE()
Macro to disable all interrupts.
Definition: sdk_defs.h:452