cc110x_communication.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2018 Otto-von-Guericke-Universität Magdeburg
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 CC110X_COMMUNICATION_H
20 #define CC110X_COMMUNICATION_H
21 
22 #include "periph/gpio.h"
23 #include "periph/spi.h"
24 #include "cc110x.h"
25 #include "cc110x_constants.h"
26 
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 
41 static inline int cc110x_acquire(cc110x_t *dev)
42 {
43  return spi_acquire(dev->params.spi, dev->params.cs, SPI_MODE_0,
44  dev->params.spi_clk);
45 }
46 
50 static inline void cc110x_release(cc110x_t *dev)
51 {
52  spi_release(dev->params.spi);
53 }
54 
78 uint8_t cc110x_read(cc110x_t *dev, uint8_t addr, uint8_t *dest);
79 
98 uint8_t cc110x_read_reliable(cc110x_t *dev, uint8_t addr, uint8_t *dest);
99 
115 uint8_t cc110x_write(cc110x_t *dev, uint8_t addr, uint8_t data);
116 
135 uint8_t cc110x_burst_read(cc110x_t *dev, uint8_t addr, void *dest, size_t len);
136 
155 uint8_t cc110x_burst_write(cc110x_t *dev, uint8_t addr,
156  const void *src, size_t len);
157 
171 uint8_t cc110x_cmd(cc110x_t *dev, uint8_t cmd);
172 
180 uint8_t cc110x_status(cc110x_t *dev);
181 
206 int cc110x_power_on(cc110x_t *dev);
207 
208 
209 #ifdef __cplusplus
210 }
211 #endif
212 
213 #endif /* CC110X_COMMUNICATION_H */
214 
cc110x_burst_read
uint8_t cc110x_burst_read(cc110x_t *dev, uint8_t addr, void *dest, size_t len)
Burst-read a bunch of configuration registers from the transceiver.
spi.h
Low-level SPI peripheral driver interface definition.
SPI_MODE_0
@ SPI_MODE_0
CPOL=0, CPHA=0.
Definition: spi.h:158
cc110x_read
uint8_t cc110x_read(cc110x_t *dev, uint8_t addr, uint8_t *dest)
Read a single configuration/status register from the transceiver.
cc110x_release
static void cc110x_release(cc110x_t *dev)
Release the SPI interface of the transceiver.
Definition: cc110x_communication.h:50
cc110x_status
uint8_t cc110x_status(cc110x_t *dev)
Get the transceivers status byte in a reliable way.
cc110x_params_t::spi_clk
spi_clk_t spi_clk
SPI clock to use (max 6.5 MHz)
Definition: cc110x.h:469
spi_release
void spi_release(spi_t bus)
Finish an ongoing SPI transaction by releasing the given SPI bus.
spi_acquire
int spi_acquire(spi_t bus, spi_cs_t cs, spi_mode_t mode, spi_clk_t clk)
Start a new SPI transaction.
cc110x_burst_write
uint8_t cc110x_burst_write(cc110x_t *dev, uint8_t addr, const void *src, size_t len)
Burst-write to a bunch of configuration registers on the transceiver.
cc110x_acquire
static int cc110x_acquire(cc110x_t *dev)
Acquire the SPI interface of the transceiver and configure it.
Definition: cc110x_communication.h:41
cc110x_t::params
cc110x_params_t params
Configuration of the driver.
Definition: cc110x.h:532
cc110x.h
Interface definition for the CC1100/CC1101 driver.
cc110x_read_reliable
uint8_t cc110x_read_reliable(cc110x_t *dev, uint8_t addr, uint8_t *dest)
Read a single status register from the transceiver reliable.
cc110x_write
uint8_t cc110x_write(cc110x_t *dev, uint8_t addr, uint8_t data)
Write to a single configuration register on the transceiver.
cc110x_params_t::spi
spi_t spi
SPI bus connected to the device.
Definition: cc110x.h:468
gpio.h
Low-level GPIO peripheral driver interface definitions.
cc110x_params_t::cs
spi_cs_t cs
GPIO pin connected to chip select.
Definition: cc110x.h:470
cc110x_cmd
uint8_t cc110x_cmd(cc110x_t *dev, uint8_t cmd)
Send a command to the transceiver.
cc110x_constants.h
Constants for the CC1100/CC1101 driver.
cc110x_power_on
int cc110x_power_on(cc110x_t *dev)
Wakes up the transceiver from "Sleep" or "Crystal oscillator off" state and waits until the crystal h...
cc110x_t
Device descriptor for CC1100/CC1101 transceivers.
Definition: cc110x.h:523