Loading...
Searching...
No Matches
kw2xrf_intern.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
19#ifndef KW2XRF_INTERN_H
20#define KW2XRF_INTERN_H
21
22#include <stdint.h>
23#include "kw2xrf.h"
24
25#ifdef __cplusplus
26extern "C" {
27#endif
28
32typedef enum {
33 KW2XRF_HIBERNATE = 0,
34 KW2XRF_DOZE,
35 KW2XRF_IDLE,
36 KW2XRF_AUTODOZE,
38
46static inline void kw2xrf_set_dreg_bit(kw2xrf_t *dev, uint8_t reg, uint8_t bit)
47{
48 uint8_t tmp = kw2xrf_read_dreg(dev, reg);
49 tmp |= bit;
50 kw2xrf_write_dreg(dev, reg, tmp);
51}
52
60static inline void kw2xrf_clear_dreg_bit(kw2xrf_t *dev, uint8_t reg, uint8_t bit)
61{
62 uint8_t tmp = kw2xrf_read_dreg(dev, reg);
63 tmp &= ~bit;
64 kw2xrf_write_dreg(dev, reg, tmp);
65}
66
72static inline void kw2xrf_enable_irq_b(kw2xrf_t *dev)
73{
74 kw2xrf_clear_dreg_bit(dev, MKW2XDM_PHY_CTRL4, MKW2XDM_PHY_CTRL4_TRCV_MSK);
75}
76
82static inline void kw2xrf_mask_irq_b(kw2xrf_t *dev)
83{
84 kw2xrf_set_dreg_bit(dev, MKW2XDM_PHY_CTRL4, MKW2XDM_PHY_CTRL4_TRCV_MSK);
85}
86
93
100
107
115
124
129 KW2XRF_TIMEBASE_500000HZ = 2,
130 KW2XRF_TIMEBASE_250000HZ,
131 KW2XRF_TIMEBASE_125000HZ,
132 KW2XRF_TIMEBASE_62500HZ,
133 KW2XRF_TIMEBASE_31250HZ,
134 KW2XRF_TIMEBASE_15625HZ,
136
149
156
163
170
177
184void kw2xrf_trigger_tx_ops_enable(kw2xrf_t *dev, uint32_t timeout);
185
192
199void kw2xrf_abort_rx_ops_enable(kw2xrf_t *dev, uint32_t timeout);
200
207
214void kw2xrf_seq_timeout_on(kw2xrf_t *dev, uint32_t timeout);
215
222
231
232#ifdef __cplusplus
233}
234#endif
235
236#endif /* KW2XRF_INTERN_H */
Interface definition for the kw2xrf driver.
void kw2xrf_update_overwrites(kw2xrf_t *dev)
uint32_t kw2xrf_get_timestamp(kw2xrf_t *dev)
Returns Timestamp of the actual received packet.
void kw2xrf_timer3_seq_abort_off(kw2xrf_t *dev)
Disable abort sequence timer.
static void kw2xrf_mask_irq_b(kw2xrf_t *dev)
Mask all transceiver interrupts to assert IRQ_B.
void kw2xrf_trigger_tx_ops_enable(kw2xrf_t *dev, uint32_t timeout)
Use T2CMP or T2PRIMECMP to Trigger Transceiver Operations.
void kw2xrf_abort_rx_ops_disable(kw2xrf_t *dev)
Disable Trigger to Abort an RX operation.
kw2xrf_powermode_t
Power Modes.
void kw2xrf_set_out_clk(kw2xrf_t *dev)
static void kw2xrf_set_dreg_bit(kw2xrf_t *dev, uint8_t reg, uint8_t bit)
Set a certain bit of a kw2xrf register.
kw2xrf_timer_timebase
Timebase values.
void kw2xrf_timer3_seq_abort_on(kw2xrf_t *dev)
Enable abort sequence timer.
void kw2xrf_timer2_seq_start_off(kw2xrf_t *dev)
Disable start sequence timer.
void kw2xrf_trigger_tx_ops_disable(kw2xrf_t *dev)
Disable Trigger for Transceiver Operations.
void kw2xrf_disable_interrupts(kw2xrf_t *dev)
Disable all interrupts on transceiver.
void kw2xrf_set_power_mode(kw2xrf_t *dev, kw2xrf_powermode_t pm)
Set power mode for device.
static void kw2xrf_clear_dreg_bit(kw2xrf_t *dev, uint8_t reg, uint8_t bit)
Clear a certain bit of a kw2xrf register.
int kw2xrf_can_switch_to_idle(kw2xrf_t *dev)
void kw2xrf_seq_timeout_on(kw2xrf_t *dev, uint32_t timeout)
Enable sequence timeout.
void kw2xrf_abort_rx_ops_enable(kw2xrf_t *dev, uint32_t timeout)
Use T3CMP to Abort an RX operation.
enum kw2xrf_timer_timebase kw2xrf_timer_timebase_t
Timebase values.
void kw2xrf_seq_timeout_off(kw2xrf_t *dev)
Disable sequence timeout.
static void kw2xrf_enable_irq_b(kw2xrf_t *dev)
Enable any transceiver interrupt to assert IRQ_B.
void kw2xrf_timer2_seq_start_on(kw2xrf_t *dev)
Enable start sequence time.
void kw2xrf_timer_init(kw2xrf_t *dev, kw2xrf_timer_timebase_t tb)
Initialize the Event Timer Block (up counter)
@ MKW2XDM_PHY_CTRL4
PHY Control 4.
Definition kw2xrf_reg.h:97
uint8_t kw2xrf_read_dreg(kw2xrf_t *dev, uint8_t addr)
Reads a byte from the kw2xrf register.
void kw2xrf_write_dreg(kw2xrf_t *dev, uint8_t addr, uint8_t value)
Writes a byte to the kw2xrf register.
Device descriptor for KW2XRF radio devices.
Definition kw2xrf.h:119