2021-08-08 18:03:25 +00:00
# include "furi-hal-subghz.h"
2021-05-18 09:23:14 +00:00
2021-08-08 18:03:25 +00:00
# include <furi-hal-gpio.h>
# include <furi-hal-spi.h>
# include <furi-hal-interrupt.h>
# include <furi-hal-resources.h>
2021-06-29 21:19:20 +00:00
2021-05-18 09:23:14 +00:00
# include <furi.h>
# include <cc1101.h>
# include <stdio.h>
2021-08-08 18:03:25 +00:00
static volatile SubGhzState furi_hal_subghz_state = SubGhzStateInit ;
2021-07-15 13:54:11 +00:00
Skorp subghz signal archive (#667)
* SubGhz: Add millis() furi, add subghz history struct
* SubGhz: Fix subghz history
* Gubghz: Fix code repeat history, add clean history
* SubGhz: reading and adding keys to history
* Gui: Renaming Sub 1-Ghz -> SubGhz
* Archive: Renaming Sub 1-Ghz -> SubGhz
* SubGhz: Add menu history, modified button for sending a signal, changed output of data about accepted protocol
* Archive: Fix name subghz
* SubGhz: Menu navigation
* Assets: Add assets/SubGHz/icon.png
* Assets: add new icons for subghz
* SubGhz: Fix name Add manually scene
* SubGhz: Fix load icon Read scene. rename encoder struct, rename protocol function load from file, add load raw data protocol, add info pleasant signals all protocol
* SubGhz: fix memory leak
* SubGhz: change of receiving frequency for read scene
* SubGhz: Add save/load frequency and preset, add automatic configuration of transmit/receive to the desired frequency and modulation, add button "save" config scene
* SubGhz: Fix frequency and preset, fix frequency add manualli scene, fix re-executing the parser
* Furi-hal-subghz: add 2-FSK config, fix ook config 650KHz BW Tx filter
* Fix formatting and release build
* SubGhz: Delete read scene
* SubGhz: Fix frequency add manualli scene, refactoring code
* SubGhz: 2 profiles for OOK, fix broken build.
* SubGhz: Add passing static codes from read scene, add notification read scene, refactoring code
* SubGhz: fix assert on worker double stop.
Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
2021-08-28 13:51:48 +00:00
static const uint8_t furi_hal_subghz_preset_ook_270khz_async_regs [ ] [ 2 ] = {
2021-07-18 18:09:00 +00:00
// https://e2e.ti.com/support/wireless-connectivity/sub-1-ghz-group/sub-1-ghz/f/sub-1-ghz-forum/382066/cc1101---don-t-know-the-correct-registers-configuration
/* GPIO GD0 */
2021-05-18 09:23:14 +00:00
{ CC1101_IOCFG0 , 0x0D } , // GD0 as async serial data output/input
2021-06-29 21:19:20 +00:00
2021-07-18 18:09:00 +00:00
/* FIFO and internals */
Skorp subghz signal archive (#667)
* SubGhz: Add millis() furi, add subghz history struct
* SubGhz: Fix subghz history
* Gubghz: Fix code repeat history, add clean history
* SubGhz: reading and adding keys to history
* Gui: Renaming Sub 1-Ghz -> SubGhz
* Archive: Renaming Sub 1-Ghz -> SubGhz
* SubGhz: Add menu history, modified button for sending a signal, changed output of data about accepted protocol
* Archive: Fix name subghz
* SubGhz: Menu navigation
* Assets: Add assets/SubGHz/icon.png
* Assets: add new icons for subghz
* SubGhz: Fix name Add manually scene
* SubGhz: Fix load icon Read scene. rename encoder struct, rename protocol function load from file, add load raw data protocol, add info pleasant signals all protocol
* SubGhz: fix memory leak
* SubGhz: change of receiving frequency for read scene
* SubGhz: Add save/load frequency and preset, add automatic configuration of transmit/receive to the desired frequency and modulation, add button "save" config scene
* SubGhz: Fix frequency and preset, fix frequency add manualli scene, fix re-executing the parser
* Furi-hal-subghz: add 2-FSK config, fix ook config 650KHz BW Tx filter
* Fix formatting and release build
* SubGhz: Delete read scene
* SubGhz: Fix frequency add manualli scene, refactoring code
* SubGhz: 2 profiles for OOK, fix broken build.
* SubGhz: Add passing static codes from read scene, add notification read scene, refactoring code
* SubGhz: fix assert on worker double stop.
Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
2021-08-28 13:51:48 +00:00
{ CC1101_FIFOTHR , 0x47 } , // The only important bit is ADC_RETENTION, FIFO Tx=33 Rx=32
2021-06-29 21:19:20 +00:00
2021-07-18 18:09:00 +00:00
/* Packet engine */
{ CC1101_PKTCTRL0 , 0x32 } , // Async, continious, no whitening
2021-05-18 09:23:14 +00:00
2021-07-18 18:09:00 +00:00
/* Frequency Synthesizer Control */
{ CC1101_FSCTRL1 , 0x06 } , // IF = (26*10^6) / (2^10) * 0x06 = 152343.75Hz
// Modem Configuration
{ CC1101_MDMCFG0 , 0x00 } , // Channel spacing is 25kHz
{ CC1101_MDMCFG1 , 0x00 } , // Channel spacing is 25kHz
{ CC1101_MDMCFG2 , 0x30 } , // Format ASK/OOK, No preamble/sync
{ CC1101_MDMCFG3 , 0x32 } , // Data rate is 3.79372 kBaud
{ CC1101_MDMCFG4 , 0x67 } , // Rx BW filter is 270.833333kHz
/* Main Radio Control State Machine */
{ CC1101_MCSM0 , 0x18 } , // Autocalibrate on idle-to-rx/tx, PO_TIMEOUT is 64 cycles(149-155us)
2021-05-18 09:23:14 +00:00
2021-07-18 18:09:00 +00:00
/* Frequency Offset Compensation Configuration */
{ CC1101_FOCCFG , 0x18 } , // no frequency offset compensation, POST_K same as PRE_K, PRE_K is 4K, GATE is off
/* Automatic Gain Control */
[FL-1610] SubGhz: scene based application, PT save and replay (#630)
* SubGhz: scene based application
* SubGhz: encoder/decoder separation, DMA streaming, update app and cli.
* SubGhz: 2 stage async tx complete, minor cleanup
* SubGhz: 2 stage async tx complete, FIX state pin end transmit
* SubGhz: Pricenton, receive TE signal
* SubGhz: Pricenton, add save data, add load data
* SubGhz: Add Read scene, Fix pricenton save, load funtion
* SubGhz: Add Read, Receiver, SaveName scene
* SubGhz: Read and Save (pricenton)
* SubGhz: add Load scence
* SubGhz: Fix select file scene, add load scene, add transmitter view, add send tx pricenton
* SubGhz: Fix pricenton encoder, fix transmitter send
* SubGhz: modified Pricenton Encoder (added guard time at the beginning), modified CC1101 config, code refactoring
* SubGhz: Fix pricenton encoder defalut TE
* Archive: Fix path and name SubGhz
* Archive: Fix name app SubGhz
* GubGhz: Came: add Save, Load key
* GubGhz: GateTX: add Save, Load key
* GubGhz: NeroSketch: add Save, Load key
* Github: better linters triggers
* SubGhz: adding fast loading keys Archive -> Run in app
* GubGhz: KeeLog: add Save, Load key, key generation from the serial number of the meter and the button
* SubGhz: format sources and fix compilation
* FuriHal: add subghz configuration description for AGC section
* SubGhz: save only protocols that can be saved. Cleanup.
* Github: lint on pull requests
Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
2021-08-12 14:42:56 +00:00
{ CC1101_AGCTRL0 , 0x40 } , // 01 - Low hysteresis, small asymmetric dead zone, medium gain; 00 - 8 samples agc; 00 - Normal AGC, 00 - 4dB boundary
{ CC1101_AGCTRL1 , 0x00 } , // 0; 0 - LNA 2 gain is decreased to minimum before decreasing LNA gain; 00 - Relative carrier sense threshold disabled; 0000 - RSSI to MAIN_TARGET
{ CC1101_AGCTRL2 , 0x03 } , // 00 - DVGA all; 000 - MAX LNA+LNA2; 011 - MAIN_TARGET 24 dB
2021-07-18 18:09:00 +00:00
/* Wake on radio and timeouts control */
{ CC1101_WORCTRL , 0xFB } , // WOR_RES is 2^15 periods (0.91 - 0.94 s) 16.5 - 17.2 hours
/* Frontend configuration */
{ CC1101_FREND0 , 0x11 } , // Adjusts current TX LO buffer + high is PATABLE[1]
{ CC1101_FREND1 , 0xB6 } , //
/* Frequency Synthesizer Calibration, valid for 433.92 */
{ CC1101_FSCAL3 , 0xE9 } ,
{ CC1101_FSCAL2 , 0x2A } ,
{ CC1101_FSCAL1 , 0x00 } ,
{ CC1101_FSCAL0 , 0x1F } ,
/* Magic f4ckery */
{ CC1101_TEST2 , 0x81 } , // FIFOTHR ADC_RETENTION=1 matched value
{ CC1101_TEST1 , 0x35 } , // FIFOTHR ADC_RETENTION=1 matched value
{ CC1101_TEST0 , 0x09 } , // VCO selection calibration stage is disabled
2021-06-29 21:19:20 +00:00
/* End */
{ 0 , 0 } ,
} ;
Skorp subghz signal archive (#667)
* SubGhz: Add millis() furi, add subghz history struct
* SubGhz: Fix subghz history
* Gubghz: Fix code repeat history, add clean history
* SubGhz: reading and adding keys to history
* Gui: Renaming Sub 1-Ghz -> SubGhz
* Archive: Renaming Sub 1-Ghz -> SubGhz
* SubGhz: Add menu history, modified button for sending a signal, changed output of data about accepted protocol
* Archive: Fix name subghz
* SubGhz: Menu navigation
* Assets: Add assets/SubGHz/icon.png
* Assets: add new icons for subghz
* SubGhz: Fix name Add manually scene
* SubGhz: Fix load icon Read scene. rename encoder struct, rename protocol function load from file, add load raw data protocol, add info pleasant signals all protocol
* SubGhz: fix memory leak
* SubGhz: change of receiving frequency for read scene
* SubGhz: Add save/load frequency and preset, add automatic configuration of transmit/receive to the desired frequency and modulation, add button "save" config scene
* SubGhz: Fix frequency and preset, fix frequency add manualli scene, fix re-executing the parser
* Furi-hal-subghz: add 2-FSK config, fix ook config 650KHz BW Tx filter
* Fix formatting and release build
* SubGhz: Delete read scene
* SubGhz: Fix frequency add manualli scene, refactoring code
* SubGhz: 2 profiles for OOK, fix broken build.
* SubGhz: Add passing static codes from read scene, add notification read scene, refactoring code
* SubGhz: fix assert on worker double stop.
Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
2021-08-28 13:51:48 +00:00
static const uint8_t furi_hal_subghz_preset_ook_650khz_async_regs [ ] [ 2 ] = {
// https://e2e.ti.com/support/wireless-connectivity/sub-1-ghz-group/sub-1-ghz/f/sub-1-ghz-forum/382066/cc1101---don-t-know-the-correct-registers-configuration
/* GPIO GD0 */
{ CC1101_IOCFG0 , 0x0D } , // GD0 as async serial data output/input
/* FIFO and internals */
{ CC1101_FIFOTHR , 0x07 } , // The only important bit is ADC_RETENTION
/* Packet engine */
{ CC1101_PKTCTRL0 , 0x32 } , // Async, continious, no whitening
/* Frequency Synthesizer Control */
{ CC1101_FSCTRL1 , 0x06 } , // IF = (26*10^6) / (2^10) * 0x06 = 152343.75Hz
// Modem Configuration
{ CC1101_MDMCFG0 , 0x00 } , // Channel spacing is 25kHz
{ CC1101_MDMCFG1 , 0x00 } , // Channel spacing is 25kHz
{ CC1101_MDMCFG2 , 0x30 } , // Format ASK/OOK, No preamble/sync
{ CC1101_MDMCFG3 , 0x32 } , // Data rate is 3.79372 kBaud
{ CC1101_MDMCFG4 , 0x17 } , // Rx BW filter is 650.000kHz
/* Main Radio Control State Machine */
{ CC1101_MCSM0 , 0x18 } , // Autocalibrate on idle-to-rx/tx, PO_TIMEOUT is 64 cycles(149-155us)
/* Frequency Offset Compensation Configuration */
{ CC1101_FOCCFG , 0x18 } , // no frequency offset compensation, POST_K same as PRE_K, PRE_K is 4K, GATE is off
/* Automatic Gain Control */
{ CC1101_AGCTRL0 , 0x40 } , // 01 - Low hysteresis, small asymmetric dead zone, medium gain; 00 - 8 samples agc; 00 - Normal AGC, 00 - 4dB boundary
{ CC1101_AGCTRL1 , 0x00 } , // 0; 0 - LNA 2 gain is decreased to minimum before decreasing LNA gain; 00 - Relative carrier sense threshold disabled; 0000 - RSSI to MAIN_TARGET
{ CC1101_AGCTRL2 , 0x03 } , // 00 - DVGA all; 000 - MAX LNA+LNA2; 011 - MAIN_TARGET 24 dB
/* Wake on radio and timeouts control */
{ CC1101_WORCTRL , 0xFB } , // WOR_RES is 2^15 periods (0.91 - 0.94 s) 16.5 - 17.2 hours
/* Frontend configuration */
{ CC1101_FREND0 , 0x11 } , // Adjusts current TX LO buffer + high is PATABLE[1]
{ CC1101_FREND1 , 0xB6 } , //
/* Frequency Synthesizer Calibration, valid for 433.92 */
{ CC1101_FSCAL3 , 0xE9 } ,
{ CC1101_FSCAL2 , 0x2A } ,
{ CC1101_FSCAL1 , 0x00 } ,
{ CC1101_FSCAL0 , 0x1F } ,
/* Magic f4ckery */
{ CC1101_TEST2 , 0x88 } ,
{ CC1101_TEST1 , 0x31 } ,
{ CC1101_TEST0 , 0x09 } , // VCO selection calibration stage is disabled
/* End */
{ 0 , 0 } ,
} ;
static const uint8_t furi_hal_subghz_preset_2fsk_async_regs [ ] [ 2 ] = {
// https://e2e.ti.com/support/wireless-connectivity/sub-1-ghz-group/sub-1-ghz/f/sub-1-ghz-forum/382066/cc1101---don-t-know-the-correct-registers-configuration
/* GPIO GD0 */
{ CC1101_IOCFG0 , 0x0D } , // GD0 as async serial data output/input
/* FIFO and internals */
{ CC1101_FIFOTHR , 0x47 } , // The only important bit is ADC_RETENTION
/* Packet engine */
{ CC1101_PKTCTRL0 , 0x32 } , // Async, continious, no whitening
/* Frequency Synthesizer Control */
{ CC1101_FSCTRL1 , 0x06 } , // IF = (26*10^6) / (2^10) * 0x06 = 152343.75Hz
// Modem Configuration
{ CC1101_MDMCFG0 , 0xF8 } ,
{ CC1101_MDMCFG1 , 0x00 } , // No preamble/sync
{ CC1101_MDMCFG2 , 0x80 } , // Format 2-FSK/FM, No preamble/sync, Disable (current optimized)
{ CC1101_MDMCFG3 , 0x83 } , // Data rate is 9.59587 kBaud
{ CC1101_MDMCFG4 , 0x88 } , // Rx BW filter is 203.125000kHz
{ CC1101_DEVIATN , 0x14 } , //Deviation 4.760742 khz
/* Main Radio Control State Machine */
{ CC1101_MCSM0 , 0x18 } , // Autocalibrate on idle-to-rx/tx, PO_TIMEOUT is 64 cycles(149-155us)
/* Frequency Offset Compensation Configuration */
{ CC1101_FOCCFG , 0x18 } , // no frequency offset compensation, POST_K same as PRE_K, PRE_K is 4K, GATE is off
/* Automatic Gain Control */
{ CC1101_AGCTRL0 , 0x40 } , // 01 - Low hysteresis, small asymmetric dead zone, medium gain; 00 - 8 samples agc; 00 - Normal AGC, 00 - 4dB boundary
{ CC1101_AGCTRL1 , 0x00 } , // 0; 0 - LNA 2 gain is decreased to minimum before decreasing LNA gain; 00 - Relative carrier sense threshold disabled; 0000 - RSSI to MAIN_TARGET
{ CC1101_AGCTRL2 , 0x03 } , // 00 - DVGA all; 000 - MAX LNA+LNA2; 011 - MAIN_TARGET 24 dB
/* Wake on radio and timeouts control */
{ CC1101_WORCTRL , 0xFB } , // WOR_RES is 2^15 periods (0.91 - 0.94 s) 16.5 - 17.2 hours
/* Frontend configuration */
{ CC1101_FREND0 , 0x10 } , // Adjusts current TX LO buffer
{ CC1101_FREND1 , 0xB6 } , //
/* Frequency Synthesizer Calibration, valid for 433.92 */
{ CC1101_FSCAL3 , 0xE9 } ,
{ CC1101_FSCAL2 , 0x2A } ,
{ CC1101_FSCAL1 , 0x00 } ,
{ CC1101_FSCAL0 , 0x1F } ,
/* Magic f4ckery */
{ CC1101_TEST2 , 0x81 } , // FIFOTHR ADC_RETENTION=1 matched value
{ CC1101_TEST1 , 0x35 } , // FIFOTHR ADC_RETENTION=1 matched value
{ CC1101_TEST0 , 0x09 } , // VCO selection calibration stage is disabled
/* End */
{ 0 , 0 } ,
} ;
2021-08-08 18:03:25 +00:00
static const uint8_t furi_hal_subghz_preset_ook_async_patable [ 8 ] = {
2021-07-16 15:51:47 +00:00
0x00 ,
0xC0 , // 10dBm 0xC0, 7dBm 0xC8, 5dBm 0x84, 0dBm 0x60, -10dBm 0x34, -15dBm 0x1D, -20dBm 0x0E, -30dBm 0x12
0x00 ,
0x00 ,
0x00 ,
0x00 ,
0x00 ,
0x00
2021-06-29 21:19:20 +00:00
} ;
Skorp subghz signal archive (#667)
* SubGhz: Add millis() furi, add subghz history struct
* SubGhz: Fix subghz history
* Gubghz: Fix code repeat history, add clean history
* SubGhz: reading and adding keys to history
* Gui: Renaming Sub 1-Ghz -> SubGhz
* Archive: Renaming Sub 1-Ghz -> SubGhz
* SubGhz: Add menu history, modified button for sending a signal, changed output of data about accepted protocol
* Archive: Fix name subghz
* SubGhz: Menu navigation
* Assets: Add assets/SubGHz/icon.png
* Assets: add new icons for subghz
* SubGhz: Fix name Add manually scene
* SubGhz: Fix load icon Read scene. rename encoder struct, rename protocol function load from file, add load raw data protocol, add info pleasant signals all protocol
* SubGhz: fix memory leak
* SubGhz: change of receiving frequency for read scene
* SubGhz: Add save/load frequency and preset, add automatic configuration of transmit/receive to the desired frequency and modulation, add button "save" config scene
* SubGhz: Fix frequency and preset, fix frequency add manualli scene, fix re-executing the parser
* Furi-hal-subghz: add 2-FSK config, fix ook config 650KHz BW Tx filter
* Fix formatting and release build
* SubGhz: Delete read scene
* SubGhz: Fix frequency add manualli scene, refactoring code
* SubGhz: 2 profiles for OOK, fix broken build.
* SubGhz: Add passing static codes from read scene, add notification read scene, refactoring code
* SubGhz: fix assert on worker double stop.
Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
2021-08-28 13:51:48 +00:00
static const uint8_t furi_hal_subghz_preset_2fsk_async_patable [ 8 ] = {
0xC0 , // 10dBm 0xC0, 7dBm 0xC8, 5dBm 0x84, 0dBm 0x60, -10dBm 0x34, -15dBm 0x1D, -20dBm 0x0E, -30dBm 0x12
0x00 ,
0x00 ,
0x00 ,
0x00 ,
0x00 ,
0x00 ,
0x00
} ;
2021-06-29 21:19:20 +00:00
2021-08-08 18:03:25 +00:00
void furi_hal_subghz_init ( ) {
furi_assert ( furi_hal_subghz_state = = SubGhzStateInit ) ;
furi_hal_subghz_state = SubGhzStateIdle ;
2021-07-15 13:54:11 +00:00
2021-08-08 18:03:25 +00:00
const FuriHalSpiDevice * device = furi_hal_spi_device_get ( FuriHalSpiDeviceIdSubGhz ) ;
2021-07-15 13:54:11 +00:00
2021-08-08 18:03:25 +00:00
# ifdef FURI_HAL_SUBGHZ_TX_GPIO
hal_gpio_init ( & FURI_HAL_SUBGHZ_TX_GPIO , GpioModeOutputPushPull , GpioPullNo , GpioSpeedLow ) ;
2021-07-15 13:54:11 +00:00
# endif
// Reset
hal_gpio_init ( & gpio_cc1101_g0 , GpioModeAnalog , GpioPullNo , GpioSpeedLow ) ;
2021-05-18 09:23:14 +00:00
cc1101_reset ( device ) ;
2021-07-15 13:54:11 +00:00
cc1101_write_reg ( device , CC1101_IOCFG0 , CC1101IocfgHighImpedance ) ;
2021-06-29 21:19:20 +00:00
2021-05-18 09:23:14 +00:00
// Prepare GD0 for power on self test
hal_gpio_init ( & gpio_cc1101_g0 , GpioModeInput , GpioPullNo , GpioSpeedLow ) ;
2021-06-29 21:19:20 +00:00
2021-05-18 09:23:14 +00:00
// GD0 low
cc1101_write_reg ( device , CC1101_IOCFG0 , CC1101IocfgHW ) ;
while ( hal_gpio_read ( & gpio_cc1101_g0 ) ! = false ) ;
2021-06-29 21:19:20 +00:00
2021-05-18 09:23:14 +00:00
// GD0 high
cc1101_write_reg ( device , CC1101_IOCFG0 , CC1101IocfgHW | CC1101_IOCFG_INV ) ;
while ( hal_gpio_read ( & gpio_cc1101_g0 ) ! = true ) ;
2021-06-29 21:19:20 +00:00
2021-05-18 09:23:14 +00:00
// Reset GD0 to floating state
cc1101_write_reg ( device , CC1101_IOCFG0 , CC1101IocfgHighImpedance ) ;
hal_gpio_init ( & gpio_cc1101_g0 , GpioModeAnalog , GpioPullNo , GpioSpeedLow ) ;
2021-06-29 21:19:20 +00:00
2021-05-18 09:23:14 +00:00
// RF switches
hal_gpio_init ( & gpio_rf_sw_0 , GpioModeOutputPushPull , GpioPullNo , GpioSpeedLow ) ;
cc1101_write_reg ( device , CC1101_IOCFG2 , CC1101IocfgHW ) ;
2021-06-29 21:19:20 +00:00
2021-07-15 13:54:11 +00:00
// Go to sleep
2021-05-18 09:23:14 +00:00
cc1101_shutdown ( device ) ;
2021-07-15 13:54:11 +00:00
2021-08-08 18:03:25 +00:00
furi_hal_spi_device_return ( device ) ;
2021-07-28 08:45:42 +00:00
FURI_LOG_I ( " FuriHalSubGhz " , " Init OK " ) ;
2021-07-15 13:54:11 +00:00
}
2021-08-08 18:03:25 +00:00
void furi_hal_subghz_sleep ( ) {
furi_assert ( furi_hal_subghz_state = = SubGhzStateIdle ) ;
const FuriHalSpiDevice * device = furi_hal_spi_device_get ( FuriHalSpiDeviceIdSubGhz ) ;
2021-07-15 13:54:11 +00:00
cc1101_switch_to_idle ( device ) ;
cc1101_write_reg ( device , CC1101_IOCFG0 , CC1101IocfgHighImpedance ) ;
hal_gpio_init ( & gpio_cc1101_g0 , GpioModeAnalog , GpioPullNo , GpioSpeedLow ) ;
cc1101_shutdown ( device ) ;
2021-08-08 18:03:25 +00:00
furi_hal_spi_device_return ( device ) ;
2021-05-18 09:23:14 +00:00
}
2021-08-08 18:03:25 +00:00
void furi_hal_subghz_dump_state ( ) {
const FuriHalSpiDevice * device = furi_hal_spi_device_get ( FuriHalSpiDeviceIdSubGhz ) ;
2021-05-18 09:23:14 +00:00
printf (
2021-08-08 18:03:25 +00:00
" [furi_hal_subghz] cc1101 chip %d, version %d \r \n " ,
2021-05-18 09:23:14 +00:00
cc1101_get_partnumber ( device ) ,
cc1101_get_version ( device )
) ;
2021-08-08 18:03:25 +00:00
furi_hal_spi_device_return ( device ) ;
2021-05-18 09:23:14 +00:00
}
2021-08-08 18:03:25 +00:00
void furi_hal_subghz_load_preset ( FuriHalSubGhzPreset preset ) {
Skorp subghz signal archive (#667)
* SubGhz: Add millis() furi, add subghz history struct
* SubGhz: Fix subghz history
* Gubghz: Fix code repeat history, add clean history
* SubGhz: reading and adding keys to history
* Gui: Renaming Sub 1-Ghz -> SubGhz
* Archive: Renaming Sub 1-Ghz -> SubGhz
* SubGhz: Add menu history, modified button for sending a signal, changed output of data about accepted protocol
* Archive: Fix name subghz
* SubGhz: Menu navigation
* Assets: Add assets/SubGHz/icon.png
* Assets: add new icons for subghz
* SubGhz: Fix name Add manually scene
* SubGhz: Fix load icon Read scene. rename encoder struct, rename protocol function load from file, add load raw data protocol, add info pleasant signals all protocol
* SubGhz: fix memory leak
* SubGhz: change of receiving frequency for read scene
* SubGhz: Add save/load frequency and preset, add automatic configuration of transmit/receive to the desired frequency and modulation, add button "save" config scene
* SubGhz: Fix frequency and preset, fix frequency add manualli scene, fix re-executing the parser
* Furi-hal-subghz: add 2-FSK config, fix ook config 650KHz BW Tx filter
* Fix formatting and release build
* SubGhz: Delete read scene
* SubGhz: Fix frequency add manualli scene, refactoring code
* SubGhz: 2 profiles for OOK, fix broken build.
* SubGhz: Add passing static codes from read scene, add notification read scene, refactoring code
* SubGhz: fix assert on worker double stop.
Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
2021-08-28 13:51:48 +00:00
if ( preset = = FuriHalSubGhzPresetOok650Async ) {
furi_hal_subghz_load_registers ( furi_hal_subghz_preset_ook_650khz_async_regs ) ;
furi_hal_subghz_load_patable ( furi_hal_subghz_preset_ook_async_patable ) ;
} else if ( preset = = FuriHalSubGhzPresetOok270Async ) {
furi_hal_subghz_load_registers ( furi_hal_subghz_preset_ook_270khz_async_regs ) ;
2021-08-08 18:03:25 +00:00
furi_hal_subghz_load_patable ( furi_hal_subghz_preset_ook_async_patable ) ;
Skorp subghz signal archive (#667)
* SubGhz: Add millis() furi, add subghz history struct
* SubGhz: Fix subghz history
* Gubghz: Fix code repeat history, add clean history
* SubGhz: reading and adding keys to history
* Gui: Renaming Sub 1-Ghz -> SubGhz
* Archive: Renaming Sub 1-Ghz -> SubGhz
* SubGhz: Add menu history, modified button for sending a signal, changed output of data about accepted protocol
* Archive: Fix name subghz
* SubGhz: Menu navigation
* Assets: Add assets/SubGHz/icon.png
* Assets: add new icons for subghz
* SubGhz: Fix name Add manually scene
* SubGhz: Fix load icon Read scene. rename encoder struct, rename protocol function load from file, add load raw data protocol, add info pleasant signals all protocol
* SubGhz: fix memory leak
* SubGhz: change of receiving frequency for read scene
* SubGhz: Add save/load frequency and preset, add automatic configuration of transmit/receive to the desired frequency and modulation, add button "save" config scene
* SubGhz: Fix frequency and preset, fix frequency add manualli scene, fix re-executing the parser
* Furi-hal-subghz: add 2-FSK config, fix ook config 650KHz BW Tx filter
* Fix formatting and release build
* SubGhz: Delete read scene
* SubGhz: Fix frequency add manualli scene, refactoring code
* SubGhz: 2 profiles for OOK, fix broken build.
* SubGhz: Add passing static codes from read scene, add notification read scene, refactoring code
* SubGhz: fix assert on worker double stop.
Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
2021-08-28 13:51:48 +00:00
} else if ( preset = = FuriHalSubGhzPreset2FSKAsync ) {
furi_hal_subghz_load_registers ( furi_hal_subghz_preset_2fsk_async_regs ) ;
furi_hal_subghz_load_patable ( furi_hal_subghz_preset_2fsk_async_patable ) ;
} else {
2021-07-18 18:09:00 +00:00
furi_check ( 0 ) ;
2021-05-18 09:23:14 +00:00
}
}
2021-08-08 18:03:25 +00:00
uint8_t furi_hal_subghz_get_status ( ) {
const FuriHalSpiDevice * device = furi_hal_spi_device_get ( FuriHalSpiDeviceIdSubGhz ) ;
2021-06-08 09:51:16 +00:00
CC1101StatusRaw st ;
st . status = cc1101_get_status ( device ) ;
2021-08-08 18:03:25 +00:00
furi_hal_spi_device_return ( device ) ;
2021-06-08 09:51:16 +00:00
return st . status_raw ;
}
2021-08-08 18:03:25 +00:00
void furi_hal_subghz_load_registers ( const uint8_t data [ ] [ 2 ] ) {
const FuriHalSpiDevice * device = furi_hal_spi_device_get ( FuriHalSpiDeviceIdSubGhz ) ;
2021-05-18 09:23:14 +00:00
cc1101_reset ( device ) ;
uint32_t i = 0 ;
while ( data [ i ] [ 0 ] ) {
cc1101_write_reg ( device , data [ i ] [ 0 ] , data [ i ] [ 1 ] ) ;
i + + ;
}
2021-08-08 18:03:25 +00:00
furi_hal_spi_device_return ( device ) ;
2021-05-18 09:23:14 +00:00
}
2021-08-08 18:03:25 +00:00
void furi_hal_subghz_load_patable ( const uint8_t data [ 8 ] ) {
const FuriHalSpiDevice * device = furi_hal_spi_device_get ( FuriHalSpiDeviceIdSubGhz ) ;
2021-05-18 09:23:14 +00:00
cc1101_set_pa_table ( device , data ) ;
2021-08-08 18:03:25 +00:00
furi_hal_spi_device_return ( device ) ;
2021-05-18 09:23:14 +00:00
}
2021-08-08 18:03:25 +00:00
void furi_hal_subghz_write_packet ( const uint8_t * data , uint8_t size ) {
const FuriHalSpiDevice * device = furi_hal_spi_device_get ( FuriHalSpiDeviceIdSubGhz ) ;
2021-05-18 09:23:14 +00:00
cc1101_flush_tx ( device ) ;
cc1101_write_fifo ( device , data , size ) ;
2021-08-08 18:03:25 +00:00
furi_hal_spi_device_return ( device ) ;
2021-05-18 09:23:14 +00:00
}
2021-08-08 18:03:25 +00:00
void furi_hal_subghz_flush_rx ( ) {
const FuriHalSpiDevice * device = furi_hal_spi_device_get ( FuriHalSpiDeviceIdSubGhz ) ;
2021-06-08 09:51:16 +00:00
cc1101_flush_rx ( device ) ;
2021-08-08 18:03:25 +00:00
furi_hal_spi_device_return ( device ) ;
2021-06-08 09:51:16 +00:00
}
2021-05-18 09:23:14 +00:00
2021-08-08 18:03:25 +00:00
void furi_hal_subghz_read_packet ( uint8_t * data , uint8_t * size ) {
const FuriHalSpiDevice * device = furi_hal_spi_device_get ( FuriHalSpiDeviceIdSubGhz ) ;
2021-06-08 09:51:16 +00:00
cc1101_read_fifo ( device , data , size ) ;
2021-08-08 18:03:25 +00:00
furi_hal_spi_device_return ( device ) ;
2021-05-18 09:23:14 +00:00
}
2021-08-08 18:03:25 +00:00
void furi_hal_subghz_shutdown ( ) {
const FuriHalSpiDevice * device = furi_hal_spi_device_get ( FuriHalSpiDeviceIdSubGhz ) ;
2021-05-18 09:23:14 +00:00
// Reset and shutdown
cc1101_shutdown ( device ) ;
2021-08-08 18:03:25 +00:00
furi_hal_spi_device_return ( device ) ;
2021-05-18 09:23:14 +00:00
}
2021-08-08 18:03:25 +00:00
void furi_hal_subghz_reset ( ) {
const FuriHalSpiDevice * device = furi_hal_spi_device_get ( FuriHalSpiDeviceIdSubGhz ) ;
2021-07-15 13:54:11 +00:00
hal_gpio_init ( & gpio_cc1101_g0 , GpioModeAnalog , GpioPullNo , GpioSpeedLow ) ;
cc1101_switch_to_idle ( device ) ;
2021-05-18 09:23:14 +00:00
cc1101_reset ( device ) ;
2021-07-15 13:54:11 +00:00
cc1101_write_reg ( device , CC1101_IOCFG0 , CC1101IocfgHighImpedance ) ;
2021-08-08 18:03:25 +00:00
furi_hal_spi_device_return ( device ) ;
2021-05-18 09:23:14 +00:00
}
2021-08-08 18:03:25 +00:00
void furi_hal_subghz_idle ( ) {
const FuriHalSpiDevice * device = furi_hal_spi_device_get ( FuriHalSpiDeviceIdSubGhz ) ;
2021-05-18 09:23:14 +00:00
cc1101_switch_to_idle ( device ) ;
2021-08-08 18:03:25 +00:00
furi_hal_spi_device_return ( device ) ;
2021-05-18 09:23:14 +00:00
}
2021-08-08 18:03:25 +00:00
void furi_hal_subghz_rx ( ) {
const FuriHalSpiDevice * device = furi_hal_spi_device_get ( FuriHalSpiDeviceIdSubGhz ) ;
2021-05-18 09:23:14 +00:00
cc1101_switch_to_rx ( device ) ;
2021-08-08 18:03:25 +00:00
furi_hal_spi_device_return ( device ) ;
2021-05-18 09:23:14 +00:00
}
2021-08-08 18:03:25 +00:00
void furi_hal_subghz_tx ( ) {
const FuriHalSpiDevice * device = furi_hal_spi_device_get ( FuriHalSpiDeviceIdSubGhz ) ;
2021-05-18 09:23:14 +00:00
cc1101_switch_to_tx ( device ) ;
2021-08-08 18:03:25 +00:00
furi_hal_spi_device_return ( device ) ;
2021-05-18 09:23:14 +00:00
}
2021-08-08 18:03:25 +00:00
float furi_hal_subghz_get_rssi ( ) {
const FuriHalSpiDevice * device = furi_hal_spi_device_get ( FuriHalSpiDeviceIdSubGhz ) ;
2021-05-18 09:23:14 +00:00
int32_t rssi_dec = cc1101_get_rssi ( device ) ;
2021-08-08 18:03:25 +00:00
furi_hal_spi_device_return ( device ) ;
2021-05-18 09:23:14 +00:00
float rssi = rssi_dec ;
if ( rssi_dec > = 128 ) {
rssi = ( ( rssi - 256.0f ) / 2.0f ) - 74.0f ;
} else {
rssi = ( rssi / 2.0f ) - 74.0f ;
}
return rssi ;
}
2021-08-08 18:03:25 +00:00
bool furi_hal_subghz_is_frequency_valid ( uint32_t value ) {
2021-07-27 11:47:45 +00:00
if ( ! ( value > = 299999755 & & value < = 348000335 ) & &
! ( value > = 386999938 & & value < = 464000000 ) & &
! ( value > = 778999847 & & value < = 928000000 ) ) {
return false ;
}
return true ;
}
2021-08-08 18:03:25 +00:00
uint32_t furi_hal_subghz_set_frequency_and_path ( uint32_t value ) {
value = furi_hal_subghz_set_frequency ( value ) ;
2021-07-27 11:47:45 +00:00
if ( value > = 299999755 & & value < = 348000335 ) {
2021-08-08 18:03:25 +00:00
furi_hal_subghz_set_path ( FuriHalSubGhzPath315 ) ;
2021-07-27 11:47:45 +00:00
} else if ( value > = 386999938 & & value < = 464000000 ) {
2021-08-08 18:03:25 +00:00
furi_hal_subghz_set_path ( FuriHalSubGhzPath433 ) ;
2021-07-27 11:47:45 +00:00
} else if ( value > = 778999847 & & value < = 928000000 ) {
2021-08-08 18:03:25 +00:00
furi_hal_subghz_set_path ( FuriHalSubGhzPath868 ) ;
2021-06-29 21:19:20 +00:00
} else {
furi_check ( 0 ) ;
}
return value ;
}
2021-08-08 18:03:25 +00:00
uint32_t furi_hal_subghz_set_frequency ( uint32_t value ) {
const FuriHalSpiDevice * device = furi_hal_spi_device_get ( FuriHalSpiDeviceIdSubGhz ) ;
2021-05-18 09:23:14 +00:00
uint32_t real_frequency = cc1101_set_frequency ( device , value ) ;
cc1101_calibrate ( device ) ;
2021-08-23 23:52:59 +00:00
while ( true ) {
CC1101Status status = cc1101_get_status ( device ) ;
if ( status . STATE = = CC1101StateIDLE ) break ;
}
2021-08-08 18:03:25 +00:00
furi_hal_spi_device_return ( device ) ;
2021-05-18 09:23:14 +00:00
return real_frequency ;
}
2021-08-08 18:03:25 +00:00
void furi_hal_subghz_set_path ( FuriHalSubGhzPath path ) {
const FuriHalSpiDevice * device = furi_hal_spi_device_get ( FuriHalSpiDeviceIdSubGhz ) ;
if ( path = = FuriHalSubGhzPath433 ) {
2021-05-18 09:23:14 +00:00
hal_gpio_write ( & gpio_rf_sw_0 , 0 ) ;
cc1101_write_reg ( device , CC1101_IOCFG2 , CC1101IocfgHW | CC1101_IOCFG_INV ) ;
2021-08-08 18:03:25 +00:00
} else if ( path = = FuriHalSubGhzPath315 ) {
2021-05-18 09:23:14 +00:00
hal_gpio_write ( & gpio_rf_sw_0 , 1 ) ;
cc1101_write_reg ( device , CC1101_IOCFG2 , CC1101IocfgHW ) ;
2021-08-08 18:03:25 +00:00
} else if ( path = = FuriHalSubGhzPath868 ) {
2021-05-18 09:23:14 +00:00
hal_gpio_write ( & gpio_rf_sw_0 , 1 ) ;
cc1101_write_reg ( device , CC1101_IOCFG2 , CC1101IocfgHW | CC1101_IOCFG_INV ) ;
2021-08-08 18:03:25 +00:00
} else if ( path = = FuriHalSubGhzPathIsolate ) {
2021-05-18 09:23:14 +00:00
hal_gpio_write ( & gpio_rf_sw_0 , 0 ) ;
cc1101_write_reg ( device , CC1101_IOCFG2 , CC1101IocfgHW ) ;
} else {
furi_check ( 0 ) ;
}
2021-08-08 18:03:25 +00:00
furi_hal_spi_device_return ( device ) ;
2021-05-18 09:23:14 +00:00
}
2021-06-29 21:19:20 +00:00
2021-08-08 18:03:25 +00:00
volatile uint32_t furi_hal_subghz_capture_delta_duration = 0 ;
volatile FuriHalSubGhzCaptureCallback furi_hal_subghz_capture_callback = NULL ;
volatile void * furi_hal_subghz_capture_callback_context = NULL ;
2021-06-29 21:19:20 +00:00
2021-08-08 18:03:25 +00:00
static void furi_hal_subghz_capture_ISR ( ) {
2021-06-29 21:19:20 +00:00
// Channel 1
if ( LL_TIM_IsActiveFlag_CC1 ( TIM2 ) ) {
LL_TIM_ClearFlag_CC1 ( TIM2 ) ;
2021-08-08 18:03:25 +00:00
furi_hal_subghz_capture_delta_duration = LL_TIM_IC_GetCaptureCH1 ( TIM2 ) ;
if ( furi_hal_subghz_capture_callback ) {
furi_hal_subghz_capture_callback ( true , furi_hal_subghz_capture_delta_duration ,
( void * ) furi_hal_subghz_capture_callback_context
2021-06-29 21:19:20 +00:00
) ;
}
}
// Channel 2
if ( LL_TIM_IsActiveFlag_CC2 ( TIM2 ) ) {
LL_TIM_ClearFlag_CC2 ( TIM2 ) ;
2021-08-08 18:03:25 +00:00
if ( furi_hal_subghz_capture_callback ) {
furi_hal_subghz_capture_callback ( false , LL_TIM_IC_GetCaptureCH2 ( TIM2 ) - furi_hal_subghz_capture_delta_duration ,
( void * ) furi_hal_subghz_capture_callback_context
2021-06-29 21:19:20 +00:00
) ;
}
}
}
2021-07-15 13:54:11 +00:00
[FL-1610] SubGhz: scene based application, PT save and replay (#630)
* SubGhz: scene based application
* SubGhz: encoder/decoder separation, DMA streaming, update app and cli.
* SubGhz: 2 stage async tx complete, minor cleanup
* SubGhz: 2 stage async tx complete, FIX state pin end transmit
* SubGhz: Pricenton, receive TE signal
* SubGhz: Pricenton, add save data, add load data
* SubGhz: Add Read scene, Fix pricenton save, load funtion
* SubGhz: Add Read, Receiver, SaveName scene
* SubGhz: Read and Save (pricenton)
* SubGhz: add Load scence
* SubGhz: Fix select file scene, add load scene, add transmitter view, add send tx pricenton
* SubGhz: Fix pricenton encoder, fix transmitter send
* SubGhz: modified Pricenton Encoder (added guard time at the beginning), modified CC1101 config, code refactoring
* SubGhz: Fix pricenton encoder defalut TE
* Archive: Fix path and name SubGhz
* Archive: Fix name app SubGhz
* GubGhz: Came: add Save, Load key
* GubGhz: GateTX: add Save, Load key
* GubGhz: NeroSketch: add Save, Load key
* Github: better linters triggers
* SubGhz: adding fast loading keys Archive -> Run in app
* GubGhz: KeeLog: add Save, Load key, key generation from the serial number of the meter and the button
* SubGhz: format sources and fix compilation
* FuriHal: add subghz configuration description for AGC section
* SubGhz: save only protocols that can be saved. Cleanup.
* Github: lint on pull requests
Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
2021-08-12 14:42:56 +00:00
void furi_hal_subghz_start_async_rx ( FuriHalSubGhzCaptureCallback callback , void * context ) {
2021-08-08 18:03:25 +00:00
furi_assert ( furi_hal_subghz_state = = SubGhzStateIdle ) ;
furi_hal_subghz_state = SubGhzStateAsyncRx ;
2021-06-29 21:19:20 +00:00
[FL-1610] SubGhz: scene based application, PT save and replay (#630)
* SubGhz: scene based application
* SubGhz: encoder/decoder separation, DMA streaming, update app and cli.
* SubGhz: 2 stage async tx complete, minor cleanup
* SubGhz: 2 stage async tx complete, FIX state pin end transmit
* SubGhz: Pricenton, receive TE signal
* SubGhz: Pricenton, add save data, add load data
* SubGhz: Add Read scene, Fix pricenton save, load funtion
* SubGhz: Add Read, Receiver, SaveName scene
* SubGhz: Read and Save (pricenton)
* SubGhz: add Load scence
* SubGhz: Fix select file scene, add load scene, add transmitter view, add send tx pricenton
* SubGhz: Fix pricenton encoder, fix transmitter send
* SubGhz: modified Pricenton Encoder (added guard time at the beginning), modified CC1101 config, code refactoring
* SubGhz: Fix pricenton encoder defalut TE
* Archive: Fix path and name SubGhz
* Archive: Fix name app SubGhz
* GubGhz: Came: add Save, Load key
* GubGhz: GateTX: add Save, Load key
* GubGhz: NeroSketch: add Save, Load key
* Github: better linters triggers
* SubGhz: adding fast loading keys Archive -> Run in app
* GubGhz: KeeLog: add Save, Load key, key generation from the serial number of the meter and the button
* SubGhz: format sources and fix compilation
* FuriHal: add subghz configuration description for AGC section
* SubGhz: save only protocols that can be saved. Cleanup.
* Github: lint on pull requests
Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
2021-08-12 14:42:56 +00:00
furi_hal_subghz_capture_callback = callback ;
furi_hal_subghz_capture_callback_context = context ;
2021-06-29 21:19:20 +00:00
hal_gpio_init_ex ( & gpio_cc1101_g0 , GpioModeAltFunctionPushPull , GpioPullNo , GpioSpeedLow , GpioAltFn1TIM2 ) ;
// Timer: base
2021-08-02 14:03:12 +00:00
LL_APB1_GRP1_EnableClock ( LL_APB1_GRP1_PERIPH_TIM2 ) ;
2021-06-29 21:19:20 +00:00
LL_TIM_InitTypeDef TIM_InitStruct = { 0 } ;
TIM_InitStruct . Prescaler = 64 - 1 ;
TIM_InitStruct . CounterMode = LL_TIM_COUNTERMODE_UP ;
2021-07-07 19:49:45 +00:00
TIM_InitStruct . Autoreload = 0x7FFFFFFE ;
2021-06-29 21:19:20 +00:00
TIM_InitStruct . ClockDivision = LL_TIM_CLOCKDIVISION_DIV1 ;
LL_TIM_Init ( TIM2 , & TIM_InitStruct ) ;
2021-07-15 13:54:11 +00:00
// Timer: advanced
2021-06-29 21:19:20 +00:00
LL_TIM_SetClockSource ( TIM2 , LL_TIM_CLOCKSOURCE_INTERNAL ) ;
LL_TIM_DisableARRPreload ( TIM2 ) ;
LL_TIM_SetTriggerInput ( TIM2 , LL_TIM_TS_TI2FP2 ) ;
LL_TIM_SetSlaveMode ( TIM2 , LL_TIM_SLAVEMODE_RESET ) ;
LL_TIM_SetTriggerOutput ( TIM2 , LL_TIM_TRGO_RESET ) ;
LL_TIM_EnableMasterSlaveMode ( TIM2 ) ;
2021-07-15 13:54:11 +00:00
LL_TIM_DisableDMAReq_TRIG ( TIM2 ) ;
LL_TIM_DisableIT_TRIG ( TIM2 ) ;
// Timer: channel 1 indirect
2021-06-29 21:19:20 +00:00
LL_TIM_IC_SetActiveInput ( TIM2 , LL_TIM_CHANNEL_CH1 , LL_TIM_ACTIVEINPUT_INDIRECTTI ) ;
LL_TIM_IC_SetPrescaler ( TIM2 , LL_TIM_CHANNEL_CH1 , LL_TIM_ICPSC_DIV1 ) ;
LL_TIM_IC_SetPolarity ( TIM2 , LL_TIM_CHANNEL_CH1 , LL_TIM_IC_POLARITY_FALLING ) ;
2021-07-15 13:54:11 +00:00
LL_TIM_IC_SetFilter ( TIM2 , LL_TIM_CHANNEL_CH1 , LL_TIM_IC_FILTER_FDIV1 ) ;
// Timer: channel 2 direct
2021-06-29 21:19:20 +00:00
LL_TIM_IC_SetActiveInput ( TIM2 , LL_TIM_CHANNEL_CH2 , LL_TIM_ACTIVEINPUT_DIRECTTI ) ;
LL_TIM_IC_SetPrescaler ( TIM2 , LL_TIM_CHANNEL_CH2 , LL_TIM_ICPSC_DIV1 ) ;
2021-07-15 13:54:11 +00:00
LL_TIM_IC_SetPolarity ( TIM2 , LL_TIM_CHANNEL_CH2 , LL_TIM_IC_POLARITY_RISING ) ;
LL_TIM_IC_SetFilter ( TIM2 , LL_TIM_CHANNEL_CH2 , LL_TIM_IC_FILTER_FDIV1 ) ;
2021-06-29 21:19:20 +00:00
// ISR setup
2021-08-08 18:03:25 +00:00
furi_hal_interrupt_set_timer_isr ( TIM2 , furi_hal_subghz_capture_ISR ) ;
2021-06-29 21:19:20 +00:00
NVIC_SetPriority ( TIM2_IRQn , NVIC_EncodePriority ( NVIC_GetPriorityGrouping ( ) , 5 , 0 ) ) ;
NVIC_EnableIRQ ( TIM2_IRQn ) ;
// Interrupts and channels
LL_TIM_EnableIT_CC1 ( TIM2 ) ;
LL_TIM_EnableIT_CC2 ( TIM2 ) ;
LL_TIM_CC_EnableChannel ( TIM2 , LL_TIM_CHANNEL_CH1 ) ;
LL_TIM_CC_EnableChannel ( TIM2 , LL_TIM_CHANNEL_CH2 ) ;
2021-08-02 14:03:12 +00:00
// Enable NVIC
NVIC_SetPriority ( TIM2_IRQn , NVIC_EncodePriority ( NVIC_GetPriorityGrouping ( ) , 5 , 0 ) ) ;
NVIC_EnableIRQ ( TIM2_IRQn ) ;
2021-06-29 21:19:20 +00:00
// Start timer
LL_TIM_SetCounter ( TIM2 , 0 ) ;
LL_TIM_EnableCounter ( TIM2 ) ;
2021-07-15 13:54:11 +00:00
// Switch to RX
2021-08-08 18:03:25 +00:00
furi_hal_subghz_rx ( ) ;
2021-06-29 21:19:20 +00:00
}
2021-08-08 18:03:25 +00:00
void furi_hal_subghz_stop_async_rx ( ) {
furi_assert ( furi_hal_subghz_state = = SubGhzStateAsyncRx ) ;
furi_hal_subghz_state = SubGhzStateIdle ;
2021-07-15 13:54:11 +00:00
// Shutdown radio
2021-08-08 18:03:25 +00:00
furi_hal_subghz_idle ( ) ;
2021-07-15 13:54:11 +00:00
2021-06-29 21:19:20 +00:00
LL_TIM_DeInit ( TIM2 ) ;
2021-08-02 14:03:12 +00:00
LL_APB1_GRP1_DisableClock ( LL_APB1_GRP1_PERIPH_TIM2 ) ;
2021-08-08 18:03:25 +00:00
furi_hal_interrupt_set_timer_isr ( TIM2 , NULL ) ;
2021-07-15 13:54:11 +00:00
hal_gpio_init ( & gpio_cc1101_g0 , GpioModeAnalog , GpioPullNo , GpioSpeedLow ) ;
}
[FL-1610] SubGhz: scene based application, PT save and replay (#630)
* SubGhz: scene based application
* SubGhz: encoder/decoder separation, DMA streaming, update app and cli.
* SubGhz: 2 stage async tx complete, minor cleanup
* SubGhz: 2 stage async tx complete, FIX state pin end transmit
* SubGhz: Pricenton, receive TE signal
* SubGhz: Pricenton, add save data, add load data
* SubGhz: Add Read scene, Fix pricenton save, load funtion
* SubGhz: Add Read, Receiver, SaveName scene
* SubGhz: Read and Save (pricenton)
* SubGhz: add Load scence
* SubGhz: Fix select file scene, add load scene, add transmitter view, add send tx pricenton
* SubGhz: Fix pricenton encoder, fix transmitter send
* SubGhz: modified Pricenton Encoder (added guard time at the beginning), modified CC1101 config, code refactoring
* SubGhz: Fix pricenton encoder defalut TE
* Archive: Fix path and name SubGhz
* Archive: Fix name app SubGhz
* GubGhz: Came: add Save, Load key
* GubGhz: GateTX: add Save, Load key
* GubGhz: NeroSketch: add Save, Load key
* Github: better linters triggers
* SubGhz: adding fast loading keys Archive -> Run in app
* GubGhz: KeeLog: add Save, Load key, key generation from the serial number of the meter and the button
* SubGhz: format sources and fix compilation
* FuriHal: add subghz configuration description for AGC section
* SubGhz: save only protocols that can be saved. Cleanup.
* Github: lint on pull requests
Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
2021-08-12 14:42:56 +00:00
# define API_HAL_SUBGHZ_ASYNC_TX_BUFFER_FULL (256)
# define API_HAL_SUBGHZ_ASYNC_TX_BUFFER_HALF (API_HAL_SUBGHZ_ASYNC_TX_BUFFER_FULL / 2)
SubGhz: read and save static remotes. Create new static and dynamic remotes. (#646)
* SubGhz: the functions of saving loading KeeLog have been modified, saving KeeLog is prohibited
* SubGhz: Fix displaying Nice FlorS in the Raed scene
* SubGhz: Fix displaying Faac SLH in the Raed scene
* SubGhz: Fix displaying iDo in the Raed scene
* SubGhz: Fix displaying Star Line in the Raed scene
* SubGhz: Fix displaying Nice Flo in the Raed scene, added save and load functions. (testing needed, no remote control)
* SubGhz: subghz_beginadded common encoder upload signal
* SubGhz: add Came encoder
* SubGhz: modified pricenton encoder, fix view transmitter hide the "Send" button if there is no encoder
* SubGhz: add nice flo encoder, need testing no remote control
* SubGhz: add gate_tx encoder
* SubGhz: add nero_sketch encoder
* SubGhz: add keelog encoder
* SubGhz: add long upload upload while the button is pressed while releasing the transfer is over, with a check for sticking (maximum 200 upload repetitions)
* SubGhz: fix max upload
* SubGhz: Fix structure subghz add encoder
* SubGhz: add generating and sending a dynamic keelog key, refactoring the code
* SubGhz: add notifications
* SubGhz: add creating a new remote control (Pricenton, Nice Flo 12bit, Nice Flo 24bit, CAME 12bit, CAME 24bit, Gate TX, DoorHan)
* SubGhz: Fix load file, fix scene start
* Subghz: Fix show key
* SubGhz: Fix subghz_cli
* SubGhz: Fix furi-hal-subghz
* Format sources
* SubGhz: standard notification scheme, fix broken assert in DMA.
* SubGhz: move level alignment logic to furi-hal-subghz, fix spelling, cleanup.
Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
2021-08-16 19:56:23 +00:00
# define API_HAL_SUBGHZ_ASYNC_TX_GUARD_TIME 333
[FL-1610] SubGhz: scene based application, PT save and replay (#630)
* SubGhz: scene based application
* SubGhz: encoder/decoder separation, DMA streaming, update app and cli.
* SubGhz: 2 stage async tx complete, minor cleanup
* SubGhz: 2 stage async tx complete, FIX state pin end transmit
* SubGhz: Pricenton, receive TE signal
* SubGhz: Pricenton, add save data, add load data
* SubGhz: Add Read scene, Fix pricenton save, load funtion
* SubGhz: Add Read, Receiver, SaveName scene
* SubGhz: Read and Save (pricenton)
* SubGhz: add Load scence
* SubGhz: Fix select file scene, add load scene, add transmitter view, add send tx pricenton
* SubGhz: Fix pricenton encoder, fix transmitter send
* SubGhz: modified Pricenton Encoder (added guard time at the beginning), modified CC1101 config, code refactoring
* SubGhz: Fix pricenton encoder defalut TE
* Archive: Fix path and name SubGhz
* Archive: Fix name app SubGhz
* GubGhz: Came: add Save, Load key
* GubGhz: GateTX: add Save, Load key
* GubGhz: NeroSketch: add Save, Load key
* Github: better linters triggers
* SubGhz: adding fast loading keys Archive -> Run in app
* GubGhz: KeeLog: add Save, Load key, key generation from the serial number of the meter and the button
* SubGhz: format sources and fix compilation
* FuriHal: add subghz configuration description for AGC section
* SubGhz: save only protocols that can be saved. Cleanup.
* Github: lint on pull requests
Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
2021-08-12 14:42:56 +00:00
typedef struct {
uint32_t * buffer ;
bool flip_flop ;
FuriHalSubGhzAsyncTxCallback callback ;
void * callback_context ;
} FuriHalSubGhzAsyncTx ;
static FuriHalSubGhzAsyncTx furi_hal_subghz_async_tx = { 0 } ;
static void furi_hal_subghz_async_tx_refill ( uint32_t * buffer , size_t samples ) {
while ( samples > 0 ) {
SubGhz: read and save static remotes. Create new static and dynamic remotes. (#646)
* SubGhz: the functions of saving loading KeeLog have been modified, saving KeeLog is prohibited
* SubGhz: Fix displaying Nice FlorS in the Raed scene
* SubGhz: Fix displaying Faac SLH in the Raed scene
* SubGhz: Fix displaying iDo in the Raed scene
* SubGhz: Fix displaying Star Line in the Raed scene
* SubGhz: Fix displaying Nice Flo in the Raed scene, added save and load functions. (testing needed, no remote control)
* SubGhz: subghz_beginadded common encoder upload signal
* SubGhz: add Came encoder
* SubGhz: modified pricenton encoder, fix view transmitter hide the "Send" button if there is no encoder
* SubGhz: add nice flo encoder, need testing no remote control
* SubGhz: add gate_tx encoder
* SubGhz: add nero_sketch encoder
* SubGhz: add keelog encoder
* SubGhz: add long upload upload while the button is pressed while releasing the transfer is over, with a check for sticking (maximum 200 upload repetitions)
* SubGhz: fix max upload
* SubGhz: Fix structure subghz add encoder
* SubGhz: add generating and sending a dynamic keelog key, refactoring the code
* SubGhz: add notifications
* SubGhz: add creating a new remote control (Pricenton, Nice Flo 12bit, Nice Flo 24bit, CAME 12bit, CAME 24bit, Gate TX, DoorHan)
* SubGhz: Fix load file, fix scene start
* Subghz: Fix show key
* SubGhz: Fix subghz_cli
* SubGhz: Fix furi-hal-subghz
* Format sources
* SubGhz: standard notification scheme, fix broken assert in DMA.
* SubGhz: move level alignment logic to furi-hal-subghz, fix spelling, cleanup.
Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
2021-08-16 19:56:23 +00:00
bool is_odd = samples % 2 ;
[FL-1610] SubGhz: scene based application, PT save and replay (#630)
* SubGhz: scene based application
* SubGhz: encoder/decoder separation, DMA streaming, update app and cli.
* SubGhz: 2 stage async tx complete, minor cleanup
* SubGhz: 2 stage async tx complete, FIX state pin end transmit
* SubGhz: Pricenton, receive TE signal
* SubGhz: Pricenton, add save data, add load data
* SubGhz: Add Read scene, Fix pricenton save, load funtion
* SubGhz: Add Read, Receiver, SaveName scene
* SubGhz: Read and Save (pricenton)
* SubGhz: add Load scence
* SubGhz: Fix select file scene, add load scene, add transmitter view, add send tx pricenton
* SubGhz: Fix pricenton encoder, fix transmitter send
* SubGhz: modified Pricenton Encoder (added guard time at the beginning), modified CC1101 config, code refactoring
* SubGhz: Fix pricenton encoder defalut TE
* Archive: Fix path and name SubGhz
* Archive: Fix name app SubGhz
* GubGhz: Came: add Save, Load key
* GubGhz: GateTX: add Save, Load key
* GubGhz: NeroSketch: add Save, Load key
* Github: better linters triggers
* SubGhz: adding fast loading keys Archive -> Run in app
* GubGhz: KeeLog: add Save, Load key, key generation from the serial number of the meter and the button
* SubGhz: format sources and fix compilation
* FuriHal: add subghz configuration description for AGC section
* SubGhz: save only protocols that can be saved. Cleanup.
* Github: lint on pull requests
Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
2021-08-12 14:42:56 +00:00
LevelDuration ld = furi_hal_subghz_async_tx . callback ( furi_hal_subghz_async_tx . callback_context ) ;
if ( level_duration_is_reset ( ld ) ) {
SubGhz: read and save static remotes. Create new static and dynamic remotes. (#646)
* SubGhz: the functions of saving loading KeeLog have been modified, saving KeeLog is prohibited
* SubGhz: Fix displaying Nice FlorS in the Raed scene
* SubGhz: Fix displaying Faac SLH in the Raed scene
* SubGhz: Fix displaying iDo in the Raed scene
* SubGhz: Fix displaying Star Line in the Raed scene
* SubGhz: Fix displaying Nice Flo in the Raed scene, added save and load functions. (testing needed, no remote control)
* SubGhz: subghz_beginadded common encoder upload signal
* SubGhz: add Came encoder
* SubGhz: modified pricenton encoder, fix view transmitter hide the "Send" button if there is no encoder
* SubGhz: add nice flo encoder, need testing no remote control
* SubGhz: add gate_tx encoder
* SubGhz: add nero_sketch encoder
* SubGhz: add keelog encoder
* SubGhz: add long upload upload while the button is pressed while releasing the transfer is over, with a check for sticking (maximum 200 upload repetitions)
* SubGhz: fix max upload
* SubGhz: Fix structure subghz add encoder
* SubGhz: add generating and sending a dynamic keelog key, refactoring the code
* SubGhz: add notifications
* SubGhz: add creating a new remote control (Pricenton, Nice Flo 12bit, Nice Flo 24bit, CAME 12bit, CAME 24bit, Gate TX, DoorHan)
* SubGhz: Fix load file, fix scene start
* Subghz: Fix show key
* SubGhz: Fix subghz_cli
* SubGhz: Fix furi-hal-subghz
* Format sources
* SubGhz: standard notification scheme, fix broken assert in DMA.
* SubGhz: move level alignment logic to furi-hal-subghz, fix spelling, cleanup.
Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
2021-08-16 19:56:23 +00:00
// One more even sample required to end at low level
if ( is_odd ) {
* buffer = API_HAL_SUBGHZ_ASYNC_TX_GUARD_TIME ;
buffer + + ;
samples - - ;
}
[FL-1610] SubGhz: scene based application, PT save and replay (#630)
* SubGhz: scene based application
* SubGhz: encoder/decoder separation, DMA streaming, update app and cli.
* SubGhz: 2 stage async tx complete, minor cleanup
* SubGhz: 2 stage async tx complete, FIX state pin end transmit
* SubGhz: Pricenton, receive TE signal
* SubGhz: Pricenton, add save data, add load data
* SubGhz: Add Read scene, Fix pricenton save, load funtion
* SubGhz: Add Read, Receiver, SaveName scene
* SubGhz: Read and Save (pricenton)
* SubGhz: add Load scence
* SubGhz: Fix select file scene, add load scene, add transmitter view, add send tx pricenton
* SubGhz: Fix pricenton encoder, fix transmitter send
* SubGhz: modified Pricenton Encoder (added guard time at the beginning), modified CC1101 config, code refactoring
* SubGhz: Fix pricenton encoder defalut TE
* Archive: Fix path and name SubGhz
* Archive: Fix name app SubGhz
* GubGhz: Came: add Save, Load key
* GubGhz: GateTX: add Save, Load key
* GubGhz: NeroSketch: add Save, Load key
* Github: better linters triggers
* SubGhz: adding fast loading keys Archive -> Run in app
* GubGhz: KeeLog: add Save, Load key, key generation from the serial number of the meter and the button
* SubGhz: format sources and fix compilation
* FuriHal: add subghz configuration description for AGC section
* SubGhz: save only protocols that can be saved. Cleanup.
* Github: lint on pull requests
Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
2021-08-12 14:42:56 +00:00
break ;
SubGhz: read and save static remotes. Create new static and dynamic remotes. (#646)
* SubGhz: the functions of saving loading KeeLog have been modified, saving KeeLog is prohibited
* SubGhz: Fix displaying Nice FlorS in the Raed scene
* SubGhz: Fix displaying Faac SLH in the Raed scene
* SubGhz: Fix displaying iDo in the Raed scene
* SubGhz: Fix displaying Star Line in the Raed scene
* SubGhz: Fix displaying Nice Flo in the Raed scene, added save and load functions. (testing needed, no remote control)
* SubGhz: subghz_beginadded common encoder upload signal
* SubGhz: add Came encoder
* SubGhz: modified pricenton encoder, fix view transmitter hide the "Send" button if there is no encoder
* SubGhz: add nice flo encoder, need testing no remote control
* SubGhz: add gate_tx encoder
* SubGhz: add nero_sketch encoder
* SubGhz: add keelog encoder
* SubGhz: add long upload upload while the button is pressed while releasing the transfer is over, with a check for sticking (maximum 200 upload repetitions)
* SubGhz: fix max upload
* SubGhz: Fix structure subghz add encoder
* SubGhz: add generating and sending a dynamic keelog key, refactoring the code
* SubGhz: add notifications
* SubGhz: add creating a new remote control (Pricenton, Nice Flo 12bit, Nice Flo 24bit, CAME 12bit, CAME 24bit, Gate TX, DoorHan)
* SubGhz: Fix load file, fix scene start
* Subghz: Fix show key
* SubGhz: Fix subghz_cli
* SubGhz: Fix furi-hal-subghz
* Format sources
* SubGhz: standard notification scheme, fix broken assert in DMA.
* SubGhz: move level alignment logic to furi-hal-subghz, fix spelling, cleanup.
Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
2021-08-16 19:56:23 +00:00
} else {
// Inject guard time if level is incorrect
if ( is_odd = = level_duration_get_level ( ld ) ) {
* buffer = API_HAL_SUBGHZ_ASYNC_TX_GUARD_TIME ;
buffer + + ;
samples - - ;
}
[FL-1610] SubGhz: scene based application, PT save and replay (#630)
* SubGhz: scene based application
* SubGhz: encoder/decoder separation, DMA streaming, update app and cli.
* SubGhz: 2 stage async tx complete, minor cleanup
* SubGhz: 2 stage async tx complete, FIX state pin end transmit
* SubGhz: Pricenton, receive TE signal
* SubGhz: Pricenton, add save data, add load data
* SubGhz: Add Read scene, Fix pricenton save, load funtion
* SubGhz: Add Read, Receiver, SaveName scene
* SubGhz: Read and Save (pricenton)
* SubGhz: add Load scence
* SubGhz: Fix select file scene, add load scene, add transmitter view, add send tx pricenton
* SubGhz: Fix pricenton encoder, fix transmitter send
* SubGhz: modified Pricenton Encoder (added guard time at the beginning), modified CC1101 config, code refactoring
* SubGhz: Fix pricenton encoder defalut TE
* Archive: Fix path and name SubGhz
* Archive: Fix name app SubGhz
* GubGhz: Came: add Save, Load key
* GubGhz: GateTX: add Save, Load key
* GubGhz: NeroSketch: add Save, Load key
* Github: better linters triggers
* SubGhz: adding fast loading keys Archive -> Run in app
* GubGhz: KeeLog: add Save, Load key, key generation from the serial number of the meter and the button
* SubGhz: format sources and fix compilation
* FuriHal: add subghz configuration description for AGC section
* SubGhz: save only protocols that can be saved. Cleanup.
* Github: lint on pull requests
Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
2021-08-12 14:42:56 +00:00
uint32_t duration = level_duration_get_duration ( ld ) ;
assert ( duration > 0 ) ;
* buffer = duration ;
SubGhz: read and save static remotes. Create new static and dynamic remotes. (#646)
* SubGhz: the functions of saving loading KeeLog have been modified, saving KeeLog is prohibited
* SubGhz: Fix displaying Nice FlorS in the Raed scene
* SubGhz: Fix displaying Faac SLH in the Raed scene
* SubGhz: Fix displaying iDo in the Raed scene
* SubGhz: Fix displaying Star Line in the Raed scene
* SubGhz: Fix displaying Nice Flo in the Raed scene, added save and load functions. (testing needed, no remote control)
* SubGhz: subghz_beginadded common encoder upload signal
* SubGhz: add Came encoder
* SubGhz: modified pricenton encoder, fix view transmitter hide the "Send" button if there is no encoder
* SubGhz: add nice flo encoder, need testing no remote control
* SubGhz: add gate_tx encoder
* SubGhz: add nero_sketch encoder
* SubGhz: add keelog encoder
* SubGhz: add long upload upload while the button is pressed while releasing the transfer is over, with a check for sticking (maximum 200 upload repetitions)
* SubGhz: fix max upload
* SubGhz: Fix structure subghz add encoder
* SubGhz: add generating and sending a dynamic keelog key, refactoring the code
* SubGhz: add notifications
* SubGhz: add creating a new remote control (Pricenton, Nice Flo 12bit, Nice Flo 24bit, CAME 12bit, CAME 24bit, Gate TX, DoorHan)
* SubGhz: Fix load file, fix scene start
* Subghz: Fix show key
* SubGhz: Fix subghz_cli
* SubGhz: Fix furi-hal-subghz
* Format sources
* SubGhz: standard notification scheme, fix broken assert in DMA.
* SubGhz: move level alignment logic to furi-hal-subghz, fix spelling, cleanup.
Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
2021-08-16 19:56:23 +00:00
buffer + + ;
samples - - ;
[FL-1610] SubGhz: scene based application, PT save and replay (#630)
* SubGhz: scene based application
* SubGhz: encoder/decoder separation, DMA streaming, update app and cli.
* SubGhz: 2 stage async tx complete, minor cleanup
* SubGhz: 2 stage async tx complete, FIX state pin end transmit
* SubGhz: Pricenton, receive TE signal
* SubGhz: Pricenton, add save data, add load data
* SubGhz: Add Read scene, Fix pricenton save, load funtion
* SubGhz: Add Read, Receiver, SaveName scene
* SubGhz: Read and Save (pricenton)
* SubGhz: add Load scence
* SubGhz: Fix select file scene, add load scene, add transmitter view, add send tx pricenton
* SubGhz: Fix pricenton encoder, fix transmitter send
* SubGhz: modified Pricenton Encoder (added guard time at the beginning), modified CC1101 config, code refactoring
* SubGhz: Fix pricenton encoder defalut TE
* Archive: Fix path and name SubGhz
* Archive: Fix name app SubGhz
* GubGhz: Came: add Save, Load key
* GubGhz: GateTX: add Save, Load key
* GubGhz: NeroSketch: add Save, Load key
* Github: better linters triggers
* SubGhz: adding fast loading keys Archive -> Run in app
* GubGhz: KeeLog: add Save, Load key, key generation from the serial number of the meter and the button
* SubGhz: format sources and fix compilation
* FuriHal: add subghz configuration description for AGC section
* SubGhz: save only protocols that can be saved. Cleanup.
* Github: lint on pull requests
Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
2021-08-12 14:42:56 +00:00
}
}
memset ( buffer , 0 , samples * sizeof ( uint32_t ) ) ;
}
2021-07-15 13:54:11 +00:00
[FL-1610] SubGhz: scene based application, PT save and replay (#630)
* SubGhz: scene based application
* SubGhz: encoder/decoder separation, DMA streaming, update app and cli.
* SubGhz: 2 stage async tx complete, minor cleanup
* SubGhz: 2 stage async tx complete, FIX state pin end transmit
* SubGhz: Pricenton, receive TE signal
* SubGhz: Pricenton, add save data, add load data
* SubGhz: Add Read scene, Fix pricenton save, load funtion
* SubGhz: Add Read, Receiver, SaveName scene
* SubGhz: Read and Save (pricenton)
* SubGhz: add Load scence
* SubGhz: Fix select file scene, add load scene, add transmitter view, add send tx pricenton
* SubGhz: Fix pricenton encoder, fix transmitter send
* SubGhz: modified Pricenton Encoder (added guard time at the beginning), modified CC1101 config, code refactoring
* SubGhz: Fix pricenton encoder defalut TE
* Archive: Fix path and name SubGhz
* Archive: Fix name app SubGhz
* GubGhz: Came: add Save, Load key
* GubGhz: GateTX: add Save, Load key
* GubGhz: NeroSketch: add Save, Load key
* Github: better linters triggers
* SubGhz: adding fast loading keys Archive -> Run in app
* GubGhz: KeeLog: add Save, Load key, key generation from the serial number of the meter and the button
* SubGhz: format sources and fix compilation
* FuriHal: add subghz configuration description for AGC section
* SubGhz: save only protocols that can be saved. Cleanup.
* Github: lint on pull requests
Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
2021-08-12 14:42:56 +00:00
static void furi_hal_subghz_async_tx_dma_isr ( ) {
furi_assert ( furi_hal_subghz_state = = SubGhzStateAsyncTx ) ;
if ( LL_DMA_IsActiveFlag_HT1 ( DMA1 ) ) {
LL_DMA_ClearFlag_HT1 ( DMA1 ) ;
furi_hal_subghz_async_tx_refill ( furi_hal_subghz_async_tx . buffer , API_HAL_SUBGHZ_ASYNC_TX_BUFFER_HALF ) ;
}
2021-07-15 13:54:11 +00:00
if ( LL_DMA_IsActiveFlag_TC1 ( DMA1 ) ) {
LL_DMA_ClearFlag_TC1 ( DMA1 ) ;
[FL-1610] SubGhz: scene based application, PT save and replay (#630)
* SubGhz: scene based application
* SubGhz: encoder/decoder separation, DMA streaming, update app and cli.
* SubGhz: 2 stage async tx complete, minor cleanup
* SubGhz: 2 stage async tx complete, FIX state pin end transmit
* SubGhz: Pricenton, receive TE signal
* SubGhz: Pricenton, add save data, add load data
* SubGhz: Add Read scene, Fix pricenton save, load funtion
* SubGhz: Add Read, Receiver, SaveName scene
* SubGhz: Read and Save (pricenton)
* SubGhz: add Load scence
* SubGhz: Fix select file scene, add load scene, add transmitter view, add send tx pricenton
* SubGhz: Fix pricenton encoder, fix transmitter send
* SubGhz: modified Pricenton Encoder (added guard time at the beginning), modified CC1101 config, code refactoring
* SubGhz: Fix pricenton encoder defalut TE
* Archive: Fix path and name SubGhz
* Archive: Fix name app SubGhz
* GubGhz: Came: add Save, Load key
* GubGhz: GateTX: add Save, Load key
* GubGhz: NeroSketch: add Save, Load key
* Github: better linters triggers
* SubGhz: adding fast loading keys Archive -> Run in app
* GubGhz: KeeLog: add Save, Load key, key generation from the serial number of the meter and the button
* SubGhz: format sources and fix compilation
* FuriHal: add subghz configuration description for AGC section
* SubGhz: save only protocols that can be saved. Cleanup.
* Github: lint on pull requests
Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
2021-08-12 14:42:56 +00:00
furi_hal_subghz_async_tx_refill ( furi_hal_subghz_async_tx . buffer + API_HAL_SUBGHZ_ASYNC_TX_BUFFER_HALF , API_HAL_SUBGHZ_ASYNC_TX_BUFFER_HALF ) ;
2021-07-15 13:54:11 +00:00
}
}
[FL-1610] SubGhz: scene based application, PT save and replay (#630)
* SubGhz: scene based application
* SubGhz: encoder/decoder separation, DMA streaming, update app and cli.
* SubGhz: 2 stage async tx complete, minor cleanup
* SubGhz: 2 stage async tx complete, FIX state pin end transmit
* SubGhz: Pricenton, receive TE signal
* SubGhz: Pricenton, add save data, add load data
* SubGhz: Add Read scene, Fix pricenton save, load funtion
* SubGhz: Add Read, Receiver, SaveName scene
* SubGhz: Read and Save (pricenton)
* SubGhz: add Load scence
* SubGhz: Fix select file scene, add load scene, add transmitter view, add send tx pricenton
* SubGhz: Fix pricenton encoder, fix transmitter send
* SubGhz: modified Pricenton Encoder (added guard time at the beginning), modified CC1101 config, code refactoring
* SubGhz: Fix pricenton encoder defalut TE
* Archive: Fix path and name SubGhz
* Archive: Fix name app SubGhz
* GubGhz: Came: add Save, Load key
* GubGhz: GateTX: add Save, Load key
* GubGhz: NeroSketch: add Save, Load key
* Github: better linters triggers
* SubGhz: adding fast loading keys Archive -> Run in app
* GubGhz: KeeLog: add Save, Load key, key generation from the serial number of the meter and the button
* SubGhz: format sources and fix compilation
* FuriHal: add subghz configuration description for AGC section
* SubGhz: save only protocols that can be saved. Cleanup.
* Github: lint on pull requests
Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
2021-08-12 14:42:56 +00:00
static void furi_hal_subghz_async_tx_timer_isr ( ) {
2021-07-15 13:54:11 +00:00
if ( LL_TIM_IsActiveFlag_UPDATE ( TIM2 ) ) {
LL_TIM_ClearFlag_UPDATE ( TIM2 ) ;
[FL-1610] SubGhz: scene based application, PT save and replay (#630)
* SubGhz: scene based application
* SubGhz: encoder/decoder separation, DMA streaming, update app and cli.
* SubGhz: 2 stage async tx complete, minor cleanup
* SubGhz: 2 stage async tx complete, FIX state pin end transmit
* SubGhz: Pricenton, receive TE signal
* SubGhz: Pricenton, add save data, add load data
* SubGhz: Add Read scene, Fix pricenton save, load funtion
* SubGhz: Add Read, Receiver, SaveName scene
* SubGhz: Read and Save (pricenton)
* SubGhz: add Load scence
* SubGhz: Fix select file scene, add load scene, add transmitter view, add send tx pricenton
* SubGhz: Fix pricenton encoder, fix transmitter send
* SubGhz: modified Pricenton Encoder (added guard time at the beginning), modified CC1101 config, code refactoring
* SubGhz: Fix pricenton encoder defalut TE
* Archive: Fix path and name SubGhz
* Archive: Fix name app SubGhz
* GubGhz: Came: add Save, Load key
* GubGhz: GateTX: add Save, Load key
* GubGhz: NeroSketch: add Save, Load key
* Github: better linters triggers
* SubGhz: adding fast loading keys Archive -> Run in app
* GubGhz: KeeLog: add Save, Load key, key generation from the serial number of the meter and the button
* SubGhz: format sources and fix compilation
* FuriHal: add subghz configuration description for AGC section
* SubGhz: save only protocols that can be saved. Cleanup.
* Github: lint on pull requests
Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
2021-08-12 14:42:56 +00:00
if ( LL_TIM_GetAutoReload ( TIM2 ) = = 0 ) {
if ( furi_hal_subghz_state = = SubGhzStateAsyncTx ) {
furi_hal_subghz_state = SubGhzStateAsyncTxLast ;
} else {
furi_hal_subghz_state = SubGhzStateAsyncTxEnd ;
LL_TIM_DisableCounter ( TIM2 ) ;
}
2021-07-15 13:54:11 +00:00
}
}
}
[FL-1610] SubGhz: scene based application, PT save and replay (#630)
* SubGhz: scene based application
* SubGhz: encoder/decoder separation, DMA streaming, update app and cli.
* SubGhz: 2 stage async tx complete, minor cleanup
* SubGhz: 2 stage async tx complete, FIX state pin end transmit
* SubGhz: Pricenton, receive TE signal
* SubGhz: Pricenton, add save data, add load data
* SubGhz: Add Read scene, Fix pricenton save, load funtion
* SubGhz: Add Read, Receiver, SaveName scene
* SubGhz: Read and Save (pricenton)
* SubGhz: add Load scence
* SubGhz: Fix select file scene, add load scene, add transmitter view, add send tx pricenton
* SubGhz: Fix pricenton encoder, fix transmitter send
* SubGhz: modified Pricenton Encoder (added guard time at the beginning), modified CC1101 config, code refactoring
* SubGhz: Fix pricenton encoder defalut TE
* Archive: Fix path and name SubGhz
* Archive: Fix name app SubGhz
* GubGhz: Came: add Save, Load key
* GubGhz: GateTX: add Save, Load key
* GubGhz: NeroSketch: add Save, Load key
* Github: better linters triggers
* SubGhz: adding fast loading keys Archive -> Run in app
* GubGhz: KeeLog: add Save, Load key, key generation from the serial number of the meter and the button
* SubGhz: format sources and fix compilation
* FuriHal: add subghz configuration description for AGC section
* SubGhz: save only protocols that can be saved. Cleanup.
* Github: lint on pull requests
Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
2021-08-12 14:42:56 +00:00
void furi_hal_subghz_start_async_tx ( FuriHalSubGhzAsyncTxCallback callback , void * context ) {
2021-08-08 18:03:25 +00:00
furi_assert ( furi_hal_subghz_state = = SubGhzStateIdle ) ;
[FL-1610] SubGhz: scene based application, PT save and replay (#630)
* SubGhz: scene based application
* SubGhz: encoder/decoder separation, DMA streaming, update app and cli.
* SubGhz: 2 stage async tx complete, minor cleanup
* SubGhz: 2 stage async tx complete, FIX state pin end transmit
* SubGhz: Pricenton, receive TE signal
* SubGhz: Pricenton, add save data, add load data
* SubGhz: Add Read scene, Fix pricenton save, load funtion
* SubGhz: Add Read, Receiver, SaveName scene
* SubGhz: Read and Save (pricenton)
* SubGhz: add Load scence
* SubGhz: Fix select file scene, add load scene, add transmitter view, add send tx pricenton
* SubGhz: Fix pricenton encoder, fix transmitter send
* SubGhz: modified Pricenton Encoder (added guard time at the beginning), modified CC1101 config, code refactoring
* SubGhz: Fix pricenton encoder defalut TE
* Archive: Fix path and name SubGhz
* Archive: Fix name app SubGhz
* GubGhz: Came: add Save, Load key
* GubGhz: GateTX: add Save, Load key
* GubGhz: NeroSketch: add Save, Load key
* Github: better linters triggers
* SubGhz: adding fast loading keys Archive -> Run in app
* GubGhz: KeeLog: add Save, Load key, key generation from the serial number of the meter and the button
* SubGhz: format sources and fix compilation
* FuriHal: add subghz configuration description for AGC section
* SubGhz: save only protocols that can be saved. Cleanup.
* Github: lint on pull requests
Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
2021-08-12 14:42:56 +00:00
furi_assert ( callback ) ;
furi_hal_subghz_async_tx . callback = callback ;
furi_hal_subghz_async_tx . callback_context = context ;
2021-08-08 18:03:25 +00:00
furi_hal_subghz_state = SubGhzStateAsyncTx ;
[FL-1610] SubGhz: scene based application, PT save and replay (#630)
* SubGhz: scene based application
* SubGhz: encoder/decoder separation, DMA streaming, update app and cli.
* SubGhz: 2 stage async tx complete, minor cleanup
* SubGhz: 2 stage async tx complete, FIX state pin end transmit
* SubGhz: Pricenton, receive TE signal
* SubGhz: Pricenton, add save data, add load data
* SubGhz: Add Read scene, Fix pricenton save, load funtion
* SubGhz: Add Read, Receiver, SaveName scene
* SubGhz: Read and Save (pricenton)
* SubGhz: add Load scence
* SubGhz: Fix select file scene, add load scene, add transmitter view, add send tx pricenton
* SubGhz: Fix pricenton encoder, fix transmitter send
* SubGhz: modified Pricenton Encoder (added guard time at the beginning), modified CC1101 config, code refactoring
* SubGhz: Fix pricenton encoder defalut TE
* Archive: Fix path and name SubGhz
* Archive: Fix name app SubGhz
* GubGhz: Came: add Save, Load key
* GubGhz: GateTX: add Save, Load key
* GubGhz: NeroSketch: add Save, Load key
* Github: better linters triggers
* SubGhz: adding fast loading keys Archive -> Run in app
* GubGhz: KeeLog: add Save, Load key, key generation from the serial number of the meter and the button
* SubGhz: format sources and fix compilation
* FuriHal: add subghz configuration description for AGC section
* SubGhz: save only protocols that can be saved. Cleanup.
* Github: lint on pull requests
Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
2021-08-12 14:42:56 +00:00
furi_hal_subghz_async_tx . buffer = furi_alloc ( API_HAL_SUBGHZ_ASYNC_TX_BUFFER_FULL * sizeof ( uint32_t ) ) ;
furi_hal_subghz_async_tx_refill ( furi_hal_subghz_async_tx . buffer , API_HAL_SUBGHZ_ASYNC_TX_BUFFER_FULL ) ;
2021-07-15 13:54:11 +00:00
// Connect CC1101_GD0 to TIM2 as output
hal_gpio_init_ex ( & gpio_cc1101_g0 , GpioModeAltFunctionPushPull , GpioPullDown , GpioSpeedLow , GpioAltFn1TIM2 ) ;
// Configure DMA
LL_DMA_InitTypeDef dma_config = { 0 } ;
dma_config . PeriphOrM2MSrcAddress = ( uint32_t ) & ( TIM2 - > ARR ) ;
[FL-1610] SubGhz: scene based application, PT save and replay (#630)
* SubGhz: scene based application
* SubGhz: encoder/decoder separation, DMA streaming, update app and cli.
* SubGhz: 2 stage async tx complete, minor cleanup
* SubGhz: 2 stage async tx complete, FIX state pin end transmit
* SubGhz: Pricenton, receive TE signal
* SubGhz: Pricenton, add save data, add load data
* SubGhz: Add Read scene, Fix pricenton save, load funtion
* SubGhz: Add Read, Receiver, SaveName scene
* SubGhz: Read and Save (pricenton)
* SubGhz: add Load scence
* SubGhz: Fix select file scene, add load scene, add transmitter view, add send tx pricenton
* SubGhz: Fix pricenton encoder, fix transmitter send
* SubGhz: modified Pricenton Encoder (added guard time at the beginning), modified CC1101 config, code refactoring
* SubGhz: Fix pricenton encoder defalut TE
* Archive: Fix path and name SubGhz
* Archive: Fix name app SubGhz
* GubGhz: Came: add Save, Load key
* GubGhz: GateTX: add Save, Load key
* GubGhz: NeroSketch: add Save, Load key
* Github: better linters triggers
* SubGhz: adding fast loading keys Archive -> Run in app
* GubGhz: KeeLog: add Save, Load key, key generation from the serial number of the meter and the button
* SubGhz: format sources and fix compilation
* FuriHal: add subghz configuration description for AGC section
* SubGhz: save only protocols that can be saved. Cleanup.
* Github: lint on pull requests
Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
2021-08-12 14:42:56 +00:00
dma_config . MemoryOrM2MDstAddress = ( uint32_t ) furi_hal_subghz_async_tx . buffer ;
2021-07-15 13:54:11 +00:00
dma_config . Direction = LL_DMA_DIRECTION_MEMORY_TO_PERIPH ;
dma_config . Mode = LL_DMA_MODE_CIRCULAR ;
dma_config . PeriphOrM2MSrcIncMode = LL_DMA_PERIPH_NOINCREMENT ;
dma_config . MemoryOrM2MDstIncMode = LL_DMA_MEMORY_INCREMENT ;
dma_config . PeriphOrM2MSrcDataSize = LL_DMA_PDATAALIGN_WORD ;
dma_config . MemoryOrM2MDstDataSize = LL_DMA_MDATAALIGN_WORD ;
[FL-1610] SubGhz: scene based application, PT save and replay (#630)
* SubGhz: scene based application
* SubGhz: encoder/decoder separation, DMA streaming, update app and cli.
* SubGhz: 2 stage async tx complete, minor cleanup
* SubGhz: 2 stage async tx complete, FIX state pin end transmit
* SubGhz: Pricenton, receive TE signal
* SubGhz: Pricenton, add save data, add load data
* SubGhz: Add Read scene, Fix pricenton save, load funtion
* SubGhz: Add Read, Receiver, SaveName scene
* SubGhz: Read and Save (pricenton)
* SubGhz: add Load scence
* SubGhz: Fix select file scene, add load scene, add transmitter view, add send tx pricenton
* SubGhz: Fix pricenton encoder, fix transmitter send
* SubGhz: modified Pricenton Encoder (added guard time at the beginning), modified CC1101 config, code refactoring
* SubGhz: Fix pricenton encoder defalut TE
* Archive: Fix path and name SubGhz
* Archive: Fix name app SubGhz
* GubGhz: Came: add Save, Load key
* GubGhz: GateTX: add Save, Load key
* GubGhz: NeroSketch: add Save, Load key
* Github: better linters triggers
* SubGhz: adding fast loading keys Archive -> Run in app
* GubGhz: KeeLog: add Save, Load key, key generation from the serial number of the meter and the button
* SubGhz: format sources and fix compilation
* FuriHal: add subghz configuration description for AGC section
* SubGhz: save only protocols that can be saved. Cleanup.
* Github: lint on pull requests
Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
2021-08-12 14:42:56 +00:00
dma_config . NbData = API_HAL_SUBGHZ_ASYNC_TX_BUFFER_FULL ;
2021-07-15 13:54:11 +00:00
dma_config . PeriphRequest = LL_DMAMUX_REQ_TIM2_UP ;
dma_config . Priority = LL_DMA_MODE_NORMAL ;
LL_DMA_Init ( DMA1 , LL_DMA_CHANNEL_1 , & dma_config ) ;
[FL-1610] SubGhz: scene based application, PT save and replay (#630)
* SubGhz: scene based application
* SubGhz: encoder/decoder separation, DMA streaming, update app and cli.
* SubGhz: 2 stage async tx complete, minor cleanup
* SubGhz: 2 stage async tx complete, FIX state pin end transmit
* SubGhz: Pricenton, receive TE signal
* SubGhz: Pricenton, add save data, add load data
* SubGhz: Add Read scene, Fix pricenton save, load funtion
* SubGhz: Add Read, Receiver, SaveName scene
* SubGhz: Read and Save (pricenton)
* SubGhz: add Load scence
* SubGhz: Fix select file scene, add load scene, add transmitter view, add send tx pricenton
* SubGhz: Fix pricenton encoder, fix transmitter send
* SubGhz: modified Pricenton Encoder (added guard time at the beginning), modified CC1101 config, code refactoring
* SubGhz: Fix pricenton encoder defalut TE
* Archive: Fix path and name SubGhz
* Archive: Fix name app SubGhz
* GubGhz: Came: add Save, Load key
* GubGhz: GateTX: add Save, Load key
* GubGhz: NeroSketch: add Save, Load key
* Github: better linters triggers
* SubGhz: adding fast loading keys Archive -> Run in app
* GubGhz: KeeLog: add Save, Load key, key generation from the serial number of the meter and the button
* SubGhz: format sources and fix compilation
* FuriHal: add subghz configuration description for AGC section
* SubGhz: save only protocols that can be saved. Cleanup.
* Github: lint on pull requests
Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
2021-08-12 14:42:56 +00:00
furi_hal_interrupt_set_dma_channel_isr ( DMA1 , LL_DMA_CHANNEL_1 , furi_hal_subghz_async_tx_dma_isr ) ;
2021-07-15 13:54:11 +00:00
LL_DMA_EnableIT_TC ( DMA1 , LL_DMA_CHANNEL_1 ) ;
[FL-1610] SubGhz: scene based application, PT save and replay (#630)
* SubGhz: scene based application
* SubGhz: encoder/decoder separation, DMA streaming, update app and cli.
* SubGhz: 2 stage async tx complete, minor cleanup
* SubGhz: 2 stage async tx complete, FIX state pin end transmit
* SubGhz: Pricenton, receive TE signal
* SubGhz: Pricenton, add save data, add load data
* SubGhz: Add Read scene, Fix pricenton save, load funtion
* SubGhz: Add Read, Receiver, SaveName scene
* SubGhz: Read and Save (pricenton)
* SubGhz: add Load scence
* SubGhz: Fix select file scene, add load scene, add transmitter view, add send tx pricenton
* SubGhz: Fix pricenton encoder, fix transmitter send
* SubGhz: modified Pricenton Encoder (added guard time at the beginning), modified CC1101 config, code refactoring
* SubGhz: Fix pricenton encoder defalut TE
* Archive: Fix path and name SubGhz
* Archive: Fix name app SubGhz
* GubGhz: Came: add Save, Load key
* GubGhz: GateTX: add Save, Load key
* GubGhz: NeroSketch: add Save, Load key
* Github: better linters triggers
* SubGhz: adding fast loading keys Archive -> Run in app
* GubGhz: KeeLog: add Save, Load key, key generation from the serial number of the meter and the button
* SubGhz: format sources and fix compilation
* FuriHal: add subghz configuration description for AGC section
* SubGhz: save only protocols that can be saved. Cleanup.
* Github: lint on pull requests
Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
2021-08-12 14:42:56 +00:00
LL_DMA_EnableIT_HT ( DMA1 , LL_DMA_CHANNEL_1 ) ;
2021-07-15 13:54:11 +00:00
LL_DMA_EnableChannel ( DMA1 , LL_DMA_CHANNEL_1 ) ;
// Configure TIM2
2021-08-02 14:03:12 +00:00
LL_APB1_GRP1_EnableClock ( LL_APB1_GRP1_PERIPH_TIM2 ) ;
2021-07-15 13:54:11 +00:00
LL_TIM_InitTypeDef TIM_InitStruct = { 0 } ;
TIM_InitStruct . Prescaler = 64 - 1 ;
TIM_InitStruct . CounterMode = LL_TIM_COUNTERMODE_UP ;
TIM_InitStruct . Autoreload = 1000 ;
TIM_InitStruct . ClockDivision = LL_TIM_CLOCKDIVISION_DIV1 ;
LL_TIM_Init ( TIM2 , & TIM_InitStruct ) ;
LL_TIM_SetClockSource ( TIM2 , LL_TIM_CLOCKSOURCE_INTERNAL ) ;
LL_TIM_EnableARRPreload ( TIM2 ) ;
// Configure TIM2 CH2
LL_TIM_OC_InitTypeDef TIM_OC_InitStruct = { 0 } ;
TIM_OC_InitStruct . OCMode = LL_TIM_OCMODE_TOGGLE ;
TIM_OC_InitStruct . OCState = LL_TIM_OCSTATE_DISABLE ;
TIM_OC_InitStruct . OCNState = LL_TIM_OCSTATE_DISABLE ;
TIM_OC_InitStruct . CompareValue = 0 ;
TIM_OC_InitStruct . OCPolarity = LL_TIM_OCPOLARITY_HIGH ;
LL_TIM_OC_Init ( TIM2 , LL_TIM_CHANNEL_CH2 , & TIM_OC_InitStruct ) ;
LL_TIM_OC_DisableFast ( TIM2 , LL_TIM_CHANNEL_CH2 ) ;
LL_TIM_DisableMasterSlaveMode ( TIM2 ) ;
[FL-1610] SubGhz: scene based application, PT save and replay (#630)
* SubGhz: scene based application
* SubGhz: encoder/decoder separation, DMA streaming, update app and cli.
* SubGhz: 2 stage async tx complete, minor cleanup
* SubGhz: 2 stage async tx complete, FIX state pin end transmit
* SubGhz: Pricenton, receive TE signal
* SubGhz: Pricenton, add save data, add load data
* SubGhz: Add Read scene, Fix pricenton save, load funtion
* SubGhz: Add Read, Receiver, SaveName scene
* SubGhz: Read and Save (pricenton)
* SubGhz: add Load scence
* SubGhz: Fix select file scene, add load scene, add transmitter view, add send tx pricenton
* SubGhz: Fix pricenton encoder, fix transmitter send
* SubGhz: modified Pricenton Encoder (added guard time at the beginning), modified CC1101 config, code refactoring
* SubGhz: Fix pricenton encoder defalut TE
* Archive: Fix path and name SubGhz
* Archive: Fix name app SubGhz
* GubGhz: Came: add Save, Load key
* GubGhz: GateTX: add Save, Load key
* GubGhz: NeroSketch: add Save, Load key
* Github: better linters triggers
* SubGhz: adding fast loading keys Archive -> Run in app
* GubGhz: KeeLog: add Save, Load key, key generation from the serial number of the meter and the button
* SubGhz: format sources and fix compilation
* FuriHal: add subghz configuration description for AGC section
* SubGhz: save only protocols that can be saved. Cleanup.
* Github: lint on pull requests
Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
2021-08-12 14:42:56 +00:00
furi_hal_interrupt_set_timer_isr ( TIM2 , furi_hal_subghz_async_tx_timer_isr ) ;
2021-07-15 13:54:11 +00:00
LL_TIM_EnableIT_UPDATE ( TIM2 ) ;
LL_TIM_EnableDMAReq_UPDATE ( TIM2 ) ;
LL_TIM_CC_EnableChannel ( TIM2 , LL_TIM_CHANNEL_CH2 ) ;
// Start counter
LL_TIM_GenerateEvent_UPDATE ( TIM2 ) ;
2021-08-08 18:03:25 +00:00
# ifdef FURI_HAL_SUBGHZ_TX_GPIO
hal_gpio_write ( & FURI_HAL_SUBGHZ_TX_GPIO , true ) ;
2021-07-15 13:54:11 +00:00
# endif
2021-08-08 18:03:25 +00:00
furi_hal_subghz_tx ( ) ;
2021-07-15 13:54:11 +00:00
2021-08-02 14:03:12 +00:00
// Enable NVIC
NVIC_SetPriority ( TIM2_IRQn , NVIC_EncodePriority ( NVIC_GetPriorityGrouping ( ) , 5 , 0 ) ) ;
NVIC_EnableIRQ ( TIM2_IRQn ) ;
2021-07-15 13:54:11 +00:00
LL_TIM_SetCounter ( TIM2 , 0 ) ;
LL_TIM_EnableCounter ( TIM2 ) ;
}
[FL-1610] SubGhz: scene based application, PT save and replay (#630)
* SubGhz: scene based application
* SubGhz: encoder/decoder separation, DMA streaming, update app and cli.
* SubGhz: 2 stage async tx complete, minor cleanup
* SubGhz: 2 stage async tx complete, FIX state pin end transmit
* SubGhz: Pricenton, receive TE signal
* SubGhz: Pricenton, add save data, add load data
* SubGhz: Add Read scene, Fix pricenton save, load funtion
* SubGhz: Add Read, Receiver, SaveName scene
* SubGhz: Read and Save (pricenton)
* SubGhz: add Load scence
* SubGhz: Fix select file scene, add load scene, add transmitter view, add send tx pricenton
* SubGhz: Fix pricenton encoder, fix transmitter send
* SubGhz: modified Pricenton Encoder (added guard time at the beginning), modified CC1101 config, code refactoring
* SubGhz: Fix pricenton encoder defalut TE
* Archive: Fix path and name SubGhz
* Archive: Fix name app SubGhz
* GubGhz: Came: add Save, Load key
* GubGhz: GateTX: add Save, Load key
* GubGhz: NeroSketch: add Save, Load key
* Github: better linters triggers
* SubGhz: adding fast loading keys Archive -> Run in app
* GubGhz: KeeLog: add Save, Load key, key generation from the serial number of the meter and the button
* SubGhz: format sources and fix compilation
* FuriHal: add subghz configuration description for AGC section
* SubGhz: save only protocols that can be saved. Cleanup.
* Github: lint on pull requests
Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
2021-08-12 14:42:56 +00:00
bool furi_hal_subghz_is_async_tx_complete ( ) {
return furi_hal_subghz_state = = SubGhzStateAsyncTxEnd ;
2021-07-15 13:54:11 +00:00
}
2021-08-08 18:03:25 +00:00
void furi_hal_subghz_stop_async_tx ( ) {
2021-07-18 18:09:00 +00:00
furi_assert (
2021-08-08 18:03:25 +00:00
furi_hal_subghz_state = = SubGhzStateAsyncTx
| | furi_hal_subghz_state = = SubGhzStateAsyncTxLast
| | furi_hal_subghz_state = = SubGhzStateAsyncTxEnd
2021-07-18 18:09:00 +00:00
) ;
2021-07-15 13:54:11 +00:00
// Shutdown radio
2021-08-08 18:03:25 +00:00
furi_hal_subghz_idle ( ) ;
# ifdef FURI_HAL_SUBGHZ_TX_GPIO
hal_gpio_write ( & FURI_HAL_SUBGHZ_TX_GPIO , false ) ;
2021-07-15 13:54:11 +00:00
# endif
// Deinitialize Timer
LL_TIM_DeInit ( TIM2 ) ;
2021-08-02 14:03:12 +00:00
LL_APB1_GRP1_DisableClock ( LL_APB1_GRP1_PERIPH_TIM2 ) ;
2021-08-08 18:03:25 +00:00
furi_hal_interrupt_set_timer_isr ( TIM2 , NULL ) ;
2021-07-15 13:54:11 +00:00
// Deinitialize DMA
LL_DMA_DeInit ( DMA1 , LL_DMA_CHANNEL_1 ) ;
2021-08-08 18:03:25 +00:00
furi_hal_interrupt_set_dma_channel_isr ( DMA1 , LL_DMA_CHANNEL_1 , NULL ) ;
2021-07-15 13:54:11 +00:00
// Deinitialize GPIO
2021-06-29 21:19:20 +00:00
hal_gpio_init ( & gpio_cc1101_g0 , GpioModeAnalog , GpioPullNo , GpioSpeedLow ) ;
2021-07-18 18:09:00 +00:00
[FL-1610] SubGhz: scene based application, PT save and replay (#630)
* SubGhz: scene based application
* SubGhz: encoder/decoder separation, DMA streaming, update app and cli.
* SubGhz: 2 stage async tx complete, minor cleanup
* SubGhz: 2 stage async tx complete, FIX state pin end transmit
* SubGhz: Pricenton, receive TE signal
* SubGhz: Pricenton, add save data, add load data
* SubGhz: Add Read scene, Fix pricenton save, load funtion
* SubGhz: Add Read, Receiver, SaveName scene
* SubGhz: Read and Save (pricenton)
* SubGhz: add Load scence
* SubGhz: Fix select file scene, add load scene, add transmitter view, add send tx pricenton
* SubGhz: Fix pricenton encoder, fix transmitter send
* SubGhz: modified Pricenton Encoder (added guard time at the beginning), modified CC1101 config, code refactoring
* SubGhz: Fix pricenton encoder defalut TE
* Archive: Fix path and name SubGhz
* Archive: Fix name app SubGhz
* GubGhz: Came: add Save, Load key
* GubGhz: GateTX: add Save, Load key
* GubGhz: NeroSketch: add Save, Load key
* Github: better linters triggers
* SubGhz: adding fast loading keys Archive -> Run in app
* GubGhz: KeeLog: add Save, Load key, key generation from the serial number of the meter and the button
* SubGhz: format sources and fix compilation
* FuriHal: add subghz configuration description for AGC section
* SubGhz: save only protocols that can be saved. Cleanup.
* Github: lint on pull requests
Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
2021-08-12 14:42:56 +00:00
free ( furi_hal_subghz_async_tx . buffer ) ;
2021-08-08 18:03:25 +00:00
furi_hal_subghz_state = SubGhzStateIdle ;
2021-06-29 21:19:20 +00:00
}