kw2xrf_getset.h
4.5 KB
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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
/*
* Copyright (C) 2016 Phytec Messtechnik GmbH
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/
/**
* @ingroup drivers_kw2xrf
* @{
*
* @file
* @brief get/set interfaces for kw2xrf driver
*
* @author Johann Fischer <j.fischer@phytec.de>
*/
#ifndef KW2XRF_GETSET_H
#define KW2XRF_GETSET_H
#include "kw2xrf.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Set tx power of given device
*
* @param[in] dev kw2xrf device descriptor
* @param[in] txpower transmit power in dBm
*/
void kw2xrf_set_tx_power(kw2xrf_t *dev, int16_t txpower);
/**
* @brief Get tx power value of given device
*
* @param[in] dev kw2xrf device descriptor
*
* @return current tx power value
*/
uint16_t kw2xrf_get_txpower(kw2xrf_t *dev);
/**
* @brief Set channel of given device
*
* @param[in] dev kw2xrf device descriptor
* @param[in] val channel
*/
int kw2xrf_set_channel(kw2xrf_t *dev, uint8_t val);
/**
* @brief Get channel of given device
*
* @param[in] dev kw2xrf device descriptor
*
* @return current channel
*/
uint8_t kw2xrf_get_channel(kw2xrf_t *dev);
/**
* @brief Abort current sequence of device
*
* @param[in] dev kw2xrf device descriptor
*/
void kw2xrf_abort_sequence(kw2xrf_t *dev);
/**
* @brief Set idle sequence state of device
*
* @param[in] dev kw2xrf device descriptor
*/
void kw2xrf_set_idle_sequence(kw2xrf_t *dev);
/**
* @brief Set sequence state of device
*
* @param[in] dev kw2xrf device descriptor
* @param[in] seq sequence
*/
void kw2xrf_set_sequence(kw2xrf_t *dev, kw2xrf_physeq_t seq);
/**
* @brief Set PAN ID of a given device
*
* @param[in] dev kw2xrf device descriptor
* @param[in] pan PAN ID value
*/
void kw2xrf_set_pan(kw2xrf_t *dev, uint16_t pan);
/**
* @brief Set short address of a given device
*
* @param[in] dev kw2xrf device descriptor
* @param[in] addr short address
*/
void kw2xrf_set_addr_short(kw2xrf_t *dev, uint16_t addr);
/**
* @brief Set long address of a given device
*
* @param[in] dev kw2xrf device descriptor
* @param[in] addr long address
*/
void kw2xrf_set_addr_long(kw2xrf_t *dev, uint64_t addr);
/**
* @brief Get short address of a given device
*
* @param[in] dev kw2xrf device descriptor
* @return current short address
*/
uint16_t kw2xrf_get_addr_short(kw2xrf_t *dev);
/**
* @brief Get long address of a given device
*
* @param[in] dev kw2xrf device descriptor
* @return current long address
*/
uint64_t kw2xrf_get_addr_long(kw2xrf_t *dev);
/**
* @brief Get CCA threshhold of a given device
*
* @param[in] dev kw2xrf device descriptor
* @return current CCA threshhold
*/
int8_t kw2xrf_get_cca_threshold(kw2xrf_t *dev);
/**
* @brief Set CCA threshold of a given device
*
* @param[in] dev kw2xrf device descriptor
* @param[in] value CCA threshold
*/
void kw2xrf_set_cca_threshold(kw2xrf_t *dev, int8_t value);
/**
* @brief Set CCA mode of a given device
*
* @param[in] dev kw2xrf device descriptor
* @param[in] mode CCA mode
*/
void kw2xrf_set_cca_mode(kw2xrf_t *dev, uint8_t mode);
/**
* @brief Get CCA mode of a given device
*
* @param[in] dev kw2xrf device descriptor
* @return current CCA mode
*/
uint8_t kw2xrf_get_cca_mode(kw2xrf_t *dev);
/**
* @brief Get RSSI from LQI value
*
* @param[in] value Current LQI value
*
* @return deduced RSSI in dBm
*/
uint32_t kw2xrf_get_rssi(uint32_t value);
/**
* @brief Get state of a given device
*
* @param[in] dev kw2xrf device descriptor
* @return current state
*/
netopt_state_t kw2xrf_get_status(kw2xrf_t *dev);
/**
* @brief Enable continous CCA
*
* @param[in] dev kw2xrf device descriptor
*
* @return CCA value
*/
int kw2xrf_cca(kw2xrf_t *dev);
/**
* @brief Set receive watermark
*
* @param[in] dev kw2xrf device descriptor
* @param[in] value watermark
*/
void kw2xrf_set_rx_watermark(kw2xrf_t *dev, uint8_t value);
/**
* @brief Set netopt a given device
*
* @param[in] dev kw2xrf device descriptor
* @param[in] option Netopt option type
* @param[in] state state
*/
void kw2xrf_set_option(kw2xrf_t *dev, uint16_t option, bool state);
#ifdef __cplusplus
}
#endif
#endif /* KW2XRF_GETSET_H */
/** @} */