![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
If you wont to knock me down, look this file...
Input/Switch/Switch.cpp@0:4df75b08b14a, 2019-05-03 (annotated)
- Committer:
- Ryosei
- Date:
- Fri May 03 11:47:27 2019 +0000
- Revision:
- 0:4df75b08b14a
a
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Ryosei | 0:4df75b08b14a | 1 | #include "Switch.h" |
Ryosei | 0:4df75b08b14a | 2 | #include <stdint.h> |
Ryosei | 0:4df75b08b14a | 3 | |
Ryosei | 0:4df75b08b14a | 4 | DigitalIn limitSw[] = { |
Ryosei | 0:4df75b08b14a | 5 | DigitalIn(LIMITSW0_PIN), |
Ryosei | 0:4df75b08b14a | 6 | DigitalIn(LIMITSW1_PIN), |
Ryosei | 0:4df75b08b14a | 7 | DigitalIn(LIMITSW2_PIN), |
Ryosei | 0:4df75b08b14a | 8 | DigitalIn(LIMITSW3_PIN), |
Ryosei | 0:4df75b08b14a | 9 | }; |
Ryosei | 0:4df75b08b14a | 10 | |
Ryosei | 0:4df75b08b14a | 11 | namespace SWITCH |
Ryosei | 0:4df75b08b14a | 12 | { |
Ryosei | 0:4df75b08b14a | 13 | void Switch::Initialize(void) { |
Ryosei | 0:4df75b08b14a | 14 | for(uint8_t i = 0; i < MOUNTING_LIMITSW_NUM; i++) limitSw[i].mode(PullUp); |
Ryosei | 0:4df75b08b14a | 15 | } |
Ryosei | 0:4df75b08b14a | 16 | |
Ryosei | 0:4df75b08b14a | 17 | bool Switch::checkPushed(int mySwitch) { |
Ryosei | 0:4df75b08b14a | 18 | return mySwitch ? false : true; |
Ryosei | 0:4df75b08b14a | 19 | } |
Ryosei | 0:4df75b08b14a | 20 | } |