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.
This is a copy of the PCA9555 library by Akifumi "Tedd" OKANO, which is compatible with PCAL6416A chip.
base_classes/CompGpioExp/CompGpioExp.h@0:035111d3d631, 2017-02-15 (annotated)
- Committer:
- andriym
- Date:
- Wed Feb 15 10:07:59 2017 +0000
- Revision:
- 0:035111d3d631
A change of name for the PCAL955x library to make it searchable for people needing PCAL6416A library.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
andriym | 0:035111d3d631 | 1 | /** GPIO expander abstraction class |
andriym | 0:035111d3d631 | 2 | * |
andriym | 0:035111d3d631 | 3 | * No instance can be made from this class |
andriym | 0:035111d3d631 | 4 | * |
andriym | 0:035111d3d631 | 5 | * @class CompGpioExp |
andriym | 0:035111d3d631 | 6 | * @author Akifumi (Tedd) OKANO, NXP Semiconductors |
andriym | 0:035111d3d631 | 7 | * @version 0.6 |
andriym | 0:035111d3d631 | 8 | * @date 19-Mar-2015 |
andriym | 0:035111d3d631 | 9 | * |
andriym | 0:035111d3d631 | 10 | * Released under the Apache 2 license |
andriym | 0:035111d3d631 | 11 | */ |
andriym | 0:035111d3d631 | 12 | |
andriym | 0:035111d3d631 | 13 | #ifndef MBED_CompGpioExp |
andriym | 0:035111d3d631 | 14 | #define MBED_CompGpioExp |
andriym | 0:035111d3d631 | 15 | |
andriym | 0:035111d3d631 | 16 | #include "mbed.h" |
andriym | 0:035111d3d631 | 17 | |
andriym | 0:035111d3d631 | 18 | typedef enum { |
andriym | 0:035111d3d631 | 19 | // GPIO Expander pin names |
andriym | 0:035111d3d631 | 20 | X0_0, /**< P0_0 pin */ |
andriym | 0:035111d3d631 | 21 | X0_1, /**< P0_1 pin */ |
andriym | 0:035111d3d631 | 22 | X0_2, /**< P0_2 pin */ |
andriym | 0:035111d3d631 | 23 | X0_3, /**< P0_3 pin */ |
andriym | 0:035111d3d631 | 24 | X0_4, /**< P0_4 pin */ |
andriym | 0:035111d3d631 | 25 | X0_5, /**< P0_5 pin */ |
andriym | 0:035111d3d631 | 26 | X0_6, /**< P0_6 pin */ |
andriym | 0:035111d3d631 | 27 | X0_7, /**< P0_7 pin */ |
andriym | 0:035111d3d631 | 28 | X1_0, /**< P1_0 pin (for 16-bit GPIO device only) */ |
andriym | 0:035111d3d631 | 29 | X1_1, /**< P1_1 pin (for 16-bit GPIO device only) */ |
andriym | 0:035111d3d631 | 30 | X1_2, /**< P1_2 pin (for 16-bit GPIO device only) */ |
andriym | 0:035111d3d631 | 31 | X1_3, /**< P1_3 pin (for 16-bit GPIO device only) */ |
andriym | 0:035111d3d631 | 32 | X1_4, /**< P1_4 pin (for 16-bit GPIO device only) */ |
andriym | 0:035111d3d631 | 33 | X1_5, /**< P1_5 pin (for 16-bit GPIO device only) */ |
andriym | 0:035111d3d631 | 34 | X1_6, /**< P1_6 pin (for 16-bit GPIO device only) */ |
andriym | 0:035111d3d631 | 35 | X1_7, /**< P1_7 pin (for 16-bit GPIO device only) */ |
andriym | 0:035111d3d631 | 36 | X0 = X0_0, /**< P0_0 pin */ |
andriym | 0:035111d3d631 | 37 | X1 = X0_1, /**< P0_1 pin */ |
andriym | 0:035111d3d631 | 38 | X2 = X0_2, /**< P0_2 pin */ |
andriym | 0:035111d3d631 | 39 | X3 = X0_3, /**< P0_3 pin */ |
andriym | 0:035111d3d631 | 40 | X4 = X0_4, /**< P0_4 pin */ |
andriym | 0:035111d3d631 | 41 | X5 = X0_5, /**< P0_5 pin */ |
andriym | 0:035111d3d631 | 42 | X6 = X0_6, /**< P0_6 pin */ |
andriym | 0:035111d3d631 | 43 | X7 = X0_7, /**< P0_7 pin */ |
andriym | 0:035111d3d631 | 44 | X8 = X1_0, /**< P1_0 pin (for 16-bit GPIO device only) */ |
andriym | 0:035111d3d631 | 45 | X9 = X1_1, /**< P1_1 pin (for 16-bit GPIO device only) */ |
andriym | 0:035111d3d631 | 46 | X10 = X1_2, /**< P1_2 pin (for 16-bit GPIO device only) */ |
andriym | 0:035111d3d631 | 47 | X11 = X1_3, /**< P1_3 pin (for 16-bit GPIO device only) */ |
andriym | 0:035111d3d631 | 48 | X12 = X1_4, /**< P1_4 pin (for 16-bit GPIO device only) */ |
andriym | 0:035111d3d631 | 49 | X13 = X1_5, /**< P1_5 pin (for 16-bit GPIO device only) */ |
andriym | 0:035111d3d631 | 50 | X14 = X1_6, /**< P1_6 pin (for 16-bit GPIO device only) */ |
andriym | 0:035111d3d631 | 51 | X15 = X1_7, /**< P1_7 pin (for 16-bit GPIO device only) */ |
andriym | 0:035111d3d631 | 52 | X_NC = ~0x0L /**< for when the pin is left no-connection */ |
andriym | 0:035111d3d631 | 53 | } GpioPinName; |
andriym | 0:035111d3d631 | 54 | |
andriym | 0:035111d3d631 | 55 | /** Abstract class for GPIO expander devices |
andriym | 0:035111d3d631 | 56 | * |
andriym | 0:035111d3d631 | 57 | * No instance can be made from this class |
andriym | 0:035111d3d631 | 58 | */ |
andriym | 0:035111d3d631 | 59 | class CompGpioExp |
andriym | 0:035111d3d631 | 60 | { |
andriym | 0:035111d3d631 | 61 | public: |
andriym | 0:035111d3d631 | 62 | CompGpioExp(); |
andriym | 0:035111d3d631 | 63 | virtual ~CompGpioExp(); |
andriym | 0:035111d3d631 | 64 | |
andriym | 0:035111d3d631 | 65 | virtual void write( int pin, int value ) = 0; |
andriym | 0:035111d3d631 | 66 | virtual int read( int pin ) = 0; |
andriym | 0:035111d3d631 | 67 | virtual void configure( int pin, int value ) = 0; |
andriym | 0:035111d3d631 | 68 | virtual int read( void ) = 0; |
andriym | 0:035111d3d631 | 69 | virtual void write_with_mask( int bitpattern, int mask_bits ) = 0; |
andriym | 0:035111d3d631 | 70 | virtual void configure_with_mask( int bitpattern, int mask_bits ) = 0; |
andriym | 0:035111d3d631 | 71 | } |
andriym | 0:035111d3d631 | 72 | ; |
andriym | 0:035111d3d631 | 73 | |
andriym | 0:035111d3d631 | 74 | #endif // MBED_CompGpioExp |
andriym | 0:035111d3d631 | 75 | |
andriym | 0:035111d3d631 | 76 |