kw41zrf_intern.h File Reference

Internal function interfaces for kw41zrf driver. More...

Detailed Description

Internal function interfaces for kw41zrf driver.

Author
Joakim NohlgÄrd joaki.nosp@m.m.no.nosp@m.hlgar.nosp@m.d@ei.nosp@m.stec..nosp@m.se

Definition in file kw41zrf_intern.h.

#include <stdint.h>
#include "kw41zrf.h"
#include "kw41zrf_getset.h"
#include "cpu.h"
+ Include dependency graph for kw41zrf_intern.h:

Go to the source code of this file.

#define PM_BLOCK(x)
 
#define PM_UNBLOCK(x)
 
#define KW41ZRF_ENABLE_LEDS   (0)
 
#define KW41ZRF_LED_NDSM_ON
 
#define KW41ZRF_LED_NDSM_OFF
 
#define KW41ZRF_LED_TX_ON
 
#define KW41ZRF_LED_TX_OFF
 
#define KW41ZRF_LED_RX_ON
 
#define KW41ZRF_LED_RX_OFF
 
#define KW41ZRF_LED_IRQ_ON
 
#define KW41ZRF_LED_IRQ_OFF
 
enum  kw41zrf_powermode_t { KW41ZRF_POWER_IDLE = 0, KW41ZRF_POWER_DSM }
 KW41Z transceiver power modes. More...
 
enum  kw41zrf_timer_timebase {
  KW41ZRF_TIMEBASE_500000HZ = 0b010, KW41ZRF_TIMEBASE_250000HZ = 0b011, KW41ZRF_TIMEBASE_125000HZ = 0b100, KW41ZRF_TIMEBASE_62500HZ = 0b101,
  KW41ZRF_TIMEBASE_31250HZ = 0b110, KW41ZRF_TIMEBASE_15625HZ = 0b111
}
 Timebase settings.
 
typedef enum kw41zrf_timer_timebase kw41zrf_timer_timebase_t
 Timebase settings.
 
static void kw41zrf_mask_irqs (void)
 Mask all transceiver interrupts.
 
static void kw41zrf_unmask_irqs (void)
 Unmask all transceiver interrupts.
 
void kw41zrf_set_irq_callback (void(*cb)(void *arg), void *arg)
 Set the callback function for the radio ISR. More...
 
void kw41zrf_set_power_mode (kw41zrf_t *dev, kw41zrf_powermode_t pm)
 Set power mode for device. More...
 
int kw41zrf_can_switch_to_idle (kw41zrf_t *dev)
 Determine if the transceiver is busy doing TX or RX. More...
 
void kw41zrf_set_sequence (kw41zrf_t *dev, uint32_t seq)
 Set sequence state of device. More...
 
static void kw41zrf_abort_sequence (kw41zrf_t *dev)
 Abort the current autosequence. More...
 
static uint32_t kw41zrf_is_dsm (void)
 Check if the radio is in deep sleep mode. More...
 
static void kw41zrf_timer_load (kw41zrf_t *dev, uint32_t value)
 Set event timer counter value. More...
 
static uint32_t kw41zrf_timer_get (kw41zrf_t *dev)
 Get current event timer counter value. More...
 
static void kw41zrf_timer_set (kw41zrf_t *dev, volatile uint32_t *cmp_reg, uint32_t timeout)
 Set a timeout value for the given compare register of the Event Timer. More...
 
static void kw41zrf_timer_init (kw41zrf_t *dev, kw41zrf_timer_timebase_t tb)
 Initialize the Event Timer Block (up counter) More...
 
static uint32_t kw41zrf_get_timestamp (kw41zrf_t *dev)
 Returns timestamp of the beginning of the most recently received packet. More...
 

Enumeration Type Documentation

◆ kw41zrf_powermode_t

KW41Z transceiver power modes.

Enumerator
KW41ZRF_POWER_IDLE 

All parts powered.

KW41ZRF_POWER_DSM 

