The PCAL9555, PCAL9554 series is a low-voltage 16-bit/8-bit General Purpose Input/Output (GPIO) expander with interrupt. This conponent library is compatible to basic operation os GPIO expanders: PCAL9555, PCA9555, PCA9535, PCA9539, PCAL9554, PCA9554 and PCA9538. On addition to this, this library is including mbed-SDK-style APIs. APIs that similar to DigitaiInOut, DigitalOut, DigitalIn, BusInOUt, BusOut and BusIn are available.
Dependents: PCAL9555_Hello OM13082-JoyStick OM13082_LED OM13082-test ... more
GpioDigitalIn.h
00001 /** GpioDigitalIn API for GPIO-expander component class 00002 * 00003 * @author Akifumi (Tedd) OKANO, NXP Semiconductors 00004 * @version 0.6 00005 * @date 19-Mar-2015 00006 * 00007 * Released under the Apache 2 license 00008 */ 00009 00010 #ifndef MBED_GpioDigitalIn 00011 #define MBED_GpioDigitalIn 00012 00013 #include "mbed.h" 00014 #include "GpioDigitalInOut.h" 00015 00016 /** GpioDigitalIn class 00017 * 00018 * @class GpioDigitalIn 00019 * 00020 * "GpioDigitalIn" class works like "DigitalIn" class of mbed-SDK. 00021 * This class provides pin oriented API, abstracting the GPIO-expander chip. 00022 * 00023 * Example: 00024 * @code 00025 * #include "mbed.h" 00026 * #include "PCAL9555.h" 00027 * 00028 * PCAL9555 gpio_exp( p28, p27, 0xE8 ); // SDA, SCL, Slave_address(option) 00029 * GpioDigitalOut pin( gpio_exp, X0_0 ); 00030 * 00031 * GpioDigitalIn enable( gpio_exp, X0_0 ); 00032 * DigitalOut led( LED1 ); 00033 * 00034 * int main() { 00035 * while(1) { 00036 * if( enable ) { 00037 * led = !led; 00038 * } 00039 * wait(0.25); 00040 * } 00041 * } 00042 * @endcode 00043 */ 00044 class GpioDigitalIn : public GpioDigitalInOut 00045 { 00046 public: 00047 00048 #if DOXYGEN_ONLY 00049 /** GPIO-Expander pin names */ 00050 typedef enum { 00051 X0_0, /**< P0_0 pin */ 00052 X0_1, /**< P0_1 pin */ 00053 X0_2, /**< P0_2 pin */ 00054 X0_3, /**< P0_3 pin */ 00055 X0_4, /**< P0_4 pin */ 00056 X0_5, /**< P0_5 pin */ 00057 X0_6, /**< P0_6 pin */ 00058 X0_7, /**< P0_7 pin */ 00059 X1_0, /**< P1_0 pin (for 16-bit GPIO device only) */ 00060 X1_1, /**< P1_1 pin (for 16-bit GPIO device only) */ 00061 X1_2, /**< P1_2 pin (for 16-bit GPIO device only) */ 00062 X1_3, /**< P1_3 pin (for 16-bit GPIO device only) */ 00063 X1_4, /**< P1_4 pin (for 16-bit GPIO device only) */ 00064 X1_5, /**< P1_5 pin (for 16-bit GPIO device only) */ 00065 X1_6, /**< P1_6 pin (for 16-bit GPIO device only) */ 00066 X1_7, /**< P1_7 pin (for 16-bit GPIO device only) */ 00067 X0 = X0_0, /**< P0_0 pin */ 00068 X1 = X0_1, /**< P0_1 pin */ 00069 X2 = X0_2, /**< P0_2 pin */ 00070 X3 = X0_3, /**< P0_3 pin */ 00071 X4 = X0_4, /**< P0_4 pin */ 00072 X5 = X0_5, /**< P0_5 pin */ 00073 X6 = X0_6, /**< P0_6 pin */ 00074 X7 = X0_7, /**< P0_7 pin */ 00075 X8 = X1_0, /**< P1_0 pin (for 16-bit GPIO device only) */ 00076 X9 = X1_1, /**< P1_1 pin (for 16-bit GPIO device only) */ 00077 X10 = X1_2, /**< P1_2 pin (for 16-bit GPIO device only) */ 00078 X11 = X1_3, /**< P1_3 pin (for 16-bit GPIO device only) */ 00079 X12 = X1_4, /**< P1_4 pin (for 16-bit GPIO device only) */ 00080 X13 = X1_5, /**< P1_5 pin (for 16-bit GPIO device only) */ 00081 X14 = X1_6, /**< P1_6 pin (for 16-bit GPIO device only) */ 00082 X15 = X1_7, /**< P1_7 pin (for 16-bit GPIO device only) */ 00083 00084 X_NC = ~0x0L /**< for when the pin is left no-connection */ 00085 } GpioPinName; 00086 #endif 00087 00088 /** Create a GpioDigitalInOut connected to the specified pin 00089 * 00090 * @param gpiop Instance of GPIO expander device 00091 * @param pin_name DigitalInOut pin to connect to 00092 */ 00093 GpioDigitalIn( CompGpioExp &gpiop, GpioPinName pin_name ); 00094 00095 /** 00096 * Destractor 00097 */ 00098 virtual ~GpioDigitalIn(); 00099 00100 private: 00101 GpioDigitalIn& operator= ( int rhs ); 00102 GpioDigitalIn& operator= ( GpioDigitalIn& rhs ); 00103 } 00104 ; 00105 00106 #endif // MBED_GpioDigitalIn
Generated on Tue Jul 12 2022 18:40:41 by 1.7.2