forked from flipperdevices/flipperzero-firmware
-
-
Notifications
You must be signed in to change notification settings - Fork 551
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from leedave/feature/subghz_like_meal_pager
Feature/subghz like meal pager
- Loading branch information
Showing
42 changed files
with
2,199 additions
and
900 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* Reduced variant of the Flipper Zero SubGhz Class */ | ||
|
||
#include "subghz_i.h" | ||
#include "../../helpers/xremote_custom_event.h" | ||
#include "../../helpers/xremote_led.h" | ||
|
||
SubGhz* subghz_alloc() { | ||
SubGhz* subghz = malloc(sizeof(SubGhz)); | ||
|
||
subghz->file_path = furi_string_alloc(); | ||
subghz->txrx = subghz_txrx_alloc(); | ||
|
||
return subghz; | ||
} | ||
|
||
void subghz_free(SubGhz* subghz) { | ||
subghz_txrx_free(subghz->txrx); | ||
furi_string_free(subghz->file_path); | ||
|
||
// The rest | ||
free(subghz); | ||
} | ||
|
||
void subghz_scene_transmit_callback_end_tx(void* context) { | ||
furi_assert(context); | ||
FURI_LOG_D(TAG, "callback end"); | ||
XRemote* app = context; | ||
view_dispatcher_send_custom_event( | ||
app->view_dispatcher, XRemoteCustomEventViewTransmitterSendStop); | ||
|
||
//app->state_notifications = SubGhzNotificationStateIDLE; | ||
//subghz_txrx_stop(app->subghz->txrx); | ||
//app->transmitting = false; | ||
//xremote_scene_ir_notification_message(app, SubGhzNotificationMessageBlinkStop); | ||
xremote_cross_remote_set_transmitting(app->cross_remote, XRemoteTransmittingStopSubghz); | ||
} | ||
|
||
void subghz_send(void* context, const char* path) { | ||
XRemote* app = context; | ||
|
||
subghz_load_protocol_from_file(app->subghz, path); | ||
FURI_LOG_D(TAG, "Starting Transmission"); | ||
subghz_txrx_tx_start( | ||
app->subghz->txrx, | ||
subghz_txrx_get_fff_data(app->subghz->txrx)); //Seems like it must be done this way | ||
|
||
FURI_LOG_D(TAG, "setting sugbhz raw file encoder worker callback"); | ||
subghz_txrx_set_raw_file_encoder_worker_callback_end( | ||
app->subghz->txrx, subghz_scene_transmit_callback_end_tx, app); | ||
app->state_notifications = SubGhzNotificationStateTx; | ||
|
||
FURI_LOG_D(TAG, "Finished Transmitting"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#pragma once | ||
|
||
#include "subghz_i.h" | ||
|
||
typedef struct SubGhz SubGhz; | ||
|
||
SubGhz* subghz_alloc(); | ||
void subghz_free(SubGhz* subghz); | ||
void subghz_send(void* context, const char* path); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#pragma once | ||
|
||
#include <furi.h> | ||
#include <furi_hal.h> | ||
|
||
/** SubGhzErrorType */ | ||
typedef enum { | ||
SubGhzErrorTypeNoError = 0, /** There are no errors */ | ||
SubGhzErrorTypeParseFile = | ||
1, /** File parsing error, or wrong file structure, or missing required parameters. more accurate data can be obtained through the debug port */ | ||
SubGhzErrorTypeOnlyRX = | ||
2, /** Transmission on this frequency is blocked by regional settings */ | ||
SubGhzErrorTypeParserOthers = 3, /** Error in protocol parameters description */ | ||
} SubGhzErrorType; |
Oops, something went wrong.