にいむら にいむら
/
NRPmainprogram2019
aa
Input/Switch/Switch.cpp@0:2e7a61458dc3, 2019-01-28 (annotated)
- Committer:
- M_souta
- Date:
- Mon Jan 28 08:34:36 2019 +0000
- Revision:
- 0:2e7a61458dc3
- Child:
- 1:e1e9671724e7
NRP2019
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
M_souta | 0:2e7a61458dc3 | 1 | #include "Switch.h" |
M_souta | 0:2e7a61458dc3 | 2 | #include <stdint.h> |
M_souta | 0:2e7a61458dc3 | 3 | |
M_souta | 0:2e7a61458dc3 | 4 | DigitalIn limitSw[] = { |
M_souta | 0:2e7a61458dc3 | 5 | DigitalIn(LIMITSW0_PIN), |
M_souta | 0:2e7a61458dc3 | 6 | DigitalIn(LIMITSW1_PIN), |
M_souta | 0:2e7a61458dc3 | 7 | DigitalIn(LIMITSW2_PIN), |
M_souta | 0:2e7a61458dc3 | 8 | DigitalIn(LIMITSW3_PIN), |
M_souta | 0:2e7a61458dc3 | 9 | }; |
M_souta | 0:2e7a61458dc3 | 10 | |
M_souta | 0:2e7a61458dc3 | 11 | namespace SWITCH |
M_souta | 0:2e7a61458dc3 | 12 | { |
M_souta | 0:2e7a61458dc3 | 13 | void Switch::Initialize(void){ |
M_souta | 0:2e7a61458dc3 | 14 | for(int i = 0 ; i < MOUNTING_LIMITSW_NUM; i++){ |
M_souta | 0:2e7a61458dc3 | 15 | limitSw[i].mode(PullUp); |
M_souta | 0:2e7a61458dc3 | 16 | } |
M_souta | 0:2e7a61458dc3 | 17 | } |
M_souta | 0:2e7a61458dc3 | 18 | |
M_souta | 0:2e7a61458dc3 | 19 | bool Switch::CheckPushed(int SwitchNumber){ |
M_souta | 0:2e7a61458dc3 | 20 | return SwitchNumber ? false : true ; |
M_souta | 0:2e7a61458dc3 | 21 | } |
M_souta | 0:2e7a61458dc3 | 22 | } |