first
Dependents: 17robo_fuzi 17robo_tokyo_kaede
cyclic_io.cpp@0:3555e86bf40d, 2017-09-20 (annotated)
- Committer:
- echo_piyo
- Date:
- Wed Sep 20 07:09:50 2017 +0000
- Revision:
- 0:3555e86bf40d
- Child:
- 1:e0bcbeb71a97
1??
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
echo_piyo | 0:3555e86bf40d | 1 | #include "cyclic_io.h" |
echo_piyo | 0:3555e86bf40d | 2 | #include "mbed.h" |
echo_piyo | 0:3555e86bf40d | 3 | |
echo_piyo | 0:3555e86bf40d | 4 | CyclicIo::CyclicIo(PinName pin) : gpio(pin){ |
echo_piyo | 0:3555e86bf40d | 5 | } |
echo_piyo | 0:3555e86bf40d | 6 | |
echo_piyo | 0:3555e86bf40d | 7 | void CyclicIo::cyclic(int state){ |
echo_piyo | 0:3555e86bf40d | 8 | if(state) { |
echo_piyo | 0:3555e86bf40d | 9 | if(flag == false) { |
echo_piyo | 0:3555e86bf40d | 10 | gpio = !gpio; |
echo_piyo | 0:3555e86bf40d | 11 | } |
echo_piyo | 0:3555e86bf40d | 12 | flag = true; |
echo_piyo | 0:3555e86bf40d | 13 | } else flag = false; |
echo_piyo | 0:3555e86bf40d | 14 | } |
echo_piyo | 0:3555e86bf40d | 15 | |
echo_piyo | 0:3555e86bf40d | 16 | int CyclicIo::getState(){ |
echo_piyo | 0:3555e86bf40d | 17 | return (int)gpio; |
echo_piyo | 0:3555e86bf40d | 18 | } |