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
Committer:
hudakz
Date:
Thu Jun 04 21:49:34 2020 +0000
Revision:
4:b57198581ca4
Parent:
3:f25880700bda
Bare-metal with EventQueue on Bluepill.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
hudakz 0:2cf53c219693 1 #include "mbed.h"
hudakz 0:2cf53c219693 2
hudakz 3:f25880700bda 3 DigitalOut led1(LED1);
hudakz 0:2cf53c219693 4 InterruptIn button(PA_8, PullUp);
hudakz 0:2cf53c219693 5 EventQueue eventQueue;
hudakz 0:2cf53c219693 6
hudakz 0:2cf53c219693 7 void onButtonFall(void)
hudakz 0:2cf53c219693 8 {
hudakz 0:2cf53c219693 9 printf("Button pushed\r\n");
hudakz 0:2cf53c219693 10 }
hudakz 0:2cf53c219693 11
hudakz 0:2cf53c219693 12 void toggleLED()
hudakz 0:2cf53c219693 13 {
hudakz 0:2cf53c219693 14 led1 = !led1;
hudakz 0:2cf53c219693 15 }
hudakz 0:2cf53c219693 16
hudakz 0:2cf53c219693 17 int main()
hudakz 0:2cf53c219693 18 {
hudakz 0:2cf53c219693 19 button.fall(eventQueue.event(onButtonFall));
hudakz 0:2cf53c219693 20 eventQueue.call_every(500, toggleLED);
hudakz 0:2cf53c219693 21 eventQueue.dispatch_forever();
hudakz 0:2cf53c219693 22 }