[FL-1906] Documentation: add Doxyfile, prepare sources for doxygen. (#741)
* Documentation: add Doxyfile, prepare sources for doxygen. * Update ReadMe and remove obsolete CLA * Add contribution guide * Contributing: update text * Correct spelling
This commit is contained in:
@@ -1,4 +1,10 @@
|
||||
/**
|
||||
* @file furi-hal-boot.h
|
||||
* Bootloader HAL API
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -17,16 +23,26 @@ typedef enum {
|
||||
FuriHalBootFlagFactoryReset=1,
|
||||
} FuriHalBootFlag;
|
||||
|
||||
/** Initialize boot subsystem */
|
||||
/** Initialize boot subsystem
|
||||
*/
|
||||
void furi_hal_boot_init();
|
||||
|
||||
/** Set boot mode */
|
||||
/** Set boot mode
|
||||
*
|
||||
* @param[in] mode FuriHalBootMode
|
||||
*/
|
||||
void furi_hal_boot_set_mode(FuriHalBootMode mode);
|
||||
|
||||
/** Set boot flags */
|
||||
/** Set boot flags
|
||||
*
|
||||
* @param[in] flags FuriHalBootFlag
|
||||
*/
|
||||
void furi_hal_boot_set_flags(FuriHalBootFlag flags);
|
||||
|
||||
/** Get boot flag */
|
||||
/** Get boot flag
|
||||
*
|
||||
* @return FuriHalBootFlag
|
||||
*/
|
||||
FuriHalBootFlag furi_hal_boot_get_flags();
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
/**
|
||||
* @file furi-hal-bt.h
|
||||
* BT/BLE HAL API
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <m-string.h>
|
||||
@@ -7,64 +12,114 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** Initialize */
|
||||
/** Initialize
|
||||
*/
|
||||
void furi_hal_bt_init();
|
||||
|
||||
/** Start BLE app */
|
||||
/** Start BLE app
|
||||
*
|
||||
* @return true if app inited
|
||||
*/
|
||||
bool furi_hal_bt_init_app();
|
||||
|
||||
/** Start advertising */
|
||||
/** Start advertising
|
||||
*/
|
||||
void furi_hal_bt_start_advertising();
|
||||
|
||||
/** Stop advertising */
|
||||
/** Stop advertising
|
||||
*/
|
||||
void furi_hal_bt_stop_advertising();
|
||||
|
||||
/** Returns true if BLE is advertising */
|
||||
/** Returns true if BLE is advertising
|
||||
*
|
||||
* @return true if BLE advertising
|
||||
*/
|
||||
bool furi_hal_bt_is_active();
|
||||
|
||||
/** Get BT/BLE system component state */
|
||||
/** Get BT/BLE system component state
|
||||
*
|
||||
* @param[in] buffer string_t buffer to write to
|
||||
*/
|
||||
void furi_hal_bt_dump_state(string_t buffer);
|
||||
|
||||
/** Get BT/BLE system component state */
|
||||
/** Get BT/BLE system component state
|
||||
*
|
||||
* @return true if core2 is alive
|
||||
*/
|
||||
bool furi_hal_bt_is_alive();
|
||||
|
||||
/** Wait for Core2 startup */
|
||||
/** Wait for Core2 startup
|
||||
*
|
||||
* @return true if success, otherwise timeouted
|
||||
*/
|
||||
bool furi_hal_bt_wait_startup();
|
||||
|
||||
/**
|
||||
* Lock shared access to flash controller
|
||||
* @return true if lock was successful, false if not
|
||||
/** Lock shared access to flash controller
|
||||
*
|
||||
* @param[in] erase_flag true if erase operation
|
||||
*
|
||||
* @return true if lock was successful, false if not
|
||||
*/
|
||||
bool furi_hal_bt_lock_flash(bool erase_flag);
|
||||
|
||||
/** Unlock shared access to flash controller */
|
||||
/** Unlock shared access to flash controller
|
||||
*
|
||||
* @param[in] erase_flag true if erase operation
|
||||
*/
|
||||
void furi_hal_bt_unlock_flash(bool erase_flag);
|
||||
|
||||
/** Start ble tone tx at given channel and power */
|
||||
/** Start ble tone tx at given channel and power
|
||||
*
|
||||
* @param[in] channel The channel
|
||||
* @param[in] power The power
|
||||
*/
|
||||
void furi_hal_bt_start_tone_tx(uint8_t channel, uint8_t power);
|
||||
|
||||
/** Stop ble tone tx */
|
||||
/** Stop ble tone tx
|
||||
*/
|
||||
void furi_hal_bt_stop_tone_tx();
|
||||
|
||||
/** Start sending ble packets at a given frequency and datarate */
|
||||
/** Start sending ble packets at a given frequency and datarate
|
||||
*
|
||||
* @param[in] channel The channel
|
||||
* @param[in] pattern The pattern
|
||||
* @param[in] datarate The datarate
|
||||
*/
|
||||
void furi_hal_bt_start_packet_tx(uint8_t channel, uint8_t pattern, uint8_t datarate);
|
||||
|
||||
/** Stop sending ble packets */
|
||||
/** Stop sending ble packets
|
||||
*
|
||||
* @return sent packet count
|
||||
*/
|
||||
uint16_t furi_hal_bt_stop_packet_test();
|
||||
|
||||
/** Start receiving packets */
|
||||
/** Start receiving packets
|
||||
*
|
||||
* @param[in] channel RX channel
|
||||
* @param[in] datarate Datarate
|
||||
*/
|
||||
void furi_hal_bt_start_packet_rx(uint8_t channel, uint8_t datarate);
|
||||
|
||||
/** Set up the RF to listen to a given RF channel */
|
||||
/** Set up the RF to listen to a given RF channel
|
||||
*
|
||||
* @param[in] channel RX channel
|
||||
*/
|
||||
void furi_hal_bt_start_rx(uint8_t channel);
|
||||
|
||||
/** Stop RF listenning */
|
||||
/** Stop RF listenning
|
||||
*/
|
||||
void furi_hal_bt_stop_rx();
|
||||
|
||||
/** Get RSSI */
|
||||
/** Get RSSI
|
||||
*
|
||||
* @return RSSI in dBm
|
||||
*/
|
||||
float furi_hal_bt_get_rssi();
|
||||
|
||||
/** Get number of transmitted packets */
|
||||
/** Get number of transmitted packets
|
||||
*
|
||||
* @return packet count
|
||||
*/
|
||||
uint32_t furi_hal_bt_get_transmitted_packets();
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
/**
|
||||
* @file furi-hal-crypto.h
|
||||
* Cryptography HAL API
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <stdbool.h>
|
||||
@@ -24,43 +28,54 @@ typedef struct {
|
||||
uint8_t* data;
|
||||
} FuriHalCryptoKey;
|
||||
|
||||
/** Initialize cryptography layer
|
||||
* This includes AES engines, PKA and RNG
|
||||
/** Initialize cryptography layer This includes AES engines, PKA and RNG
|
||||
*/
|
||||
void furi_hal_crypto_init();
|
||||
|
||||
/** Store key in crypto storage
|
||||
* @param key - FuriHalCryptoKey to store. Only Master, Simple or Encrypted
|
||||
* @param slot - pinter to int where store slot number will be saved
|
||||
* @return true on success
|
||||
*
|
||||
* @param key FuriHalCryptoKey to store. Only Master, Simple or
|
||||
* Encrypted
|
||||
* @param slot pinter to int where store slot number will be saved
|
||||
*
|
||||
* @return true on success
|
||||
*/
|
||||
bool furi_hal_crypto_store_add_key(FuriHalCryptoKey* key, uint8_t* slot);
|
||||
|
||||
/** Init AES engine and load key from crypto store
|
||||
* @param slot - store slot number
|
||||
* @return true on success
|
||||
*
|
||||
* @param slot store slot number
|
||||
* @param[in] iv pointer to 16 bytes Initialization Vector data
|
||||
*
|
||||
* @return true on success
|
||||
*/
|
||||
bool furi_hal_crypto_store_load_key(uint8_t slot, const uint8_t* iv);
|
||||
|
||||
/** Unload key engine and deinit AES engine
|
||||
* @param slot - store slot number
|
||||
* @return true on success
|
||||
*
|
||||
* @param slot store slot number
|
||||
*
|
||||
* @return true on success
|
||||
*/
|
||||
bool furi_hal_crypto_store_unload_key(uint8_t slot);
|
||||
|
||||
|
||||
/** Encrypt data
|
||||
* @param input - pointer to input data
|
||||
* @param output - pointer to output data
|
||||
* @param size - input/output buffer size in bytes
|
||||
* @return true on success
|
||||
*
|
||||
* @param input pointer to input data
|
||||
* @param output pointer to output data
|
||||
* @param size input/output buffer size in bytes
|
||||
*
|
||||
* @return true on success
|
||||
*/
|
||||
bool furi_hal_crypto_encrypt(const uint8_t *input, uint8_t *output, size_t size);
|
||||
|
||||
/** Decrypt data
|
||||
* @param input - pointer to input data
|
||||
* @param output - pointer to output data
|
||||
* @param size - input/output buffer size in bytes
|
||||
* @return true on success
|
||||
*
|
||||
* @param input pointer to input data
|
||||
* @param output pointer to output data
|
||||
* @param size input/output buffer size in bytes
|
||||
*
|
||||
* @return true on success
|
||||
*/
|
||||
bool furi_hal_crypto_decrypt(const uint8_t *input, uint8_t *output, size_t size);
|
||||
|
||||
@@ -1,23 +1,39 @@
|
||||
/**
|
||||
* @file furi-hal-delay.h
|
||||
* Delay HAL API
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "main.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** Init DWT */
|
||||
/** Init DWT
|
||||
*/
|
||||
void furi_hal_delay_init(void);
|
||||
|
||||
/**
|
||||
* Delay in milliseconds
|
||||
* @warning Cannot be used from ISR
|
||||
/** Delay in milliseconds
|
||||
* @warning Cannot be used from ISR
|
||||
*
|
||||
* @param[in] milliseconds milliseconds to wait
|
||||
*/
|
||||
void delay(float milliseconds);
|
||||
|
||||
/** Delay in microseconds */
|
||||
/** Delay in microseconds
|
||||
*
|
||||
* @param[in] microseconds microseconds to wait
|
||||
*/
|
||||
void delay_us(float microseconds);
|
||||
|
||||
/** Get current millisecond */
|
||||
/** Get current millisecond
|
||||
*
|
||||
* System uptime, pProvided by HAL, may overflow.
|
||||
*
|
||||
* @return Current milliseconds
|
||||
*/
|
||||
uint32_t millis(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
/**
|
||||
* @file furi-hal-i2c.h
|
||||
* I2C HAL API
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdbool.h>
|
||||
@@ -8,17 +13,19 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** Init I2C */
|
||||
/** Init I2C
|
||||
*/
|
||||
void furi_hal_i2c_init();
|
||||
|
||||
/**
|
||||
* Perform I2C tx transfer
|
||||
* @param instance I2C_TypeDef instance
|
||||
* @param address I2C slave address
|
||||
* @param data pointer to data buffer
|
||||
* @param size size of data buffer
|
||||
* @param timeout timeout in CPU ticks
|
||||
* @return true on successful transfer, false otherwise
|
||||
/** Perform I2C tx transfer
|
||||
*
|
||||
* @param instance I2C_TypeDef instance
|
||||
* @param address I2C slave address
|
||||
* @param data pointer to data buffer
|
||||
* @param size size of data buffer
|
||||
* @param timeout timeout in CPU ticks
|
||||
*
|
||||
* @return true on successful transfer, false otherwise
|
||||
*/
|
||||
bool furi_hal_i2c_tx(
|
||||
I2C_TypeDef* instance,
|
||||
@@ -27,14 +34,15 @@ bool furi_hal_i2c_tx(
|
||||
const uint8_t size,
|
||||
uint32_t timeout);
|
||||
|
||||
/**
|
||||
* Perform I2C rx transfer
|
||||
* @param instance I2C_TypeDef instance
|
||||
* @param address I2C slave address
|
||||
* @param data pointer to data buffer
|
||||
* @param size size of data buffer
|
||||
* @param timeout timeout in CPU ticks
|
||||
* @return true on successful transfer, false otherwise
|
||||
/** Perform I2C rx transfer
|
||||
*
|
||||
* @param instance I2C_TypeDef instance
|
||||
* @param address I2C slave address
|
||||
* @param data pointer to data buffer
|
||||
* @param size size of data buffer
|
||||
* @param timeout timeout in CPU ticks
|
||||
*
|
||||
* @return true on successful transfer, false otherwise
|
||||
*/
|
||||
bool furi_hal_i2c_rx(
|
||||
I2C_TypeDef* instance,
|
||||
@@ -43,16 +51,17 @@ bool furi_hal_i2c_rx(
|
||||
const uint8_t size,
|
||||
uint32_t timeout);
|
||||
|
||||
/**
|
||||
* Perform I2C tx and rx transfers
|
||||
* @param instance I2C_TypeDef instance
|
||||
* @param address I2C slave address
|
||||
* @param tx_data pointer to tx data buffer
|
||||
* @param tx_size size of tx data buffer
|
||||
* @param rx_data pointer to rx data buffer
|
||||
* @param rx_size size of rx data buffer
|
||||
* @param timeout timeout in CPU ticks
|
||||
* @return true on successful transfer, false otherwise
|
||||
/** Perform I2C tx and rx transfers
|
||||
*
|
||||
* @param instance I2C_TypeDef instance
|
||||
* @param address I2C slave address
|
||||
* @param tx_data pointer to tx data buffer
|
||||
* @param tx_size size of tx data buffer
|
||||
* @param rx_data pointer to rx data buffer
|
||||
* @param rx_size size of rx data buffer
|
||||
* @param timeout timeout in CPU ticks
|
||||
*
|
||||
* @return true on successful transfer, false otherwise
|
||||
*/
|
||||
bool furi_hal_i2c_trx(
|
||||
I2C_TypeDef* instance,
|
||||
@@ -63,17 +72,22 @@ bool furi_hal_i2c_trx(
|
||||
const uint8_t rx_size,
|
||||
uint32_t timeout);
|
||||
|
||||
/** Acquire I2C mutex */
|
||||
/** Acquire I2C mutex
|
||||
*/
|
||||
void furi_hal_i2c_lock();
|
||||
|
||||
/** Release I2C mutex */
|
||||
/** Release I2C mutex
|
||||
*/
|
||||
void furi_hal_i2c_unlock();
|
||||
|
||||
/**
|
||||
* With clause for I2C peripheral
|
||||
* @param type type of function_body
|
||||
* @param pointer pointer to return of function_body
|
||||
* @param function_body a (){} lambda declaration, executed with I2C mutex acquired
|
||||
/** With clause for I2C peripheral
|
||||
*
|
||||
* @param type type of function_body
|
||||
* @param pointer pointer to return of function_body
|
||||
* @param function_body a (){} lambda declaration, executed with I2C mutex
|
||||
* acquired
|
||||
*
|
||||
* @return Nothing
|
||||
*/
|
||||
#define with_furi_hal_i2c(type, pointer, function_body) \
|
||||
{ \
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
/**
|
||||
* @file furi-hal-ibutton.h
|
||||
* iButton HAL API
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
/**
|
||||
* @file furi-hal-irda.h
|
||||
* IRDA HAL API
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
@@ -11,122 +17,120 @@ extern "C" {
|
||||
#define IRDA_MIN_FREQUENCY 10000
|
||||
|
||||
typedef enum {
|
||||
FuriHalIrdaTxGetDataStateOk, /* New data obtained */
|
||||
FuriHalIrdaTxGetDataStateDone, /* New data obtained, and this is end of package */
|
||||
FuriHalIrdaTxGetDataStateLastDone, /* New data obtained, and this is end of package and no more data available */
|
||||
FuriHalIrdaTxGetDataStateOk, /**< New data obtained */
|
||||
FuriHalIrdaTxGetDataStateDone, /**< New data obtained, and this is end of package */
|
||||
FuriHalIrdaTxGetDataStateLastDone, /**< New data obtained, and this is end of package and no more data available */
|
||||
} FuriHalIrdaTxGetDataState;
|
||||
|
||||
/* Callback type for providing data to IRDA DMA TX system. It is called every tim */
|
||||
/** Callback type for providing data to IRDA DMA TX system. It is called every tim */
|
||||
typedef FuriHalIrdaTxGetDataState (*FuriHalIrdaTxGetDataISRCallback) (void* context, uint32_t* duration, bool* level);
|
||||
|
||||
/* Callback type called every time signal is sent by DMA to Timer.
|
||||
* Actually, it means there are 2 timings left to send for this signal, which is almost end.
|
||||
* Don't use this callback to stop transmission, as far as there are next signal is
|
||||
* charged for transmission by DMA.
|
||||
/** Callback type called every time signal is sent by DMA to Timer.
|
||||
*
|
||||
* Actually, it means there are 2 timings left to send for this signal, which is
|
||||
* almost end. Don't use this callback to stop transmission, as far as there are
|
||||
* next signal is charged for transmission by DMA.
|
||||
*/
|
||||
typedef void (*FuriHalIrdaTxSignalSentISRCallback) (void* context);
|
||||
|
||||
/**
|
||||
* Signature of callback function for receiving continuous IRDA rx signal.
|
||||
/** Signature of callback function for receiving continuous IRDA rx signal.
|
||||
*
|
||||
* @param ctx[in] - context to pass to callback
|
||||
* @param level[in] - level of input IRDA rx signal
|
||||
* @param duration[in] - duration of continuous rx signal level in us
|
||||
* @param ctx[in] context to pass to callback
|
||||
* @param level[in] level of input IRDA rx signal
|
||||
* @param duration[in] duration of continuous rx signal level in us
|
||||
*/
|
||||
typedef void (*FuriHalIrdaRxCaptureCallback)(void* ctx, bool level, uint32_t duration);
|
||||
|
||||
/**
|
||||
* Signature of callback function for reaching silence timeout on IRDA port.
|
||||
/** Signature of callback function for reaching silence timeout on IRDA port.
|
||||
*
|
||||
* @param ctx[in] - context to pass to callback
|
||||
* @param ctx[in] context to pass to callback
|
||||
*/
|
||||
typedef void (*FuriHalIrdaRxTimeoutCallback)(void* ctx);
|
||||
|
||||
/**
|
||||
* Initialize IRDA RX timer to receive interrupts.
|
||||
* It provides interrupts for every RX-signal edge changing
|
||||
* with its duration.
|
||||
/** Initialize IRDA RX timer to receive interrupts.
|
||||
*
|
||||
* It provides interrupts for every RX-signal edge changing with its duration.
|
||||
*/
|
||||
void furi_hal_irda_async_rx_start(void);
|
||||
|
||||
/**
|
||||
* Deinitialize IRDA RX interrupt.
|
||||
/** Deinitialize IRDA RX interrupt.
|
||||
*/
|
||||
void furi_hal_irda_async_rx_stop(void);
|
||||
|
||||
/** Setup hal for receiving silence timeout.
|
||||
*
|
||||
* Should be used with 'furi_hal_irda_timeout_irq_set_callback()'.
|
||||
*
|
||||
* @param[in] timeout_us - time to wait for silence on IRDA port
|
||||
* before generating IRQ.
|
||||
* @param[in] timeout_us time to wait for silence on IRDA port before
|
||||
* generating IRQ.
|
||||
*/
|
||||
void furi_hal_irda_async_rx_set_timeout(uint32_t timeout_us);
|
||||
|
||||
/** Setup callback for previously initialized IRDA RX interrupt.
|
||||
*
|
||||
* @param[in] callback - callback to call when RX signal edge changing occurs
|
||||
* @param[in] ctx - context for callback
|
||||
* @param[in] callback callback to call when RX signal edge changing occurs
|
||||
* @param[in] ctx context for callback
|
||||
*/
|
||||
void furi_hal_irda_async_rx_set_capture_isr_callback(FuriHalIrdaRxCaptureCallback callback, void *ctx);
|
||||
|
||||
/**
|
||||
* Setup callback for reaching silence timeout on IRDA port.
|
||||
/** Setup callback for reaching silence timeout on IRDA port.
|
||||
*
|
||||
* Should setup hal with 'furi_hal_irda_setup_rx_timeout_irq()' first.
|
||||
*
|
||||
* @param[in] callback - callback for silence timeout
|
||||
* @param[in] ctx - context to pass to callback
|
||||
* @param[in] callback callback for silence timeout
|
||||
* @param[in] ctx context to pass to callback
|
||||
*/
|
||||
void furi_hal_irda_async_rx_set_timeout_isr_callback(FuriHalIrdaRxTimeoutCallback callback, void *ctx);
|
||||
|
||||
/**
|
||||
* Check if IRDA is in use now.
|
||||
* @return true - IRDA is busy, false otherwise.
|
||||
/** Check if IRDA is in use now.
|
||||
*
|
||||
* @return true if IRDA is busy, false otherwise.
|
||||
*/
|
||||
bool furi_hal_irda_is_busy(void);
|
||||
|
||||
/**
|
||||
* Set callback providing new data. This function has to be called
|
||||
* before furi_hal_irda_async_tx_start().
|
||||
/** Set callback providing new data.
|
||||
*
|
||||
* @param[in] callback - function to provide new data
|
||||
* @param[in] context - context for callback
|
||||
* This function has to be called before furi_hal_irda_async_tx_start().
|
||||
*
|
||||
* @param[in] callback function to provide new data
|
||||
* @param[in] context context for callback
|
||||
*/
|
||||
void furi_hal_irda_async_tx_set_data_isr_callback(FuriHalIrdaTxGetDataISRCallback callback, void* context);
|
||||
|
||||
/**
|
||||
* Start IR asynchronous transmission. It can be stopped by 2 reasons:
|
||||
* 1) implicit call for furi_hal_irda_async_tx_stop()
|
||||
* 2) callback can provide FuriHalIrdaTxGetDataStateLastDone response
|
||||
* which means no more data available for transmission.
|
||||
/** Start IR asynchronous transmission.
|
||||
*
|
||||
* It can be stopped by 2 reasons:
|
||||
* 1. implicit call for furi_hal_irda_async_tx_stop()
|
||||
* 2. callback can provide FuriHalIrdaTxGetDataStateLastDone response which
|
||||
* means no more data available for transmission.
|
||||
*
|
||||
* Any func (furi_hal_irda_async_tx_stop() or
|
||||
* furi_hal_irda_async_tx_wait_termination()) has to be called to wait
|
||||
* end of transmission and free resources.
|
||||
* furi_hal_irda_async_tx_wait_termination()) has to be called to wait end of
|
||||
* transmission and free resources.
|
||||
*
|
||||
* @param[in] freq - frequency for PWM
|
||||
* @param[in] duty_cycle - duty cycle for PWM
|
||||
* @param[in] freq frequency for PWM
|
||||
* @param[in] duty_cycle duty cycle for PWM
|
||||
*/
|
||||
void furi_hal_irda_async_tx_start(uint32_t freq, float duty_cycle);
|
||||
|
||||
/**
|
||||
* Stop IR asynchronous transmission and free resources.
|
||||
* Transmission will stop as soon as transmission reaches end of
|
||||
* package (FuriHalIrdaTxGetDataStateDone or FuriHalIrdaTxGetDataStateLastDone).
|
||||
/** Stop IR asynchronous transmission and free resources.
|
||||
*
|
||||
* Transmission will stop as soon as transmission reaches end of package
|
||||
* (FuriHalIrdaTxGetDataStateDone or FuriHalIrdaTxGetDataStateLastDone).
|
||||
*/
|
||||
void furi_hal_irda_async_tx_stop(void);
|
||||
|
||||
/**
|
||||
* Wait for end of IR asynchronous transmission and free resources.
|
||||
* Transmission will stop as soon as transmission reaches end of
|
||||
* transmission (FuriHalIrdaTxGetDataStateLastDone).
|
||||
/** Wait for end of IR asynchronous transmission and free resources.
|
||||
*
|
||||
* Transmission will stop as soon as transmission reaches end of transmission
|
||||
* (FuriHalIrdaTxGetDataStateLastDone).
|
||||
*/
|
||||
void furi_hal_irda_async_tx_wait_termination(void);
|
||||
|
||||
/**
|
||||
* Set callback for end of signal transmission
|
||||
/** Set callback for end of signal transmission
|
||||
*
|
||||
* @param[in] callback - function to call when signal is sent
|
||||
* @param[in] context - context for callback
|
||||
* @param[in] callback function to call when signal is sent
|
||||
* @param[in] context context for callback
|
||||
*/
|
||||
void furi_hal_irda_async_tx_set_signal_sent_isr_callback(FuriHalIrdaTxSignalSentISRCallback callback, void* context);
|
||||
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
/**
|
||||
* @file furi-hal-light.h
|
||||
* Light control HAL API
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdbool.h>
|
||||
@@ -8,13 +13,14 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** Init light driver */
|
||||
/** Init light driver
|
||||
*/
|
||||
void furi_hal_light_init();
|
||||
|
||||
/**
|
||||
* Set light value
|
||||
* @param light - Light
|
||||
* @param value - light brightness [0-255]
|
||||
/** Set light value
|
||||
*
|
||||
* @param light Light
|
||||
* @param value light brightness [0-255]
|
||||
*/
|
||||
void furi_hal_light_set(Light light, uint8_t value);
|
||||
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
/**
|
||||
* @file furi-hal-nfc.h
|
||||
* NFC HAL API
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <rfal_nfc.h>
|
||||
@@ -11,58 +16,78 @@ extern "C" {
|
||||
|
||||
#define FURI_HAL_NFC_UID_MAX_LEN 10
|
||||
|
||||
/**
|
||||
* Init nfc
|
||||
/** Init nfc
|
||||
*/
|
||||
void furi_hal_nfc_init();
|
||||
|
||||
/**
|
||||
* Check if nfc worker is busy
|
||||
/** Check if nfc worker is busy
|
||||
*
|
||||
* @return true if busy
|
||||
*/
|
||||
bool furi_hal_nfc_is_busy();
|
||||
|
||||
/**
|
||||
* NFC field on
|
||||
/** NFC field on
|
||||
*/
|
||||
void furi_hal_nfc_field_on();
|
||||
|
||||
/**
|
||||
* NFC field off
|
||||
/** NFC field off
|
||||
*/
|
||||
void furi_hal_nfc_field_off();
|
||||
|
||||
/**
|
||||
* NFC start sleep
|
||||
/** NFC start sleep
|
||||
*/
|
||||
void furi_hal_nfc_start_sleep();
|
||||
|
||||
/**
|
||||
* NFC stop sleep
|
||||
/** NFC stop sleep
|
||||
*/
|
||||
void furi_hal_nfc_exit_sleep();
|
||||
|
||||
/**
|
||||
* NFC poll
|
||||
/** NFC poll
|
||||
*
|
||||
* @param dev_list pointer to rfalNfcDevice buffer
|
||||
* @param dev_cnt pointer device count
|
||||
* @param timeout timeout in ms
|
||||
* @param deactivate deactivate flag
|
||||
*
|
||||
* @return true on success
|
||||
*/
|
||||
bool furi_hal_nfc_detect(rfalNfcDevice** dev_list, uint8_t* dev_cnt, uint32_t timeout, bool deactivate);
|
||||
|
||||
/**
|
||||
* NFC listen
|
||||
/** NFC listen
|
||||
*
|
||||
* @param uid pointer to uid buffer
|
||||
* @param uid_len uid length
|
||||
* @param atqa pointer to atqa
|
||||
* @param sak sak
|
||||
* @param activate_after_sak activate after sak flag
|
||||
* @param timeout timeout in ms
|
||||
*
|
||||
* @return true on success
|
||||
*/
|
||||
bool furi_hal_nfc_listen(uint8_t* uid, uint8_t uid_len, uint8_t* atqa, uint8_t sak, bool activate_after_sak, uint32_t timeout);
|
||||
|
||||
/**
|
||||
* Get first command from reader after activation in emulation mode
|
||||
/** Get first command from reader after activation in emulation mode
|
||||
*
|
||||
* @param rx_buff pointer to receive buffer
|
||||
* @param rx_len receive buffer length
|
||||
*
|
||||
* @return true on success
|
||||
*/
|
||||
bool furi_hal_nfc_get_first_frame(uint8_t** rx_buff, uint16_t** rx_len);
|
||||
|
||||
/**
|
||||
* NFC data exchange
|
||||
/** NFC data exchange
|
||||
*
|
||||
* @param tx_buff transmit buffer
|
||||
* @param tx_len transmit buffer length
|
||||
* @param rx_buff receive buffer
|
||||
* @param rx_len receive buffer length
|
||||
* @param deactivate deactivate flag
|
||||
*
|
||||
* @return ST ReturnCode
|
||||
*/
|
||||
ReturnCode furi_hal_nfc_data_exchange(uint8_t* tx_buff, uint16_t tx_len, uint8_t** rx_buff, uint16_t** rx_len, bool deactivate);
|
||||
|
||||
/**
|
||||
* NFC deactivate and start sleep
|
||||
/** NFC deactivate and start sleep
|
||||
*/
|
||||
void furi_hal_nfc_deactivate();
|
||||
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
/**
|
||||
* @file furi-hal-power.h
|
||||
* Power HAL API
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
@@ -14,92 +19,142 @@ typedef enum {
|
||||
FuriHalPowerICFuelGauge,
|
||||
} FuriHalPowerIC;
|
||||
|
||||
/** Initialize drivers */
|
||||
/** Initialize drivers
|
||||
*/
|
||||
void furi_hal_power_init();
|
||||
|
||||
/**
|
||||
* Get current insomnia level
|
||||
* @return insomnia level: 0 - no insomnia, >0 - insomnia, bearer count.
|
||||
/** Get current insomnia level
|
||||
*
|
||||
* @return insomnia level: 0 - no insomnia, >0 - insomnia, bearer count.
|
||||
*/
|
||||
uint16_t furi_hal_power_insomnia_level();
|
||||
|
||||
/**
|
||||
* Enter insomnia mode
|
||||
* Prevents device from going to sleep
|
||||
* @warning Internally increases insomnia level
|
||||
* Must be paired with furi_hal_power_insomnia_exit
|
||||
/** Enter insomnia mode Prevents device from going to sleep
|
||||
* @warning Internally increases insomnia level Must be paired with
|
||||
* furi_hal_power_insomnia_exit
|
||||
*/
|
||||
void furi_hal_power_insomnia_enter();
|
||||
|
||||
/**
|
||||
* Exit insomnia mode
|
||||
* Allow device to go to sleep
|
||||
* @warning Internally decreases insomnia level.
|
||||
* Must be paired with furi_hal_power_insomnia_enter
|
||||
/** Exit insomnia mode Allow device to go to sleep
|
||||
* @warning Internally decreases insomnia level. Must be paired with
|
||||
* furi_hal_power_insomnia_enter
|
||||
*/
|
||||
void furi_hal_power_insomnia_exit();
|
||||
|
||||
/** Check if sleep availble */
|
||||
/** Check if sleep availble
|
||||
*
|
||||
* @return true if available
|
||||
*/
|
||||
bool furi_hal_power_sleep_available();
|
||||
|
||||
/** Check if deep sleep availble */
|
||||
/** Check if deep sleep availble
|
||||
*
|
||||
* @return true if available
|
||||
*/
|
||||
bool furi_hal_power_deep_sleep_available();
|
||||
|
||||
/** Go to sleep */
|
||||
/** Go to sleep
|
||||
*/
|
||||
void furi_hal_power_sleep();
|
||||
|
||||
/** Get predicted remaining battery capacity in percents */
|
||||
/** Get predicted remaining battery capacity in percents
|
||||
*
|
||||
* @return remaining battery capacity in percents
|
||||
*/
|
||||
uint8_t furi_hal_power_get_pct();
|
||||
|
||||
/** Get battery health state in percents */
|
||||
/** Get battery health state in percents
|
||||
*
|
||||
* @return health in percents
|
||||
*/
|
||||
uint8_t furi_hal_power_get_bat_health_pct();
|
||||
|
||||
/** Get charging status */
|
||||
/** Get charging status
|
||||
*
|
||||
* @return true if charging
|
||||
*/
|
||||
bool furi_hal_power_is_charging();
|
||||
|
||||
/** Poweroff device */
|
||||
/** Poweroff device
|
||||
*/
|
||||
void furi_hal_power_off();
|
||||
|
||||
/** Reset device */
|
||||
/** Reset device
|
||||
*/
|
||||
void furi_hal_power_reset();
|
||||
|
||||
/** OTG enable */
|
||||
/** OTG enable
|
||||
*/
|
||||
void furi_hal_power_enable_otg();
|
||||
|
||||
/** OTG disable */
|
||||
/** OTG disable
|
||||
*/
|
||||
void furi_hal_power_disable_otg();
|
||||
|
||||
/** Get OTG status */
|
||||
/** Get OTG status
|
||||
*
|
||||
* @return true if enabled
|
||||
*/
|
||||
bool furi_hal_power_is_otg_enabled();
|
||||
|
||||
/** Get remaining battery battery capacity in mAh */
|
||||
/** Get remaining battery battery capacity in mAh
|
||||
*
|
||||
* @return capacity in mAh
|
||||
*/
|
||||
uint32_t furi_hal_power_get_battery_remaining_capacity();
|
||||
|
||||
/** Get full charge battery capacity in mAh */
|
||||
/** Get full charge battery capacity in mAh
|
||||
*
|
||||
* @return capacity in mAh
|
||||
*/
|
||||
uint32_t furi_hal_power_get_battery_full_capacity();
|
||||
|
||||
/** Get battery voltage in V */
|
||||
/** Get battery voltage in V
|
||||
*
|
||||
* @param ic FuriHalPowerIc to get measurment
|
||||
*
|
||||
* @return voltage in V
|
||||
*/
|
||||
float furi_hal_power_get_battery_voltage(FuriHalPowerIC ic);
|
||||
|
||||
/** Get battery current in A */
|
||||
/** Get battery current in A
|
||||
*
|
||||
* @param ic FuriHalPowerIc to get measurment
|
||||
*
|
||||
* @return current in A
|
||||
*/
|
||||
float furi_hal_power_get_battery_current(FuriHalPowerIC ic);
|
||||
|
||||
/** Get temperature in C */
|
||||
/** Get temperature in C
|
||||
*
|
||||
* @param ic FuriHalPowerIc to get measurment
|
||||
*
|
||||
* @return temperature in C
|
||||
*/
|
||||
float furi_hal_power_get_battery_temperature(FuriHalPowerIC ic);
|
||||
|
||||
/** Get System voltage in V */
|
||||
/** Get System voltage in V
|
||||
*
|
||||
* @return voltage in V
|
||||
*/
|
||||
float furi_hal_power_get_system_voltage();
|
||||
|
||||
/** Get USB voltage in V */
|
||||
/** Get USB voltage in V
|
||||
*
|
||||
* @return voltage in V
|
||||
*/
|
||||
float furi_hal_power_get_usb_voltage();
|
||||
|
||||
/** Get power system component state */
|
||||
/** Get power system component state
|
||||
*/
|
||||
void furi_hal_power_dump_state();
|
||||
|
||||
/** Enable 3.3v on external gpio and sd card */
|
||||
/** Enable 3.3v on external gpio and sd card
|
||||
*/
|
||||
void furi_hal_power_enable_external_3_3v();
|
||||
|
||||
/** Disable 3.3v on external gpio and sd card */
|
||||
/** Disable 3.3v on external gpio and sd card
|
||||
*/
|
||||
void furi_hal_power_disable_external_3_3v();
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
/**
|
||||
* @file furi-hal-rfid.h
|
||||
* RFID HAL API
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <main.h>
|
||||
@@ -7,111 +13,91 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** Initialize RFID subsystem */
|
||||
/** Initialize RFID subsystem
|
||||
*/
|
||||
void furi_hal_rfid_init();
|
||||
|
||||
/**
|
||||
* @brief config rfid pins to reset state
|
||||
*
|
||||
/** Config rfid pins to reset state
|
||||
*/
|
||||
void furi_hal_rfid_pins_reset();
|
||||
|
||||
/**
|
||||
* @brief config rfid pins to emulate state
|
||||
*
|
||||
/** Config rfid pins to emulate state
|
||||
*/
|
||||
void furi_hal_rfid_pins_emulate();
|
||||
|
||||
/**
|
||||
* @brief config rfid pins to read state
|
||||
*
|
||||
/** Config rfid pins to read state
|
||||
*/
|
||||
void furi_hal_rfid_pins_read();
|
||||
|
||||
/**
|
||||
* @brief config rfid timer to read state
|
||||
*
|
||||
* @param freq timer frequency
|
||||
* @param duty_cycle timer duty cycle, 0.0-1.0
|
||||
/** Config rfid timer to read state
|
||||
*
|
||||
* @param freq timer frequency
|
||||
* @param duty_cycle timer duty cycle, 0.0-1.0
|
||||
*/
|
||||
void furi_hal_rfid_tim_read(float freq, float duty_cycle);
|
||||
|
||||
/**
|
||||
* @brief start read timer
|
||||
*
|
||||
/** Start read timer
|
||||
*/
|
||||
void furi_hal_rfid_tim_read_start();
|
||||
|
||||
/**
|
||||
* @brief stop read timer
|
||||
*
|
||||
/** Stop read timer
|
||||
*/
|
||||
void furi_hal_rfid_tim_read_stop();
|
||||
|
||||
/**
|
||||
* @brief config rfid timer to emulate state
|
||||
*
|
||||
* @param freq timer frequency
|
||||
/** Config rfid timer to emulate state
|
||||
*
|
||||
* @param freq timer frequency
|
||||
*/
|
||||
void furi_hal_rfid_tim_emulate(float freq);
|
||||
|
||||
/**
|
||||
* @brief start emulation timer
|
||||
*
|
||||
/** Start emulation timer
|
||||
*/
|
||||
void furi_hal_rfid_tim_emulate_start();
|
||||
|
||||
/**
|
||||
* @brief stop emulation timer
|
||||
*
|
||||
/** Stop emulation timer
|
||||
*/
|
||||
void furi_hal_rfid_tim_emulate_stop();
|
||||
|
||||
/**
|
||||
* @brief config rfid timers to reset state
|
||||
*
|
||||
/** Config rfid timers to reset state
|
||||
*/
|
||||
void furi_hal_rfid_tim_reset();
|
||||
|
||||
/**
|
||||
* @brief check that timer instance is emulation timer
|
||||
*
|
||||
* @param hw timer instance
|
||||
/** Check that timer instance is emulation timer
|
||||
*
|
||||
* @param hw timer instance
|
||||
*
|
||||
* @return true if instance is emulation timer
|
||||
*/
|
||||
bool furi_hal_rfid_is_tim_emulate(TIM_HandleTypeDef* hw);
|
||||
|
||||
/**
|
||||
* @brief set emulation timer period
|
||||
*
|
||||
* @param period overall duration
|
||||
/** Set emulation timer period
|
||||
*
|
||||
* @param period overall duration
|
||||
*/
|
||||
void furi_hal_rfid_set_emulate_period(uint32_t period);
|
||||
|
||||
/**
|
||||
* @brief set emulation timer pulse
|
||||
*
|
||||
* @param pulse duration of high level
|
||||
/** Set emulation timer pulse
|
||||
*
|
||||
* @param pulse duration of high level
|
||||
*/
|
||||
void furi_hal_rfid_set_emulate_pulse(uint32_t pulse);
|
||||
|
||||
/**
|
||||
* @brief set read timer period
|
||||
*
|
||||
* @param period overall duration
|
||||
/** Set read timer period
|
||||
*
|
||||
* @param period overall duration
|
||||
*/
|
||||
void furi_hal_rfid_set_read_period(uint32_t period);
|
||||
|
||||
/**
|
||||
* @brief set read timer pulse
|
||||
*
|
||||
* @param pulse duration of high level
|
||||
/** Set read timer pulse
|
||||
*
|
||||
* @param pulse duration of high level
|
||||
*/
|
||||
void furi_hal_rfid_set_read_pulse(uint32_t pulse);
|
||||
|
||||
/**
|
||||
* Сhanges the configuration of the RFID timer "on a fly"
|
||||
* @param freq new frequency
|
||||
* @param duty_cycle new duty cycle
|
||||
/** Сhanges the configuration of the RFID timer "on a fly"
|
||||
*
|
||||
* @param freq new frequency
|
||||
* @param duty_cycle new duty cycle
|
||||
*/
|
||||
void furi_hal_rfid_change_read_config(float freq, float duty_cycle);
|
||||
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
/**
|
||||
* @file furi-hal-sd.h
|
||||
* SD Card HAL API
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
@@ -5,19 +10,20 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** Init SD card detect */
|
||||
/** Init SD card detect
|
||||
*/
|
||||
void hal_sd_detect_init(void);
|
||||
|
||||
/** Set SD card detect pin to low */
|
||||
/** Set SD card detect pin to low
|
||||
*/
|
||||
void hal_sd_detect_set_low(void);
|
||||
|
||||
/**
|
||||
* Get SD card status
|
||||
* @return true if SD card present
|
||||
* @return false if SD card not present
|
||||
/** Get SD card status
|
||||
*
|
||||
* @return true if SD card present, false if SD card not present
|
||||
*/
|
||||
bool hal_sd_detect(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
/**
|
||||
* @file furi-hal-subghz.h
|
||||
* SubGhz HAL API
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdbool.h>
|
||||
@@ -11,130 +16,148 @@ extern "C" {
|
||||
|
||||
/** Radio Presets */
|
||||
typedef enum {
|
||||
FuriHalSubGhzPresetOok270Async, /** OOK, bandwidth 270kHz, asynchronous */
|
||||
FuriHalSubGhzPresetOok650Async, /** OOK, bandwidth 650kHz, asynchronous */
|
||||
FuriHalSubGhzPreset2FSKAsync, /** FM, asynchronous */
|
||||
FuriHalSubGhzPresetOok270Async, /**< OOK, bandwidth 270kHz, asynchronous */
|
||||
FuriHalSubGhzPresetOok650Async, /**< OOK, bandwidth 650kHz, asynchronous */
|
||||
FuriHalSubGhzPreset2FSKAsync, /**< FM, asynchronous */
|
||||
} FuriHalSubGhzPreset;
|
||||
|
||||
/** Switchable Radio Paths */
|
||||
/** Switchable Radio Paths */
|
||||
typedef enum {
|
||||
FuriHalSubGhzPathIsolate, /** Isolate Radio from antenna */
|
||||
FuriHalSubGhzPath433, /** Center Frquency: 433MHz. Path 1: SW1RF1-SW2RF2, LCLCL */
|
||||
FuriHalSubGhzPath315, /** Center Frquency: 315MHz. Path 2: SW1RF2-SW2RF1, LCLCLCL */
|
||||
FuriHalSubGhzPath868, /** Center Frquency: 868MHz. Path 3: SW1RF3-SW2RF3, LCLC */
|
||||
FuriHalSubGhzPathIsolate, /**< Isolate Radio from antenna */
|
||||
FuriHalSubGhzPath433, /**< Center Frquency: 433MHz. Path 1: SW1RF1-SW2RF2, LCLCL */
|
||||
FuriHalSubGhzPath315, /**< Center Frquency: 315MHz. Path 2: SW1RF2-SW2RF1, LCLCLCL */
|
||||
FuriHalSubGhzPath868, /**< Center Frquency: 868MHz. Path 3: SW1RF3-SW2RF3, LCLC */
|
||||
} FuriHalSubGhzPath;
|
||||
|
||||
/** SubGhz state */
|
||||
typedef enum {
|
||||
SubGhzStateInit, /** Init pending */
|
||||
SubGhzStateInit, /**< Init pending */
|
||||
|
||||
SubGhzStateIdle, /** Idle, energy save mode */
|
||||
SubGhzStateIdle, /**< Idle, energy save mode */
|
||||
|
||||
SubGhzStateAsyncRx, /** Async RX started */
|
||||
SubGhzStateAsyncRx, /**< Async RX started */
|
||||
|
||||
SubGhzStateAsyncTx, /** Async TX started, DMA and timer is on */
|
||||
SubGhzStateAsyncTxLast, /** Async TX continue, DMA completed and timer got last value to go */
|
||||
SubGhzStateAsyncTxEnd, /** Async TX complete, cleanup needed */
|
||||
SubGhzStateAsyncTx, /**< Async TX started, DMA and timer is on */
|
||||
SubGhzStateAsyncTxLast, /**< Async TX continue, DMA completed and timer got last value to go */
|
||||
SubGhzStateAsyncTxEnd, /**< Async TX complete, cleanup needed */
|
||||
|
||||
} SubGhzState;
|
||||
|
||||
/** SubGhz regulation, receive transmission on the current frequency for the region */
|
||||
/** SubGhz regulation, receive transmission on the current frequency for the
|
||||
* region */
|
||||
typedef enum {
|
||||
SubGhzRegulationOnlyRx, /**only Rx*/
|
||||
SubGhzRegulationTxRx, /**TxRx*/
|
||||
} SubGhzRegulation;
|
||||
|
||||
/** Initialize and switch to power save mode
|
||||
* Used by internal API-HAL initalization routine
|
||||
* Can be used to reinitialize device to safe state and send it to sleep
|
||||
/** Initialize and switch to power save mode Used by internal API-HAL
|
||||
* initalization routine Can be used to reinitialize device to safe state and
|
||||
* send it to sleep
|
||||
*/
|
||||
void furi_hal_subghz_init();
|
||||
|
||||
/** Send device to sleep mode */
|
||||
/** Send device to sleep mode
|
||||
*/
|
||||
void furi_hal_subghz_sleep();
|
||||
|
||||
/** Dump info to stdout */
|
||||
/** Dump info to stdout
|
||||
*/
|
||||
void furi_hal_subghz_dump_state();
|
||||
|
||||
/** Load registers from preset by preset name
|
||||
* @param preset to load
|
||||
/** Load registers from preset by preset name
|
||||
*
|
||||
* @param preset to load
|
||||
*/
|
||||
void furi_hal_subghz_load_preset(FuriHalSubGhzPreset preset);
|
||||
|
||||
/** Get status */
|
||||
uint8_t furi_hal_subghz_get_status();
|
||||
|
||||
/** Load registers
|
||||
* @param register-value pairs array, terminated with {0,0}
|
||||
*
|
||||
* @param data Registers data
|
||||
*/
|
||||
void furi_hal_subghz_load_registers(const uint8_t data[][2]);
|
||||
|
||||
/** Load PATABLE
|
||||
* @param data, 8 uint8_t values
|
||||
*
|
||||
* @param data 8 uint8_t values
|
||||
*/
|
||||
void furi_hal_subghz_load_patable(const uint8_t data[8]);
|
||||
|
||||
/** Write packet to FIFO
|
||||
* @param data, bytes array
|
||||
* @param size, size
|
||||
*
|
||||
* @param data bytes array
|
||||
* @param size size
|
||||
*/
|
||||
void furi_hal_subghz_write_packet(const uint8_t* data, uint8_t size);
|
||||
|
||||
/** Read packet from FIFO
|
||||
* @param data, pointer
|
||||
* @param size, size
|
||||
*
|
||||
* @param data pointer
|
||||
* @param size size
|
||||
*/
|
||||
void furi_hal_subghz_read_packet(uint8_t* data, uint8_t* size);
|
||||
|
||||
/** Flush rx FIFO buffer */
|
||||
/** Flush rx FIFO buffer
|
||||
*/
|
||||
void furi_hal_subghz_flush_rx();
|
||||
|
||||
/** Shutdown
|
||||
* Issue spwd command
|
||||
* @warning registers content will be lost
|
||||
/** Shutdown Issue spwd command
|
||||
* @warning registers content will be lost
|
||||
*/
|
||||
void furi_hal_subghz_shutdown();
|
||||
|
||||
/** Reset
|
||||
* Issue reset command
|
||||
* @warning registers content will be lost
|
||||
/** Reset Issue reset command
|
||||
* @warning registers content will be lost
|
||||
*/
|
||||
void furi_hal_subghz_reset();
|
||||
|
||||
/** Switch to Idle */
|
||||
/** Switch to Idle
|
||||
*/
|
||||
void furi_hal_subghz_idle();
|
||||
|
||||
/** Switch to Recieve */
|
||||
/** Switch to Recieve
|
||||
*/
|
||||
void furi_hal_subghz_rx();
|
||||
|
||||
/** Switch to Transmit
|
||||
* @return true if the transfer is allowed by belonging to the region
|
||||
*/
|
||||
*
|
||||
* @return true if the transfer is allowed by belonging to the region
|
||||
*/
|
||||
bool furi_hal_subghz_tx();
|
||||
|
||||
/** Get RSSI value in dBm */
|
||||
/** Get RSSI value in dBm
|
||||
*
|
||||
* @return RSSI value
|
||||
*/
|
||||
float furi_hal_subghz_get_rssi();
|
||||
|
||||
/** Check if frequency is in valid range
|
||||
* @return true if frequncy is valid, otherwise false
|
||||
*
|
||||
* @param value frequency in Hz
|
||||
*
|
||||
* @return true if frequncy is valid, otherwise false
|
||||
*/
|
||||
bool furi_hal_subghz_is_frequency_valid(uint32_t value);
|
||||
|
||||
/** Set frequency and path
|
||||
* This function automatically selects antenna matching network
|
||||
* @param frequency in herz
|
||||
* @return real frequency in herz
|
||||
/** Set frequency and path This function automatically selects antenna matching
|
||||
* network
|
||||
*
|
||||
* @param value frequency in Hz
|
||||
*
|
||||
* @return real frequency in herz
|
||||
*/
|
||||
uint32_t furi_hal_subghz_set_frequency_and_path(uint32_t value);
|
||||
|
||||
/** Set frequency
|
||||
* @param frequency in herz
|
||||
* @return real frequency in herz
|
||||
*
|
||||
* @param value frequency in Hz
|
||||
*
|
||||
* @return real frequency in herz
|
||||
*/
|
||||
uint32_t furi_hal_subghz_set_frequency(uint32_t value);
|
||||
|
||||
/** Set path
|
||||
* @param radio path to use
|
||||
*
|
||||
* @param path path to use
|
||||
*/
|
||||
void furi_hal_subghz_set_path(FuriHalSubGhzPath path);
|
||||
|
||||
@@ -143,33 +166,39 @@ void furi_hal_subghz_set_path(FuriHalSubGhzPath path);
|
||||
/** Signal Timings Capture callback */
|
||||
typedef void (*FuriHalSubGhzCaptureCallback)(bool level, uint32_t duration, void* context);
|
||||
|
||||
/** Enable signal timings capture
|
||||
* Initializes GPIO and TIM2 for timings capture
|
||||
/** Enable signal timings capture Initializes GPIO and TIM2 for timings capture
|
||||
*
|
||||
* @param callback FuriHalSubGhzCaptureCallback
|
||||
* @param context callback context
|
||||
*/
|
||||
void furi_hal_subghz_start_async_rx(FuriHalSubGhzCaptureCallback callback, void* context);
|
||||
|
||||
/** Disable signal timings capture
|
||||
* Resets GPIO and TIM2
|
||||
/** Disable signal timings capture Resets GPIO and TIM2
|
||||
*/
|
||||
void furi_hal_subghz_stop_async_rx();
|
||||
|
||||
/** Async TX callback type
|
||||
* @param context - callback context
|
||||
* @return LevelDuration
|
||||
* @param context callback context
|
||||
* @return LevelDuration
|
||||
*/
|
||||
typedef LevelDuration (*FuriHalSubGhzAsyncTxCallback)(void* context);
|
||||
|
||||
/** Start async TX
|
||||
* Initializes GPIO, TIM2 and DMA1 for signal output
|
||||
* @return true if the transfer is allowed by belonging to the region
|
||||
/** Start async TX Initializes GPIO, TIM2 and DMA1 for signal output
|
||||
*
|
||||
* @param callback FuriHalSubGhzAsyncTxCallback
|
||||
* @param context callback context
|
||||
*
|
||||
* @return true if the transfer is allowed by belonging to the region
|
||||
*/
|
||||
bool furi_hal_subghz_start_async_tx(FuriHalSubGhzAsyncTxCallback callback, void* context);
|
||||
|
||||
/** Wait for async transmission to complete */
|
||||
/** Wait for async transmission to complete
|
||||
*
|
||||
* @return true if TX complete
|
||||
*/
|
||||
bool furi_hal_subghz_is_async_tx_complete();
|
||||
|
||||
/** Stop async transmission and cleanup resources
|
||||
* Resets GPIO, TIM2, and DMA1
|
||||
/** Stop async transmission and cleanup resources Resets GPIO, TIM2, and DMA1
|
||||
*/
|
||||
void furi_hal_subghz_stop_async_tx();
|
||||
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
/**
|
||||
* @file furi-hal-vcp.h
|
||||
* VCP HAL API
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdbool.h>
|
||||
@@ -8,35 +13,34 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Init VCP HAL
|
||||
* Allocates ring buffer and initializes state
|
||||
/** Init VCP HAL Allocates ring buffer and initializes state
|
||||
*/
|
||||
void furi_hal_vcp_init();
|
||||
|
||||
/**
|
||||
* Recieve data from VCP
|
||||
* Waits till some data arrives, never returns 0
|
||||
* @param buffer - pointer to buffer
|
||||
* @param size - buffer size
|
||||
* @return items copied in buffer, 0 if channel closed
|
||||
/** Recieve data from VCP Waits till some data arrives, never returns 0
|
||||
*
|
||||
* @param buffer pointer to buffer
|
||||
* @param size buffer size
|
||||
*
|
||||
* @return items copied in buffer, 0 if channel closed
|
||||
*/
|
||||
size_t furi_hal_vcp_rx(uint8_t* buffer, size_t size);
|
||||
|
||||
/**
|
||||
* Recieve data from VCP with timeout
|
||||
* Waits till some data arrives during timeout
|
||||
* @param buffer - pointer to buffer
|
||||
* @param size - buffer size
|
||||
* @param timeout - rx timeout in ms
|
||||
* @return items copied in buffer, 0 if channel closed or timeout occurs
|
||||
/** Recieve data from VCP with timeout Waits till some data arrives during
|
||||
* timeout
|
||||
*
|
||||
* @param buffer pointer to buffer
|
||||
* @param size buffer size
|
||||
* @param timeout rx timeout in ms
|
||||
*
|
||||
* @return items copied in buffer, 0 if channel closed or timeout occurs
|
||||
*/
|
||||
size_t furi_hal_vcp_rx_with_timeout(uint8_t* buffer, size_t size, uint32_t timeout);
|
||||
|
||||
/**
|
||||
* Transmit data to VCP
|
||||
* @param buffer - pointer to buffer
|
||||
* @param size - buffer size
|
||||
/** Transmit data to VCP
|
||||
*
|
||||
* @param buffer pointer to buffer
|
||||
* @param size buffer size
|
||||
*/
|
||||
void furi_hal_vcp_tx(const uint8_t* buffer, size_t size);
|
||||
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
/**
|
||||
* @file furi-hal-version.h
|
||||
* Version HAL API
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdbool.h>
|
||||
@@ -24,65 +29,110 @@ typedef enum {
|
||||
FuriHalVersionRegionJp=0x03,
|
||||
} FuriHalVersionRegion;
|
||||
|
||||
/** Init flipper version */
|
||||
/** Init flipper version
|
||||
*/
|
||||
void furi_hal_version_init();
|
||||
|
||||
/** Check target firmware version */
|
||||
/** Check target firmware version
|
||||
*
|
||||
* @return true if target and real matches
|
||||
*/
|
||||
bool furi_hal_version_do_i_belong_here();
|
||||
|
||||
/** Get model name */
|
||||
/** Get model name
|
||||
*
|
||||
* @return model name C-string
|
||||
*/
|
||||
const char* furi_hal_version_get_model_name();
|
||||
|
||||
/** Get hardware version */
|
||||
/** Get hardware version
|
||||
*
|
||||
* @return Hardware Version
|
||||
*/
|
||||
const uint8_t furi_hal_version_get_hw_version();
|
||||
|
||||
/** Get hardware target */
|
||||
/** Get hardware target
|
||||
*
|
||||
* @return Hardware Target
|
||||
*/
|
||||
const uint8_t furi_hal_version_get_hw_target();
|
||||
|
||||
/** Get hardware body */
|
||||
/** Get hardware body
|
||||
*
|
||||
* @return Hardware Body
|
||||
*/
|
||||
const uint8_t furi_hal_version_get_hw_body();
|
||||
|
||||
/** Get hardware body color */
|
||||
/** Get hardware body color
|
||||
*
|
||||
* @return Hardware Color
|
||||
*/
|
||||
const FuriHalVersionColor furi_hal_version_get_hw_color();
|
||||
|
||||
/** Get hardware connect */
|
||||
/** Get hardware connect
|
||||
*
|
||||
* @return Hardware Interconnect
|
||||
*/
|
||||
const uint8_t furi_hal_version_get_hw_connect();
|
||||
|
||||
/** Get hardware region */
|
||||
/** Get hardware region
|
||||
*
|
||||
* @return Hardware Region
|
||||
*/
|
||||
const FuriHalVersionRegion furi_hal_version_get_hw_region();
|
||||
|
||||
/** Get hardware timestamp */
|
||||
/** Get hardware timestamp
|
||||
*
|
||||
* @return Hardware Manufacture timestamp
|
||||
*/
|
||||
const uint32_t furi_hal_version_get_hw_timestamp();
|
||||
|
||||
/** Get pointer to target name */
|
||||
/** Get pointer to target name
|
||||
*
|
||||
* @return Hardware Name C-string
|
||||
*/
|
||||
const char* furi_hal_version_get_name_ptr();
|
||||
|
||||
/** Get pointer to target device name */
|
||||
/** Get pointer to target device name
|
||||
*
|
||||
* @return Hardware Device Name C-string
|
||||
*/
|
||||
const char* furi_hal_version_get_device_name_ptr();
|
||||
|
||||
/** Get pointer to target ble local device name */
|
||||
/** Get pointer to target ble local device name
|
||||
*
|
||||
* @return Ble Device Name C-string
|
||||
*/
|
||||
const char* furi_hal_version_get_ble_local_device_name_ptr();
|
||||
|
||||
/** Get BLE MAC address
|
||||
*
|
||||
* @return pointer to BLE MAC address
|
||||
*/
|
||||
const uint8_t* furi_hal_version_get_ble_mac();
|
||||
|
||||
/**
|
||||
* Get address of version structure of bootloader, stored in chip flash.
|
||||
/** Get address of version structure of bootloader, stored in chip flash.
|
||||
*
|
||||
* @return Address of boot version structure.
|
||||
* @return Address of boot version structure.
|
||||
*/
|
||||
const struct Version* furi_hal_version_get_boot_version(void);
|
||||
const struct Version* furi_hal_version_get_boot_version();
|
||||
|
||||
/**
|
||||
* Get address of version structure of firmware.
|
||||
/** Get address of version structure of firmware.
|
||||
*
|
||||
* @return Address of firmware version structure.
|
||||
* @return Address of firmware version structure.
|
||||
*/
|
||||
const struct Version* furi_hal_version_get_firmware_version(void);
|
||||
const struct Version* furi_hal_version_get_firmware_version();
|
||||
|
||||
/** Get platform UID size in bytes */
|
||||
/** Get platform UID size in bytes
|
||||
*
|
||||
* @return UID size in bytes
|
||||
*/
|
||||
size_t furi_hal_version_uid_size();
|
||||
|
||||
/** Get const pointer to UID */
|
||||
/** Get const pointer to UID
|
||||
*
|
||||
* @return pointer to UID
|
||||
*/
|
||||
const uint8_t* furi_hal_version_uid();
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
/**
|
||||
* @file furi-hal-vibro.h
|
||||
* Vibro HAL API
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdbool.h>
|
||||
@@ -8,10 +13,14 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** Initialize vibro */
|
||||
/** Initialize vibro
|
||||
*/
|
||||
void furi_hal_vibro_init();
|
||||
|
||||
/** Turn on/off vibro */
|
||||
/** Turn on/off vibro
|
||||
*
|
||||
* @param[in] value new state
|
||||
*/
|
||||
void furi_hal_vibro_on(bool value);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
/**
|
||||
* @file furi-hal.h
|
||||
* Furi HAL API
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
Reference in New Issue
Block a user