forked from ttrftech/NanoVNA
-
Notifications
You must be signed in to change notification settings - Fork 53
/
si446x_defs.h
124 lines (109 loc) · 4.12 KB
/
si446x_defs.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
/*
* Project: Si4463 Radio Library for AVR and Arduino
* Author: Zak Kemble, [email protected]
* Copyright: (C) 2017 by Zak Kemble
* License: GNU GPL v3 (see License.txt)
* Web: http://blog.zakkemble.co.uk/si4463-radio-library-avr-arduino/
*/
#ifndef SI446X_DEFS_H_
#define SI446X_DEFS_H_
#define SI446X_CMD_POWER_UP 0x02
#define SI446X_CMD_NOP 0x00
#define SI446X_CMD_PART_INFO 0x01
#define SI446X_CMD_FUNC_INFO 0x10
#define SI446X_CMD_SET_PROPERTY 0x11
#define SI446X_CMD_GET_PROPERTY 0x12
#define SI446X_CMD_GPIO_PIN_CFG 0x13
#define SI446X_CMD_FIFO_INFO 0x15
#define SI446X_CMD_GET_INT_STATUS 0x20
#define SI446X_CMD_REQUEST_DEVICE_STATE 0x33
#define SI446X_CMD_CHANGE_STATE 0x34
#define SI446X_CMD_READ_CMD_BUFF 0x44
#define SI446X_CMD_READ_FRR_A 0x50
#define SI446X_CMD_READ_FRR_B 0x51
#define SI446X_CMD_READ_FRR_C 0x53
#define SI446X_CMD_READ_FRR_D 0x57
#define SI446X_CMD_IRCAL 0x17
#define SI446X_CMD_IRCAL_MANUAL 0x1a
#define SI446X_CMD_START_TX 0x31
#define SI446X_CMD_TX_HOP 0x37
#define SI446X_CMD_WRITE_TX_FIFO 0x66
#define SI446X_CMD_PACKET_INFO 0x16
#define SI446X_CMD_GET_MODEM_STATUS 0x22
#define SI446X_CMD_START_RX 0x32
#define SI446X_CMD_RX_HOP 0x36
#define SI446X_CMD_READ_RX_FIFO 0x77
#define SI446X_CMD_GET_ADC_READING 0x14
#define SI446X_CMD_GET_PH_STATUS 0x21
#define SI446X_CMD_GET_CHIP_STATUS 0x23
#define SI446X_INT_CTL_CHIP_LOW_BATT_EN 1
#define SI446X_INT_CTL_CHIP_WUT_EN 0
typedef enum
{
SI446X_ADC_CONV_TEMP = 16,
SI446X_ADC_CONV_BATT = 8,
SI446X_ADC_CONV_GPIO = 4
} si446x_adc_conv_t;
typedef enum
{
SI446X_ADC_RANGE_0P8 = 0,
SI446X_ADC_RANGE_1P6 = 4,
SI446X_ADC_RANGE_3P2 = 5,
SI446X_ADC_RANGE_2P4 = 8,
SI446X_ADC_RANGE_3P6 = 9
} si446x_adc_range_t;
#define SI446X_FIFO_CLEAR_RX 0x02
#define SI446X_FIFO_CLEAR_TX 0x01
#define GLOBAL_PROP(prop) ((SI446X_PROP_GROUP_GLOBAL<<8) | prop)
#define INT_PROP(prop) ((SI446X_PROP_GROUP_INT<<8) | prop)
#define PKT_PROP(prop) ((SI446X_PROP_GROUP_PKT<<8) | prop)
#define PA_PROP(prop) ((SI446X_PROP_GROUP_PA<<8) | prop)
#define MATCH_PROP(prop) ((SI446X_PROP_GROUP_MATCH<<8) | prop)
#define SI446X_GLOBAL_CONFIG GLOBAL_PROP(0x03)
#define SI446X_FIFO_MODE_HALF_DUPLEX 0x10
#define SI446X_GLOBAL_CLK_CFG GLOBAL_PROP(0x01)
#define SI446X_DIVIDED_CLK_DIS 0x00
#define SI446X_DIVIDED_CLK_EN 0x40
#define SI446X_DIVIDED_CLK_SEL_DIV_1 0<<5
#define SI446X_DIVIDED_CLK_SEL_DIV_2 1<<5
#define SI446X_DIVIDED_CLK_SEL_DIV_3 2<<5
#define SI446X_DIVIDED_CLK_SEL_DIV_7_5 3<<5
#define SI446X_DIVIDED_CLK_SEL_DIV_10 4<<5
#define SI446X_DIVIDED_CLK_SEL_DIV_15 5<<5
#define SI446X_DIVIDED_CLK_SEL_DIV_30 6<<5
#define SI446X_DIVIDED_CLK_32K_SEL_OFF 0x00
#define SI446X_DIVIDED_CLK_32K_SEL_RC 0x01
#define SI446X_DIVIDED_CLK_32K_SEL_XTAL 0x02
#define SI446X_GLOBAL_LOW_BATT_THRESH GLOBAL_PROP(0x02)
#define SI446X_GLOBAL_WUT_CONFIG GLOBAL_PROP(0x04)
#define SI446X_GLOBAL_WUT_M GLOBAL_PROP(0x05)
#define SI446X_GLOBAL_WUT_R GLOBAL_PROP(0x07)
#define SI446X_GLOBAL_WUT_LDC GLOBAL_PROP(0x08)
#define SI446X_WUT_SLEEP 5
#define SI446X_LDC_MAX_PERIODS_FOREVER 0<<6
#define SI446X_LDC_MAX_PERIODS_TWO 1<<6
#define SI446X_LDC_MAX_PERIODS_FOUR 2<<6
#define SI446X_LDC_MAX_PERIODS_EIGHT 3<<6
#define SI446X_GLOBAL_WUT_CONFIG_WUT_LDC_EN_RX 1<<6
#define SI446X_GLOBAL_WUT_CONFIG_WUT_EN 1
#define SI446X_GLOBAL_WUT_CONFIG_WUT_LBD_EN 2
#define SI446X_INT_CTL_ENABLE INT_PROP(0x00)
#define SI446X_INT_CTL_PH_ENABLE INT_PROP(0x01)
#define SI446X_INT_CTL_MODEM_ENABLE INT_PROP(0x02)
#define SI446X_INT_CTL_CHIP_ENABLE INT_PROP(0x03)
#define SI446X_FILTER_MATCH_PEND 7
#define SI446X_FILTER_MISS_PEND 6
#define SI446X_PACKET_SENT_PEND 5
#define SI446X_PACKET_RX_PEND 4
#define SI446X_CRC_ERROR_PEND 3
#define SI446X_INVALID_SYNC_PEND 5
#define SI446X_SYNC_DETECT_PEND 0
#define SI446X_LOW_BATT_PEND 1
#define SI446X_WUT_PEND 0
#define SI446X_MATCH_VALUE_1 MATCH_PROP(0x00)
#define SI446X_MATCH_EN 0x40
#define SI446X_PA_PWR_LVL PA_PROP(0x01)
#define SI446X_PKT_FIELD_1_LENGTH PKT_PROP(0x0D)
#define SI446X_PKT_FIELD_2_LENGTH PKT_PROP(0x11)
#define SI446X_PKT_FIELD_2_LENGTH_LOW PKT_PROP(0x12)
#endif /* SI446X_DEFS_H_ */