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
9#pragma once
10
24
25#include <stdint.h>
26
27#include "board.h"
28#include "periph/spi.h"
29#include "periph/gpio.h"
30#include "net/netdev.h"
32#include "net/gnrc/nettype.h"
33#include "thread.h"
34#include "net/ieee802154/radio.h"
35
36#ifdef __cplusplus
37extern "C" {
38#endif
39
43#define KW2XRF_MAX_PKT_LENGTH (IEEE802154_FRAME_LEN_MAX)
44
53#ifndef KW2XRF_DEFAULT_CHANNEL
54#define KW2XRF_DEFAULT_CHANNEL (CONFIG_IEEE802154_DEFAULT_CHANNEL)
55#endif
57
63#define KW2XRF_MIN_CHANNEL (11U)
64#define KW2XRF_MAX_CHANNEL (26U)
66
70#define KW2XRF_DEFAULT_TX_POWER (CONFIG_IEEE802154_DEFAULT_TXPOWER)
71
75#define KW2XDRF_OUTPUT_POWER_MAX (8)
76
80#define KW2XDRF_OUTPUT_POWER_MIN (-35)
81
90#define KW2XRF_OPT_SRC_ADDR_LONG (NETDEV_IEEE802154_SRC_MODE_LONG)
91#define KW2XRF_OPT_RAWDUMP (NETDEV_IEEE802154_RAW)
92#define KW2XRF_OPT_ACK_REQ (NETDEV_IEEE802154_ACK_REQ)
93
94#define KW2XRF_OPT_AUTOCCA (0x0100)
95#define KW2XRF_OPT_PROMISCUOUS (0x0200)
97#define KW2XRF_OPT_PRELOADING (0x0400)
98#define KW2XRF_OPT_AUTOACK (0x8000)
101
112
142
155 gpio_cb_t cb, void *ctx);
156
163
170
171#ifdef __cplusplus
172}
173#endif
174
spi_clk_t
Definition periph_cpu.h:348
Definitions for netdev common IEEE 802.15.4 code.
Definitions low-level network driver interface.
Low-level GPIO peripheral driver interface definitions.
struct _thread thread_t
forward declaration for thread_t, defined in thread.h
Definition sched.h:154
struct ieee802154_dev ieee802154_dev_t
Forward declaration of the IEEE802.15.4 device descriptor.
Definition radio.h:400
#define KW2XRF_MAX_PKT_LENGTH
Maximum packet length.
Definition kw2xrf.h:43
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.
Struct holding all params needed for device initialization.
Definition kw2xrf.h:105
gpio_t cs_pin
GPIO pin connected to chip select.
Definition kw2xrf.h:108
spi_t spi
SPI bus the device is connected to.
Definition kw2xrf.h:106
gpio_t int_pin
GPIO pin connected to the interrupt pin.
Definition kw2xrf.h:109
gpio_t rst_pin
GPIO pin connected to RST_B.
Definition kw2xrf.h:110
spi_clk_t spi_clk
SPI clock speed to use.
Definition kw2xrf.h:107
Device descriptor for KW2XRF radio devices.
Definition kw2xrf.h:118
bool tx_done
Indicate whether TX completed.
Definition kw2xrf.h:136
uint8_t state
current state of the radio
Definition kw2xrf.h:126
bool waiting_for_cca
Indicate whether CCA is still ongoing.
Definition kw2xrf.h:135
bool ack_rcvd
Indicate if ACK was received for last transmission.
Definition kw2xrf.h:137
bool ack_requested
ACK was requested for last frame.
Definition kw2xrf.h:133
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:129
int16_t tx_power
The current tx-power setting of the device.
Definition kw2xrf.h:132
bool tx_cca_pending
true a manual CCA was started and a TX should be triggered on channel clear indication
Definition kw2xrf.h:139
uint8_t idle_state
state to return to after sending
Definition kw2xrf.h:128
thread_t * thread
device specific fields
Definition kw2xrf.h:123
uint8_t buf[KW2XRF_MAX_PKT_LENGTH]
Buffer for incoming or outgoing packets.
Definition kw2xrf.h:125
bool cca_before_tx
true if CCA shall be performed before TX
Definition kw2xrf.h:138
bool ch_clear
CCA indicated channel clear.
Definition kw2xrf.h:134
uint8_t tx_frame_len
length of the current TX frame
Definition kw2xrf.h:127
const kw2xrf_params_t * params
parameters for initialization
Definition kw2xrf.h:124