1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
RIOT/drivers/cc2420/include/cc2420_spi.h

93 lines
2.3 KiB
C
Raw Normal View History

/**
* cc2420_spi.h - Definition of CC2420 SPI functions.
* Copyright (C) 2013 Milan Babel <babel@inf.fu-berlin.de>
*
* This source code is licensed under the GNU Lesser General Public License,
* Version 2. See the file LICENSE for more details.
*/
/**
* @ingroup CC2420
* @{
* @file
* @brief Definition of CC2420 SPI functions
* @author Milan Babel <babel@inf.fu-berlin.de>
*
*/
#ifndef CC2420_SPI_H
#define CC2420_SPI_H
#include <stdio.h>
/**
* @brief Writes a byte to the cc2420 register.
*
* @param[in] addr The address of the register to write.
* @param[in] value The value to write in the register.
*/
void cc2420_write_reg(uint8_t addr, uint16_t value);
/**
* @brief Reads a byte from the cc2420 register.
*
* @param[in] addr The address of the register to read.
*
* @return The value in the register.
*/
uint16_t cc2420_read_reg(uint8_t addr);
/**
* @brief Sends a strobe command to the cc2420.
*
* @param[in] c The strobe command to send.
*
* @return The result of the strobe command.
*/
uint8_t cc2420_strobe(uint8_t c);
/**
* @brief Reads multiple bytes from the cc2420 ram.
*
* @param[in] addr The ram address to read.
* @param[out] buffer A buffer to store the value of the ram.
* @param[in] len The count of bytes which should be read.
*
* @return The number of bytes read.
*/
uint16_t cc2420_read_ram(uint16_t addr, uint8_t* buffer, uint16_t len);
/**
* @brief Writes multiple bytes to the cc2420 ram.
*
* @param[in] addr The ram address to write.
* @param[in] buffer A buffer with the value to write to the ram.
* @param[in] len The count of bytes which should be written.
*
* @return The number of bytes written.
*/
uint16_t cc2420_write_ram(uint16_t addr, uint8_t* buffer, uint16_t len);
/**
* @brief Writes multiple bytes to the cc2420 fifo.
*
* @param[in] data A buffer with the value to write to the fifo.
* @param[in] data_length The count of bytes which should be written.
*
* @return The number of bytes written.
*/
uint16_t cc2420_write_fifo(uint8_t* data, uint16_t data_length);
/**
* @brief Reads multiple bytes from the cc2420 fifo.
*
* @param[out] data A buffer to store the value of the fifo.
* @param[in] data_length The count of bytes which should be read.
*
* @return The number of bytes read.
*/
uint16_t cc2420_read_fifo(uint8_t* data, uint16_t data_length);
#endif