Bouffalo SDK  1.0
Bouffalolab Software Development Kit
bflb_ir.h
Go to the documentation of this file.
1 #ifndef _BFLB_IR_H
2 #define _BFLB_IR_H
3 
4 #include "bflb_core.h"
5 
14 #if !defined(BL616)
15 
18 #define IR_TX_NEC 0
19 #define IR_TX_RC5 1
20 #define IR_TX_SWM 2
21 #define IR_TX_CUSTOMIZE 3
22 
29 #if !defined(BL602) && !defined(BL702)
30 #define IR_TX_FIFO_WIDTH_8BIT 0
31 #define IR_TX_FIFO_WIDTH_16BIT 1
32 #define IR_TX_FIFO_WIDTH_24BIT 2
33 #endif
34 #define IR_TX_FIFO_WIDTH_32BIT 3
35 
42 #define IR_TX_INTEN_END (1 << 0)
43 #if !defined(BL602) && !defined(BL702)
44 #define IR_TX_INTEN_FIFO (1 << 1)
45 #define IR_TX_INTEN_FER (1 << 2)
46 #endif
47 
54 #define IR_TX_INTSTS_END (1 << 0)
55 #if !defined(BL602) && !defined(BL702)
56 #define IR_TX_INTSTS_FIFO (1 << 1)
57 #define IR_TX_INTSTS_FER (1 << 2)
58 #endif
59 
63 #endif
64 
65 #if !defined(BL702L)
66 
69 #define IR_RX_NEC 0
70 #define IR_RX_RC5 1
71 #define IR_RX_SWM 2
72 
79 #define IR_RX_INTEN_END (1 << 0)
80 #if !defined(BL602) && !defined(BL702)
81 #define IR_RX_INTEN_FIFO (1 << 1)
82 #define IR_RX_INTEN_FER (1 << 2)
83 #endif
84 
91 #define IR_RX_INTSTS_END (1 << 0)
92 #if !defined(BL602) && !defined(BL702)
93 #define IR_RX_INTSTS_FIFO (1 << 1)
94 #define IR_RX_INTSTS_FER (1 << 2)
95 #endif
96 
99 #endif
100 
101 #if !defined(BL616)
102 
134  uint8_t tx_mode;
135  uint8_t data_bits;
136  uint8_t tail_inverse;
137  uint8_t tail_enable;
138  uint8_t head_inverse;
139  uint8_t head_enable;
140  uint8_t logic1_inverse;
141  uint8_t logic0_inverse;
142  uint8_t data_enable;
143  uint8_t swm_enable;
145  uint8_t output_inverse;
146  uint8_t freerun_enable;
148  uint8_t fifo_width;
149  uint8_t fifo_threshold;
158  uint8_t modu_width_1;
159  uint8_t modu_width_0;
161 };
162 #endif
163 
164 #if !defined(BL702L)
165 
177  uint8_t rx_mode;
178  uint8_t input_inverse;
180  uint8_t deglitch_cnt;
181  uint16_t data_threshold;
182  uint16_t end_threshold;
183  uint16_t fifo_threshold;
184 };
185 #endif
186 
187 #ifdef __cplusplus
188 extern "C" {
189 #endif
190 
191 #if !defined(BL616)
192 
198 void bflb_ir_tx_init(struct bflb_device_s *dev, const struct bflb_ir_tx_config_s *config);
199 
207 void bflb_ir_send(struct bflb_device_s *dev, uint32_t *data, uint32_t length);
208 
216 void bflb_ir_swm_send(struct bflb_device_s *dev, uint16_t *data, uint8_t length);
217 
224 void bflb_ir_tx_enable(struct bflb_device_s *dev, bool enable);
225 
233 void bflb_ir_txint_mask(struct bflb_device_s *dev, uint8_t int_type, bool mask);
234 
241 uint32_t bflb_ir_get_txint_status(struct bflb_device_s *dev);
242 
248 void bflb_ir_txint_clear(struct bflb_device_s *dev);
249 
250 #if !defined(BL602) && !defined(BL702)
251 
257 void bflb_ir_link_txdma(struct bflb_device_s *dev, bool enable);
258 
265 uint8_t bflb_ir_get_txfifo_cnt(struct bflb_device_s *dev);
266 
272 void bflb_ir_txfifo_clear(struct bflb_device_s *dev);
273 #endif
274 #endif
275 
276 #if !defined(BL702L)
277 
283 void bflb_ir_rx_init(struct bflb_device_s *dev, const struct bflb_ir_rx_config_s *config);
284 
292 uint8_t bflb_ir_receive(struct bflb_device_s *dev, uint64_t *data);
293 
302 uint8_t bflb_ir_swm_receive(struct bflb_device_s *dev, uint16_t *data, uint8_t length);
303 
310 void bflb_ir_rx_enable(struct bflb_device_s *dev, bool enable);
311 
318 uint8_t bflb_ir_get_rxfifo_cnt(struct bflb_device_s *dev);
319 
325 void bflb_ir_rxfifo_clear(struct bflb_device_s *dev);
326 
334 void bflb_ir_rxint_mask(struct bflb_device_s *dev, uint8_t int_type, bool mask);
335 
342 uint32_t bflb_ir_get_rxint_status(struct bflb_device_s *dev);
343 
349 void bflb_ir_rxint_clear(struct bflb_device_s *dev);
350 
351 #endif
352 
361 int bflb_ir_feature_control(struct bflb_device_s *dev, int cmd, size_t arg);
362 
363 #ifdef __cplusplus
364 }
365 #endif
366 
375 #endif
uint8_t head_inverse
Definition: bflb_ir.h:138
uint16_t pulse_width_unit
Definition: bflb_ir.h:160
void bflb_ir_swm_send(struct bflb_device_s *dev, uint16_t *data, uint8_t length)
Send data in software mode.
void bflb_ir_tx_init(struct bflb_device_s *dev, const struct bflb_ir_tx_config_s *config)
Initialize ir tx.
void bflb_ir_rx_init(struct bflb_device_s *dev, const struct bflb_ir_rx_config_s *config)
Initialize ir rx.
uint8_t logic0_pulse_width_0
Definition: bflb_ir.h:151
uint8_t head_pulse_width_1
Definition: bflb_ir.h:154
uint8_t logic1_inverse
Definition: bflb_ir.h:140
uint8_t tail_enable
Definition: bflb_ir.h:137
uint32_t bflb_ir_get_txint_status(struct bflb_device_s *dev)
Get ir tx interrupt status.
uint8_t logic1_pulse_width_1
Definition: bflb_ir.h:152
uint8_t logic1_pulse_width_0
Definition: bflb_ir.h:153
void bflb_ir_rxint_clear(struct bflb_device_s *dev)
Clear ir rx interrupt.
uint8_t swm_enable
Definition: bflb_ir.h:143
uint8_t head_enable
Definition: bflb_ir.h:139
uint8_t tail_inverse
Definition: bflb_ir.h:136
uint8_t bflb_ir_get_rxfifo_cnt(struct bflb_device_s *dev)
Get ir rx fifo available count.
uint8_t input_inverse
Definition: bflb_ir.h:178
uint8_t deglitch_enable
Definition: bflb_ir.h:179
void bflb_ir_rxfifo_clear(struct bflb_device_s *dev)
Clear ir rx fifo.
void bflb_ir_txint_mask(struct bflb_device_s *dev, uint8_t int_type, bool mask)
Mask or unmask ir tx interrupt.
uint8_t data_enable
Definition: bflb_ir.h:142
void bflb_ir_link_txdma(struct bflb_device_s *dev, bool enable)
Enable or disable ir tx dma mode.
uint8_t output_inverse
Definition: bflb_ir.h:145
void bflb_ir_txfifo_clear(struct bflb_device_s *dev)
Clear ir tx fifo.
uint8_t head_pulse_width_0
Definition: bflb_ir.h:155
void bflb_ir_rxint_mask(struct bflb_device_s *dev, uint8_t int_type, bool mask)
Mask ir rx interrupt.
void bflb_ir_txint_clear(struct bflb_device_s *dev)
Clear ir tx interrupt.
uint8_t continue_enable
Definition: bflb_ir.h:147
uint8_t bflb_ir_get_txfifo_cnt(struct bflb_device_s *dev)
Get ir tx fifo available count.
uint8_t modu_width_0
Definition: bflb_ir.h:159
uint8_t output_modulation
Definition: bflb_ir.h:144
uint8_t deglitch_cnt
Definition: bflb_ir.h:180
void bflb_ir_tx_enable(struct bflb_device_s *dev, bool enable)
Enable or disable ir tx.
void bflb_ir_send(struct bflb_device_s *dev, uint32_t *data, uint32_t length)
Send data in NEC/RC5/customize mode.
uint8_t modu_width_1
Definition: bflb_ir.h:158
uint16_t end_threshold
Definition: bflb_ir.h:182
uint8_t bflb_ir_receive(struct bflb_device_s *dev, uint64_t *data)
Receive data in NEC/RC5/customize mode.
uint8_t bflb_ir_swm_receive(struct bflb_device_s *dev, uint16_t *data, uint8_t length)
Receive data in software mode.
IR RX configuration structure.
Definition: bflb_ir.h:176
int bflb_ir_feature_control(struct bflb_device_s *dev, int cmd, size_t arg)
Control ir feature.
uint8_t logic0_pulse_width_1
Definition: bflb_ir.h:150
uint8_t fifo_width
Definition: bflb_ir.h:148
uint8_t tail_pulse_width_0
Definition: bflb_ir.h:157
uint16_t fifo_threshold
Definition: bflb_ir.h:183
uint8_t tail_pulse_width_1
Definition: bflb_ir.h:156
uint8_t logic0_inverse
Definition: bflb_ir.h:141
uint8_t fifo_threshold
Definition: bflb_ir.h:149
uint32_t bflb_ir_get_rxint_status(struct bflb_device_s *dev)
Get ir rx interrupt status.
uint8_t data_bits
Definition: bflb_ir.h:135
uint16_t data_threshold
Definition: bflb_ir.h:181
void bflb_ir_rx_enable(struct bflb_device_s *dev, bool enable)
Enable or disable ir rx.
IR TX configuration structure.
Definition: bflb_ir.h:133
uint8_t freerun_enable
Definition: bflb_ir.h:146