kw41zrf_getset.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017 SKF AB
3  * Copyright (C) 2016 Phytec Messtechnik GmbH
4  *
5  * This file is subject to the terms and conditions of the GNU Lesser
6  * General Public License v2.1. See the file LICENSE in the top level
7  * directory for more details.
8  */
9 
20 #ifndef KW41ZRF_GETSET_H
21 #define KW41ZRF_GETSET_H
22 
23 #include "kw41zrf.h"
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
33 #define KW41ZRF_OPT_CSMA (0x01u)
34 #define KW41ZRF_OPT_PROMISCUOUS (0x02u)
35 #define KW41ZRF_OPT_PRELOADING (0x04u)
36 #define KW41ZRF_OPT_TELL_TX_START (0x08u)
37 #define KW41ZRF_OPT_TELL_TX_END (0x10u)
38 #define KW41ZRF_OPT_TELL_RX_START (0x20u)
39 #define KW41ZRF_OPT_TELL_RX_END (0x40u)
40 #define KW41ZRF_OPT_AUTOACK (0x80u)
41 #define KW41ZRF_OPT_ACK_PENDING (0x81u)
45 enum kw41zrf_xcvseq {
46  XCVSEQ_IDLE = 0b000,
47  XCVSEQ_RECEIVE = 0b001,
48  XCVSEQ_TRANSMIT = 0b010,
49  XCVSEQ_CCA = 0b011,
50  XCVSEQ_TX_RX = 0b100,
51  XCVSEQ_CONTINUOUS_CCA = 0b101,
52  /* Other values are reserved */
53  /* Special value for idle_seq when sleeping */
54  XCVSEQ_DSM_IDLE = 0b1000,
55 };
56 
63 void kw41zrf_set_tx_power(kw41zrf_t *dev, int16_t txpower);
64 
72 int16_t kw41zrf_get_txpower(kw41zrf_t *dev);
73 
80 int kw41zrf_set_channel(kw41zrf_t *dev, uint8_t val);
81 
89 uint8_t kw41zrf_get_channel(kw41zrf_t *dev);
90 
97 void kw41zrf_set_pan(kw41zrf_t *dev, uint16_t pan);
98 
106 uint16_t kw41zrf_get_pan(kw41zrf_t *dev);
107 
114 void kw41zrf_set_addr_short(kw41zrf_t *dev, const network_uint16_t *addr);
115 
122 void kw41zrf_set_addr_long(kw41zrf_t *dev, const eui64_t *addr);
123 
131 
138 void kw41zrf_get_addr_long(kw41zrf_t *dev, eui64_t *addr);
139 
147 
154 void kw41zrf_set_cca_threshold(kw41zrf_t *dev, int8_t value);
155 
162 void kw41zrf_set_cca_mode(kw41zrf_t *dev, uint8_t mode);
163 
170 uint8_t kw41zrf_get_cca_mode(kw41zrf_t *dev);
171 
178 int8_t kw41zrf_get_ed_level(kw41zrf_t *dev);
179 
188 int kw41zrf_cca(kw41zrf_t *dev);
189 
196 void kw41zrf_set_rx_watermark(kw41zrf_t *dev, uint8_t value);
197 
205 void kw41zrf_set_option(kw41zrf_t *dev, uint8_t option, uint8_t state);
206 
207 #ifdef __cplusplus
208 }
209 #endif
210 
211 #endif /* KW41ZRF_GETSET_H */
212 
kw41zrf_get_ed_level
int8_t kw41zrf_get_ed_level(kw41zrf_t *dev)
Get latest ED measurement from the device.
kw41zrf_get_addr_long
void kw41zrf_get_addr_long(kw41zrf_t *dev, eui64_t *addr)
Get long address of a given device.
kw41zrf.h
Interface definition for the kw41zrf driver.
be_uint16_t
A 16 bit integer in big endian aka network byte order.
Definition: byteorder.h:77
kw41zrf_get_addr_short
void kw41zrf_get_addr_short(kw41zrf_t *dev, network_uint16_t *addr)
Get short address of a given device.
kw41zrf_set_channel
int kw41zrf_set_channel(kw41zrf_t *dev, uint8_t val)
Set channel of given device.
kw41zrf_set_pan
void kw41zrf_set_pan(kw41zrf_t *dev, uint16_t pan)
Set PAN ID of a given device.
kw41zrf_get_cca_mode
uint8_t kw41zrf_get_cca_mode(kw41zrf_t *dev)
Get CCA mode of a given device.
kw41zrf_get_cca_threshold
int8_t kw41zrf_get_cca_threshold(kw41zrf_t *dev)
Get CCA threshold of a given device.
kw41zrf_set_rx_watermark
void kw41zrf_set_rx_watermark(kw41zrf_t *dev, uint8_t value)
Set receive watermark to signal when the packet buffer is part full.
kw41zrf_cca
int kw41zrf_cca(kw41zrf_t *dev)
Perform one CCA measurement and return the result.
kw41zrf_set_cca_mode
void kw41zrf_set_cca_mode(kw41zrf_t *dev, uint8_t mode)
Set CCA mode of a given device.
kw41zrf_get_pan
uint16_t kw41zrf_get_pan(kw41zrf_t *dev)
Get PAN ID of given device.
kw41zrf_get_txpower
int16_t kw41zrf_get_txpower(kw41zrf_t *dev)
Get tx power value of given device.
kw41zrf_set_tx_power
void kw41zrf_set_tx_power(kw41zrf_t *dev, int16_t txpower)
Set tx power of given device.
kw41zrf_set_cca_threshold
void kw41zrf_set_cca_threshold(kw41zrf_t *dev, int8_t value)
Set CCA threshold of a given device.
eui64_t
Data type to represent an EUI-64.
Definition: eui64.h:55
kw41zrf_t
Device descriptor for KW41ZRF radio devices.
Definition: kw41zrf.h:102
kw41zrf_set_addr_short
void kw41zrf_set_addr_short(kw41zrf_t *dev, const network_uint16_t *addr)
Set short address of a given device.
kw41zrf_set_addr_long
void kw41zrf_set_addr_long(kw41zrf_t *dev, const eui64_t *addr)
Set long address of a given device.
kw41zrf_get_channel
uint8_t kw41zrf_get_channel(kw41zrf_t *dev)
Get channel of given device.
kw41zrf_set_option
void kw41zrf_set_option(kw41zrf_t *dev, uint8_t option, uint8_t state)
Set netopt a given device.