gfdgd
Fork of PCA995xA by
Diff: PCA9956A/PCA9956A.h
- Revision:
- 4:fe221e1d4f44
- Parent:
- 2:eeea2e848b81
- Child:
- 5:cb07190e05e7
--- a/PCA9956A/PCA9956A.h Wed Mar 04 10:27:55 2015 +0000 +++ b/PCA9956A/PCA9956A.h Thu Mar 19 08:40:03 2015 +0000 @@ -5,8 +5,8 @@ * * @class PCA9956A * @author Akifumi (Tedd) OKANO, NXP Semiconductors - * @version 0.5 - * @date 25-Feb-2015 + * @version 0.6 + * @date 19-Mar-2015 * * Released under the Apache 2 license * @@ -28,11 +28,15 @@ * Detail information is available on next URL. * http://www.nxp.com/products/interface_and_connectivity/i2c/i2c_led_display_control/PCA9956ATW.html * + * Next sample code shows operation based on low-level-API (operated by just device instane) + * * Example: * @code - * #include "mbed.h" + * // PCA9956A operation sample using its device instance * + * #include "mbed.h" * #include "PCA9956A.h" + * * PCA9956A led_cntlr( p28, p27, 0x02 ); // SDA, SCL, Slave_address(option) * * int main() @@ -50,11 +54,82 @@ * } * } * @endcode + * + * The high-level-API:LedPwmOutCC is also available. + * It can be used like next sample code. + * + * @code + * // PCA9956A operation sample using high-level-API + * + * #include "mbed.h" + * #include "PCA9956A.h" + * + * PCA9956A led_cntlr( p28, p27, 0x02 ); // SDA, SCL, Slave_address(option) + * LedPwmOutCC led0( led_cntlr, L0 ); // Instance for LED0 pin + * LedPwmOutCC led1( led_cntlr, L1 ); // Instance for LED1 pin + * LedPwmOutCC led2( led_cntlr, L2 ); // Instance for LED2 pin + * + * int main() + * { + * led0.current( 0.5 ); // LED0 pin current output setting to 50% + * led1.current( 0.5 ); // LED1 pin current output setting to 50% + * led2.current( 0.5 ); // LED2 pin current output setting to 50% + * + * while(1) { + * + * for ( float p = 1.0; p >= 0.0; p -= 0.01 ) { + * led0 = p; // Set LED0 output PWM dutycycle as 'p' + * wait( 0.01 ); + * } + * + * for ( float p = 1.0; p >= 0.0; p -= 0.01 ) { + * led1 = p; // Set LED1 output PWM dutycycle as 'p' + * wait( 0.01 ); + * } + * + * for ( float p = 1.0; p >= 0.0; p -= 0.01 ) { + * led2 = p; // Set LED2 output PWM dutycycle as 'p' + * wait( 0.01 ); + * } + * } + * } + * @endcode */ - class PCA9956A : public PCA995xA { public: + +#if DOXYGEN_ONLY + /** PCA9956A pin names high-level API i.e. LedPwmOutCC */ + typedef enum { + L0, /**< LED0 pin */ + L1, /**< LED1 pin */ + L2, /**< LED2 pin */ + L3, /**< LED3 pin */ + L4, /**< LED4 pin */ + L5, /**< LED5 pin */ + L6, /**< LED6 pin */ + L7, /**< LED7 pin */ + L8, /**< LED8 pin */ + L9, /**< LED9 pin */ + L10, /**< LED10 pin */ + L11, /**< LED11 pin */ + L12, /**< LED12 pin */ + L13, /**< LED13 pin */ + L14, /**< LED14 pin */ + L15, /**< LED15 pin */ + L16, /**< LED16 pin */ + L17, /**< LED17 pin */ + L18, /**< LED18 pin */ + L19, /**< LED19 pin */ + L20, /**< LED20 pin */ + L21, /**< LED21 pin */ + L22, /**< LED22 pin */ + L23, /**< LED23 pin */ + L_NC = ~0x0L /**< for when the pin is left no-connection */ + } LedPinName; +#endif // DOXYGEN_ONLY + /** Name of the PCA9956A registers */ enum command_reg { MODE1, MODE2,