Skip to content

Commit

Permalink
SubGhz: add frequencies and add DoorHan 315.00 (flipperdevices#1028)
Browse files Browse the repository at this point in the history
* SubGhz: add frequencies and add DoorHan 315.00
* SubGhz: fix syntax

Co-authored-by: あく <[email protected]>
  • Loading branch information
Skorpionm and skotopes authored Mar 17, 2022
1 parent c098292 commit b86a400
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 6 deletions.
37 changes: 34 additions & 3 deletions applications/subghz/scenes/subghz_scene_set_type.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ enum SubmenuIndex {
SubmenuIndexNeroSketch,
SubmenuIndexNeroRadio,
SubmenuIndexGateTX,
SubmenuIndexDoorHan,
SubmenuIndexDoorHan_315_00,
SubmenuIndexDoorHan_433_92,
};

bool subghz_scene_set_type_submenu_gen_data_protocol(
Expand Down Expand Up @@ -122,10 +123,16 @@ void subghz_scene_set_type_on_enter(void* context) {
SubmenuIndexGateTX,
subghz_scene_set_type_submenu_callback,
subghz);
submenu_add_item(
subghz->submenu,
"DoorHan_315",
SubmenuIndexDoorHan_315_00,
subghz_scene_set_type_submenu_callback,
subghz);
submenu_add_item(
subghz->submenu,
"DoorHan_433",
SubmenuIndexDoorHan,
SubmenuIndexDoorHan_433_92,
subghz_scene_set_type_submenu_callback,
subghz);

Expand Down Expand Up @@ -195,7 +202,7 @@ bool subghz_scene_set_type_on_event(void* context, SceneManagerEvent event) {
generated_protocol = true;
}
break;
case SubmenuIndexDoorHan:
case SubmenuIndexDoorHan_433_92:
subghz->txrx->transmitter =
subghz_transmitter_alloc_init(subghz->txrx->environment, "KeeLoq");
if(subghz->txrx->transmitter) {
Expand All @@ -219,6 +226,30 @@ bool subghz_scene_set_type_on_event(void* context, SceneManagerEvent event) {
scene_manager_next_scene(subghz->scene_manager, SubGhzSceneShowError);
}
break;
case SubmenuIndexDoorHan_315_00:
subghz->txrx->transmitter =
subghz_transmitter_alloc_init(subghz->txrx->environment, "KeeLoq");
if(subghz->txrx->transmitter) {
subghz_protocol_keeloq_create_data(
subghz->txrx->transmitter->protocol_instance,
subghz->txrx->fff_data,
key & 0x0FFFFFFF,
0x2,
0x0003,
"DoorHan",
subghz_frequencies[subghz_frequencies_315_00],
FuriHalSubGhzPresetOok650Async);
generated_protocol = true;
} else {
generated_protocol = false;
}
subghz_transmitter_free(subghz->txrx->transmitter);
if(!generated_protocol) {
string_set(
subghz->error_str, "Function requires\nan SD card with\nfresh databases.");
scene_manager_next_scene(subghz->scene_manager, SubGhzSceneShowError);
}
break;
default:
return false;
break;
Expand Down
31 changes: 28 additions & 3 deletions applications/subghz/subghz.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,41 +4,66 @@
#include <lib/toolbox/path.h>

const char* const subghz_frequencies_text[] = {

"300.00",
"303.88",
"304.25",
"315.00",
"318.00",

"390.00",
"418.00",
"433.08",
"433.42",
"433.92",
"434.42",
"434.78",
"438.90",

"868.35",
"915.00",
"925.00",
};

const uint32_t subghz_frequencies[] = {

/* 300 - 348 */
300000000,
303875000,
304250000,
315000000,
318000000,

/* 387 - 464 */

390000000,
418000000,
433075000, /* LPD433 first */
433420000,
433920000, /* LPD433 mid */
434420000,
/* 779 - 928 */
434775000, /* LPD433 last channels */
438900000,

/* 779 - 928 */
868350000,
915000000,
925000000,

};

const uint32_t subghz_hopper_frequencies[] = {
315000000,
318000000,
390000000,
433920000,
868350000,
};

const uint32_t subghz_frequencies_count = sizeof(subghz_frequencies) / sizeof(uint32_t);
const uint32_t subghz_hopper_frequencies_count =
sizeof(subghz_hopper_frequencies) / sizeof(uint32_t);
const uint32_t subghz_frequencies_433_92 = 3;
const uint32_t subghz_frequencies_433_92 = 9;
const uint32_t subghz_frequencies_315_00 = 3;

bool subghz_custom_event_callback(void* context, uint32_t event) {
furi_assert(context);
Expand Down
1 change: 1 addition & 0 deletions applications/subghz/subghz_i.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ extern const uint32_t subghz_hopper_frequencies[];
extern const uint32_t subghz_frequencies_count;
extern const uint32_t subghz_hopper_frequencies_count;
extern const uint32_t subghz_frequencies_433_92;
extern const uint32_t subghz_frequencies_315_00;

/** SubGhzNotification state */
typedef enum {
Expand Down

0 comments on commit b86a400

Please sign in to comment.