Loading...
Searching...
No Matches
kw2xrf.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2016 Phytec Messtechnik GmbH
3 *
4 * This file is subject to the terms and conditions of the GNU Lesser
5 * General Public License v2.1. See the file LICENSE in the top level
6 * directory for more details.
7 */
8
23#ifndef KW2XRF_H
24#define KW2XRF_H
25
26#include <stdint.h>
27
28#include "board.h"
29#include "periph/spi.h"
30#include "periph/gpio.h"
31#include "net/netdev.h"
33#include "net/gnrc/nettype.h"
34#include "thread.h"
35#include "net/ieee802154/radio.h"
36
37#ifdef __cplusplus
38extern "C" {
39#endif
40
44#define KW2XRF_MAX_PKT_LENGTH (IEEE802154_FRAME_LEN_MAX)
45
54#ifndef KW2XRF_DEFAULT_CHANNEL
55#define KW2XRF_DEFAULT_CHANNEL (CONFIG_IEEE802154_DEFAULT_CHANNEL)
56#endif
64#define KW2XRF_MIN_CHANNEL (11U)
65#define KW2XRF_MAX_CHANNEL (26U)
71#define KW2XRF_DEFAULT_TX_POWER (CONFIG_IEEE802154_DEFAULT_TXPOWER)
72
76#define KW2XDRF_OUTPUT_POWER_MAX (8)
77
81#define KW2XDRF_OUTPUT_POWER_MIN (-35)
82
91#define KW2XRF_OPT_SRC_ADDR_LONG (NETDEV_IEEE802154_SRC_MODE_LONG)
92#define KW2XRF_OPT_RAWDUMP (NETDEV_IEEE802154_RAW)
93#define KW2XRF_OPT_ACK_REQ (NETDEV_IEEE802154_ACK_REQ)
95#define KW2XRF_OPT_AUTOCCA (0x0100)
96#define KW2XRF_OPT_PROMISCUOUS (0x0200)
98#define KW2XRF_OPT_PRELOADING (0x0400)
99#define KW2XRF_OPT_AUTOACK (0x8000)
113
143
156 gpio_cb_t cb, void *ctx);
157
164
171
172#ifdef __cplusplus
173}
174#endif
175
176#endif /* KW2XRF_H */
spi_clk_t
Definition periph_cpu.h:352
Definitions for netdev common IEEE 802.15.4 code.
Definitions low-level network driver interface.
Low-level GPIO peripheral driver interface definitions.
#define KW2XRF_MAX_PKT_LENGTH
Maximum packet length.
Definition kw2xrf.h:44
void kw2xrf_radio_hal_irq_handler(void *dev)
IRQ Handler for the KW2XRF device.
void kw2xrf_reset_phy(kw2xrf_t *dev)
Configure radio with default values.
int kw2xrf_init(kw2xrf_t *dev, const kw2xrf_params_t *params, ieee802154_dev_t *hal, gpio_cb_t cb, void *ctx)
Initialize the given KW2XRF device.
struct kw2xrf_params kw2xrf_params_t
Struct holding all params needed for device initialization.
void(* gpio_cb_t)(void *arg)
Signature of event callback functions triggered from interrupts.
Definition gpio.h:146
Protocol type definitions.
Low-level SPI peripheral driver interface definition.
thread_t holds thread's context data.
Definition thread.h:168
the IEEE802.15.4 device descriptor
Definition radio.h:415
Struct holding all params needed for device initialization.
Definition kw2xrf.h:106
gpio_t cs_pin
GPIO pin connected to chip select.
Definition kw2xrf.h:109
spi_t spi
SPI bus the device is connected to.
Definition kw2xrf.h:107
gpio_t int_pin
GPIO pin connected to the interrupt pin.
Definition kw2xrf.h:110
gpio_t rst_pin
GPIO pin connected to RST_B.
Definition kw2xrf.h:111
spi_clk_t spi_clk
SPI clock speed to use.
Definition kw2xrf.h:108
Device descriptor for KW2XRF radio devices.
Definition kw2xrf.h:119
bool tx_done
Indicate whether TX completed.
Definition kw2xrf.h:137
uint8_t state
current state of the radio
Definition kw2xrf.h:127
bool waiting_for_cca
Indicate whether CCA is still ongoing.
Definition kw2xrf.h:136
bool ack_rcvd
Indicate if ACK was received for last transmission.
Definition kw2xrf.h:138
bool ack_requested
ACK was requested for last frame.
Definition kw2xrf.h:134
uint8_t pending_tx
keep track of pending TX calls this is required to know when to return to kw2xrf_t::idle_state
Definition kw2xrf.h:130
int16_t tx_power
The current tx-power setting of the device.
Definition kw2xrf.h:133
bool tx_cca_pending
true a manual CCA was started and a TX should be triggered on channel clear indication
Definition kw2xrf.h:140
uint8_t idle_state
state to return to after sending
Definition kw2xrf.h:129
thread_t * thread
device specific fields
Definition kw2xrf.h:124
bool cca_before_tx
true if CCA shall be performed before TX
Definition kw2xrf.h:139
bool ch_clear
CCA indicated channel clear.
Definition kw2xrf.h:135
uint8_t tx_frame_len
length of the current TX frame
Definition kw2xrf.h:128
const kw2xrf_params_t * params
parameters for initialization
Definition kw2xrf.h:125