Ryo Od / ExioBufferdController
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers ExioBufferedIn.h Source File

ExioBufferedIn.h

00001 /*
00002  * ExioBufferdIn.h
00003  *
00004  * Created: 2016.11.05
00005  *
00006  */
00007 #ifndef _EXIOBUFFEREDIN_H_
00008 #define _EXIOBUFFEREDIN_H_
00009 
00010 #include "mbed.h"
00011 #include "rtos.h"
00012 #include "ExioInBuffer.h"
00013 
00014 class ExioBufferedIn
00015 {
00016 public:
00017     ExioBufferedIn(ExioInBuffer* buffer, int pin) :
00018         _buffer(buffer),
00019         _pin(pin)
00020     {
00021         
00022     }
00023     
00024     ~ExioBufferedIn() {}
00025     
00026     void mode(PinMode pull)
00027     {
00028         // Todo: impliment pullmode
00029         if (pull != PullUp) {
00030             error("ExioBufferedIn::mode() is not impl");
00031         }  
00032     }
00033     
00034     int read()
00035     {
00036         uint8_t v = _buffer->readPort();
00037         return (v & (1 << _pin)) ? 1 : 0;
00038     }
00039     
00040 protected:
00041     ExioInBuffer* _buffer;
00042     int _pin;
00043 };
00044 
00045 #endif //_EXIOBUFFEREDIN_H_