unkounko

Dependencies:   mbed Servo

Input/Switch/Switch.cpp

Committer:
niimurasyou
Date:
2019-02-25
Revision:
11:88f17bc0724f
Parent:
1:e73cf2469f83

File content as of revision 11:88f17bc0724f:

#include "Switch.h"
#include <stdint.h>

DigitalIn limitSw[] = {
    DigitalIn(LIMITSW0_PIN),
    DigitalIn(LIMITSW1_PIN),
 //   DigitalIn(LIMITSW2_PIN),
 //   DigitalIn(LIMITSW3_PIN),
};

namespace SWITCH
{
    void Switch::Initialize(void) {
        for(uint8_t i = 0; i < MOUNTING_LIMITSW_NUM; i++) limitSw[i].mode(PullUp);
    }

    bool Switch::checkPushed(int mySwitch) {
        return  limitSw[mySwitch] ? false : true;
    }
}