[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,24 +1,30 @@
|
||||
#include "ibutton_scene_info.h"
|
||||
#include "../ibutton_app.h"
|
||||
#include "../ibutton_view_manager.h"
|
||||
#include "../ibutton_event.h"
|
||||
#include <callback-connector.h>
|
||||
|
||||
static void widget_callback(GuiButtonType result, InputType type, void* context) {
|
||||
iButtonApp* app = static_cast<iButtonApp*>(context);
|
||||
iButtonEvent event;
|
||||
|
||||
if(type == InputTypeShort) {
|
||||
event.type = iButtonEvent::Type::EventTypeWidgetButtonResult;
|
||||
event.payload.widget_button_result = result;
|
||||
app->get_view_manager()->send_event(&event);
|
||||
}
|
||||
}
|
||||
|
||||
void iButtonSceneInfo::on_enter(iButtonApp* app) {
|
||||
iButtonAppViewManager* view_manager = app->get_view_manager();
|
||||
Widget* widget = view_manager->get_widget();
|
||||
auto callback = cbc::obtain_connector(this, &iButtonSceneInfo::widget_callback);
|
||||
|
||||
iButtonKey* key = app->get_key();
|
||||
uint8_t* key_data = key->get_data();
|
||||
const uint8_t* key_data = ibutton_key_get_data_p(key);
|
||||
|
||||
app->set_text_store("%s", key->get_name());
|
||||
app->set_text_store("%s", ibutton_key_get_name_p(key));
|
||||
widget_add_text_box_element(
|
||||
widget, 0, 0, 128, 27, AlignCenter, AlignCenter, app->get_text_store());
|
||||
widget_add_button_element(widget, GuiButtonTypeLeft, "Back", callback, app);
|
||||
widget_add_button_element(widget, GuiButtonTypeLeft, "Back", widget_callback, app);
|
||||
|
||||
switch(key->get_key_type()) {
|
||||
case iButtonKeyType::KeyDallas:
|
||||
switch(ibutton_key_get_type(key)) {
|
||||
case iButtonKeyDS1990:
|
||||
app->set_text_store(
|
||||
"%02X %02X %02X %02X %02X %02X %02X %02X",
|
||||
key_data[0],
|
||||
@@ -32,13 +38,13 @@ void iButtonSceneInfo::on_enter(iButtonApp* app) {
|
||||
widget_add_string_element(
|
||||
widget, 64, 45, AlignCenter, AlignBottom, FontSecondary, "Dallas");
|
||||
break;
|
||||
case iButtonKeyType::KeyMetakom:
|
||||
case iButtonKeyMetakom:
|
||||
app->set_text_store(
|
||||
"%02X %02X %02X %02X", key_data[0], key_data[1], key_data[2], key_data[3]);
|
||||
widget_add_string_element(
|
||||
widget, 64, 45, AlignCenter, AlignBottom, FontSecondary, "Metakom");
|
||||
break;
|
||||
case iButtonKeyType::KeyCyfral:
|
||||
case iButtonKeyCyfral:
|
||||
app->set_text_store("%02X %02X", key_data[0], key_data[1]);
|
||||
widget_add_string_element(
|
||||
widget, 64, 45, AlignCenter, AlignBottom, FontSecondary, "Cyfral");
|
||||
@@ -71,15 +77,3 @@ void iButtonSceneInfo::on_exit(iButtonApp* app) {
|
||||
|
||||
widget_reset(widget);
|
||||
}
|
||||
|
||||
void iButtonSceneInfo::widget_callback(GuiButtonType result, InputType type, void* context) {
|
||||
iButtonApp* app = static_cast<iButtonApp*>(context);
|
||||
iButtonEvent event;
|
||||
|
||||
if(type == InputTypeShort) {
|
||||
event.type = iButtonEvent::Type::EventTypeWidgetButtonResult;
|
||||
event.payload.widget_button_result = result;
|
||||
}
|
||||
|
||||
app->get_view_manager()->send_event(&event);
|
||||
}
|
||||
|
Reference in New Issue
Block a user