ibutton app, only read mode

This commit is contained in:
DrZlo13
2020-11-17 07:10:58 +10:00
parent a8fdbc6376
commit 799eefd754
5 changed files with 33 additions and 9 deletions

View File

@@ -4,8 +4,12 @@
// start app
void AppiButton::run() {
acquire_state();
mode[0] = new AppiButtonModeDallasRead(this);
mode[1] = new AppiButtonModeDallasEmulate(this);
release_state();
switch_to_mode(0);
// create pin
GpioPin red_led = led_gpio[0];
@@ -94,6 +98,14 @@ void AppiButton::decrease_mode() {
release_state();
}
void AppiButton::switch_to_mode(uint8_t mode_index) {
acquire_state();
mode[state.mode_index]->release();
state.mode_index = mode_index;
mode[state.mode_index]->acquire();
release_state();
}
// app enter function
extern "C" void app_ibutton(void* p) {
AppiButton* app = new AppiButton();