-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
rf_433mhz.h
66 lines (53 loc) · 1.31 KB
/
rf_433mhz.h
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
64
65
#ifndef rf_h_INCLUDED
#define rf_h_INCLUDED
#include <stdint.h>
#include <stdbool.h>
#define RECIEVE_MAX_BUFFER_LEN 67
#define SEPERATION_LIMIT_433MHZ 5000
#define RECIEVE_TOLERANCE_433MHZ 60
/*
* This is a pure c reimplemnation of the rc swich library, it was build to be used with open rtos
* Copyright: Felix Richter 2018
*/
typedef struct{
uint8_t high_time;
uint8_t low_time;
} pulse_t;
typedef struct{
pulse_t sync;
pulse_t zero;
pulse_t one;
bool inverted;
} protocol_433mhz;
typedef struct{
uint32_t data;
unsigned int code_lenght;
protocol_433mhz* protocol;
uint16_t pulse_length;
uint8_t repeat;
} message_433mhz;
typedef struct{
uint16_t recieve_len;
unsigned long last_time;
unsigned int changeCount;
unsigned int repeatCount;
unsigned int seperation_limit;
unsigned int recieve_tolerance;
unsigned int timeings[RECIEVE_MAX_BUFFER_LEN];
} reciever_433mhz;
void send_message_433mhz(uint8_t pin, message_433mhz* msg);
void recieve_on_interrupt(reciever_433mhz* reciever);
bool decode_recieved(reciever_433mhz* reciever, protocol_433mhz* proto, message_433mhz* msg);
reciever_433mhz* create_reciever_buffer();
extern protocol_433mhz protocols_433mhz[];
typedef enum {
PROTO1,
PROTO2,
PROTO3,
PROTO4,
PROTO5,
PROTO6,
PROTO7,
PROTOCOL_COUNT
} protocol_name_433mhz;
#endif // rf_h_INCLUDED