Loading...
Searching...
No Matches
kw2xrf.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2016 Phytec Messtechnik GmbH
3 * SPDX-License-Identifier: LGPL-2.1-only
4 */
5
6#pragma once
7
21
22#include <stdint.h>
23
24#include "board.h"
25#include "periph/spi.h"
26#include "periph/gpio.h"
27#include "net/netdev.h"
29#include "net/gnrc/nettype.h"
30#include "thread.h"
31#include "net/ieee802154/radio.h"
32
33#ifdef __cplusplus
34extern "C" {
35#endif
36
40#define KW2XRF_MAX_PKT_LENGTH (IEEE802154_FRAME_LEN_MAX)
41
50#ifndef KW2XRF_DEFAULT_CHANNEL
51#define KW2XRF_DEFAULT_CHANNEL (CONFIG_IEEE802154_DEFAULT_CHANNEL)
52#endif
54
60#define KW2XRF_MIN_CHANNEL (11U)
61#define KW2XRF_MAX_CHANNEL (26U)
63
67#define KW2XRF_DEFAULT_TX_POWER (CONFIG_IEEE802154_DEFAULT_TXPOWER)
68
72#define KW2XDRF_OUTPUT_POWER_MAX (8)
73
77#define KW2XDRF_OUTPUT_POWER_MIN (-35)
78
87#define KW2XRF_OPT_SRC_ADDR_LONG (NETDEV_IEEE802154_SRC_MODE_LONG)
88#define KW2XRF_OPT_RAWDUMP (NETDEV_IEEE802154_RAW)
89#define KW2XRF_OPT_ACK_REQ (NETDEV_IEEE802154_ACK_REQ)
90
91#define KW2XRF_OPT_AUTOCCA (0x0100)
92#define KW2XRF_OPT_PROMISCUOUS (0x0200)
94#define KW2XRF_OPT_PRELOADING (0x0400)
95#define KW2XRF_OPT_AUTOACK (0x8000)
98
109
139
152 gpio_cb_t cb, void *ctx);
153
160
167
168#ifdef __cplusplus
169}
170#endif
171
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:150
struct ieee802154_dev ieee802154_dev_t
Forward declaration of the IEEE802.15.4 device descriptor.
Definition radio.h:407
#define KW2XRF_MAX_PKT_LENGTH
Maximum packet length.
Definition kw2xrf.h:40
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:143
Protocol type definitions.
Low-level SPI peripheral driver interface definition.
Struct holding all params needed for device initialization.
Definition kw2xrf.h:102
gpio_t cs_pin
GPIO pin connected to chip select.
Definition kw2xrf.h:105
spi_t spi
SPI bus the device is connected to.
Definition kw2xrf.h:103
gpio_t int_pin
GPIO pin connected to the interrupt pin.
Definition kw2xrf.h:106
gpio_t rst_pin
GPIO pin connected to RST_B.
Definition kw2xrf.h:107
spi_clk_t spi_clk
SPI clock speed to use.
Definition kw2xrf.h:104
Device descriptor for KW2XRF radio devices.
Definition kw2xrf.h:115
bool tx_done
Indicate whether TX completed.
Definition kw2xrf.h:133
uint8_t state
current state of the radio
Definition kw2xrf.h:123
bool waiting_for_cca
Indicate whether CCA is still ongoing.
Definition kw2xrf.h:132
bool ack_rcvd
Indicate if ACK was received for last transmission.
Definition kw2xrf.h:134
bool ack_requested
ACK was requested for last frame.
Definition kw2xrf.h:130
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:126
int16_t tx_power
The current tx-power setting of the device.
Definition kw2xrf.h:129
bool tx_cca_pending
true a manual CCA was started and a TX should be triggered on channel clear indication
Definition kw2xrf.h:136
uint8_t idle_state
state to return to after sending
Definition kw2xrf.h:125
thread_t * thread
device specific fields
Definition kw2xrf.h:120
uint8_t buf[KW2XRF_MAX_PKT_LENGTH]
Buffer for incoming or outgoing packets.
Definition kw2xrf.h:122
bool cca_before_tx
true if CCA shall be performed before TX
Definition kw2xrf.h:135
bool ch_clear
CCA indicated channel clear.
Definition kw2xrf.h:131
uint8_t tx_frame_len
length of the current TX frame
Definition kw2xrf.h:124
const kw2xrf_params_t * params
parameters for initialization
Definition kw2xrf.h:121