kw2xrf_spi.h File Reference

Definition of KW2XRF SPI functions. More...

Detailed Description

Definition of KW2XRF SPI functions.

Author
Johann Fischer j.fis.nosp@m.cher.nosp@m.@phyt.nosp@m.ec.d.nosp@m.e

Definition in file kw2xrf_spi.h.

#include <stdio.h>
#include "board.h"
#include "cpu.h"
#include "periph/spi.h"
#include "periph_conf.h"
+ Include dependency graph for kw2xrf_spi.h:

Go to the source code of this file.

int kw2xrf_spi_init (kw2xrf_t *dev)
 SPI interface initialization. More...
 
void kw2xrf_write_dreg (kw2xrf_t *dev, uint8_t addr, uint8_t value)
 Writes a byte to the kw2xrf register. More...
 
uint8_t kw2xrf_read_dreg (kw2xrf_t *dev, uint8_t addr)
 Reads a byte from the kw2xrf register. More...
 
void kw2xrf_write_dregs (kw2xrf_t *dev, uint8_t addr, uint8_t *buf, uint8_t length)
 Writes to kw2xrf direct registers. More...
 
void kw2xrf_read_dregs (kw2xrf_t *dev, uint8_t addr, uint8_t *buf, uint8_t length)
 Reads a byte from the kw2xrf indirect register. More...
 
void kw2xrf_write_ireg (kw2xrf_t *dev, uint8_t addr, uint8_t value)
 Writes to a byte from the kw2xrf indirect register. More...
 
uint8_t kw2xrf_read_ireg (kw2xrf_t *dev, uint8_t addr)
 Reads a byte from the kw2xrf indirect register. More...
 
void kw2xrf_write_iregs (kw2xrf_t *dev, uint8_t addr, uint8_t *buf, uint8_t length)
 Writes to kw2xrf indirect registers. More...
 
void kw2xrf_read_iregs (kw2xrf_t *dev, uint8_t addr, uint8_t *buf, uint8_t length)
 Reads a byte from the kw2xrf indirect register. More...
 
void kw2xrf_write_fifo (kw2xrf_t *dev, uint8_t *data, uint8_t data_length)
 Writes multiple bytes to the kw2xrf fifo. More...
 
void kw2xrf_read_fifo (kw2xrf_t *dev, uint8_t *data, uint8_t data_length)
 Reads multiple bytes from the kw2xrf fifo. More...
 

Function Documentation

◆ kw2xrf_read_dreg()

uint8_t kw2xrf_read_dreg ( kw2xrf_t dev,
uint8_t  addr 
)

Reads a byte from the kw2xrf register.

Parameters
[in]devdevice descriptor
[in]addrAddress of the register to read.
Returns
Value of the register.

◆ kw2xrf_read_dregs()

void kw2xrf_read_dregs ( kw2xrf_t dev,
uint8_t  addr,
uint8_t *  buf,
uint8_t  length 
)

Reads a byte from the kw2xrf indirect register.

Parameters
[in]devdevice descriptor
[in]addrAddress of the register to read.
[in]bufBuffer, where the content of the reg shall be written to.
[in]lengthLength of the register.

◆ kw2xrf_read_fifo()

void kw2xrf_read_fifo ( kw2xrf_t dev,
uint8_t *  data,
uint8_t  data_length 
)

Reads multiple bytes from the kw2xrf fifo.

Parameters
[in]devdevice descriptor
[out]dataA buffer to store the value of the fifo.
[in]data_lengthThe count of bytes which should be read.
Returns
number of bytes read.

◆ kw2xrf_read_ireg()

uint8_t kw2xrf_read_ireg ( kw2xrf_t dev,
uint8_t  addr 
)

Reads a byte from the kw2xrf indirect register.

Parameters
[in]devdevice descriptor
[in]addrAddress of the register to read.
Returns
value in the register

◆ kw2xrf_read_iregs()

void kw2xrf_read_iregs ( kw2xrf_t dev,
uint8_t  addr,
uint8_t *  buf,
uint8_t  length 
)

Reads a byte from the kw2xrf indirect register.

Parameters
[in]devdevice descriptor
[in]addrAddress of the register to read.
[in]bufBuffer, where the content of the reg shall be written to.
[in]lengthLength of the register.

◆ kw2xrf_spi_init()

int kw2xrf_spi_init ( kw2xrf_t dev)

SPI interface initialization.

Parameters
[in]devdevice descriptor
Returns
0 on success
-1 on error

◆ kw2xrf_write_dreg()

void kw2xrf_write_dreg ( kw2xrf_t dev,
uint8_t  addr,
uint8_t  value 
)

Writes a byte to the kw2xrf register.

Parameters
[in]devdevice descriptor
[in]addrAddress of the register to write.
[in]valueThe value to write in the register.

◆ kw2xrf_write_dregs()

void kw2xrf_write_dregs ( kw2xrf_t dev,
uint8_t  addr,
uint8_t *  buf,
uint8_t  length 
)

Writes to kw2xrf direct registers.

Parameters
[in]devdevice descriptor
[in]addrAddress of the register to write into.
[in]bufValue that shall be written.
[in]lengthLength of the register.

◆ kw2xrf_write_fifo()

void kw2xrf_write_fifo ( kw2xrf_t dev,
uint8_t *  data,
uint8_t  data_length 
)

Writes multiple bytes to the kw2xrf fifo.

Parameters
[in]devdevice descriptor
[in]dataA buffer with the value to write to the fifo.
[in]data_lengthThe count of bytes which should be written.
Returns
number of bytes written.

◆ kw2xrf_write_ireg()

void kw2xrf_write_ireg ( kw2xrf_t dev,
uint8_t  addr,
uint8_t  value 
)

Writes to a byte from the kw2xrf indirect register.

Parameters
[in]devdevice descriptor
[in]addrAddress of the register to write into.
[in]valueValue that shall be written.

◆ kw2xrf_write_iregs()

void kw2xrf_write_iregs ( kw2xrf_t dev,
uint8_t  addr,
uint8_t *  buf,
uint8_t  length 
)

Writes to kw2xrf indirect registers.

Parameters
[in]devdevice descriptor
[in]addrAddress of the register to write into.
[in]bufValue that shall be written.
[in]lengthLength of the register.