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
26 extern "C" {
27 #endif
28 
32 typedef enum {
33  KW2XRF_HIBERNATE = 0,
34  KW2XRF_DOZE,
35  KW2XRF_IDLE,
36  KW2XRF_AUTODOZE,
38 
46 static 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 
60 static 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 
72 static 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 
82 static 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 
106 void kw2xrf_set_out_clk(kw2xrf_t *dev);
107 
115 
124 
128 typedef enum kw2xrf_timer_timebase {
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 
184 void kw2xrf_trigger_tx_ops_enable(kw2xrf_t *dev, uint32_t timeout);
185 
192 
199 void kw2xrf_abort_rx_ops_enable(kw2xrf_t *dev, uint32_t timeout);
200 
207 
214 void kw2xrf_seq_timeout_on(kw2xrf_t *dev, uint32_t timeout);
215 
222 
230 uint32_t kw2xrf_get_timestamp(kw2xrf_t *dev);
231 
232 #ifdef __cplusplus
233 }
234 #endif
235 
236 #endif /* KW2XRF_INTERN_H */
237 
kw2xrf_timer_timebase
kw2xrf_timer_timebase
Timebase values.
Definition: kw2xrf_intern.h:128
kw2xrf_set_dreg_bit
static void kw2xrf_set_dreg_bit(kw2xrf_t *dev, uint8_t reg, uint8_t bit)
Set a certain bit of a kw2xrf register.
Definition: kw2xrf_intern.h:46
kw2xrf_seq_timeout_off
void kw2xrf_seq_timeout_off(kw2xrf_t *dev)
Disable sequence timeout.
kw2xrf_get_timestamp
uint32_t kw2xrf_get_timestamp(kw2xrf_t *dev)
Returns Timestamp of the actual received packet.
kw2xrf_timer3_seq_abort_off
void kw2xrf_timer3_seq_abort_off(kw2xrf_t *dev)
Disable abort sequence timer.
kw2xrf_timer2_seq_start_off
void kw2xrf_timer2_seq_start_off(kw2xrf_t *dev)
Disable start sequence timer.
kw2xrf_timer_init
void kw2xrf_timer_init(kw2xrf_t *dev, kw2xrf_timer_timebase_t tb)
Initialize the Event Timer Block (up counter)
kw2xrf_trigger_tx_ops_enable
void kw2xrf_trigger_tx_ops_enable(kw2xrf_t *dev, uint32_t timeout)
Use T2CMP or T2PRIMECMP to Trigger Transceiver Operations.
kw2xrf_write_dreg
void kw2xrf_write_dreg(kw2xrf_t *dev, uint8_t addr, uint8_t value)
Writes a byte to the kw2xrf register.
kw2xrf_seq_timeout_on
void kw2xrf_seq_timeout_on(kw2xrf_t *dev, uint32_t timeout)
Enable sequence timeout.
kw2xrf_timer2_seq_start_on
void kw2xrf_timer2_seq_start_on(kw2xrf_t *dev)
Enable start sequence time.
kw2xrf_set_power_mode
void kw2xrf_set_power_mode(kw2xrf_t *dev, kw2xrf_powermode_t pm)
Set power mode for device.
kw2xrf_clear_dreg_bit
static void kw2xrf_clear_dreg_bit(kw2xrf_t *dev, uint8_t reg, uint8_t bit)
Clear a certain bit of a kw2xrf register.
Definition: kw2xrf_intern.h:60
kw2xrf_can_switch_to_idle
int kw2xrf_can_switch_to_idle(kw2xrf_t *dev)
kw2xrf_read_dreg
uint8_t kw2xrf_read_dreg(kw2xrf_t *dev, uint8_t addr)
Reads a byte from the kw2xrf register.
kw2xrf_trigger_tx_ops_disable
void kw2xrf_trigger_tx_ops_disable(kw2xrf_t *dev)
Disable Trigger for Transceiver Operations.
kw2xrf_mask_irq_b
static void kw2xrf_mask_irq_b(kw2xrf_t *dev)
Mask all transceiver interrupts to assert IRQ_B.
Definition: kw2xrf_intern.h:82
kw2xrf.h
Interface definition for the kw2xrf driver.
kw2xrf_disable_interrupts
void kw2xrf_disable_interrupts(kw2xrf_t *dev)
Disable all interrupts on transceiver.
kw2xrf_abort_rx_ops_enable
void kw2xrf_abort_rx_ops_enable(kw2xrf_t *dev, uint32_t timeout)
Use T3CMP to Abort an RX operation.
kw2xrf_timer3_seq_abort_on
void kw2xrf_timer3_seq_abort_on(kw2xrf_t *dev)
Enable abort sequence timer.
kw2xrf_update_overwrites
void kw2xrf_update_overwrites(kw2xrf_t *dev)
kw2xrf_powermode_t
kw2xrf_powermode_t
Power Modes.
Definition: kw2xrf_intern.h:32
kw2xrf_set_out_clk
void kw2xrf_set_out_clk(kw2xrf_t *dev)
kw2xrf_enable_irq_b
static void kw2xrf_enable_irq_b(kw2xrf_t *dev)
Enable any transceiver interrupt to assert IRQ_B.
Definition: kw2xrf_intern.h:72
MKW2XDM_PHY_CTRL4
@ MKW2XDM_PHY_CTRL4
PHY Control 4.
Definition: kw2xrf_reg.h:97
kw2xrf_timer_timebase_t
enum kw2xrf_timer_timebase kw2xrf_timer_timebase_t
Timebase values.
kw2xrf_t
Device descriptor for KW2XRF radio devices.
Definition: kw2xrf.h:125
kw2xrf_abort_rx_ops_disable
void kw2xrf_abort_rx_ops_disable(kw2xrf_t *dev)
Disable Trigger to Abort an RX operation.