Refactor F2/local before F3 merge (#220)

* add files from f3
* rollback lfs
* Move assets from LFS
* remove lfs from build

Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
This commit is contained in:
coreglitch
2020-11-06 14:31:59 +06:00
committed by GitHub
parent 841cae99ef
commit eb2679b982
106 changed files with 879 additions and 802 deletions

View File

@@ -1,5 +1,6 @@
#include "flipper_v2.h"
#include "cc1101-workaround/cc1101.h"
#include "spi.h"
// ******************************************************************************
#define WRITE_BURST 0x40
@@ -27,34 +28,14 @@ CC1101::CC1101(GpioPin* ss_pin) {
//******************************************************************************
//SpiInit
/******************************************************************************/
extern SPI_HandleTypeDef hspi3;
extern SPI_HandleTypeDef SPI_R;
void CC1101::SpiInit(void) {
//initialize spi pins
//Enable spi master, MSB, SPI mode 0, FOSC/4
SpiMode(0);
if(HAL_SPI_DeInit(&hspi3) != HAL_OK) {
Error_Handler();
}
hspi3.Init.Mode = SPI_MODE_MASTER;
hspi3.Init.Direction = SPI_DIRECTION_2LINES;
hspi3.Init.DataSize = SPI_DATASIZE_8BIT;
hspi3.Init.CLKPolarity = SPI_POLARITY_LOW;
hspi3.Init.CLKPhase = SPI_PHASE_1EDGE;
hspi3.Init.NSS = SPI_NSS_SOFT;
hspi3.Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_64;
hspi3.Init.FirstBit = SPI_FIRSTBIT_MSB;
hspi3.Init.TIMode = SPI_TIMODE_DISABLE;
hspi3.Init.CRCCalculation = SPI_CRCCALCULATION_DISABLE;
hspi3.Init.CRCPolynomial = 7;
hspi3.Init.CRCLength = SPI_CRC_LENGTH_DATASIZE;
hspi3.Init.NSSPMode = SPI_NSS_PULSE_DISABLE;
if(HAL_SPI_Init(&hspi3) != HAL_OK) {
Error_Handler();
}
CC1101_SPI_Reconfigure();
}
void CC1101::SpiEnd(void) {
@@ -99,7 +80,7 @@ uint8_t CC1101::SpiTransfer(uint8_t value) {
uint8_t buf[1] = {value};
uint8_t rxbuf[1] = {0};
HAL_SPI_TransmitReceive(&hspi3, buf, rxbuf, 1, HAL_MAX_DELAY);
HAL_SPI_TransmitReceive(&SPI_R, buf, rxbuf, 1, HAL_MAX_DELAY);
return rxbuf[0];
}