ERIS CORE
appReprogram.h
Go to the documentation of this file.
1 /**
2  * @file appReprogram.h
3  * @author Brian Monkaba (brian.monkaba@gmail.com)
4  * @brief
5  * @version 0.1
6  * @date 2021-08-24
7  *
8  * @copyright Copyright (c) 2021
9  *
10  */
11 #include <core_pins.h>
12 #include "AppManager.h"
13 // Enter Programming Mode
14 //
15 
16 /**
17  * @brief helper class for forcing the teensy into programming mode
18  * this is usefull in applications where the reset button is not so easily accessible
19  */
20 class AppReprogram:public AppBaseClass {
21  public:
23  sprintf(name,"AppReprogram");
24  pinMode(TAP_INPUT, INPUT);
25  pinMode(SW_D, INPUT);
26  }
27  //define event handlers
28  //void render(){};
29  void update (){
30  update_priority = 3500;
31  //Enter program mode if both TAP_INPUT and SW_D
32  //switches are pressed at the same time.
33  if (digitalRead(TAP_INPUT) == LOW && digitalRead(SW_D) == LOW){
34  sci->println(F("M AppReprogram:update Entering Programming Mode"));
35  delay(100);
36  __asm__ volatile ("bkpt #251"); //enter the bootloader
37  while(1);//wait for reset
38  }
39  }
40 };
SvcSerialCommandInterface * sci
Definition: AppBaseClass.h:39
char name[MAX_NAME_LENGTH]
Definition: AppBaseClass.h:74
uint16_t update_priority
Definition: AppBaseClass.h:52
base class definition / implementation from which all app classes will be derived and override
Definition: AppBaseClass.h:34
void update()
update loop
Definition: appReprogram.h:29
helper class for forcing the teensy into programming mode this is usefull in applications where the r...
Definition: appReprogram.h:20