DEBUG: enter MRI from SlowTicker ISR if ISP button is pressed
authorMichael Moon <triffid.hunter@gmail.com>
Sat, 22 Dec 2012 01:17:33 +0000 (12:17 +1100)
committerMichael Moon <triffid.hunter@gmail.com>
Wed, 2 Jan 2013 00:45:28 +0000 (11:45 +1100)
src/libs/SlowTicker.cpp
src/libs/SlowTicker.h

index e9aeffb..ea39bfe 100644 (file)
@@ -14,6 +14,7 @@ using namespace std;
 #include "libs/Hook.h"
 #include "system_LPC17xx.h" // mbed.h lib
 
+#include <mri.h>
 
 SlowTicker* global_slow_ticker;
 
@@ -25,6 +26,8 @@ SlowTicker::SlowTicker(){
     LPC_TIM2->MCR = 3;              // Match on MR0, reset on MR0
     LPC_TIM2->TCR = 1;              // Enable interrupt
     NVIC_EnableIRQ(TIMER2_IRQn);    // Enable interrupt handler
+
+    ispbtn.from_string("2.10")->as_input()->pull_up();
 }
 
 void SlowTicker::set_frequency( int frequency ){
@@ -49,6 +52,8 @@ void SlowTicker::tick(){
 
     LPC_GPIO1->FIOCLR = 1<<20;
 
+    if (ispbtn.get() == 0)
+        __debugbreak();
 }
 
 extern "C" void TIMER2_IRQHandler (void){
index 68bcb3e..65bccaa 100644 (file)
@@ -17,6 +17,8 @@ using namespace std;
 #include "libs/Kernel.h"
 #include "libs/Hook.h"
 
+#include "libs/Pin.h"
+
 class SlowTicker : public Module{
     public:
         SlowTicker();
@@ -38,6 +40,8 @@ class SlowTicker : public Module{
 
         vector<Hook*> hooks;
         double max_frequency;
+
+        Pin ispbtn;
 };