mirror of
https://github.com/DarkFlippers/unleashed-firmware
synced 2024-12-11 21:52:28 +00:00
4d6b170769
* Fixing compiler warnings with -Wextra * More warnings suppression, WIP * Even more warning fixes * Added new lines at end of text files. * Padding fix * Additional fixes to warnings on different build configurations; added -Wextra to default build pipeline * Fixes for Secplus v1 * -additional warnings * +-Wredundant-decls fixes * FuriHal: print stack overflow task name in console * FuriHal: add missing include Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
173 lines
4 KiB
C
173 lines
4 KiB
C
#pragma once
|
|
|
|
#include "cc1101_regs.h"
|
|
|
|
#include <stdbool.h>
|
|
#include <stdint.h>
|
|
#include <furi_hal_spi.h>
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/* Low level API */
|
|
|
|
/** Strobe command to the device
|
|
*
|
|
* @param handle - pointer to FuriHalSpiHandle
|
|
* @param strobe - command to execute
|
|
*
|
|
* @return device status
|
|
*/
|
|
CC1101Status cc1101_strobe(FuriHalSpiBusHandle* handle, uint8_t strobe);
|
|
|
|
/** Write device register
|
|
*
|
|
* @param handle - pointer to FuriHalSpiHandle
|
|
* @param reg - register
|
|
* @param data - data to write
|
|
*
|
|
* @return device status
|
|
*/
|
|
CC1101Status cc1101_write_reg(FuriHalSpiBusHandle* handle, uint8_t reg, uint8_t data);
|
|
|
|
/** Read device register
|
|
*
|
|
* @param handle - pointer to FuriHalSpiHandle
|
|
* @param reg - register
|
|
* @param[out] data - pointer to data
|
|
*
|
|
* @return device status
|
|
*/
|
|
CC1101Status cc1101_read_reg(FuriHalSpiBusHandle* handle, uint8_t reg, uint8_t* data);
|
|
|
|
/* High level API */
|
|
|
|
/** Reset
|
|
*
|
|
* @param handle - pointer to FuriHalSpiHandle
|
|
*/
|
|
void cc1101_reset(FuriHalSpiBusHandle* handle);
|
|
|
|
/** Get status
|
|
*
|
|
* @param handle - pointer to FuriHalSpiHandle
|
|
*
|
|
* @return CC1101Status structure
|
|
*/
|
|
CC1101Status cc1101_get_status(FuriHalSpiBusHandle* handle);
|
|
|
|
/** Enable shutdown mode
|
|
*
|
|
* @param handle - pointer to FuriHalSpiHandle
|
|
*/
|
|
void cc1101_shutdown(FuriHalSpiBusHandle* handle);
|
|
|
|
/** Get Partnumber
|
|
*
|
|
* @param handle - pointer to FuriHalSpiHandle
|
|
*
|
|
* @return part number id
|
|
*/
|
|
uint8_t cc1101_get_partnumber(FuriHalSpiBusHandle* handle);
|
|
|
|
/** Get Version
|
|
*
|
|
* @param handle - pointer to FuriHalSpiHandle
|
|
*
|
|
* @return version
|
|
*/
|
|
uint8_t cc1101_get_version(FuriHalSpiBusHandle* handle);
|
|
|
|
/** Get raw RSSI value
|
|
*
|
|
* @param handle - pointer to FuriHalSpiHandle
|
|
*
|
|
* @return rssi value
|
|
*/
|
|
uint8_t cc1101_get_rssi(FuriHalSpiBusHandle* handle);
|
|
|
|
/** Calibrate oscillator
|
|
*
|
|
* @param handle - pointer to FuriHalSpiHandle
|
|
*/
|
|
void cc1101_calibrate(FuriHalSpiBusHandle* handle);
|
|
|
|
/** Switch to idle
|
|
*
|
|
* @param handle - pointer to FuriHalSpiHandle
|
|
*/
|
|
void cc1101_switch_to_idle(FuriHalSpiBusHandle* handle);
|
|
|
|
/** Switch to RX
|
|
*
|
|
* @param handle - pointer to FuriHalSpiHandle
|
|
*/
|
|
void cc1101_switch_to_rx(FuriHalSpiBusHandle* handle);
|
|
|
|
/** Switch to TX
|
|
*
|
|
* @param handle - pointer to FuriHalSpiHandle
|
|
*/
|
|
void cc1101_switch_to_tx(FuriHalSpiBusHandle* handle);
|
|
|
|
/** Flush RX FIFO
|
|
*
|
|
* @param handle - pointer to FuriHalSpiHandle
|
|
*/
|
|
void cc1101_flush_rx(FuriHalSpiBusHandle* handle);
|
|
|
|
/** Flush TX FIFO
|
|
*
|
|
* @param handle - pointer to FuriHalSpiHandle
|
|
*/
|
|
void cc1101_flush_tx(FuriHalSpiBusHandle* handle);
|
|
|
|
/** Set Frequency
|
|
*
|
|
* @param handle - pointer to FuriHalSpiHandle
|
|
* @param value - frequency in herz
|
|
*
|
|
* @return real frequency that were synthesized
|
|
*/
|
|
uint32_t cc1101_set_frequency(FuriHalSpiBusHandle* handle, uint32_t value);
|
|
|
|
/** Set Intermediate Frequency
|
|
*
|
|
* @param handle - pointer to FuriHalSpiHandle
|
|
* @param value - frequency in herz
|
|
*
|
|
* @return real inermediate frequency that were synthesized
|
|
*/
|
|
uint32_t cc1101_set_intermediate_frequency(FuriHalSpiBusHandle* handle, uint32_t value);
|
|
|
|
/** Set Power Amplifier level table, ramp
|
|
*
|
|
* @param handle - pointer to FuriHalSpiHandle
|
|
* @param value - array of power level values
|
|
*/
|
|
void cc1101_set_pa_table(FuriHalSpiBusHandle* handle, const uint8_t value[8]);
|
|
|
|
/** Write FIFO
|
|
*
|
|
* @param handle - pointer to FuriHalSpiHandle
|
|
* @param data pointer to byte array
|
|
* @param size write bytes count
|
|
*
|
|
* @return size, written bytes count
|
|
*/
|
|
uint8_t cc1101_write_fifo(FuriHalSpiBusHandle* handle, const uint8_t* data, uint8_t size);
|
|
|
|
/** Read FIFO
|
|
*
|
|
* @param handle - pointer to FuriHalSpiHandle
|
|
* @param data pointer to byte array
|
|
* @param size bytes to read from fifo
|
|
*
|
|
* @return size, read bytes count
|
|
*/
|
|
uint8_t cc1101_read_fifo(FuriHalSpiBusHandle* handle, uint8_t* data, uint8_t* size);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|