Merge pull request #401 from microbit-sam/050

Delay microbit_panic for 050 / 051 errors
This commit is contained in:
Joe Finney 2018-11-08 09:44:59 +00:00 committed by GitHub
commit 3b3848a4c3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 2 deletions

View file

@ -112,7 +112,8 @@ MicroBitAccelerometer& MicroBitAccelerometer::autoDetect(MicroBitI2C &i2c)
else
{
microbit_panic(MICROBIT_HARDWARE_UNAVAILABLE_ACC);
MicroBitAccelerometer *unavailable = new MicroBitAccelerometer(coordinateSpace, MICROBIT_ID_ACCELEROMETER);
MicroBitAccelerometer::detectedAccelerometer = unavailable;
}
}
@ -438,6 +439,7 @@ int MicroBitAccelerometer::configure()
*/
int MicroBitAccelerometer::requestUpdate()
{
microbit_panic(MICROBIT_HARDWARE_UNAVAILABLE_ACC);
return MICROBIT_NOT_SUPPORTED;
}

View file

@ -134,7 +134,8 @@ MicroBitCompass& MicroBitCompass::autoDetect(MicroBitI2C &i2c)
else
{
microbit_panic(MICROBIT_HARDWARE_UNAVAILABLE_MAG);
MicroBitCompass *unavailable = new MicroBitCompass(coordinateSpace, MICROBIT_ID_COMPASS);
MicroBitCompass::detectedCompass = unavailable;
}
}
@ -357,6 +358,7 @@ int MicroBitCompass::getPeriod()
*/
int MicroBitCompass::requestUpdate()
{
microbit_panic(MICROBIT_HARDWARE_UNAVAILABLE_MAG);
return MICROBIT_NOT_SUPPORTED;
}