MCP23S17 Bufferd

Committer:
ryood
Date:
Fri Nov 04 20:44:41 2016 +0000
Revision:
3:8be680035a08
Child:
4:acd6e59f8544
ExioBufferdIn?RtosTimer????????????????????run()??????

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ryood 3:8be680035a08 1 /*
ryood 3:8be680035a08 2 * ExioBufferdIn.h
ryood 3:8be680035a08 3 *
ryood 3:8be680035a08 4 * Created: 2016.11.05
ryood 3:8be680035a08 5 *
ryood 3:8be680035a08 6 */
ryood 3:8be680035a08 7 #ifndef _EXIOBUFFEREDIN_H_
ryood 3:8be680035a08 8 #define _EXIOBUFFEREDIN_H_
ryood 3:8be680035a08 9
ryood 3:8be680035a08 10 #include "mbed.h"
ryood 3:8be680035a08 11 #include "rtos.h"
ryood 3:8be680035a08 12 #include "ExioInBuffer.h"
ryood 3:8be680035a08 13
ryood 3:8be680035a08 14 class ExioBufferedIn
ryood 3:8be680035a08 15 {
ryood 3:8be680035a08 16 public:
ryood 3:8be680035a08 17 ExioBufferedIn(ExioInBuffer* buffer, int pin) :
ryood 3:8be680035a08 18 _buffer(buffer),
ryood 3:8be680035a08 19 _pin(pin)
ryood 3:8be680035a08 20 {
ryood 3:8be680035a08 21
ryood 3:8be680035a08 22 }
ryood 3:8be680035a08 23
ryood 3:8be680035a08 24 ~ExioBufferedIn() {}
ryood 3:8be680035a08 25
ryood 3:8be680035a08 26 void mode(PinMode pull)
ryood 3:8be680035a08 27 {
ryood 3:8be680035a08 28 // Todo: impliment pullmode
ryood 3:8be680035a08 29 }
ryood 3:8be680035a08 30
ryood 3:8be680035a08 31 int read()
ryood 3:8be680035a08 32 {
ryood 3:8be680035a08 33 uint8_t v = _buffer->readPort();
ryood 3:8be680035a08 34 return (v & (1 << _pin)) ? 1 : 0;
ryood 3:8be680035a08 35 }
ryood 3:8be680035a08 36
ryood 3:8be680035a08 37 protected:
ryood 3:8be680035a08 38 ExioInBuffer* _buffer;
ryood 3:8be680035a08 39 int _pin;
ryood 3:8be680035a08 40 };
ryood 3:8be680035a08 41
ryood 3:8be680035a08 42 #endif //_EXIOBUFFEREDIN_H_