-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathradio.h
49 lines (34 loc) · 909 Bytes
/
radio.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
/*
* radio.h
*
* (c) 2014 George Louthan
* 3-clause BSD license; see license.md.
*/
#ifndef RADIO_H_
#define RADIO_H_
#include <stdint.h>
#define RFM_FIFO 0x00
#define RFM_OPMODE 0x01
#define RFM_MODE_RX 0b00010000
#define RFM_MODE_SB 0b00000100
#define RFM_MODE_TX 0b00001100
#define RFM_MODE_SL 0b00000000
#define RFM_IRQ1 0x27
#define RFM_IRQ2 0x28
#define RFM_BROADCAST 0xff
extern volatile uint8_t rfm_state;
#define RFM_IDLE 0
#define RFM_BUSY 1
#define RFM_AUTOMODE_RX 0b01100101
#define RFM_AUTOMODE_TX 0b01011011
#define RFM_AUTOMODE_OFF 0b00000000
void init_radio();
void write_single_register(uint8_t, uint8_t);
uint8_t read_single_register_sync(uint8_t);
void mode_sync(uint8_t mode);
void radio_send_sync();
void radio_send_half_async();
void radio_send_async();
void radio_recv();
uint8_t rfm_crcok();
#endif /* RADIO_H_ */