FL-353 Cc1101 rx (#255)

* enable transparent mode
* rssi ok, transmit ok, fifo ok
* I see the signal
* successful async rx (registers from smartrf)
* refactor rfstudio register config
* rewrite config, found some issues
* handle G0 interrupts
* g0 irq enable after cc1101 init
* update cube
This commit is contained in:
coreglitch 2020-12-01 21:47:46 +03:00 committed by GitHub
parent 36937f3595
commit f58b322bb5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 939 additions and 1016 deletions

View File

@ -49,13 +49,6 @@ CFLAGS += -DAPP_POWER
C_SOURCES += $(wildcard $(APP_DIR)/power/*.c) C_SOURCES += $(wildcard $(APP_DIR)/power/*.c)
endif endif
APP_CLI ?= 0
ifeq ($(APP_CLI), 1)
APP_GUI = 1
CFLAGS += -DAPP_CLI
C_SOURCES += $(wildcard $(APP_DIR)/cli/*.c)
endif
APP_MENU ?= 0 APP_MENU ?= 0
ifeq ($(APP_MENU), 1) ifeq ($(APP_MENU), 1)
CFLAGS += -DAPP_MENU CFLAGS += -DAPP_MENU
@ -176,6 +169,7 @@ C_SOURCES += $(wildcard $(APP_DIR)/cc1101-workaround/*.c)
CPP_SOURCES += $(wildcard $(APP_DIR)/cc1101-workaround/*.cpp) CPP_SOURCES += $(wildcard $(APP_DIR)/cc1101-workaround/*.cpp)
APP_INPUT = 1 APP_INPUT = 1
APP_GUI = 1 APP_GUI = 1
APP_CLI = 1
endif endif
APP_LF_RFID ?= 0 APP_LF_RFID ?= 0
@ -312,3 +306,10 @@ ifeq ($(APP_INPUT), 1)
CFLAGS += -DAPP_INPUT CFLAGS += -DAPP_INPUT
C_SOURCES += $(APP_DIR)/input/input.c C_SOURCES += $(APP_DIR)/input/input.c
endif endif
APP_CLI ?= 0
ifeq ($(APP_CLI), 1)
APP_GUI = 1
CFLAGS += -DAPP_CLI
C_SOURCES += $(wildcard $(APP_DIR)/cli/*.c)
endif

View File

@ -2,9 +2,10 @@
#include "cc1101-workaround/cc1101.h" #include "cc1101-workaround/cc1101.h"
extern "C" void cli_print(const char* str);
#define RSSI_DELAY 5000 //rssi delay in micro second #define RSSI_DELAY 5000 //rssi delay in micro second
#define CHAN_SPA 0.05 // channel spacing #define CHAN_SPA 0.05 // channel spacing
#define F_OSC 26e6
int16_t rssi_to_dbm(uint8_t rssi_dec, uint8_t rssiOffset) { int16_t rssi_to_dbm(uint8_t rssi_dec, uint8_t rssiOffset) {
int16_t rssi; int16_t rssi;
@ -33,9 +34,9 @@ typedef struct {
void setup_freq(CC1101* cc1101, const FreqConfig* config) { void setup_freq(CC1101* cc1101, const FreqConfig* config) {
// cc1101->SpiWriteReg(CC1101_MCSM0, 0x08); // disalbe FS_AUTOCAL // cc1101->SpiWriteReg(CC1101_MCSM0, 0x08); // disalbe FS_AUTOCAL
cc1101->SpiWriteReg(CC1101_AGCCTRL2, 0x43 | 0x0C); // MAX_DVGA_GAIN to 11 for fast rssi // cc1101->SpiWriteReg(CC1101_AGCCTRL2, 0x43 | 0x0C); // MAX_DVGA_GAIN to 11 for fast rssi
cc1101->SpiWriteReg(CC1101_AGCCTRL0, 0xB0); // max AGC WAIT_TIME; 0 filter_length // cc1101->SpiWriteReg(CC1101_AGCCTRL0, 0xB0); // max AGC WAIT_TIME; 0 filter_length
cc1101->SetMod(GFSK); // set to GFSK for fast rssi measurement | +8 is dcfilter off // cc1101->SetMod(GFSK); // set to GFSK for fast rssi measurement | +8 is dcfilter off
uint32_t freq_reg = config->band->base_freq * 1e6 / (F_OSC / 65536); uint32_t freq_reg = config->band->base_freq * 1e6 / (F_OSC / 65536);
cc1101->SetFreq((freq_reg >> 16) & 0xFF, (freq_reg >> 8) & 0xFF, (freq_reg)&0xFF); cc1101->SetFreq((freq_reg >> 16) & 0xFF, (freq_reg >> 8) & 0xFF, (freq_reg)&0xFF);
@ -52,31 +53,71 @@ void setup_freq(CC1101* cc1101, const FreqConfig* config) {
*/ */
} }
int16_t rx_rssi(CC1101* cc1101, const FreqConfig* config) { static GpioPin debug_0 = {GPIOB, GPIO_PIN_2};
cc1101->SetReceive();
delay_us(RSSI_DELAY); int16_t rx_rssi(CC1101* cc1101, const FreqConfig* config) {
// cc1101->SpiStrobe(CC1101_SFRX);
// cc1101->SetReceive();
// uint8_t begin_size = cc1101->SpiReadStatus(CC1101_RXBYTES);
// uint8_t rx_status = cc1101->SpiReadStatus(CC1101_MARCSTATE);
// delay_us(RSSI_DELAY);
// osDelay(15);
// uint8_t end_size = cc1101->SpiReadStatus(CC1101_RXBYTES);
// 1.4.8) read PKTSTATUS register while the radio is in RX state // 1.4.8) read PKTSTATUS register while the radio is in RX state
/*uint8_t _pkt_status = */ cc1101->SpiReadStatus(CC1101_PKTSTATUS); /*uint8_t _pkt_status = */ // cc1101->SpiReadStatus(CC1101_PKTSTATUS);
// 1.4.9) enter IDLE state by issuing a SIDLE command // 1.4.9) enter IDLE state by issuing a SIDLE command
cc1101->SpiStrobe(CC1101_SIDLE); // cc1101->SpiStrobe(CC1101_SIDLE);
// //read rssi value and converto to dBm form // //read rssi value and converto to dBm form
uint8_t rssi_dec = (uint8_t)cc1101->SpiReadStatus(CC1101_RSSI); uint8_t rssi_dec = (uint8_t)cc1101->SpiReadStatus(CC1101_RSSI);
int16_t rssi_dBm = rssi_to_dbm(rssi_dec, config->band->rssi_offset); int16_t rssi_dBm = rssi_to_dbm(rssi_dec, config->band->rssi_offset);
/*
char buf[256];
sprintf(buf, "status: %d -> %d, rssi: %d\n", rx_status, cc1101->SpiReadStatus(CC1101_MARCSTATE), rssi_dBm);
cli_print(buf);
sprintf(buf, "begin: %d, end: %d\n", begin_size, end_size);
cli_print(buf);
*/
// uint8_t rx_data[64];
// uint8_t fifo_length = end_size - begin_size;
/*
if(fifo_length < 64) {
// cc1101->SpiReadBurstReg(CC1101_RXFIFO, rx_data, fifo_length);
*
printf("FIFO:");
for(uint8_t i = 0; i < fifo_length; i++) {
for(uint8_t bit = 0; bit < 8; bit++) {
printf("%s", (rx_data[i] & (1 << bit)) > 0 ? "1" : "0");
}
printf(" ");
}
printf("\n");
*
for(uint8_t i = 0; i < fifo_length; i++) {
for(uint8_t bit = 0; bit < 8; bit++) {
gpio_write((GpioPin*)&debug_0, (rx_data[i] & (1 << bit)) > 0);
delay_us(5);
}
}
} else {
cli_print("fifo size over\n");
}
*/
return rssi_dBm; return rssi_dBm;
} }
void tx(CC1101* cc1101, const FreqConfig* config) { void tx(CC1101* cc1101, const FreqConfig* config) {
/*
cc1101->SpiWriteReg(CC1101_MCSM0, 0x18); //enable FS_AUTOCAL
cc1101->SpiWriteReg(CC1101_AGCCTRL2, 0x43); //back to recommended config
cc1101->SpiWriteReg(CC1101_AGCCTRL0, 0x91); //back to recommended config
*/
uint32_t freq_reg = config->band->base_freq * 1e6 / (F_OSC / 65536); uint32_t freq_reg = config->band->base_freq * 1e6 / (F_OSC / 65536);
cc1101->SetFreq((freq_reg >> 16) & 0xFF, (freq_reg >> 8) & 0xFF, (freq_reg)&0xFF); cc1101->SetFreq((freq_reg >> 16) & 0xFF, (freq_reg >> 8) & 0xFF, (freq_reg)&0xFF);
cc1101->SetChannel(config->channel); cc1101->SetChannel(config->channel);
@ -88,6 +129,136 @@ void idle(CC1101* cc1101) {
cc1101->SpiStrobe(CC1101_SIDLE); cc1101->SpiStrobe(CC1101_SIDLE);
} }
void flp_config(CC1101* cc1101) {
// cc1101->SpiWriteReg(CC1101_FSCTRL1, 0x06); //IF frequency
// cc1101->SpiWriteReg(CC1101_FSCTRL0, 0x00); //frequency offset before synthesizer
// cc1101->SpiWriteReg(CC1101_MDMCFG4, 0xCC); // RX filter bandwidth 100k(0xcc)
// cc1101->SpiWriteReg(CC1101_MDMCFG3, 0x43); //datarate config 512kBaud for the purpose of fast rssi measurement
// cc1101->SpiWriteReg(CC1101_MDMCFG1, 0x21); //FEC preamble etc. last 2 bits for channel spacing
// cc1101->SpiWriteReg(CC1101_MDMCFG0, 0xF8); //100khz channel spacing
// CC1101_CHANNR moved to SetChannel func
cc1101->SpiWriteReg(
CC1101_MCSM0, 0x18); // calibrate when going from IDLE to RX or TX ; 149 - 155 μs timeout
// MCSM0.FS_AUTOCAL[1:0] = 1
// cc1101->SpiSetRegValue(CC1101_MCSM0, 1, 5, 4); // this not work
// cc1101->SpiWriteReg(CC1101_FOCCFG, 0x16); //frequency compensation
cc1101->SpiWriteReg(CC1101_AGCCTRL2, 0x43);
cc1101->SpiWriteReg(CC1101_AGCCTRL1, 0x49);
cc1101->SpiWriteReg(CC1101_AGCCTRL0, 0x91);
//freq synthesizer calibration
cc1101->SpiWriteReg(CC1101_FSCAL3, 0xEA);
cc1101->SpiWriteReg(CC1101_FSCAL2, 0x2A);
cc1101->SpiWriteReg(CC1101_FSCAL1, 0x00);
cc1101->SpiWriteReg(CC1101_FSCAL0, 0x1F);
// cc1101->SpiWriteReg(CC1101_TEST2, 0x81);
// cc1101->SpiWriteReg(CC1101_TEST1, 0x35);
// cc1101->SpiWriteReg(CC1101_TEST0, 0x0B); //should be 0x0B for lower than 430.6MHz and 0x09 for higher
// cc1101->SpiWriteReg(CC1101_IOCFG2, 0x0D); //data output pin for asynchronous mode
// cc1101->SpiWriteReg(CC1101_IOCFG0, 0x2E); //High impedance (3-state), GDO0 configed as data input for asynchronous mode
// cc1101->SpiWriteReg(CC1101_PKTCTRL0, 0x33); //whitening off; asynchronous serial mode; CRC diablereserved
// cc1101->SpiWriteReg(CC1101_FIFOTHR, 0x47); //Adc_retention enabled for RX filter bandwidth less than 325KHz; defalut fifo threthold.
// === Transparent mode ===
// async data out
cc1101->SpiSetRegValue(CC1101_IOCFG0, 13, 5, 0);
// FIFOTHR.ADC_RETENTION = 1
cc1101->SpiSetRegValue(CC1101_FIFOTHR, 1, 6, 6);
// PKTCTRL1.APPEND_STATUS = 0
cc1101->SpiSetRegValue(CC1101_PKTCTRL1, 0, 2, 2);
// PKTCTRL0.WHITE_DATA = 0
cc1101->SpiSetRegValue(CC1101_PKTCTRL0, 0, 6, 6);
// PKTCTRL0.LENGTH_CONFIG = 2 // Infinite packet length mode
cc1101->SpiSetRegValue(CC1101_PKTCTRL0, 2, 1, 0);
// PKTCTRL0.CRC_EN = 0
cc1101->SpiSetRegValue(CC1101_PKTCTRL0, 0, 2, 2);
// PKTCTRL0.PKT_FORMAT = 3
cc1101->SpiSetRegValue(CC1101_PKTCTRL0, 3, 5, 4);
// bandwidth 50-100 kHz
if(!cc1101->setRxBandwidth(75.0)) {
printf("wrong rx bw\n");
}
// datarate ~30 kbps
if(!cc1101->setBitRate(100.)) {
printf("wrong bitrate\n");
}
cc1101->SetReceive();
// mod
// MDMCFG2.MOD_FORMAT = 3 (3: OOK, 0: 2-FSK)
cc1101->SpiSetRegValue(CC1101_MDMCFG2, 3, 6, 4);
// MDMCFG2.SYNC_MODE = 0
cc1101->SpiSetRegValue(CC1101_MDMCFG2, 0, 2, 0);
}
void async_config(CC1101* cc1101) {
cc1101->SpiSetRegValue(CC1101_IOCFG0, 13, 5, 0); // GDO0 Output Pin Configuration
// FIFOTHR.ADC_RETENTION = 1
cc1101->SpiSetRegValue(CC1101_FIFOTHR, 1, 6, 6);
// PKTCTRL1.APPEND_STATUS = 0
cc1101->SpiSetRegValue(CC1101_PKTCTRL1, 0, 2, 2);
cc1101->SpiWriteReg(CC1101_PKTCTRL0, 0x32); // Packet Automation Control
/*
FIXME: this sequence not work
// PKTCTRL0.PKT_FORMAT = 3
cc1101->SpiSetRegValue(CC1101_PKTCTRL0, 3, 5, 4);
// PKTCTRL0.LENGTH_CONFIG = 2 // Infinite packet length mode
cc1101->SpiSetRegValue(CC1101_PKTCTRL0, 2, 1, 0);
// PKTCTRL0.CRC_EN = 0
cc1101->SpiSetRegValue(CC1101_PKTCTRL0, 0, 2, 2);
// PKTCTRL0.WHITE_DATA = 0
cc1101->SpiSetRegValue(CC1101_PKTCTRL0, 0, 6, 6);
*/
cc1101->SpiWriteReg(CC1101_MDMCFG4, 0xD6); //Modem Configuration
cc1101->SpiWriteReg(CC1101_MDMCFG3, 0xE4); //Modem Configuration
/*
FIXME: not work
// bandwidth 50-100 kHz
if(!cc1101->setRxBandwidth(75.0)) {
printf("wrong rx bw\n");
}
// datarate ~30 kbps
if(!cc1101->setBitRate(100.)) {
printf("wrong bitrate\n");
}
*/
cc1101->SpiWriteReg(CC1101_MDMCFG2, 0x30); //Modem Configuration
/*
FIXME: not work
// MDMCFG2.MOD_FORMAT = 3 (3: OOK, 0: 2-FSK)
cc1101->SpiSetRegValue(CC1101_MDMCFG2, 3, 6, 4);
// MDMCFG2.SYNC_MODE = 0
cc1101->SpiSetRegValue(CC1101_MDMCFG2, 0, 2, 0);
*/
cc1101->SpiWriteReg(CC1101_MCSM0, 0x18); //Main Radio Control State Machine Configuration
cc1101->SpiWriteReg(CC1101_FSCAL3, 0xE9); //Frequency Synthesizer Calibration
cc1101->SpiWriteReg(CC1101_FSCAL2, 0x2A); //Frequency Synthesizer Calibration
cc1101->SpiWriteReg(CC1101_FSCAL1, 0x00); //Frequency Synthesizer Calibration
cc1101->SpiWriteReg(CC1101_FSCAL0, 0x1F); //Frequency Synthesizer Calibration
}
// f = (f_osc/65536) * (FREQ + CHAN * (256 + CH_SP_M) * 2^(CH_SP_E - 2)) // f = (f_osc/65536) * (FREQ + CHAN * (256 + CH_SP_M) * 2^(CH_SP_E - 2))
// FREQ = f / (f_osc/65536) // FREQ = f / (f_osc/65536)
// CHAN = 0 // CHAN = 0
@ -99,7 +270,7 @@ const Band bands[] = {
{315., {0x00, 0x00, 0x00}, 0, 255, 74}, {315., {0x00, 0x00, 0x00}, 0, 255, 74},
{348., {0x00, 0x00, 0x00}, 0, 255, 74}, {348., {0x00, 0x00, 0x00}, 0, 255, 74},
{387., {0x00, 0x00, 0x00}, 0, 255, 74}, {387., {0x00, 0x00, 0x00}, 0, 255, 74},
{433., {0x00, 0x00, 0x00}, 0, 255, 74}, {433.92, {0x00, 0x00, 0x00}, 0, 255, 74},
{464., {0x00, 0x00, 0x00}, 0, 255, 74}, {464., {0x00, 0x00, 0x00}, 0, 255, 74},
{779., {0x00, 0x00, 0x00}, 0, 255, 74}, {779., {0x00, 0x00, 0x00}, 0, 255, 74},
{868., {0x00, 0x00, 0x00}, 0, 255, 74}, {868., {0x00, 0x00, 0x00}, 0, 255, 74},
@ -120,6 +291,10 @@ const FreqConfig FREQ_LIST[] = {
{&bands[9], 0}, {&bands[9], 0},
}; };
extern "C" void cc1101_isr() {
gpio_write((GpioPin*)&debug_0, gpio_read(&cc1101_g0_gpio));
}
typedef enum { typedef enum {
EventTypeTick, EventTypeTick,
EventTypeKey, EventTypeKey,
@ -157,6 +332,8 @@ typedef struct {
static void render_callback(CanvasApi* canvas, void* ctx) { static void render_callback(CanvasApi* canvas, void* ctx) {
State* state = (State*)acquire_mutex((ValueMutex*)ctx, 25); State* state = (State*)acquire_mutex((ValueMutex*)ctx, 25);
if(!state) return;
canvas->clear(canvas); canvas->clear(canvas);
canvas->set_color(canvas, ColorBlack); canvas->set_color(canvas, ColorBlack);
canvas->set_font(canvas, FontPrimary); canvas->set_font(canvas, FontPrimary);
@ -222,7 +399,7 @@ extern "C" void cc1101_workaround(void* p) {
State _state; State _state;
_state.mode = ModeRx; _state.mode = ModeRx;
_state.active_freq = 0; _state.active_freq = 4;
_state.need_cc1101_conf = true; _state.need_cc1101_conf = true;
_state.last_rssi = 0; _state.last_rssi = 0;
_state.tx_level = 0; _state.tx_level = 0;
@ -246,6 +423,9 @@ extern "C" void cc1101_workaround(void* p) {
} }
gui->add_widget(gui, widget, GuiLayerFullscreen); gui->add_widget(gui, widget, GuiLayerFullscreen);
gpio_init(&debug_0, GpioModeOutputPushPull);
gpio_write((GpioPin*)&debug_0, false);
printf("[cc1101] creating device\n"); printf("[cc1101] creating device\n");
GpioPin cs_pin = {CC1101_CS_GPIO_Port, CC1101_CS_Pin}; GpioPin cs_pin = {CC1101_CS_GPIO_Port, CC1101_CS_Pin};
@ -262,14 +442,16 @@ extern "C" void cc1101_workaround(void* p) {
furiac_exit(NULL); furiac_exit(NULL);
} }
// RX filter bandwidth 58.035714(0xFD) 100k(0xCD) 200k(0x8D) cc1101.SpiStrobe(CC1101_SIDLE);
cc1101.SpiWriteReg(CC1101_MDMCFG4, 0xCD);
// datarate config 250kBaud for the purpose of fast rssi measurement // flp_config(&cc1101);
cc1101.SpiWriteReg(CC1101_MDMCFG3, 0x3B); async_config(&cc1101);
// FEC preamble etc. last 2 bits for channel spacing setup_freq(&cc1101, &FREQ_LIST[4]);
cc1101.SpiWriteReg(CC1101_MDMCFG1, 0x20); enable_cc1101_irq();
// 50khz channel spacing
cc1101.SpiWriteReg(CC1101_MDMCFG0, 0xF8); printf("init ok\n");
// === Transparent mode ===
// TODO open record // TODO open record
GpioPin* led_record = (GpioPin*)&led_gpio[1]; GpioPin* led_record = (GpioPin*)&led_gpio[1];
@ -279,9 +461,13 @@ extern "C" void cc1101_workaround(void* p) {
const int16_t RSSI_THRESHOLD = -89; const int16_t RSSI_THRESHOLD = -89;
// setup_freq(&cc1101, &FREQ_LIST[1]);
cc1101.SetReceive();
AppEvent event; AppEvent event;
while(1) { while(1) {
osStatus_t event_status = osMessageQueueGet(event_queue, &event, NULL, 150); osStatus_t event_status = osMessageQueueGet(event_queue, &event, NULL, 20);
State* state = (State*)acquire_mutex_block(&state_mutex); State* state = (State*)acquire_mutex_block(&state_mutex);
if(event_status == osOK) { if(event_status == osOK) {

View File

@ -1,6 +1,7 @@
#include "flipper_v2.h" #include "flipper_v2.h"
#include "cc1101-workaround/cc1101.h" #include "cc1101-workaround/cc1101.h"
#include "spi.h" #include "spi.h"
#include <math.h>
// ****************************************************************************** // ******************************************************************************
#define WRITE_BURST 0x40 #define WRITE_BURST 0x40
@ -85,6 +86,8 @@ uint8_t CC1101::SpiTransfer(uint8_t value) {
return rxbuf[0]; return rxbuf[0];
} }
uint8_t last_status;
/**************************************************************** /****************************************************************
*FUNCTION NAME:SpiWriteReg *FUNCTION NAME:SpiWriteReg
*FUNCTION :CC1101 write data to register *FUNCTION :CC1101 write data to register
@ -95,8 +98,9 @@ void CC1101::SpiWriteReg(uint8_t addr, uint8_t value) {
gpio_write(ss_pin, false); gpio_write(ss_pin, false);
while(gpio_read(this->miso_pin_record)) while(gpio_read(this->miso_pin_record))
; ;
SpiTransfer(addr);
SpiTransfer(value); last_status = SpiTransfer(addr);
last_status = SpiTransfer(value);
gpio_write(ss_pin, true); gpio_write(ss_pin, true);
} }
@ -107,15 +111,12 @@ void CC1101::SpiWriteReg(uint8_t addr, uint8_t value) {
*OUTPUT :none *OUTPUT :none
****************************************************************/ ****************************************************************/
void CC1101::SpiWriteBurstReg(uint8_t addr, uint8_t* buffer, uint8_t num) { void CC1101::SpiWriteBurstReg(uint8_t addr, uint8_t* buffer, uint8_t num) {
uint8_t i, temp;
temp = addr | WRITE_BURST;
gpio_write(ss_pin, false); gpio_write(ss_pin, false);
while(gpio_read(this->miso_pin_record)) while(gpio_read(this->miso_pin_record))
; ;
SpiTransfer(temp); last_status = SpiTransfer(addr | WRITE_BURST);
for(i = 0; i < num; i++) { for(uint8_t i = 0; i < num; i++) {
SpiTransfer(buffer[i]); last_status = SpiTransfer(buffer[i]);
} }
gpio_write(ss_pin, true); gpio_write(ss_pin, true);
} }
@ -130,7 +131,7 @@ void CC1101::SpiStrobe(uint8_t strobe) {
gpio_write(ss_pin, false); gpio_write(ss_pin, false);
while(gpio_read(this->miso_pin_record)) while(gpio_read(this->miso_pin_record))
; ;
SpiTransfer(strobe); last_status = SpiTransfer(strobe);
gpio_write(ss_pin, true); gpio_write(ss_pin, true);
} }
@ -141,14 +142,11 @@ void CC1101::SpiStrobe(uint8_t strobe) {
*OUTPUT :register value *OUTPUT :register value
****************************************************************/ ****************************************************************/
uint8_t CC1101::SpiReadReg(uint8_t addr) { uint8_t CC1101::SpiReadReg(uint8_t addr) {
uint8_t temp, value;
temp = addr | READ_SINGLE;
gpio_write(ss_pin, false); gpio_write(ss_pin, false);
while(gpio_read(this->miso_pin_record)) while(gpio_read(this->miso_pin_record))
; ;
SpiTransfer(temp); last_status = SpiTransfer(addr | READ_SINGLE);
value = SpiTransfer(0); uint8_t value = SpiTransfer(0);
gpio_write(ss_pin, true); gpio_write(ss_pin, true);
return value; return value;
@ -161,14 +159,11 @@ uint8_t CC1101::SpiReadReg(uint8_t addr) {
*OUTPUT :none *OUTPUT :none
****************************************************************/ ****************************************************************/
void CC1101::SpiReadBurstReg(uint8_t addr, uint8_t* buffer, uint8_t num) { void CC1101::SpiReadBurstReg(uint8_t addr, uint8_t* buffer, uint8_t num) {
uint8_t i, temp;
temp = addr | READ_BURST;
gpio_write(ss_pin, false); gpio_write(ss_pin, false);
while(gpio_read(this->miso_pin_record)) while(gpio_read(this->miso_pin_record))
; ;
SpiTransfer(temp); last_status = SpiTransfer(addr | READ_BURST);
for(i = 0; i < num; i++) { for(uint8_t i = 0; i < num; i++) {
buffer[i] = SpiTransfer(0); buffer[i] = SpiTransfer(0);
} }
gpio_write(ss_pin, true); gpio_write(ss_pin, true);
@ -181,14 +176,11 @@ void CC1101::SpiReadBurstReg(uint8_t addr, uint8_t* buffer, uint8_t num) {
*OUTPUT :status value *OUTPUT :status value
****************************************************************/ ****************************************************************/
uint8_t CC1101::SpiReadStatus(uint8_t addr) { uint8_t CC1101::SpiReadStatus(uint8_t addr) {
uint8_t value, temp;
temp = addr | READ_BURST;
gpio_write(ss_pin, false); gpio_write(ss_pin, false);
while(gpio_read(this->miso_pin_record)) while(gpio_read(this->miso_pin_record))
; ;
SpiTransfer(temp); last_status = SpiTransfer(addr | READ_BURST);
value = SpiTransfer(0); uint8_t value = SpiTransfer(0);
gpio_write(ss_pin, true); gpio_write(ss_pin, true);
return value; return value;
@ -208,11 +200,25 @@ void CC1101::Reset(void) {
gpio_write(ss_pin, false); gpio_write(ss_pin, false);
while(gpio_read(this->miso_pin_record)) while(gpio_read(this->miso_pin_record))
; ;
SpiTransfer(CC1101_SRES); last_status = SpiTransfer(CC1101_SRES);
while(gpio_read(this->miso_pin_record)) while(gpio_read(this->miso_pin_record))
; ;
gpio_write(ss_pin, true); gpio_write(ss_pin, true);
} }
bool CC1101::SpiSetRegValue(uint8_t reg, uint8_t value, uint8_t msb, uint8_t lsb) {
if((msb > 7) || (lsb > 7) || (lsb > msb)) {
return false;
}
uint8_t current_value = SpiReadReg(reg);
uint8_t mask = ~((0b11111111 << (msb + 1)) | (0b11111111 >> (8 - lsb)));
uint8_t new_value = (current_value & ~mask) | (value & mask);
SpiWriteReg(reg, new_value);
return true;
}
/**************************************************************** /****************************************************************
*FUNCTION NAME:Init *FUNCTION NAME:Init
*FUNCTION :CC1101 initialization *FUNCTION :CC1101 initialization
@ -230,7 +236,9 @@ uint8_t CC1101::Init(void) {
#ifdef CC1101_DEBUG #ifdef CC1101_DEBUG
printf("Reset CC1101...\n"); printf("Reset CC1101...\n");
#endif #endif
Reset(); //CC1101 reset Reset(); // CC1101 reset
osDelay(150);
uint8_t partnum __attribute__((unused)); uint8_t partnum __attribute__((unused));
uint8_t version; uint8_t version;
@ -245,7 +253,7 @@ uint8_t CC1101::Init(void) {
#ifdef CC1101_DEBUG #ifdef CC1101_DEBUG
printf("Init CC1101..."); printf("Init CC1101...");
#endif #endif
RegConfigSettings(); //CC1101 register config // RegConfigSettings(); //CC1101 register config
#ifdef CC1101_DEBUG #ifdef CC1101_DEBUG
printf("Done!\n"); printf("Done!\n");
@ -401,3 +409,75 @@ void CC1101::SetTransmit(void) {
; ;
} }
//cc1101 cc1101; //cc1101 cc1101;
bool CC1101::setRxBandwidth(float bandwidth) {
if(bandwidth < 58.0 || bandwidth > 821.0) return false;
// set mode to standby
SpiStrobe(CC1101_SIDLE);
// calculate exponent and mantissa values
for(int8_t e = 3; e >= 0; e--) {
for(int8_t m = 3; m >= 0; m--) {
float point = (F_OSC) / (8 * (m + 4) * ((uint32_t)1 << e));
if(fabs((bandwidth * 1000.0) - point) <= 1000) {
// set Rx channel filter bandwidth
SpiSetRegValue(CC1101_MDMCFG4, (e << 6) | (m << 4), 7, 4);
return true;
}
}
}
return false;
}
static void getExpMant(
float target,
uint16_t mantOffset,
uint8_t divExp,
uint8_t expMax,
uint8_t& exp,
uint8_t& mant) {
// get table origin point (exp = 0, mant = 0)
float origin = (mantOffset * F_OSC) / ((uint32_t)1 << divExp);
// iterate over possible exponent values
for(int8_t e = expMax; e >= 0; e--) {
// get table column start value (exp = e, mant = 0);
float intervalStart = ((uint32_t)1 << e) * origin;
// check if target value is in this column
if(target >= intervalStart) {
// save exponent value
exp = e;
// calculate size of step between table rows
float stepSize = intervalStart / (float)mantOffset;
// get target point position (exp = e, mant = m)
mant = ((target - intervalStart) / stepSize);
// we only need the first match, terminate
return;
}
}
}
bool CC1101::setBitRate(float bitrate) {
if(bitrate < 0.6 || bitrate > 500.0) return false;
// set mode to standby
SpiStrobe(CC1101_SIDLE);
// calculate exponent and mantissa values
uint8_t e = 0;
uint8_t m = 0;
getExpMant(bitrate * 1000.0, 256, 28, 14, e, m);
// set bit rate value
SpiSetRegValue(CC1101_MDMCFG4, e, 3, 0);
SpiSetRegValue(CC1101_MDMCFG3, m, 7, 0);
return true;
}

View File

@ -2,8 +2,11 @@
#include "flipper_v2.h" #include "flipper_v2.h"
#define F_OSC 26e6
/*******************************debug mode*************************************/ /*******************************debug mode*************************************/
// #define CC1101_DEBUG 1 // #define CC1101_DEBUG 1
//******************************CC1101 defines ******************************** //******************************CC1101 defines ********************************
//******************************config registers ***************************** //******************************config registers *****************************
#define CC1101_IOCFG2 0x00 //GDO2 output pin configration #define CC1101_IOCFG2 0x00 //GDO2 output pin configration
@ -148,13 +151,14 @@ private:
void Reset(void); void Reset(void);
void SpiWriteBurstReg(uint8_t addr, uint8_t* buffer, uint8_t num); void SpiWriteBurstReg(uint8_t addr, uint8_t* buffer, uint8_t num);
uint8_t SpiReadReg(uint8_t addr); uint8_t SpiReadReg(uint8_t addr);
void SpiReadBurstReg(uint8_t addr, uint8_t* buffer, uint8_t num);
void RegConfigSettings(void); void RegConfigSettings(void);
public: public:
CC1101(GpioPin* ss_pin); CC1101(GpioPin* ss_pin);
void SpiWriteReg(uint8_t addr, uint8_t value); void SpiWriteReg(uint8_t addr, uint8_t value);
bool SpiSetRegValue(uint8_t reg, uint8_t value, uint8_t msb, uint8_t lsb);
void SpiReadBurstReg(uint8_t addr, uint8_t* buffer, uint8_t num);
void SpiInit(void); void SpiInit(void);
void SpiEnd(void); void SpiEnd(void);
void SetMod(uint8_t mode); void SetMod(uint8_t mode);
@ -165,4 +169,6 @@ public:
void SetReceive(void); void SetReceive(void);
void SetTransmit(void); void SetTransmit(void);
void SetChannel(int channel); void SetChannel(int channel);
bool setRxBandwidth(float bandwidth);
bool setBitRate(float bitrate);
}; };

View File

@ -6,6 +6,10 @@
void nfc_isr(void); void nfc_isr(void);
#endif #endif
#ifdef BUILD_CC1101
void cc1101_isr();
#endif
static volatile bool initialized = false; static volatile bool initialized = false;
static ValueManager input_state_record; static ValueManager input_state_record;
static PubSub input_events_record; static PubSub input_events_record;
@ -115,6 +119,13 @@ void HAL_GPIO_EXTI_Callback(uint16_t pin) {
} }
#endif #endif
#ifdef BUILD_CC1101
if(pin == CC1101_G0_Pin) {
cc1101_isr();
return;
}
#endif
if(!initialized) return; if(!initialized) return;
signal_event(&event); signal_event(&event);

View File

@ -19,4 +19,8 @@ void hal_gpio_init(
bool hal_gpio_read_sd_detect(void) { bool hal_gpio_read_sd_detect(void) {
return true; return true;
} }
void enable_cc1101_irq() {
}

View File

@ -64,4 +64,6 @@ static inline bool hal_gpio_read(const GpioPin* gpio) {
} }
} }
bool hal_gpio_read_sd_detect(void); bool hal_gpio_read_sd_detect(void);
void enable_cc1101_irq();

View File

@ -30,3 +30,4 @@ const GpioPin led_gpio[3] = {
const GpioPin backlight_gpio = {DISPLAY_BACKLIGHT_GPIO_Port, DISPLAY_BACKLIGHT_Pin}; const GpioPin backlight_gpio = {DISPLAY_BACKLIGHT_GPIO_Port, DISPLAY_BACKLIGHT_Pin};
const GpioPin vibro_gpio = {VIBRO_GPIO_Port, VIBRO_Pin}; const GpioPin vibro_gpio = {VIBRO_GPIO_Port, VIBRO_Pin};
const GpioPin ibutton_gpio = {iButton_GPIO_Port, iButton_Pin}; const GpioPin ibutton_gpio = {iButton_GPIO_Port, iButton_Pin};
const GpioPin cc1101_g0_gpio = {NULL, 0};

View File

@ -11,4 +11,5 @@ extern const bool input_invert[GPIO_INPUT_PINS_COUNT];
extern const GpioPin led_gpio[3]; extern const GpioPin led_gpio[3];
extern const GpioPin backlight_gpio; extern const GpioPin backlight_gpio;
extern const GpioPin vibro_gpio; extern const GpioPin vibro_gpio;
extern const GpioPin ibutton_gpio; extern const GpioPin ibutton_gpio;
extern const GpioPin cc1101_g0_gpio;

View File

@ -1,398 +0,0 @@
##########################################################################################################################
# File automatically-generated by tool: [projectgenerator] version: [3.10.0-B14] date: [Mon Nov 23 12:04:48 VLAT 2020]
##########################################################################################################################
# ------------------------------------------------
# Generic Makefile (based on gcc)
#
# ChangeLog :
# 2017-02-10 - Several enhancements + project update mode
# 2015-07-22 - first version
# ------------------------------------------------
######################################
# target
######################################
TARGET = f3
######################################
# building variables
######################################
# debug build?
DEBUG = 1
# optimization
OPT = -Og
#######################################
# paths
#######################################
# Build path
BUILD_DIR = build
######################################
# source
######################################
# C sources
C_SOURCES = \
Src/main.c \
Src/gpio.c \
Src/app_freertos.c \
Src/adc.c \
Src/i2c.c \
Src/rtc.c \
Src/spi.c \
Src/tim.c \
Src/usart.c \
Src/usb_device.c \
Src/usbd_conf.c \
Src/usbd_desc.c \
Src/usbd_cdc_if.c \
Src/stm32wbxx_it.c \
Src/stm32wbxx_hal_msp.c \
Src/stm32wbxx_hal_timebase_tim.c \
/Users/aku/Work/flipper/flipperzero-firmware-community/lib/STM32CubeWB/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_gpio.c \
/Users/aku/Work/flipper/flipperzero-firmware-community/lib/STM32CubeWB/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_pcd.c \
/Users/aku/Work/flipper/flipperzero-firmware-community/lib/STM32CubeWB/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_pcd_ex.c \
/Users/aku/Work/flipper/flipperzero-firmware-community/lib/STM32CubeWB/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_ll_usb.c \
/Users/aku/Work/flipper/flipperzero-firmware-community/lib/STM32CubeWB/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_rcc.c \
/Users/aku/Work/flipper/flipperzero-firmware-community/lib/STM32CubeWB/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_rcc_ex.c \
/Users/aku/Work/flipper/flipperzero-firmware-community/lib/STM32CubeWB/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_flash.c \
/Users/aku/Work/flipper/flipperzero-firmware-community/lib/STM32CubeWB/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_flash_ex.c \
/Users/aku/Work/flipper/flipperzero-firmware-community/lib/STM32CubeWB/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_hsem.c \
/Users/aku/Work/flipper/flipperzero-firmware-community/lib/STM32CubeWB/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_dma.c \
/Users/aku/Work/flipper/flipperzero-firmware-community/lib/STM32CubeWB/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_dma_ex.c \
/Users/aku/Work/flipper/flipperzero-firmware-community/lib/STM32CubeWB/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_pwr.c \
/Users/aku/Work/flipper/flipperzero-firmware-community/lib/STM32CubeWB/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_pwr_ex.c \
/Users/aku/Work/flipper/flipperzero-firmware-community/lib/STM32CubeWB/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_cortex.c \
/Users/aku/Work/flipper/flipperzero-firmware-community/lib/STM32CubeWB/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal.c \
/Users/aku/Work/flipper/flipperzero-firmware-community/lib/STM32CubeWB/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_exti.c \
/Users/aku/Work/flipper/flipperzero-firmware-community/lib/STM32CubeWB/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_adc.c \
/Users/aku/Work/flipper/flipperzero-firmware-community/lib/STM32CubeWB/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_adc_ex.c \
/Users/aku/Work/flipper/flipperzero-firmware-community/lib/STM32CubeWB/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_ll_adc.c \
/Users/aku/Work/flipper/flipperzero-firmware-community/lib/STM32CubeWB/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_i2c.c \
/Users/aku/Work/flipper/flipperzero-firmware-community/lib/STM32CubeWB/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_i2c_ex.c \
/Users/aku/Work/flipper/flipperzero-firmware-community/lib/STM32CubeWB/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_rtc.c \
/Users/aku/Work/flipper/flipperzero-firmware-community/lib/STM32CubeWB/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_rtc_ex.c \
/Users/aku/Work/flipper/flipperzero-firmware-community/lib/STM32CubeWB/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_spi.c \
/Users/aku/Work/flipper/flipperzero-firmware-community/lib/STM32CubeWB/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_spi_ex.c \
/Users/aku/Work/flipper/flipperzero-firmware-community/lib/STM32CubeWB/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_tim.c \
/Users/aku/Work/flipper/flipperzero-firmware-community/lib/STM32CubeWB/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_tim_ex.c \
/Users/aku/Work/flipper/flipperzero-firmware-community/lib/STM32CubeWB/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_uart.c \
/Users/aku/Work/flipper/flipperzero-firmware-community/lib/STM32CubeWB/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_uart_ex.c \
Src/system_stm32wbxx.c \
/Users/aku/Work/flipper/flipperzero-firmware-community/lib/STM32CubeWB/Middlewares/Third_Party/FreeRTOS/Source/croutine.c \
/Users/aku/Work/flipper/flipperzero-firmware-community/lib/STM32CubeWB/Middlewares/Third_Party/FreeRTOS/Source/event_groups.c \
/Users/aku/Work/flipper/flipperzero-firmware-community/lib/STM32CubeWB/Middlewares/Third_Party/FreeRTOS/Source/list.c \
/Users/aku/Work/flipper/flipperzero-firmware-community/lib/STM32CubeWB/Middlewares/Third_Party/FreeRTOS/Source/queue.c \
/Users/aku/Work/flipper/flipperzero-firmware-community/lib/STM32CubeWB/Middlewares/Third_Party/FreeRTOS/Source/stream_buffer.c \
/Users/aku/Work/flipper/flipperzero-firmware-community/lib/STM32CubeWB/Middlewares/Third_Party/FreeRTOS/Source/tasks.c \
/Users/aku/Work/flipper/flipperzero-firmware-community/lib/STM32CubeWB/Middlewares/Third_Party/FreeRTOS/Source/timers.c \
/Users/aku/Work/flipper/flipperzero-firmware-community/lib/STM32CubeWB/Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2/cmsis_os2.c \
/Users/aku/Work/flipper/flipperzero-firmware-community/lib/STM32CubeWB/Middlewares/Third_Party/FreeRTOS/Source/portable/MemMang/heap_4.c \
/Users/aku/Work/flipper/flipperzero-firmware-community/lib/STM32CubeWB/Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM4F/port.c \
/Users/aku/Work/flipper/flipperzero-firmware-community/lib/STM32CubeWB/Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_core.c \
/Users/aku/Work/flipper/flipperzero-firmware-community/lib/STM32CubeWB/Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_ctlreq.c \
/Users/aku/Work/flipper/flipperzero-firmware-community/lib/STM32CubeWB/Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_ioreq.c \
/Users/aku/Work/flipper/flipperzero-firmware-community/lib/STM32CubeWB/Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Src/usbd_cdc.c \
C:/work/cmake-stm32/projects/flipperzero-firmware-community/lib/STM32CubeWB/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_gpio.c \
C:/work/cmake-stm32/projects/flipperzero-firmware-community/lib/STM32CubeWB/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_pcd.c \
C:/work/cmake-stm32/projects/flipperzero-firmware-community/lib/STM32CubeWB/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_pcd_ex.c \
C:/work/cmake-stm32/projects/flipperzero-firmware-community/lib/STM32CubeWB/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_ll_usb.c \
C:/work/cmake-stm32/projects/flipperzero-firmware-community/lib/STM32CubeWB/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_rcc.c \
C:/work/cmake-stm32/projects/flipperzero-firmware-community/lib/STM32CubeWB/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_rcc_ex.c \
C:/work/cmake-stm32/projects/flipperzero-firmware-community/lib/STM32CubeWB/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_flash.c \
C:/work/cmake-stm32/projects/flipperzero-firmware-community/lib/STM32CubeWB/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_flash_ex.c \
C:/work/cmake-stm32/projects/flipperzero-firmware-community/lib/STM32CubeWB/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_hsem.c \
C:/work/cmake-stm32/projects/flipperzero-firmware-community/lib/STM32CubeWB/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_dma.c \
C:/work/cmake-stm32/projects/flipperzero-firmware-community/lib/STM32CubeWB/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_dma_ex.c \
C:/work/cmake-stm32/projects/flipperzero-firmware-community/lib/STM32CubeWB/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_pwr.c \
C:/work/cmake-stm32/projects/flipperzero-firmware-community/lib/STM32CubeWB/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_pwr_ex.c \
C:/work/cmake-stm32/projects/flipperzero-firmware-community/lib/STM32CubeWB/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_cortex.c \
C:/work/cmake-stm32/projects/flipperzero-firmware-community/lib/STM32CubeWB/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal.c \
C:/work/cmake-stm32/projects/flipperzero-firmware-community/lib/STM32CubeWB/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_exti.c \
C:/work/cmake-stm32/projects/flipperzero-firmware-community/lib/STM32CubeWB/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_adc.c \
C:/work/cmake-stm32/projects/flipperzero-firmware-community/lib/STM32CubeWB/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_adc_ex.c \
C:/work/cmake-stm32/projects/flipperzero-firmware-community/lib/STM32CubeWB/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_ll_adc.c \
C:/work/cmake-stm32/projects/flipperzero-firmware-community/lib/STM32CubeWB/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_i2c.c \
C:/work/cmake-stm32/projects/flipperzero-firmware-community/lib/STM32CubeWB/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_i2c_ex.c \
C:/work/cmake-stm32/projects/flipperzero-firmware-community/lib/STM32CubeWB/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_rtc.c \
C:/work/cmake-stm32/projects/flipperzero-firmware-community/lib/STM32CubeWB/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_rtc_ex.c \
C:/work/cmake-stm32/projects/flipperzero-firmware-community/lib/STM32CubeWB/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_spi.c \
C:/work/cmake-stm32/projects/flipperzero-firmware-community/lib/STM32CubeWB/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_spi_ex.c \
C:/work/cmake-stm32/projects/flipperzero-firmware-community/lib/STM32CubeWB/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_tim.c \
C:/work/cmake-stm32/projects/flipperzero-firmware-community/lib/STM32CubeWB/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_tim_ex.c \
C:/work/cmake-stm32/projects/flipperzero-firmware-community/lib/STM32CubeWB/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_uart.c \
C:/work/cmake-stm32/projects/flipperzero-firmware-community/lib/STM32CubeWB/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_uart_ex.c \
C:/work/cmake-stm32/projects/flipperzero-firmware-community/lib/STM32CubeWB/Middlewares/Third_Party/FreeRTOS/Source/croutine.c \
C:/work/cmake-stm32/projects/flipperzero-firmware-community/lib/STM32CubeWB/Middlewares/Third_Party/FreeRTOS/Source/event_groups.c \
C:/work/cmake-stm32/projects/flipperzero-firmware-community/lib/STM32CubeWB/Middlewares/Third_Party/FreeRTOS/Source/list.c \
C:/work/cmake-stm32/projects/flipperzero-firmware-community/lib/STM32CubeWB/Middlewares/Third_Party/FreeRTOS/Source/queue.c \
C:/work/cmake-stm32/projects/flipperzero-firmware-community/lib/STM32CubeWB/Middlewares/Third_Party/FreeRTOS/Source/stream_buffer.c \
C:/work/cmake-stm32/projects/flipperzero-firmware-community/lib/STM32CubeWB/Middlewares/Third_Party/FreeRTOS/Source/tasks.c \
C:/work/cmake-stm32/projects/flipperzero-firmware-community/lib/STM32CubeWB/Middlewares/Third_Party/FreeRTOS/Source/timers.c \
C:/work/cmake-stm32/projects/flipperzero-firmware-community/lib/STM32CubeWB/Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2/cmsis_os2.c \
C:/work/cmake-stm32/projects/flipperzero-firmware-community/lib/STM32CubeWB/Middlewares/Third_Party/FreeRTOS/Source/portable/MemMang/heap_4.c \
C:/work/cmake-stm32/projects/flipperzero-firmware-community/lib/STM32CubeWB/Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM4F/port.c \
C:/work/cmake-stm32/projects/flipperzero-firmware-community/lib/STM32CubeWB/Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_core.c \
C:/work/cmake-stm32/projects/flipperzero-firmware-community/lib/STM32CubeWB/Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_ctlreq.c \
C:/work/cmake-stm32/projects/flipperzero-firmware-community/lib/STM32CubeWB/Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_ioreq.c \
C:/work/cmake-stm32/projects/flipperzero-firmware-community/lib/STM32CubeWB/Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Src/usbd_cdc.c \
/Users/aku/STM32Cube/Repository/STM32Cube_FW_WB_V1.9.0/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_gpio.c \
/Users/aku/STM32Cube/Repository/STM32Cube_FW_WB_V1.9.0/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_pcd.c \
/Users/aku/STM32Cube/Repository/STM32Cube_FW_WB_V1.9.0/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_pcd_ex.c \
/Users/aku/STM32Cube/Repository/STM32Cube_FW_WB_V1.9.0/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_ll_usb.c \
/Users/aku/STM32Cube/Repository/STM32Cube_FW_WB_V1.9.0/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_rcc.c \
/Users/aku/STM32Cube/Repository/STM32Cube_FW_WB_V1.9.0/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_rcc_ex.c \
/Users/aku/STM32Cube/Repository/STM32Cube_FW_WB_V1.9.0/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_flash.c \
/Users/aku/STM32Cube/Repository/STM32Cube_FW_WB_V1.9.0/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_flash_ex.c \
/Users/aku/STM32Cube/Repository/STM32Cube_FW_WB_V1.9.0/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_hsem.c \
/Users/aku/STM32Cube/Repository/STM32Cube_FW_WB_V1.9.0/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_dma.c \
/Users/aku/STM32Cube/Repository/STM32Cube_FW_WB_V1.9.0/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_dma_ex.c \
/Users/aku/STM32Cube/Repository/STM32Cube_FW_WB_V1.9.0/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_pwr.c \
/Users/aku/STM32Cube/Repository/STM32Cube_FW_WB_V1.9.0/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_pwr_ex.c \
/Users/aku/STM32Cube/Repository/STM32Cube_FW_WB_V1.9.0/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_cortex.c \
/Users/aku/STM32Cube/Repository/STM32Cube_FW_WB_V1.9.0/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal.c \
/Users/aku/STM32Cube/Repository/STM32Cube_FW_WB_V1.9.0/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_exti.c \
/Users/aku/STM32Cube/Repository/STM32Cube_FW_WB_V1.9.0/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_adc.c \
/Users/aku/STM32Cube/Repository/STM32Cube_FW_WB_V1.9.0/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_adc_ex.c \
/Users/aku/STM32Cube/Repository/STM32Cube_FW_WB_V1.9.0/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_ll_adc.c \
/Users/aku/STM32Cube/Repository/STM32Cube_FW_WB_V1.9.0/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_i2c.c \
/Users/aku/STM32Cube/Repository/STM32Cube_FW_WB_V1.9.0/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_i2c_ex.c \
/Users/aku/STM32Cube/Repository/STM32Cube_FW_WB_V1.9.0/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_rtc.c \
/Users/aku/STM32Cube/Repository/STM32Cube_FW_WB_V1.9.0/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_rtc_ex.c \
/Users/aku/STM32Cube/Repository/STM32Cube_FW_WB_V1.9.0/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_spi.c \
/Users/aku/STM32Cube/Repository/STM32Cube_FW_WB_V1.9.0/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_spi_ex.c \
/Users/aku/STM32Cube/Repository/STM32Cube_FW_WB_V1.9.0/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_tim.c \
/Users/aku/STM32Cube/Repository/STM32Cube_FW_WB_V1.9.0/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_tim_ex.c \
/Users/aku/STM32Cube/Repository/STM32Cube_FW_WB_V1.9.0/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_uart.c \
/Users/aku/STM32Cube/Repository/STM32Cube_FW_WB_V1.9.0/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_uart_ex.c \
/Users/aku/STM32Cube/Repository/STM32Cube_FW_WB_V1.9.0/Middlewares/Third_Party/FreeRTOS/Source/croutine.c \
/Users/aku/STM32Cube/Repository/STM32Cube_FW_WB_V1.9.0/Middlewares/Third_Party/FreeRTOS/Source/event_groups.c \
/Users/aku/STM32Cube/Repository/STM32Cube_FW_WB_V1.9.0/Middlewares/Third_Party/FreeRTOS/Source/list.c \
/Users/aku/STM32Cube/Repository/STM32Cube_FW_WB_V1.9.0/Middlewares/Third_Party/FreeRTOS/Source/queue.c \
/Users/aku/STM32Cube/Repository/STM32Cube_FW_WB_V1.9.0/Middlewares/Third_Party/FreeRTOS/Source/stream_buffer.c \
/Users/aku/STM32Cube/Repository/STM32Cube_FW_WB_V1.9.0/Middlewares/Third_Party/FreeRTOS/Source/tasks.c \
/Users/aku/STM32Cube/Repository/STM32Cube_FW_WB_V1.9.0/Middlewares/Third_Party/FreeRTOS/Source/timers.c \
/Users/aku/STM32Cube/Repository/STM32Cube_FW_WB_V1.9.0/Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2/cmsis_os2.c \
/Users/aku/STM32Cube/Repository/STM32Cube_FW_WB_V1.9.0/Middlewares/Third_Party/FreeRTOS/Source/portable/MemMang/heap_4.c \
/Users/aku/STM32Cube/Repository/STM32Cube_FW_WB_V1.9.0/Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM4F/port.c \
/Users/aku/STM32Cube/Repository/STM32Cube_FW_WB_V1.9.0/Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_core.c \
/Users/aku/STM32Cube/Repository/STM32Cube_FW_WB_V1.9.0/Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_ctlreq.c \
/Users/aku/STM32Cube/Repository/STM32Cube_FW_WB_V1.9.0/Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_ioreq.c \
/Users/aku/STM32Cube/Repository/STM32Cube_FW_WB_V1.9.0/Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Src/usbd_cdc.c \
Src/comp.c \
/Users/aku/STM32Cube/Repository/STM32Cube_FW_WB_V1.9.0/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_comp.c \
Src/rf.c \
C:/Users/whoju/STM32Cube/Repository/STM32Cube_FW_WB_V1.9.0/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_gpio.c \
C:/Users/whoju/STM32Cube/Repository/STM32Cube_FW_WB_V1.9.0/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_pcd.c \
C:/Users/whoju/STM32Cube/Repository/STM32Cube_FW_WB_V1.9.0/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_pcd_ex.c \
C:/Users/whoju/STM32Cube/Repository/STM32Cube_FW_WB_V1.9.0/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_ll_usb.c \
C:/Users/whoju/STM32Cube/Repository/STM32Cube_FW_WB_V1.9.0/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_rcc.c \
C:/Users/whoju/STM32Cube/Repository/STM32Cube_FW_WB_V1.9.0/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_rcc_ex.c \
C:/Users/whoju/STM32Cube/Repository/STM32Cube_FW_WB_V1.9.0/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_flash.c \
C:/Users/whoju/STM32Cube/Repository/STM32Cube_FW_WB_V1.9.0/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_flash_ex.c \
C:/Users/whoju/STM32Cube/Repository/STM32Cube_FW_WB_V1.9.0/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_hsem.c \
C:/Users/whoju/STM32Cube/Repository/STM32Cube_FW_WB_V1.9.0/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_dma.c \
C:/Users/whoju/STM32Cube/Repository/STM32Cube_FW_WB_V1.9.0/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_dma_ex.c \
C:/Users/whoju/STM32Cube/Repository/STM32Cube_FW_WB_V1.9.0/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_pwr.c \
C:/Users/whoju/STM32Cube/Repository/STM32Cube_FW_WB_V1.9.0/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_pwr_ex.c \
C:/Users/whoju/STM32Cube/Repository/STM32Cube_FW_WB_V1.9.0/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_cortex.c \
C:/Users/whoju/STM32Cube/Repository/STM32Cube_FW_WB_V1.9.0/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal.c \
C:/Users/whoju/STM32Cube/Repository/STM32Cube_FW_WB_V1.9.0/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_exti.c \
C:/Users/whoju/STM32Cube/Repository/STM32Cube_FW_WB_V1.9.0/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_adc.c \
C:/Users/whoju/STM32Cube/Repository/STM32Cube_FW_WB_V1.9.0/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_adc_ex.c \
C:/Users/whoju/STM32Cube/Repository/STM32Cube_FW_WB_V1.9.0/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_ll_adc.c \
C:/Users/whoju/STM32Cube/Repository/STM32Cube_FW_WB_V1.9.0/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_comp.c \
C:/Users/whoju/STM32Cube/Repository/STM32Cube_FW_WB_V1.9.0/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_i2c.c \
C:/Users/whoju/STM32Cube/Repository/STM32Cube_FW_WB_V1.9.0/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_i2c_ex.c \
C:/Users/whoju/STM32Cube/Repository/STM32Cube_FW_WB_V1.9.0/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_rtc.c \
C:/Users/whoju/STM32Cube/Repository/STM32Cube_FW_WB_V1.9.0/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_rtc_ex.c \
C:/Users/whoju/STM32Cube/Repository/STM32Cube_FW_WB_V1.9.0/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_spi.c \
C:/Users/whoju/STM32Cube/Repository/STM32Cube_FW_WB_V1.9.0/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_spi_ex.c \
C:/Users/whoju/STM32Cube/Repository/STM32Cube_FW_WB_V1.9.0/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_tim.c \
C:/Users/whoju/STM32Cube/Repository/STM32Cube_FW_WB_V1.9.0/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_tim_ex.c \
C:/Users/whoju/STM32Cube/Repository/STM32Cube_FW_WB_V1.9.0/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_uart.c \
C:/Users/whoju/STM32Cube/Repository/STM32Cube_FW_WB_V1.9.0/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_uart_ex.c \
C:/Users/whoju/STM32Cube/Repository/STM32Cube_FW_WB_V1.9.0/Middlewares/Third_Party/FreeRTOS/Source/croutine.c \
C:/Users/whoju/STM32Cube/Repository/STM32Cube_FW_WB_V1.9.0/Middlewares/Third_Party/FreeRTOS/Source/event_groups.c \
C:/Users/whoju/STM32Cube/Repository/STM32Cube_FW_WB_V1.9.0/Middlewares/Third_Party/FreeRTOS/Source/list.c \
C:/Users/whoju/STM32Cube/Repository/STM32Cube_FW_WB_V1.9.0/Middlewares/Third_Party/FreeRTOS/Source/queue.c \
C:/Users/whoju/STM32Cube/Repository/STM32Cube_FW_WB_V1.9.0/Middlewares/Third_Party/FreeRTOS/Source/stream_buffer.c \
C:/Users/whoju/STM32Cube/Repository/STM32Cube_FW_WB_V1.9.0/Middlewares/Third_Party/FreeRTOS/Source/tasks.c \
C:/Users/whoju/STM32Cube/Repository/STM32Cube_FW_WB_V1.9.0/Middlewares/Third_Party/FreeRTOS/Source/timers.c \
C:/Users/whoju/STM32Cube/Repository/STM32Cube_FW_WB_V1.9.0/Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2/cmsis_os2.c \
C:/Users/whoju/STM32Cube/Repository/STM32Cube_FW_WB_V1.9.0/Middlewares/Third_Party/FreeRTOS/Source/portable/MemMang/heap_4.c \
C:/Users/whoju/STM32Cube/Repository/STM32Cube_FW_WB_V1.9.0/Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM4F/port.c \
C:/Users/whoju/STM32Cube/Repository/STM32Cube_FW_WB_V1.9.0/Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_core.c \
C:/Users/whoju/STM32Cube/Repository/STM32Cube_FW_WB_V1.9.0/Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_ctlreq.c \
C:/Users/whoju/STM32Cube/Repository/STM32Cube_FW_WB_V1.9.0/Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_ioreq.c \
C:/Users/whoju/STM32Cube/Repository/STM32Cube_FW_WB_V1.9.0/Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Src/usbd_cdc.c
# ASM sources
ASM_SOURCES = \
startup_stm32wb55xx_cm4.s
#######################################
# binaries
#######################################
PREFIX = arm-none-eabi-
# The gcc compiler bin path can be either defined in make command via GCC_PATH variable (> make GCC_PATH=xxx)
# either it can be added to the PATH environment variable.
ifdef GCC_PATH
CC = $(GCC_PATH)/$(PREFIX)gcc
AS = $(GCC_PATH)/$(PREFIX)gcc -x assembler-with-cpp
CP = $(GCC_PATH)/$(PREFIX)objcopy
SZ = $(GCC_PATH)/$(PREFIX)size
else
CC = $(PREFIX)gcc
AS = $(PREFIX)gcc -x assembler-with-cpp
CP = $(PREFIX)objcopy
SZ = $(PREFIX)size
endif
HEX = $(CP) -O ihex
BIN = $(CP) -O binary -S
#######################################
# CFLAGS
#######################################
# cpu
CPU = -mcpu=cortex-m4
# fpu
FPU = -mfpu=fpv4-sp-d16
# float-abi
FLOAT-ABI = -mfloat-abi=hard
# mcu
MCU = $(CPU) -mthumb $(FPU) $(FLOAT-ABI)
# macros for gcc
# AS defines
AS_DEFS =
# C defines
C_DEFS = \
-DUSE_HAL_DRIVER \
-DSTM32WB55xx
# AS includes
AS_INCLUDES = \
-IInc
# C includes
C_INCLUDES = \
-IInc \
-I/Users/aku/Work/flipper/flipperzero-firmware-community/lib/STM32CubeWB/Drivers/STM32WBxx_HAL_Driver/Inc \
-I/Users/aku/Work/flipper/flipperzero-firmware-community/lib/STM32CubeWB/Drivers/STM32WBxx_HAL_Driver/Inc/Legacy \
-I/Users/aku/Work/flipper/flipperzero-firmware-community/lib/STM32CubeWB/Middlewares/Third_Party/FreeRTOS/Source/include \
-I/Users/aku/Work/flipper/flipperzero-firmware-community/lib/STM32CubeWB/Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2 \
-I/Users/aku/Work/flipper/flipperzero-firmware-community/lib/STM32CubeWB/Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM4F \
-I/Users/aku/Work/flipper/flipperzero-firmware-community/lib/STM32CubeWB/Middlewares/ST/STM32_USB_Device_Library/Core/Inc \
-I/Users/aku/Work/flipper/flipperzero-firmware-community/lib/STM32CubeWB/Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Inc \
-I/Users/aku/Work/flipper/flipperzero-firmware-community/lib/STM32CubeWB/Drivers/CMSIS/Device/ST/STM32WBxx/Include \
-I/Users/aku/Work/flipper/flipperzero-firmware-community/lib/STM32CubeWB/Drivers/CMSIS/Include \
-I/Users/aku/Work/flipper/flipperzero-firmware-community/lib/STM32CubeWB/Drivers/CMSIS/Include \
-IC:/work/cmake-stm32/projects/flipperzero-firmware-community/lib/STM32CubeWB/Drivers/STM32WBxx_HAL_Driver/Inc \
-IC:/work/cmake-stm32/projects/flipperzero-firmware-community/lib/STM32CubeWB/Drivers/STM32WBxx_HAL_Driver/Inc/Legacy \
-IC:/work/cmake-stm32/projects/flipperzero-firmware-community/lib/STM32CubeWB/Middlewares/Third_Party/FreeRTOS/Source/include \
-IC:/work/cmake-stm32/projects/flipperzero-firmware-community/lib/STM32CubeWB/Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2 \
-IC:/work/cmake-stm32/projects/flipperzero-firmware-community/lib/STM32CubeWB/Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM4F \
-IC:/work/cmake-stm32/projects/flipperzero-firmware-community/lib/STM32CubeWB/Middlewares/ST/STM32_USB_Device_Library/Core/Inc \
-IC:/work/cmake-stm32/projects/flipperzero-firmware-community/lib/STM32CubeWB/Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Inc \
-IC:/work/cmake-stm32/projects/flipperzero-firmware-community/lib/STM32CubeWB/Drivers/CMSIS/Device/ST/STM32WBxx/Include \
-IC:/work/cmake-stm32/projects/flipperzero-firmware-community/lib/STM32CubeWB/Drivers/CMSIS/Include \
-I/Users/aku/STM32Cube/Repository/STM32Cube_FW_WB_V1.9.0/Drivers/STM32WBxx_HAL_Driver/Inc \
-I/Users/aku/STM32Cube/Repository/STM32Cube_FW_WB_V1.9.0/Drivers/STM32WBxx_HAL_Driver/Inc/Legacy \
-I/Users/aku/STM32Cube/Repository/STM32Cube_FW_WB_V1.9.0/Middlewares/Third_Party/FreeRTOS/Source/include \
-I/Users/aku/STM32Cube/Repository/STM32Cube_FW_WB_V1.9.0/Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2 \
-I/Users/aku/STM32Cube/Repository/STM32Cube_FW_WB_V1.9.0/Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM4F \
-I/Users/aku/STM32Cube/Repository/STM32Cube_FW_WB_V1.9.0/Middlewares/ST/STM32_USB_Device_Library/Core/Inc \
-I/Users/aku/STM32Cube/Repository/STM32Cube_FW_WB_V1.9.0/Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Inc \
-I/Users/aku/STM32Cube/Repository/STM32Cube_FW_WB_V1.9.0/Drivers/CMSIS/Device/ST/STM32WBxx/Include \
-I/Users/aku/STM32Cube/Repository/STM32Cube_FW_WB_V1.9.0/Drivers/CMSIS/Include \
-IC:/Users/whoju/STM32Cube/Repository/STM32Cube_FW_WB_V1.9.0/Drivers/STM32WBxx_HAL_Driver/Inc \
-IC:/Users/whoju/STM32Cube/Repository/STM32Cube_FW_WB_V1.9.0/Drivers/STM32WBxx_HAL_Driver/Inc/Legacy \
-IC:/Users/whoju/STM32Cube/Repository/STM32Cube_FW_WB_V1.9.0/Middlewares/Third_Party/FreeRTOS/Source/include \
-IC:/Users/whoju/STM32Cube/Repository/STM32Cube_FW_WB_V1.9.0/Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2 \
-IC:/Users/whoju/STM32Cube/Repository/STM32Cube_FW_WB_V1.9.0/Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM4F \
-IC:/Users/whoju/STM32Cube/Repository/STM32Cube_FW_WB_V1.9.0/Middlewares/ST/STM32_USB_Device_Library/Core/Inc \
-IC:/Users/whoju/STM32Cube/Repository/STM32Cube_FW_WB_V1.9.0/Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Inc \
-IC:/Users/whoju/STM32Cube/Repository/STM32Cube_FW_WB_V1.9.0/Drivers/CMSIS/Device/ST/STM32WBxx/Include \
-IC:/Users/whoju/STM32Cube/Repository/STM32Cube_FW_WB_V1.9.0/Drivers/CMSIS/Include
# compile gcc flags
ASFLAGS = $(MCU) $(AS_DEFS) $(AS_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections
CFLAGS = $(MCU) $(C_DEFS) $(C_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections
ifeq ($(DEBUG), 1)
CFLAGS += -g -gdwarf-2
endif
# Generate dependency information
CFLAGS += -MMD -MP -MF"$(@:%.o=%.d)"
#######################################
# LDFLAGS
#######################################
# link script
LDSCRIPT = stm32wb55xx_flash_cm4.ld
# libraries
LIBS = -lc -lm -lnosys
LIBDIR =
LDFLAGS = $(MCU) -specs=nano.specs -T$(LDSCRIPT) $(LIBDIR) $(LIBS) -Wl,-Map=$(BUILD_DIR)/$(TARGET).map,--cref -Wl,--gc-sections
# default action: build all
all: $(BUILD_DIR)/$(TARGET).elf $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET).bin
#######################################
# build the application
#######################################
# list of objects
OBJECTS = $(addprefix $(BUILD_DIR)/,$(notdir $(C_SOURCES:.c=.o)))
vpath %.c $(sort $(dir $(C_SOURCES)))
# list of ASM program objects
OBJECTS += $(addprefix $(BUILD_DIR)/,$(notdir $(ASM_SOURCES:.s=.o)))
vpath %.s $(sort $(dir $(ASM_SOURCES)))
$(BUILD_DIR)/%.o: %.c Makefile | $(BUILD_DIR)
$(CC) -c $(CFLAGS) -Wa,-a,-ad,-alms=$(BUILD_DIR)/$(notdir $(<:.c=.lst)) $< -o $@
$(BUILD_DIR)/%.o: %.s Makefile | $(BUILD_DIR)
$(AS) -c $(CFLAGS) $< -o $@
$(BUILD_DIR)/$(TARGET).elf: $(OBJECTS) Makefile
$(CC) $(OBJECTS) $(LDFLAGS) -o $@
$(SZ) $@
$(BUILD_DIR)/%.hex: $(BUILD_DIR)/%.elf | $(BUILD_DIR)
$(HEX) $< $@
$(BUILD_DIR)/%.bin: $(BUILD_DIR)/%.elf | $(BUILD_DIR)
$(BIN) $< $@
$(BUILD_DIR):
mkdir $@
#######################################
# clean up
#######################################
clean:
-rm -fR $(BUILD_DIR)
#######################################
# dependencies
#######################################
-include $(wildcard $(BUILD_DIR)/*.d)
# *** EOF ***

View File

@ -110,8 +110,8 @@ void MX_GPIO_Init(void)
/*Configure GPIO pin : PtPin */ /*Configure GPIO pin : PtPin */
GPIO_InitStruct.Pin = CC1101_G0_Pin; GPIO_InitStruct.Pin = CC1101_G0_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_INPUT; GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING_FALLING;
GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Pull = GPIO_PULLDOWN;
HAL_GPIO_Init(CC1101_G0_GPIO_Port, &GPIO_InitStruct); HAL_GPIO_Init(CC1101_G0_GPIO_Port, &GPIO_InitStruct);
/*Configure GPIO pins : PBPin PBPin */ /*Configure GPIO pins : PBPin PBPin */

View File

@ -311,6 +311,16 @@ void HSEM_IRQHandler(void)
} }
/* USER CODE BEGIN 1 */ /* USER CODE BEGIN 1 */
void EXTI4_IRQHandler(void)
{
/* USER CODE BEGIN EXTI4_IRQn 0 */
/* USER CODE END EXTI4_IRQn 0 */
HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_4);
/* USER CODE BEGIN EXTI4_IRQn 1 */
/* USER CODE END EXTI4_IRQn 1 */
}
/* USER CODE END 1 */ /* USER CODE END 1 */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View File

@ -36,4 +36,9 @@ bool hal_gpio_read_sd_detect(void) {
delay(50); delay(50);
return result; return result;
} }
void enable_cc1101_irq() {
HAL_NVIC_SetPriority(EXTI4_IRQn, 5, 0);
HAL_NVIC_EnableIRQ(EXTI4_IRQn);
}

View File

@ -64,4 +64,6 @@ static inline bool hal_gpio_read(const GpioPin* gpio) {
} }
} }
bool hal_gpio_read_sd_detect(void); bool hal_gpio_read_sd_detect(void);
void enable_cc1101_irq();

View File

@ -28,3 +28,4 @@ const GpioPin backlight_gpio = {DISPLAY_BACKLIGHT_GPIO_Port, DISPLAY_BACKLIGHT_P
const GpioPin sd_cs_gpio = {SD_CS_GPIO_Port, SD_CS_Pin}; const GpioPin sd_cs_gpio = {SD_CS_GPIO_Port, SD_CS_Pin};
const GpioPin vibro_gpio = {VIBRO_GPIO_Port, VIBRO_Pin}; const GpioPin vibro_gpio = {VIBRO_GPIO_Port, VIBRO_Pin};
const GpioPin ibutton_gpio = {iBTN_GPIO_Port, iBTN_Pin}; const GpioPin ibutton_gpio = {iBTN_GPIO_Port, iBTN_Pin};
const GpioPin cc1101_g0_gpio = {CC1101_G0_GPIO_Port, CC1101_G0_Pin};

View File

@ -13,3 +13,4 @@ extern const GpioPin backlight_gpio;
extern const GpioPin sd_cs_gpio; extern const GpioPin sd_cs_gpio;
extern const GpioPin vibro_gpio; extern const GpioPin vibro_gpio;
extern const GpioPin ibutton_gpio; extern const GpioPin ibutton_gpio;
extern const GpioPin cc1101_g0_gpio;

File diff suppressed because it is too large Load Diff

View File

@ -49,3 +49,7 @@ bool hal_gpio_read(const GpioPin* gpio) {
// TODO emulate pin state? // TODO emulate pin state?
return false; return false;
} }
void enable_cc1101_irq() {
printf("enable cc1101 irq\n");
}

View File

@ -50,4 +50,6 @@ void hal_gpio_init(
void hal_gpio_write(const GpioPin* gpio, const bool state); void hal_gpio_write(const GpioPin* gpio, const bool state);
// read value from GPIO, false = LOW, true = HIGH // read value from GPIO, false = LOW, true = HIGH
bool hal_gpio_read(const GpioPin* gpio); bool hal_gpio_read(const GpioPin* gpio);
void enable_cc1101_irq();