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 
9 #pragma once
10 
21 #include "periph/gpio.h"
22 #include "periph/spi.h"
23 #include "cc110x.h"
24 #include "cc110x_constants.h"
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
37 static inline void cc110x_acquire(cc110x_t *dev)
38 {
40 }
41 
45 static inline void cc110x_release(cc110x_t *dev)
46 {
47  spi_release(dev->params.spi);
48 }
49 
73 uint8_t cc110x_read(cc110x_t *dev, uint8_t addr, uint8_t *dest);
74 
93 uint8_t cc110x_read_reliable(cc110x_t *dev, uint8_t addr, uint8_t *dest);
94 
110 uint8_t cc110x_write(cc110x_t *dev, uint8_t addr, uint8_t data);
111 
130 uint8_t cc110x_burst_read(cc110x_t *dev, uint8_t addr, void *dest, size_t len);
131 
150 uint8_t cc110x_burst_write(cc110x_t *dev, uint8_t addr,
151  const void *src, size_t len);
152 
166 uint8_t cc110x_cmd(cc110x_t *dev, uint8_t cmd);
167 
175 uint8_t cc110x_status(cc110x_t *dev);
176 
205 
206 #ifdef __cplusplus
207 }
208 #endif
209 
Interface definition for the CC1100/CC1101 driver.
int cc110x_power_on_and_acquire(cc110x_t *dev)
Wakes up the transceiver from "Sleep" or "Crystal oscillator off" state and waits until the crystal h...
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.
uint8_t cc110x_status(cc110x_t *dev)
Get the transceivers status byte in a reliable way.
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.
static void cc110x_acquire(cc110x_t *dev)
Acquire the SPI interface of the transceiver.
uint8_t cc110x_read(cc110x_t *dev, uint8_t addr, uint8_t *dest)
Read a single configuration/status register from the transceiver.
uint8_t cc110x_read_reliable(cc110x_t *dev, uint8_t addr, uint8_t *dest)
Read a single status register from the transceiver reliable.
static void cc110x_release(cc110x_t *dev)
Release the SPI interface of the transceiver.
uint8_t cc110x_cmd(cc110x_t *dev, uint8_t cmd)
Send a command to the transceiver.
uint8_t cc110x_write(cc110x_t *dev, uint8_t addr, uint8_t data)
Write to a single configuration register on the transceiver.
Constants for the CC1100/CC1101 driver.
Low-level GPIO peripheral driver interface definitions.
void spi_acquire(spi_t bus, spi_cs_t cs, spi_mode_t mode, spi_clk_t clk)
Start a new SPI transaction.
void spi_release(spi_t bus)
Finish an ongoing SPI transaction by releasing the given SPI bus.
@ SPI_MODE_0
CPOL=0, CPHA=0.
Definition: periph_cpu.h:43
Low-level SPI peripheral driver interface definition.
spi_t spi
SPI bus connected to the device.
Definition: cc110x.h:461
spi_clk_t spi_clk
SPI clock to use (max 6.5 MHz)
Definition: cc110x.h:462
spi_cs_t cs
GPIO pin connected to chip select.
Definition: cc110x.h:463
Device descriptor for CC1100/CC1101 transceivers.
Definition: cc110x.h:511
cc110x_params_t params
Configuration of the driver.
Definition: cc110x.h:520