Miya Miyagawa
/
OREWOTAOSITAI
aaaaa
Input/Switch/Switch.cpp@12:8321e464475f, 2019-02-25 (annotated)
- Committer:
- Ryosei
- Date:
- Mon Feb 25 06:44:02 2019 +0000
- Revision:
- 12:8321e464475f
- Parent:
- 11:88f17bc0724f
unko
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
t_yamamoto | 0:562021ed1ba9 | 1 | #include "Switch.h" |
t_yamamoto | 0:562021ed1ba9 | 2 | #include <stdint.h> |
t_yamamoto | 0:562021ed1ba9 | 3 | |
t_yamamoto | 0:562021ed1ba9 | 4 | DigitalIn limitSw[] = { |
t_yamamoto | 0:562021ed1ba9 | 5 | DigitalIn(LIMITSW0_PIN), |
t_yamamoto | 0:562021ed1ba9 | 6 | DigitalIn(LIMITSW1_PIN), |
niimurasyou | 11:88f17bc0724f | 7 | // DigitalIn(LIMITSW2_PIN), |
niimurasyou | 11:88f17bc0724f | 8 | // DigitalIn(LIMITSW3_PIN), |
t_yamamoto | 0:562021ed1ba9 | 9 | }; |
t_yamamoto | 0:562021ed1ba9 | 10 | |
t_yamamoto | 0:562021ed1ba9 | 11 | namespace SWITCH |
t_yamamoto | 0:562021ed1ba9 | 12 | { |
t_yamamoto | 0:562021ed1ba9 | 13 | void Switch::Initialize(void) { |
t_yamamoto | 0:562021ed1ba9 | 14 | for(uint8_t i = 0; i < MOUNTING_LIMITSW_NUM; i++) limitSw[i].mode(PullUp); |
t_yamamoto | 0:562021ed1ba9 | 15 | } |
t_yamamoto | 0:562021ed1ba9 | 16 | |
t_yamamoto | 0:562021ed1ba9 | 17 | bool Switch::checkPushed(int mySwitch) { |
niimurasyou | 11:88f17bc0724f | 18 | return limitSw[mySwitch] ? false : true; |
t_yamamoto | 0:562021ed1ba9 | 19 | } |
t_yamamoto | 0:562021ed1ba9 | 20 | } |