Deep sleep mode.

Definition at line 110 of file kw41zrf_intern.h.

Function Documentation

◆ kw41zrf_abort_sequence()

static void kw41zrf_abort_sequence ( kw41zrf_t dev)
inlinestatic

Abort the current autosequence.

Parameters
[in]devkw41zrf device descriptor

Definition at line 186 of file kw41zrf_intern.h.

◆ kw41zrf_can_switch_to_idle()

int kw41zrf_can_switch_to_idle ( kw41zrf_t dev)

Determine if the transceiver is busy doing TX or RX.

Parameters
[in]devkw41zrf device descriptor
Returns
0 if transceiver is in progress transmitting a packet
1 otherwise

◆ kw41zrf_get_timestamp()

static uint32_t kw41zrf_get_timestamp ( kw41zrf_t dev)
inlinestatic

Returns timestamp of the beginning of the most recently received packet.

The latched timestamp corresponds to the point where the SFD detection was triggered for the most recent packet, i.e. right before the first byte of the packet.

Parameters
[in]devkw41zrf device descriptor
Returns
timestamp value

Definition at line 282 of file kw41zrf_intern.h.

◆ kw41zrf_is_dsm()

static uint32_t kw41zrf_is_dsm ( void  )
inlinestatic

Check if the radio is in deep sleep mode.

Returns
non-zero if radio is in deep sleep
0 if radio is not in deep sleep mode

Definition at line 209 of file kw41zrf_intern.h.

◆ kw41zrf_set_irq_callback()

void kw41zrf_set_irq_callback ( void(*)(void *arg)  cb,
void *  arg 
)

Set the callback function for the radio ISR.

This callback will be called from ISR context when a radio_1 interrupt occurs

Parameters
[in]cbPointer to callback function
[in]argArgument that will be passed to the callback

◆ kw41zrf_set_power_mode()

void kw41zrf_set_power_mode ( kw41zrf_t dev,
kw41zrf_powermode_t  pm 
)

Set power mode for device.

Parameters
[in]devkw41zrf device descriptor
[in]pmpower mode value

◆ kw41zrf_set_sequence()

void kw41zrf_set_sequence ( kw41zrf_t dev,
uint32_t  seq 
)

Set sequence state of device.

Parameters
[in]devkw41zrf device descriptor
[in]seqsequence

◆ kw41zrf_timer_get()

static uint32_t kw41zrf_timer_get ( kw41zrf_t dev)
inlinestatic

Get current event timer counter value.

Parameters
[in]devkw41zrf device descriptor
Returns
Current timer value

Definition at line 233 of file kw41zrf_intern.h.

◆ kw41zrf_timer_init()

static void kw41zrf_timer_init ( kw41zrf_t dev,
kw41zrf_timer_timebase_t  tb 
)
inlinestatic

Initialize the Event Timer Block (up counter)

The Event Timer Block provides:

  • Abort an RX and CCA sequence at pre-determined time
  • Latches "timestamp" value during packet reception
  • Initiates timer-triggered sequences
Parameters
[in]devkw41zrf device descriptor
[in]tbtimer base value

Definition at line 264 of file kw41zrf_intern.h.

◆ kw41zrf_timer_load()

static void kw41zrf_timer_load ( kw41zrf_t dev,
uint32_t  value 
)
inlinestatic

Set event timer counter value.

Parameters
[in]devkw41zrf device descriptor
[in]valuenew time

Definition at line 220 of file kw41zrf_intern.h.

◆ kw41zrf_timer_set()

static void kw41zrf_timer_set ( kw41zrf_t dev,
volatile uint32_t *  cmp_reg,
uint32_t  timeout 
)
inlinestatic

Set a timeout value for the given compare register of the Event Timer.

Parameters
[in]devkw41zrf device descriptor
[out]cmp_regpointer to timer compare register, &ZLL->TxCMP
[in]timeouttimer offset from current time

Definition at line 246 of file kw41zrf_intern.h.