microbit: BUGFIX MicroBit::reset() now operates correctly
This commit is contained in:
parent
a61bd49620
commit
ec30695d7d
3 changed files with 13 additions and 10 deletions
|
@ -11,7 +11,7 @@ void panic(int statusCode);
|
|||
* Resets the micro:bit.
|
||||
* @param statusCode the appropriate status code. Status codes must be in the range 0-255.
|
||||
*/
|
||||
void reset(int statusCode);
|
||||
void microbit_reset();
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -19,6 +19,16 @@ void panic(int statusCode)
|
|||
uBit.panic(statusCode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Perform a hard reset of the micro:bit.
|
||||
*/
|
||||
void
|
||||
microbit_reset()
|
||||
{
|
||||
NVIC_SystemReset();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Callback when a BLE GATT disconnect occurs.
|
||||
*/
|
||||
|
@ -139,7 +149,7 @@ void MicroBit::init()
|
|||
*/
|
||||
void MicroBit::reset()
|
||||
{
|
||||
reset();
|
||||
microbit_reset();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -7,18 +7,11 @@ Serial pc(USBTX, USBRX);
|
|||
MicroBit uBit;
|
||||
InterruptIn resetButton(MICROBIT_PIN_BUTTON_RESET);
|
||||
|
||||
void
|
||||
reset()
|
||||
{
|
||||
NVIC_SystemReset();
|
||||
}
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
// Bring up soft reset button.
|
||||
resetButton.mode(PullUp);
|
||||
resetButton.fall(reset);
|
||||
resetButton.fall(microbit_reset);
|
||||
|
||||
#if CONFIG_ENABLED(MICROBIT_DBG)
|
||||
pc.baud(115200);
|
||||
|
|
Loading…
Reference in a new issue