mirror of
https://github.com/DarkFlippers/unleashed-firmware
synced 2024-12-20 17:53:20 +00:00
8073992925
* RFID: pull antenna down when emulating * Rfid: fixed HID emulation by adding zero pulse every 4 bits * Rfid: HID emulation fixed with DSP based FSK oscillator. * Rfid: receive 125KHz clock for emulation timer from antenna and comparator * Rfid: commented unused variable * Firmware: rollback changes in f6. * Add F7 target based on F6. * F7/F6: update cube projects, apply changes to the targets, update linker scripts with correct RAM start values. * FuriHal: RFID init routine. * Scripts: update OTP tool for v11 board Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
114 lines
3.2 KiB
C
114 lines
3.2 KiB
C
#include <furi-hal-spi-config.h>
|
|
#include <furi-hal-resources.h>
|
|
|
|
#define SPI_R SPI1
|
|
#define SPI_D SPI2
|
|
|
|
const LL_SPI_InitTypeDef furi_hal_spi_config_nfc = {
|
|
.Mode = LL_SPI_MODE_MASTER,
|
|
.TransferDirection = LL_SPI_FULL_DUPLEX,
|
|
.DataWidth = LL_SPI_DATAWIDTH_8BIT,
|
|
.ClockPolarity = LL_SPI_POLARITY_LOW,
|
|
.ClockPhase = LL_SPI_PHASE_2EDGE,
|
|
.NSS = LL_SPI_NSS_SOFT,
|
|
.BaudRate = LL_SPI_BAUDRATEPRESCALER_DIV8,
|
|
.BitOrder = LL_SPI_MSB_FIRST,
|
|
.CRCCalculation = LL_SPI_CRCCALCULATION_DISABLE,
|
|
.CRCPoly = 7,
|
|
};
|
|
|
|
const LL_SPI_InitTypeDef furi_hal_spi_config_subghz = {
|
|
.Mode = LL_SPI_MODE_MASTER,
|
|
.TransferDirection = LL_SPI_FULL_DUPLEX,
|
|
.DataWidth = LL_SPI_DATAWIDTH_8BIT,
|
|
.ClockPolarity = LL_SPI_POLARITY_LOW,
|
|
.ClockPhase = LL_SPI_PHASE_1EDGE,
|
|
.NSS = LL_SPI_NSS_SOFT,
|
|
.BaudRate = LL_SPI_BAUDRATEPRESCALER_DIV8,
|
|
.BitOrder = LL_SPI_MSB_FIRST,
|
|
.CRCCalculation = LL_SPI_CRCCALCULATION_DISABLE,
|
|
.CRCPoly = 7,
|
|
};
|
|
|
|
const LL_SPI_InitTypeDef furi_hal_spi_config_display = {
|
|
.Mode = LL_SPI_MODE_MASTER,
|
|
.TransferDirection = LL_SPI_FULL_DUPLEX,
|
|
.DataWidth = LL_SPI_DATAWIDTH_8BIT,
|
|
.ClockPolarity = LL_SPI_POLARITY_LOW,
|
|
.ClockPhase = LL_SPI_PHASE_1EDGE,
|
|
.NSS = LL_SPI_NSS_SOFT,
|
|
.BaudRate = LL_SPI_BAUDRATEPRESCALER_DIV16,
|
|
.BitOrder = LL_SPI_MSB_FIRST,
|
|
.CRCCalculation = LL_SPI_CRCCALCULATION_DISABLE,
|
|
.CRCPoly = 7,
|
|
};
|
|
|
|
/**
|
|
* SD Card in fast mode (after init)
|
|
*/
|
|
const LL_SPI_InitTypeDef furi_hal_spi_config_sd_fast = {
|
|
.Mode = LL_SPI_MODE_MASTER,
|
|
.TransferDirection = LL_SPI_FULL_DUPLEX,
|
|
.DataWidth = LL_SPI_DATAWIDTH_8BIT,
|
|
.ClockPolarity = LL_SPI_POLARITY_LOW,
|
|
.ClockPhase = LL_SPI_PHASE_1EDGE,
|
|
.NSS = LL_SPI_NSS_SOFT,
|
|
.BaudRate = LL_SPI_BAUDRATEPRESCALER_DIV2,
|
|
.BitOrder = LL_SPI_MSB_FIRST,
|
|
.CRCCalculation = LL_SPI_CRCCALCULATION_DISABLE,
|
|
.CRCPoly = 7,
|
|
};
|
|
|
|
/**
|
|
* SD Card in slow mode (before init)
|
|
*/
|
|
const LL_SPI_InitTypeDef furi_hal_spi_config_sd_slow = {
|
|
.Mode = LL_SPI_MODE_MASTER,
|
|
.TransferDirection = LL_SPI_FULL_DUPLEX,
|
|
.DataWidth = LL_SPI_DATAWIDTH_8BIT,
|
|
.ClockPolarity = LL_SPI_POLARITY_LOW,
|
|
.ClockPhase = LL_SPI_PHASE_1EDGE,
|
|
.NSS = LL_SPI_NSS_SOFT,
|
|
.BaudRate = LL_SPI_BAUDRATEPRESCALER_DIV32,
|
|
.BitOrder = LL_SPI_MSB_FIRST,
|
|
.CRCCalculation = LL_SPI_CRCCALCULATION_DISABLE,
|
|
.CRCPoly = 7,
|
|
};
|
|
|
|
const FuriHalSpiBus spi_r = {
|
|
.spi = SPI_R,
|
|
.miso = &gpio_spi_r_miso,
|
|
.mosi = &gpio_spi_r_mosi,
|
|
.clk = &gpio_spi_r_sck,
|
|
};
|
|
|
|
const FuriHalSpiBus spi_d = {
|
|
.spi = SPI_D,
|
|
.miso = &gpio_spi_d_miso,
|
|
.mosi = &gpio_spi_d_mosi,
|
|
.clk = &gpio_spi_d_sck,
|
|
};
|
|
|
|
const FuriHalSpiDevice furi_hal_spi_devices[FuriHalSpiDeviceIdMax] = {
|
|
{
|
|
.bus = &spi_r,
|
|
.config = &furi_hal_spi_config_subghz,
|
|
.chip_select = &gpio_subghz_cs,
|
|
},
|
|
{
|
|
.bus = &spi_d,
|
|
.config = &furi_hal_spi_config_display,
|
|
.chip_select = &gpio_display_cs,
|
|
},
|
|
{
|
|
.bus = &spi_d,
|
|
.config = &furi_hal_spi_config_sd_fast,
|
|
.chip_select = &gpio_sdcard_cs,
|
|
},
|
|
{
|
|
.bus = &spi_d,
|
|
.config = &furi_hal_spi_config_sd_slow,
|
|
.chip_select = &gpio_sdcard_cs,
|
|
},
|
|
{.bus = &spi_r, .config = &furi_hal_spi_config_nfc, .chip_select = &gpio_nfc_cs},
|
|
};
|