にいむら にいむら
/
mainboardnrp2018
unkounko
Input/Switch/Switch.cpp@0:562021ed1ba9, 2018-01-13 (annotated)
- Committer:
- t_yamamoto
- Date:
- Sat Jan 13 13:33:09 2018 +0000
- Revision:
- 0:562021ed1ba9
- Child:
- 1:e73cf2469f83
NaganoNCT-MainBoardNRP2018
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), |
t_yamamoto | 0:562021ed1ba9 | 7 | DigitalIn(LIMITSW2_PIN), |
t_yamamoto | 0:562021ed1ba9 | 8 | DigitalIn(LIMITSW3_PIN), |
t_yamamoto | 0:562021ed1ba9 | 9 | DigitalIn(LIMITSW4_PIN), |
t_yamamoto | 0:562021ed1ba9 | 10 | }; |
t_yamamoto | 0:562021ed1ba9 | 11 | |
t_yamamoto | 0:562021ed1ba9 | 12 | namespace SWITCH |
t_yamamoto | 0:562021ed1ba9 | 13 | { |
t_yamamoto | 0:562021ed1ba9 | 14 | void Switch::Initialize(void) { |
t_yamamoto | 0:562021ed1ba9 | 15 | for(uint8_t i = 0; i < MOUNTING_LIMITSW_NUM; i++) limitSw[i].mode(PullUp); |
t_yamamoto | 0:562021ed1ba9 | 16 | } |
t_yamamoto | 0:562021ed1ba9 | 17 | |
t_yamamoto | 0:562021ed1ba9 | 18 | bool Switch::checkPushed(int mySwitch) { |
t_yamamoto | 0:562021ed1ba9 | 19 | return mySwitch ? false : true; |
t_yamamoto | 0:562021ed1ba9 | 20 | } |
t_yamamoto | 0:562021ed1ba9 | 21 | } |
t_yamamoto | 0:562021ed1ba9 | 22 |