2021-03-31 20:52:26 +03:00
|
|
|
#include "subghz_test_packet.h"
|
2021-06-30 00:19:20 +03:00
|
|
|
#include "../subghz_i.h"
|
2021-12-22 14:05:14 +03:00
|
|
|
#include "../helpers/subghz_testing.h"
|
2021-03-31 20:52:26 +03:00
|
|
|
|
|
|
|
#include <math.h>
|
|
|
|
#include <furi.h>
|
2022-01-05 19:10:18 +03:00
|
|
|
#include <furi_hal.h>
|
2021-03-31 20:52:26 +03:00
|
|
|
#include <input/input.h>
|
2021-07-18 21:09:00 +03:00
|
|
|
#include <toolbox/level_duration.h>
|
2022-03-03 12:48:56 +03:00
|
|
|
#include <lib/subghz/protocols/princeton_for_testing.h>
|
2021-03-31 20:52:26 +03:00
|
|
|
|
2021-12-13 15:21:37 +03:00
|
|
|
#define SUBGHZ_TEST_PACKET_COUNT 500
|
2021-03-31 20:52:26 +03:00
|
|
|
|
2022-03-03 12:48:56 +03:00
|
|
|
struct SubGhzTestPacket {
|
2021-03-31 20:52:26 +03:00
|
|
|
View* view;
|
2021-12-21 15:16:25 +03:00
|
|
|
osTimerId_t timer;
|
[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 17:42:56 +03:00
|
|
|
|
|
|
|
SubGhzDecoderPrinceton* decoder;
|
|
|
|
SubGhzEncoderPrinceton* encoder;
|
2021-07-18 21:09:00 +03:00
|
|
|
volatile size_t packet_rx;
|
2022-03-03 12:48:56 +03:00
|
|
|
SubGhzTestPacketCallback callback;
|
2021-09-28 03:05:40 +03:00
|
|
|
void* context;
|
2021-03-31 20:52:26 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef enum {
|
2022-03-03 12:48:56 +03:00
|
|
|
SubGhzTestPacketModelStatusRx,
|
|
|
|
SubGhzTestPacketModelStatusOnlyRx,
|
|
|
|
SubGhzTestPacketModelStatusTx,
|
|
|
|
} SubGhzTestPacketModelStatus;
|
2021-03-31 20:52:26 +03:00
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
uint8_t frequency;
|
|
|
|
uint32_t real_frequency;
|
2021-08-08 21:03:25 +03:00
|
|
|
FuriHalSubGhzPath path;
|
2021-03-31 20:52:26 +03:00
|
|
|
float rssi;
|
2021-07-18 21:09:00 +03:00
|
|
|
size_t packets;
|
2022-03-03 12:48:56 +03:00
|
|
|
SubGhzTestPacketModelStatus status;
|
|
|
|
} SubGhzTestPacketModel;
|
2021-03-31 20:52:26 +03:00
|
|
|
|
2021-07-18 21:09:00 +03:00
|
|
|
volatile bool subghz_test_packet_overrun = false;
|
|
|
|
|
2021-09-28 03:05:40 +03:00
|
|
|
void subghz_test_packet_set_callback(
|
2022-03-03 12:48:56 +03:00
|
|
|
SubGhzTestPacket* subghz_test_packet,
|
|
|
|
SubGhzTestPacketCallback callback,
|
2021-09-28 03:05:40 +03:00
|
|
|
void* context) {
|
|
|
|
furi_assert(subghz_test_packet);
|
|
|
|
furi_assert(callback);
|
|
|
|
subghz_test_packet->callback = callback;
|
|
|
|
subghz_test_packet->context = context;
|
|
|
|
}
|
|
|
|
|
2021-07-18 21:09:00 +03:00
|
|
|
static void subghz_test_packet_rx_callback(bool level, uint32_t duration, void* context) {
|
|
|
|
furi_assert(context);
|
2022-03-03 12:48:56 +03:00
|
|
|
SubGhzTestPacket* instance = context;
|
|
|
|
subghz_decoder_princeton_for_testing_parse(instance->decoder, level, duration);
|
2021-07-18 21:09:00 +03:00
|
|
|
}
|
|
|
|
|
2022-03-03 12:48:56 +03:00
|
|
|
//todo
|
|
|
|
static void subghz_test_packet_rx_pt_callback(SubGhzDecoderPrinceton* parser, void* context) {
|
2022-05-06 16:37:10 +03:00
|
|
|
UNUSED(parser);
|
2021-07-18 21:09:00 +03:00
|
|
|
furi_assert(context);
|
2022-03-03 12:48:56 +03:00
|
|
|
SubGhzTestPacket* instance = context;
|
2021-07-18 21:09:00 +03:00
|
|
|
instance->packet_rx++;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void subghz_test_packet_rssi_timer_callback(void* context) {
|
|
|
|
furi_assert(context);
|
2022-03-03 12:48:56 +03:00
|
|
|
SubGhzTestPacket* instance = context;
|
2021-07-18 21:09:00 +03:00
|
|
|
|
|
|
|
with_view_model(
|
2022-03-03 12:48:56 +03:00
|
|
|
instance->view, (SubGhzTestPacketModel * model) {
|
|
|
|
if(model->status == SubGhzTestPacketModelStatusRx) {
|
2021-08-08 21:03:25 +03:00
|
|
|
model->rssi = furi_hal_subghz_get_rssi();
|
2021-07-18 21:09:00 +03:00
|
|
|
model->packets = instance->packet_rx;
|
2022-03-03 12:48:56 +03:00
|
|
|
} else if(model->status == SubGhzTestPacketModelStatusTx) {
|
|
|
|
model->packets =
|
|
|
|
SUBGHZ_TEST_PACKET_COUNT -
|
|
|
|
subghz_encoder_princeton_for_testing_get_repeat_left(instance->encoder);
|
2021-07-18 21:09:00 +03:00
|
|
|
}
|
|
|
|
return true;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2022-03-03 12:48:56 +03:00
|
|
|
static void subghz_test_packet_draw(Canvas* canvas, SubGhzTestPacketModel* model) {
|
2021-03-31 20:52:26 +03:00
|
|
|
char buffer[64];
|
|
|
|
|
|
|
|
canvas_set_color(canvas, ColorBlack);
|
|
|
|
canvas_set_font(canvas, FontPrimary);
|
2021-07-04 19:01:16 +03:00
|
|
|
canvas_draw_str(canvas, 0, 8, "CC1101 Packet Test");
|
2021-03-31 20:52:26 +03:00
|
|
|
|
|
|
|
canvas_set_font(canvas, FontSecondary);
|
|
|
|
// Frequency
|
|
|
|
snprintf(
|
|
|
|
buffer,
|
|
|
|
sizeof(buffer),
|
|
|
|
"Freq: %03ld.%03ld.%03ld Hz",
|
|
|
|
model->real_frequency / 1000000 % 1000,
|
|
|
|
model->real_frequency / 1000 % 1000,
|
|
|
|
model->real_frequency % 1000);
|
2021-07-04 19:01:16 +03:00
|
|
|
canvas_draw_str(canvas, 0, 20, buffer);
|
2021-03-31 20:52:26 +03:00
|
|
|
// Path
|
|
|
|
char* path_name = "Unknown";
|
2021-08-08 21:03:25 +03:00
|
|
|
if(model->path == FuriHalSubGhzPathIsolate) {
|
2021-03-31 20:52:26 +03:00
|
|
|
path_name = "isolate";
|
2021-08-08 21:03:25 +03:00
|
|
|
} else if(model->path == FuriHalSubGhzPath433) {
|
2021-03-31 20:52:26 +03:00
|
|
|
path_name = "433MHz";
|
2021-08-08 21:03:25 +03:00
|
|
|
} else if(model->path == FuriHalSubGhzPath315) {
|
2021-03-31 20:52:26 +03:00
|
|
|
path_name = "315MHz";
|
2021-08-08 21:03:25 +03:00
|
|
|
} else if(model->path == FuriHalSubGhzPath868) {
|
2021-03-31 20:52:26 +03:00
|
|
|
path_name = "868MHz";
|
|
|
|
}
|
|
|
|
snprintf(buffer, sizeof(buffer), "Path: %d - %s", model->path, path_name);
|
2021-07-04 19:01:16 +03:00
|
|
|
canvas_draw_str(canvas, 0, 31, buffer);
|
2021-07-18 21:09:00 +03:00
|
|
|
|
|
|
|
snprintf(buffer, sizeof(buffer), "Packets: %d", model->packets);
|
|
|
|
canvas_draw_str(canvas, 0, 42, buffer);
|
|
|
|
|
2022-03-03 12:48:56 +03:00
|
|
|
if(model->status == SubGhzTestPacketModelStatusRx) {
|
2021-03-31 20:52:26 +03:00
|
|
|
snprintf(
|
|
|
|
buffer,
|
|
|
|
sizeof(buffer),
|
|
|
|
"RSSI: %ld.%ld dBm",
|
|
|
|
(int32_t)(model->rssi),
|
|
|
|
(int32_t)fabs(model->rssi * 10) % 10);
|
2021-07-18 21:09:00 +03:00
|
|
|
canvas_draw_str(canvas, 0, 53, buffer);
|
2021-03-31 20:52:26 +03:00
|
|
|
} else {
|
2021-07-18 21:09:00 +03:00
|
|
|
canvas_draw_str(canvas, 0, 53, "TX");
|
2021-03-31 20:52:26 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-07-18 21:09:00 +03:00
|
|
|
static bool subghz_test_packet_input(InputEvent* event, void* context) {
|
2021-03-31 20:52:26 +03:00
|
|
|
furi_assert(context);
|
2022-03-03 12:48:56 +03:00
|
|
|
SubGhzTestPacket* instance = context;
|
2021-03-31 20:52:26 +03:00
|
|
|
|
2021-08-24 02:52:59 +03:00
|
|
|
if(event->key == InputKeyBack || event->type != InputTypeShort) {
|
2021-03-31 20:52:26 +03:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
with_view_model(
|
2022-03-03 12:48:56 +03:00
|
|
|
instance->view, (SubGhzTestPacketModel * model) {
|
|
|
|
if(model->status == SubGhzTestPacketModelStatusRx) {
|
2021-08-08 21:03:25 +03:00
|
|
|
furi_hal_subghz_stop_async_rx();
|
2022-03-03 12:48:56 +03:00
|
|
|
} else if(model->status == SubGhzTestPacketModelStatusTx) {
|
2022-03-30 18:23:40 +03:00
|
|
|
subghz_encoder_princeton_for_testing_stop(instance->encoder, furi_hal_get_tick());
|
2021-08-08 21:03:25 +03:00
|
|
|
furi_hal_subghz_stop_async_tx();
|
2021-07-18 21:09:00 +03:00
|
|
|
}
|
2021-03-31 20:52:26 +03:00
|
|
|
|
2021-08-24 02:52:59 +03:00
|
|
|
if(event->key == InputKeyLeft) {
|
|
|
|
if(model->frequency > 0) model->frequency--;
|
|
|
|
} else if(event->key == InputKeyRight) {
|
2021-12-22 14:05:14 +03:00
|
|
|
if(model->frequency < subghz_frequencies_count_testing - 1) model->frequency++;
|
2021-08-24 02:52:59 +03:00
|
|
|
} else if(event->key == InputKeyDown) {
|
|
|
|
if(model->path > 0) model->path--;
|
|
|
|
} else if(event->key == InputKeyUp) {
|
|
|
|
if(model->path < FuriHalSubGhzPath868) model->path++;
|
|
|
|
} else if(event->key == InputKeyOk) {
|
2022-03-03 12:48:56 +03:00
|
|
|
if(model->status == SubGhzTestPacketModelStatusRx) {
|
|
|
|
model->status = SubGhzTestPacketModelStatusTx;
|
2021-09-28 03:05:40 +03:00
|
|
|
} else {
|
2022-03-03 12:48:56 +03:00
|
|
|
model->status = SubGhzTestPacketModelStatusRx;
|
2021-03-31 20:52:26 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-08-24 02:52:59 +03:00
|
|
|
model->real_frequency =
|
2021-12-22 14:05:14 +03:00
|
|
|
furi_hal_subghz_set_frequency(subghz_frequencies_testing[model->frequency]);
|
2021-08-24 02:52:59 +03:00
|
|
|
furi_hal_subghz_set_path(model->path);
|
|
|
|
|
2022-03-03 12:48:56 +03:00
|
|
|
if(model->status == SubGhzTestPacketModelStatusRx) {
|
[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 17:42:56 +03:00
|
|
|
furi_hal_subghz_start_async_rx(subghz_test_packet_rx_callback, instance);
|
2021-03-31 20:52:26 +03:00
|
|
|
} else {
|
2022-03-03 12:48:56 +03:00
|
|
|
subghz_encoder_princeton_for_testing_set(
|
2021-12-13 15:21:37 +03:00
|
|
|
instance->encoder,
|
|
|
|
0x00AABBCC,
|
|
|
|
SUBGHZ_TEST_PACKET_COUNT,
|
2021-12-22 14:05:14 +03:00
|
|
|
subghz_frequencies_testing[model->frequency]);
|
2021-09-28 03:05:40 +03:00
|
|
|
if(!furi_hal_subghz_start_async_tx(
|
2022-03-03 12:48:56 +03:00
|
|
|
subghz_encoder_princeton_for_testing_yield, instance->encoder)) {
|
|
|
|
model->status = SubGhzTestPacketModelStatusOnlyRx;
|
|
|
|
instance->callback(SubGhzTestPacketEventOnlyRx, instance->context);
|
2021-09-28 03:05:40 +03:00
|
|
|
}
|
2021-03-31 20:52:26 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
});
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void subghz_test_packet_enter(void* context) {
|
|
|
|
furi_assert(context);
|
2022-03-03 12:48:56 +03:00
|
|
|
SubGhzTestPacket* instance = context;
|
2021-07-18 21:09:00 +03:00
|
|
|
|
2021-08-08 21:03:25 +03:00
|
|
|
furi_hal_subghz_reset();
|
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 16:51:48 +03:00
|
|
|
furi_hal_subghz_load_preset(FuriHalSubGhzPresetOok650Async);
|
2021-03-31 20:52:26 +03:00
|
|
|
|
|
|
|
with_view_model(
|
2022-03-03 12:48:56 +03:00
|
|
|
instance->view, (SubGhzTestPacketModel * model) {
|
2021-12-22 14:05:14 +03:00
|
|
|
model->frequency = subghz_frequencies_433_92_testing;
|
2021-03-31 20:52:26 +03:00
|
|
|
model->real_frequency =
|
2021-12-22 14:05:14 +03:00
|
|
|
furi_hal_subghz_set_frequency(subghz_frequencies_testing[model->frequency]);
|
2021-08-08 21:03:25 +03:00
|
|
|
model->path = FuriHalSubGhzPathIsolate; // isolate
|
2021-03-31 20:52:26 +03:00
|
|
|
model->rssi = 0.0f;
|
2022-03-03 12:48:56 +03:00
|
|
|
model->status = SubGhzTestPacketModelStatusRx;
|
2021-03-31 20:52:26 +03:00
|
|
|
return true;
|
|
|
|
});
|
|
|
|
|
[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 17:42:56 +03:00
|
|
|
furi_hal_subghz_start_async_rx(subghz_test_packet_rx_callback, instance);
|
2021-03-31 20:52:26 +03:00
|
|
|
|
2021-11-22 21:49:57 +03:00
|
|
|
osTimerStart(instance->timer, osKernelGetTickFreq() / 4);
|
2021-03-31 20:52:26 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void subghz_test_packet_exit(void* context) {
|
|
|
|
furi_assert(context);
|
2022-03-03 12:48:56 +03:00
|
|
|
SubGhzTestPacket* instance = context;
|
2021-03-31 20:52:26 +03:00
|
|
|
|
2021-07-18 21:09:00 +03:00
|
|
|
osTimerStop(instance->timer);
|
2021-03-31 20:52:26 +03:00
|
|
|
|
|
|
|
// Reinitialize IC to default state
|
|
|
|
with_view_model(
|
2022-03-03 12:48:56 +03:00
|
|
|
instance->view, (SubGhzTestPacketModel * model) {
|
|
|
|
if(model->status == SubGhzTestPacketModelStatusRx) {
|
2021-08-08 21:03:25 +03:00
|
|
|
furi_hal_subghz_stop_async_rx();
|
2022-03-03 12:48:56 +03:00
|
|
|
} else if(model->status == SubGhzTestPacketModelStatusTx) {
|
2022-03-30 18:23:40 +03:00
|
|
|
subghz_encoder_princeton_for_testing_stop(instance->encoder, furi_hal_get_tick());
|
2021-08-08 21:03:25 +03:00
|
|
|
furi_hal_subghz_stop_async_tx();
|
2021-07-18 21:09:00 +03:00
|
|
|
}
|
2021-03-31 20:52:26 +03:00
|
|
|
return true;
|
|
|
|
});
|
2021-08-08 21:03:25 +03:00
|
|
|
furi_hal_subghz_sleep();
|
2021-03-31 20:52:26 +03:00
|
|
|
}
|
|
|
|
|
2022-03-03 12:48:56 +03:00
|
|
|
SubGhzTestPacket* subghz_test_packet_alloc() {
|
|
|
|
SubGhzTestPacket* instance = malloc(sizeof(SubGhzTestPacket));
|
2021-03-31 20:52:26 +03:00
|
|
|
|
|
|
|
// View allocation and configuration
|
2021-07-18 21:09:00 +03:00
|
|
|
instance->view = view_alloc();
|
2022-03-03 12:48:56 +03:00
|
|
|
view_allocate_model(instance->view, ViewModelTypeLocking, sizeof(SubGhzTestPacketModel));
|
2021-07-18 21:09:00 +03:00
|
|
|
view_set_context(instance->view, instance);
|
|
|
|
view_set_draw_callback(instance->view, (ViewDrawCallback)subghz_test_packet_draw);
|
|
|
|
view_set_input_callback(instance->view, subghz_test_packet_input);
|
|
|
|
view_set_enter_callback(instance->view, subghz_test_packet_enter);
|
|
|
|
view_set_exit_callback(instance->view, subghz_test_packet_exit);
|
|
|
|
|
|
|
|
instance->timer =
|
|
|
|
osTimerNew(subghz_test_packet_rssi_timer_callback, osTimerPeriodic, instance, NULL);
|
|
|
|
|
2022-03-03 12:48:56 +03:00
|
|
|
instance->decoder = subghz_decoder_princeton_for_testing_alloc();
|
|
|
|
subghz_decoder_princeton_for_testing_set_callback(
|
|
|
|
instance->decoder, subghz_test_packet_rx_pt_callback, instance);
|
|
|
|
instance->encoder = subghz_encoder_princeton_for_testing_alloc();
|
2021-07-18 21:09:00 +03:00
|
|
|
|
|
|
|
return instance;
|
2021-03-31 20:52:26 +03:00
|
|
|
}
|
|
|
|
|
2022-03-03 12:48:56 +03:00
|
|
|
void subghz_test_packet_free(SubGhzTestPacket* instance) {
|
2021-07-18 21:09:00 +03:00
|
|
|
furi_assert(instance);
|
|
|
|
|
2022-03-03 12:48:56 +03:00
|
|
|
subghz_decoder_princeton_for_testing_free(instance->decoder);
|
|
|
|
subghz_encoder_princeton_for_testing_free(instance->encoder);
|
[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 17:42:56 +03:00
|
|
|
|
2021-07-18 21:09:00 +03:00
|
|
|
osTimerDelete(instance->timer);
|
|
|
|
view_free(instance->view);
|
|
|
|
free(instance);
|
2021-03-31 20:52:26 +03:00
|
|
|
}
|
|
|
|
|
2022-03-03 12:48:56 +03:00
|
|
|
View* subghz_test_packet_get_view(SubGhzTestPacket* instance) {
|
2021-07-18 21:09:00 +03:00
|
|
|
furi_assert(instance);
|
|
|
|
return instance->view;
|
2021-12-21 15:16:25 +03:00
|
|
|
}
|