/* * spreadspace avr utils * * * Copyright (C) 2013-2015 Christian Pointner * * This file is part of spreadspace avr utils. * * spreadspace avr utils is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * spreadspace avr utils is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with spreadspace avr utils. If not, see . */ #ifndef SPREADAVR_cc1101_h_INCLUDED #define SPREADAVR_cc1101_h_INCLUDED typedef enum { unknown, sleep, idle, xoff, mancal, fs_wakeup, calibrate, settling, rx, txrx_settling, rxfifo_overflow, fstxon, tx, rxtx_settling, txfifo_underflow } cc1101_state_t; char* cc1101_state_to_string(cc1101_state_t); #define CC1101_FREQ_CORR(xtal) ((float)(xtal/65536.0)) typedef struct { void (*spi_cs_enable)(void); void (*spi_cs_disable)(void); uint8_t (*spi_read_miso)(void); void (*spi_write_byte)(const uint8_t); uint8_t (*spi_read_byte)(void); uint8_t (*spi_transfer_byte)(const uint8_t); float freq_corr; } cc1101_driver_conf_t; void cc1101_init(cc1101_driver_conf_t conf); void cc1101_reg_init(void); void cc1101_soft_reset(void); void cc1101_powerdown(void); void cc1101_idle(void); void cc1101_osc_off(void); void cc1101_calibrate(void); void cc1101_fasttxon(void); void cc1101_rx(void); void cc1101_tx(void); cc1101_state_t cc1101_get_state(void); void cc1101_set_freq_hz(uint32_t hz); uint32_t cc1101_get_freq_hz(void); uint8_t cc1101_get_partnum(void); uint8_t cc1101_get_chip_version(void); uint8_t cc1101_get_freq_offset_est(void); uint8_t cc1101_get_lqi(void); int8_t cc1101_get_rssi(void); uint16_t cc1101_get_wortime(void); uint8_t cc1101_get_pkt_status(void); uint8_t cc1101_get_tx_bytes(void); uint8_t cc1101_get_rx_bytes(void); void cc1101_dump_register(void); #endif