Stefan Waldschmidt / Mbed OS Test_GPIO-out_Toggle_Time
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 /*
00002    Test GPIO-output toggle time
00003 
00004    Hardware: NUCLEO-F767ZI
00005      STM32F767ZIT6 @ 216 MHz
00006    Libraries:
00007      mbed-os-5.12.3
00008    Measured gpio_out frequency
00009    * total period: 8 nsec - 20 nsec (125 MHz - 50 MHz)
00010 */
00011 
00012 #include "mbed.h"
00013 
00014 DigitalOut gpio_out(PC_8);
00015 
00016 void run()
00017 {
00018     while (true) {
00019         gpio_out = 1;
00020         gpio_out = 0;
00021         gpio_out = 1;
00022         gpio_out = 0;
00023     }
00024 }
00025 
00026 int main()
00027 {
00028     Thread *thread  = new Thread(osPriorityRealtime);
00029 
00030     thread->start(run);
00031 
00032     while (true) {
00033         wait(0.1); // 100 ns
00034     }
00035 }