We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Arising from support ticket https://support.microbit.org/helpdesk/tickets/85223 (private)
The code below works first time if I press A (uBit.logo.isPressed) but not B (uBit.io.logo.isTouched).
After the uBit constructors, the uBit.logo TouchButton has configured the uBit.io.logo pin for it's needs but not set its IO_STATUS_TOUCH_IN flag. https://github.com/lancaster-university/codal-core/blob/master/source/drivers/Button.cpp#L182
IO_STATUS_TOUCH_IN is only set inside isTouched, and isTouched is not called from CODAL.
The first call to uBit.io.logo.isTouched(), sees that IO_STATUS_TOUCH_IN is not set, and creates a replacement for uBit.logo.
To confirm, insert target_panic(999) before this line. https://github.com/lancaster-university/codal-nrf52/blob/master/source/NRF52Pin.cpp#L569
#include "MicroBit.h" MicroBit uBit; void onButtonA(MicroBitEvent e) { if ( uBit.logo.isPressed()) { uBit.display.print('Y'); } else { uBit.display.print('N'); } uBit.sleep(100); uBit.display.clear(); } void onButtonB(MicroBitEvent e) { if ( uBit.io.logo.isTouched()) { uBit.display.print('Y'); } else { uBit.display.print('N'); } uBit.sleep(100); uBit.display.clear(); } void onButtonAB(MicroBitEvent e) { } void forever() { while (true) { uBit.sleep(1000); } } int main() { uBit.init(); uBit.messageBus.listen( MICROBIT_ID_BUTTON_A, MICROBIT_BUTTON_EVT_CLICK, onButtonA); uBit.messageBus.listen( MICROBIT_ID_BUTTON_B, MICROBIT_BUTTON_EVT_CLICK, onButtonB); uBit.messageBus.listen( MICROBIT_ID_BUTTON_AB, MICROBIT_BUTTON_EVT_CLICK, onButtonAB); create_fiber( forever); release_fiber(); return 0; }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Arising from support ticket https://support.microbit.org/helpdesk/tickets/85223 (private)
The code below works first time if I press A (uBit.logo.isPressed) but not B (uBit.io.logo.isTouched).
After the uBit constructors, the uBit.logo TouchButton has configured the uBit.io.logo pin for it's needs but not set its IO_STATUS_TOUCH_IN flag.
https://github.com/lancaster-university/codal-core/blob/master/source/drivers/Button.cpp#L182
IO_STATUS_TOUCH_IN is only set inside isTouched, and isTouched is not called from CODAL.
The first call to uBit.io.logo.isTouched(), sees that IO_STATUS_TOUCH_IN is not set, and creates a replacement for uBit.logo.
To confirm, insert target_panic(999) before this line.
https://github.com/lancaster-university/codal-nrf52/blob/master/source/NRF52Pin.cpp#L569
The text was updated successfully, but these errors were encountered: