Bare-metal configuration with EventQueue for a Bluepill board.

Warning

It does not work with the Mbed Online Compiler.

Follow these steps to import and compile it with Mbed CLI:

mbed import https://os.mbed.com/users/hudakz/code/Baremetal_EventQue_Bluepill
mbed compile -t GCC_ARM -m bluepill

main.cpp

Committer:
hudakz
Date:
2020-05-18
Revision:
3:f25880700bda
Parent:
1:96018ca8cb3f

File content as of revision 3:f25880700bda:

#include "mbed.h"

DigitalOut  led1(LED1);
InterruptIn button(PA_8, PullUp);
EventQueue  eventQueue;

void onButtonFall(void)
{
    printf("Button pushed\r\n");
}

void toggleLED()
{
    led1 = !led1;
}

int main()
{
    button.fall(eventQueue.event(onButtonFall));
    eventQueue.call_every(500, toggleLED);
    eventQueue.dispatch_forever();
}