[FL-2393][FL-2381] iButton, OneWire: move to plain C (#1068)
* iButton: getting started on the worker concept * Hal delay: added global instructions_per_us variable * iButton: one wire slave * iButton: ibutton key setter * iButton: one wire host, use ibutton_hal * iButton\RFID: common pulse decoder concept * iButton: cyfral decoder * iButton: worker thread concept * iButton: metakom decoder * iButton: write key through worker * iButton: worker mode holder * iButton: worker improvements * iButton: Cyfral encoder * iButton: Metakom encoder * lib: pulse protocol helpers * iButton: Metakom decoder * iButton: Cyfral decoder * iButton worker: separate modes * iButton: libs documentation * HAL: iButton gpio modes * iButton worker: rename modes file * iButton worker, hal: move to LL * iButton CLI: worker for reading and emulation commands * iButton HAL: correct init and emulation sequence * iButton cli: moved to plain C * iButton: move to worker, small step to plain C * Libs, one wire: move to plain C * Libs: added forgotten files to compilation * iButton writer: get rid of manual disable/enable irq
This commit is contained in:
@@ -1,21 +1,26 @@
|
||||
#include "ibutton_scene_read_success.h"
|
||||
#include "../ibutton_app.h"
|
||||
#include "../ibutton_view_manager.h"
|
||||
#include "../ibutton_event.h"
|
||||
#include <dolphin/dolphin.h>
|
||||
#include <callback-connector.h>
|
||||
|
||||
static void dialog_ex_callback(DialogExResult result, void* context) {
|
||||
iButtonApp* app = static_cast<iButtonApp*>(context);
|
||||
iButtonEvent event;
|
||||
|
||||
event.type = iButtonEvent::Type::EventTypeDialogResult;
|
||||
event.payload.dialog_result = result;
|
||||
|
||||
app->get_view_manager()->send_event(&event);
|
||||
}
|
||||
|
||||
void iButtonSceneReadSuccess::on_enter(iButtonApp* app) {
|
||||
iButtonAppViewManager* view_manager = app->get_view_manager();
|
||||
DialogEx* dialog_ex = view_manager->get_dialog_ex();
|
||||
auto callback = cbc::obtain_connector(this, &iButtonSceneReadSuccess::dialog_ex_callback);
|
||||
iButtonKey* key = app->get_key();
|
||||
const uint8_t* key_data = ibutton_key_get_data_p(key);
|
||||
DOLPHIN_DEED(DolphinDeedIbuttonReadSuccess);
|
||||
|
||||
iButtonKey* key = app->get_key();
|
||||
uint8_t* key_data = key->get_data();
|
||||
|
||||
switch(key->get_key_type()) {
|
||||
case iButtonKeyType::KeyDallas:
|
||||
switch(ibutton_key_get_type(key)) {
|
||||
case iButtonKeyDS1990:
|
||||
app->set_text_store(
|
||||
"Dallas\n%02X %02X %02X %02X\n%02X %02X %02X %02X",
|
||||
key_data[0],
|
||||
@@ -27,10 +32,10 @@ void iButtonSceneReadSuccess::on_enter(iButtonApp* app) {
|
||||
key_data[6],
|
||||
key_data[7]);
|
||||
break;
|
||||
case iButtonKeyType::KeyCyfral:
|
||||
case iButtonKeyCyfral:
|
||||
app->set_text_store("Cyfral\n%02X %02X", key_data[0], key_data[1]);
|
||||
break;
|
||||
case iButtonKeyType::KeyMetakom:
|
||||
case iButtonKeyMetakom:
|
||||
app->set_text_store(
|
||||
"Metakom\n%02X %02X %02X %02X", key_data[0], key_data[1], key_data[2], key_data[3]);
|
||||
break;
|
||||
@@ -40,7 +45,7 @@ void iButtonSceneReadSuccess::on_enter(iButtonApp* app) {
|
||||
dialog_ex_set_left_button_text(dialog_ex, "Retry");
|
||||
dialog_ex_set_right_button_text(dialog_ex, "More");
|
||||
dialog_ex_set_icon(dialog_ex, 0, 1, &I_DolphinExcited_64x63);
|
||||
dialog_ex_set_result_callback(dialog_ex, callback);
|
||||
dialog_ex_set_result_callback(dialog_ex, dialog_ex_callback);
|
||||
dialog_ex_set_context(dialog_ex, app);
|
||||
|
||||
view_manager->switch_to(iButtonAppViewManager::Type::iButtonAppViewDialogEx);
|
||||
@@ -80,13 +85,3 @@ void iButtonSceneReadSuccess::on_exit(iButtonApp* app) {
|
||||
|
||||
app->notify_green_off();
|
||||
}
|
||||
|
||||
void iButtonSceneReadSuccess::dialog_ex_callback(DialogExResult result, void* context) {
|
||||
iButtonApp* app = static_cast<iButtonApp*>(context);
|
||||
iButtonEvent event;
|
||||
|
||||
event.type = iButtonEvent::Type::EventTypeDialogResult;
|
||||
event.payload.dialog_result = result;
|
||||
|
||||
app->get_view_manager()->send_event(&event);
|
||||
}
|
||||
|
Reference in New Issue
Block a user