Skip to content
New issue

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

serial/fibers problem #461

Open
mmoskal opened this issue Apr 1, 2020 · 3 comments
Open

serial/fibers problem #461

mmoskal opened this issue Apr 1, 2020 · 3 comments
Assignees

Comments

@mmoskal
Copy link
Contributor

mmoskal commented Apr 1, 2020

From microsoft/pxt-microbit#2709

The following program blinks nicely until A is pressed. Then the release_fiber() seems to exit.

Joe, this is blocking on MakeCode side.

void onButton(MicroBitEvent e) {
    uBit.serial.send((uint8_t *)" ", 1);
}

void blink() {
    for (;;) {
        uBit.display.image.setPixelValue(0, 0, 255);
        fiber_sleep(100);
        uBit.display.image.setPixelValue(0, 0, 0);
        fiber_sleep(100);
    }
}

int main() {
    uBit.init();
    uBit.messageBus.listen(MICROBIT_ID_BUTTON_A, MICROBIT_BUTTON_EVT_CLICK, onButton);
    create_fiber(blink);
    release_fiber();
    return 0;
}
@finneyj
Copy link
Contributor

finneyj commented Apr 1, 2020

Thanks @mmoskal. I'll check it out today.

finneyj added a commit that referenced this issue Apr 1, 2020
  - MicroBitSerial use wake_on_event for condition synchronisation.
  - By contract, a fiber doing this should subsequently call schedule()
    and no other blocking operation
@finneyj
Copy link
Contributor

finneyj commented Apr 1, 2020

Fixed in f96a390

@zfm076
Copy link

zfm076 commented Apr 3, 2020

Fixed in f96a390

Hi, I found a problem on the radio.Could you take a look at it for me? Fix: #462

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants