blob: 49a8e136d88478721daee7bcc32dd4f1c28cab64 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
/**
*********************************************************************************************************
* Copyright(c) 2020, Realtek Semiconductor Corporation. All rights reserved.
*********************************************************************************************************
* @file ir_nec_protocol.h
* @brief
* @details
* @author barry_bian
* @date 2020-02-26
* @version v1.0
* *********************************************************************************************************
*/
#ifndef _IR_NEC_PROTOCOL_H_
#define _IR_NEC_PROTOCOL_H_
#include "stdint.h"
#include "ir_send_driver.h"
#include "key_handle.h"
#define IR_NEC_DECODE 0
#define NEC_SEND_FREQUENCY 38000 /*38KHz*/
#define NEC_ADDRESS 0x88
#define NEC_CODE_LEN 4
#define NEC_MAX_HEADDER_LEN 16
#define NEC_MAX_LOG_WAVFORM_SIZE 2
#define NEC_MAX_CODE_SIZE 12
#define NEC_MAX_REPETA_CODE_SIZE 3
#define NEC_IR_COMMAND_PERIOD 108 /*ms*/
#define NEC_IR_REPEAT_CODE_PERIOD 108 /*ms*/
typedef struct
{
uint16_t header_len;
uint32_t header_context[NEC_MAX_HEADDER_LEN];
uint32_t log0_context[NEC_MAX_LOG_WAVFORM_SIZE];
uint32_t log1_context[NEC_MAX_LOG_WAVFORM_SIZE];
uint32_t stop_context;
uint32_t dif_base;
uint32_t dif_divisor;
} T_IR_NEC_SPEC;
typedef struct
{
uint32_t repeat_code_len;
uint32_t repeat_code_buf[NEC_MAX_REPETA_CODE_SIZE];
} T_IR_NEC_REPEAT_CODE_SPEC;
typedef struct
{
float carrier_frequency_hz;
uint8_t code[NEC_MAX_CODE_SIZE];
uint8_t code_len;
uint16_t buf_len;
uint32_t *p_buf;
} T_IR_NEC_BUF;
T_IRDA_RET ir_protocol_nec_command_encode(IR_KEY_CODE ir_key_command,
T_IR_SEND_PARA *p_ir_send_parameters);
T_IRDA_RET ir_protocol_nec_repeat_code_encode(T_IR_SEND_PARA *p_ir_send_parameters);
#endif
|