flipperzero-firmware/firmware/targets/f4/api-hal/api-hal-spi-config.h
あく 5439e232cc
[FL-950] CC1101 Stage1, SPI Refactoring, Drivers layer (#386)
* API HAL SPI: refactoring, split into layers, prepare ST HAL separation. API HAL SubGhz: initialize on start. Drivers: add basic cc1101 driver. Update API usage. Debug: increase max debugger port speed. Remove subghz apps.
* CC1101: chip status handling. ApiHalSpi: increase SubGhz bus speed to 8mhz. F4: backport subghz initialization.
* Api Hal SubGhz: rx path and frequency. CC1101: frequency control.
* SubGhz Application: basic tests
* SubGhz app: tone and packet test. API HAL SUBGHZ: update configs, add missing bits and pieces.
2021-03-31 20:52:26 +03:00

67 lines
1.6 KiB
C

#pragma once
#include <api-hal-gpio.h>
#include <cmsis_os2.h>
#ifdef __cplusplus
extern "C" {
#endif
extern const SPI_InitTypeDef api_hal_spi_config_nfc;
extern const SPI_InitTypeDef api_hal_spi_config_subghz;
extern const SPI_InitTypeDef api_hal_spi_config_display;
/** API HAL SPI BUS handler
* Structure content may change at some point
*/
typedef struct {
const SPI_HandleTypeDef* spi;
const osMutexId_t* mutex;
const GpioPin* miso;
const GpioPin* mosi;
const GpioPin* clk;
} ApiHalSpiBus;
/** API HAL SPI Device handler
* Structure content may change at some point
*/
typedef struct {
const ApiHalSpiBus* bus;
const SPI_InitTypeDef* config;
const GpioPin* chip_select;
} ApiHalSpiDevice;
/** API HAL SPI Standard Device IDs */
typedef enum {
ApiHalSpiDeviceIdSubGhz, /** SubGhz: CC1101, non-standard SPI usage */
ApiHalSpiDeviceIdDisplay, /** Display: ERC12864, only have MOSI */
ApiHalSpiDeviceIdSdCard, /** SDCARD: no default bus config, bus must explicitly be configured */
ApiHalSpiDeviceIdNfc, /** NFC: ST25R3916, pretty standard, but RFAL makes it complex */
ApiHalSpiDeviceIdMax, /** Service Value, do not use */
} ApiHalSpiDeviceId;
/** Api Hal Spi Bus R
* CC1101, Nfc
*/
extern const ApiHalSpiBus spi_r;
/** Api Hal Spi Bus D
* Display, SdCard
*/
extern const ApiHalSpiBus spi_d;
/** Api Hal Spi devices */
extern const ApiHalSpiDevice api_hal_spi_devices[ApiHalSpiDeviceIdMax];
typedef struct {
const ApiHalSpiBus* bus;
const SPI_InitTypeDef config;
} SPIDevice;
extern const SPIDevice sd_fast_spi;
extern const SPIDevice sd_slow_spi;
#ifdef __cplusplus
}
#endif