The PCAL6416A is a low-voltage 16-bit general purpose I/O (GPIO) expander with interrupt. This component library is compatible to basic operation as GPIO expanders: PCAL6416A, 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.
CompGpioExp.h
00001 /** GPIO expander abstraction class 00002 * 00003 * No instance can be made from this class 00004 * 00005 * @class CompGpioExp 00006 * @author Akifumi (Tedd) OKANO, NXP Semiconductors 00007 * @version 0.6 00008 * @date 19-Mar-2015 00009 * 00010 * Released under the Apache 2 license 00011 */ 00012 00013 #ifndef MBED_CompGpioExp 00014 #define MBED_CompGpioExp 00015 00016 #include "mbed.h" 00017 00018 typedef enum { 00019 // GPIO Expander pin names 00020 X0_0, /**< P0_0 pin */ 00021 X0_1, /**< P0_1 pin */ 00022 X0_2, /**< P0_2 pin */ 00023 X0_3, /**< P0_3 pin */ 00024 X0_4, /**< P0_4 pin */ 00025 X0_5, /**< P0_5 pin */ 00026 X0_6, /**< P0_6 pin */ 00027 X0_7, /**< P0_7 pin */ 00028 X1_0, /**< P1_0 pin (for 16-bit GPIO device only) */ 00029 X1_1, /**< P1_1 pin (for 16-bit GPIO device only) */ 00030 X1_2, /**< P1_2 pin (for 16-bit GPIO device only) */ 00031 X1_3, /**< P1_3 pin (for 16-bit GPIO device only) */ 00032 X1_4, /**< P1_4 pin (for 16-bit GPIO device only) */ 00033 X1_5, /**< P1_5 pin (for 16-bit GPIO device only) */ 00034 X1_6, /**< P1_6 pin (for 16-bit GPIO device only) */ 00035 X1_7, /**< P1_7 pin (for 16-bit GPIO device only) */ 00036 X0 = X0_0, /**< P0_0 pin */ 00037 X1 = X0_1, /**< P0_1 pin */ 00038 X2 = X0_2, /**< P0_2 pin */ 00039 X3 = X0_3, /**< P0_3 pin */ 00040 X4 = X0_4, /**< P0_4 pin */ 00041 X5 = X0_5, /**< P0_5 pin */ 00042 X6 = X0_6, /**< P0_6 pin */ 00043 X7 = X0_7, /**< P0_7 pin */ 00044 X8 = X1_0, /**< P1_0 pin (for 16-bit GPIO device only) */ 00045 X9 = X1_1, /**< P1_1 pin (for 16-bit GPIO device only) */ 00046 X10 = X1_2, /**< P1_2 pin (for 16-bit GPIO device only) */ 00047 X11 = X1_3, /**< P1_3 pin (for 16-bit GPIO device only) */ 00048 X12 = X1_4, /**< P1_4 pin (for 16-bit GPIO device only) */ 00049 X13 = X1_5, /**< P1_5 pin (for 16-bit GPIO device only) */ 00050 X14 = X1_6, /**< P1_6 pin (for 16-bit GPIO device only) */ 00051 X15 = X1_7, /**< P1_7 pin (for 16-bit GPIO device only) */ 00052 X_NC = ~0x0L /**< for when the pin is left no-connection */ 00053 } GpioPinName; 00054 00055 /** Abstract class for GPIO expander devices 00056 * 00057 * No instance can be made from this class 00058 */ 00059 class CompGpioExp 00060 { 00061 public: 00062 CompGpioExp(); 00063 virtual ~CompGpioExp(); 00064 00065 virtual void write( int pin, int value ) = 0; 00066 virtual int read( int pin ) = 0; 00067 virtual void configure( int pin, int value ) = 0; 00068 virtual int read( void ) = 0; 00069 virtual void write_with_mask( int bitpattern, int mask_bits ) = 0; 00070 virtual void configure_with_mask( int bitpattern, int mask_bits ) = 0; 00071 } 00072 ; 00073 00074 #endif // MBED_CompGpioExp 00075 00076
Generated on Tue Jul 12 2022 14:15:36 by 1.7.2