Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: CompLedDvr/LedPwmOut.h
- Revision:
- 0:da1fe3fe7093
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/CompLedDvr/LedPwmOut.h Wed Mar 04 04:12:53 2015 +0000
@@ -0,0 +1,62 @@
+/** LedPwmOut class for LED driver component
+ *
+ * @author Akifumi (Tedd) OKANO, NXP Semiconductors
+ * @version 0.5
+ * @date 04-Mar-2015
+ *
+ * Released under the Apache 2 license License
+ */
+
+#ifndef MBED_LedPwmOut
+#define MBED_LedPwmOut
+
+#include "mbed.h"
+#include "CompLedDvr.h"
+
+/** LedPwmOut class
+ *
+ * "LedPwmOut" class works like "PwmOut" class of mbed-SDK.
+ * This class provides API on device's pin level with abstracting the LED controller.
+ *
+ * Example:
+ * @code
+ * #include "mbed.h"
+ * #include "PCA9632.h"
+ *
+ * PCA9632 led_cntlr( p28, p27, 0xC4 ); // SDA, SCL, Slave_address(option)
+ * LedPwmOut led( led_cntlr, L0 );
+ *
+ * int main()
+ * {
+ * while( 1 ) {
+ * for( float p = 0.0f; p < 1.0f; p += 0.1f ) {
+ * led = p;
+ * wait( 0.1 );
+ * }
+ * }
+ * }
+ * @endcode
+ */
+
+
+class LedPwmOut
+{
+public:
+ LedPwmOut( CompLedDvr &ledp, LedPinName pin_name );
+ virtual ~LedPwmOut();
+
+ virtual void pwm( float v );
+
+ /** A shorthand for write()
+ */
+ LedPwmOut& operator= ( float rhs );
+
+private:
+ CompLedDvr *leddvrp;
+ LedPinName pin;
+
+ void pwm( int pin, float value );
+}
+;
+
+#endif // MBED_LedPwmOut
PCA9632 : 4ch LED driver (voltage switch type)