不韋 呂
/
UIT2_ExecutionTime
Measurment of execution time for sin() and sinf() functions for ST Nucleo F401RE.
Diff: main.cpp
- Revision:
- 0:24dff9fbc559
- Child:
- 1:33dad37b0caf
diff -r 000000000000 -r 24dff9fbc559 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Wed Oct 29 07:58:27 2014 +0000 @@ -0,0 +1,31 @@ +//-------------------------------------------------------------- +// Measurement execution time +// Use D7 +// 2014/10/29, Copyright (c) 2014 MIKAMI, Naoki +//-------------------------------------------------------------- + +#include "mbed.h" + +DigitalOut dOut_(D7); +DigitalIn sw1_(D2, PullDown); + +int main() +{ + while (true) + { + if (sw1_ == 0) + { + dOut_.write(1); + float x1 = sinf(0.1f); + dOut_.write(0); + } + else + { + dOut_.write(1); + double x1 = sin(0.1); + dOut_.write(0); + } + + wait_us(50); // 0.05 ms + } +}