Abstract class for LED driver component. Including "LedPwmOut API" class.

Dependents:   PCA962x PCA9632

Embed: (wiki syntax)

« Back to documentation index

LedPwmOut Class Reference

LedPwmOut Class Reference

LedPwmOut class. More...

#include <LedPwmOut.h>

Public Member Functions

 LedPwmOut (CompLedDvr &ledp, LedPinName pin_name)
 Create a LedPwmOutCC instance connected to a pin on the LED driver A pin which performs PWM and constant current sink.
virtual ~LedPwmOut ()
 Destractor.
virtual void pwm (float v)
 Set PWM duty-cycle.
LedPwmOutoperator= (float rhs)
 A shorthand for pwm()

Detailed Description

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:

  #include "mbed.h"
  #include "PCA9626.h"
  
  PCA9626     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 );
          }
      }
  }

Definition at line 42 of file LedPwmOut.h.


Constructor & Destructor Documentation

LedPwmOut ( CompLedDvr ledp,
LedPinName  pin_name 
)

Create a LedPwmOutCC instance connected to a pin on the LED driver A pin which performs PWM and constant current sink.

Parameters:
ledpInstance of a device (LED driver)
pin_nameSpecifying pin by LedPinName like 'L7'.
Note:
Pin names of LED driver are defined like L0, L1, L2.. It is not like "LED0". Because we cannot use mbed reserved symbols.

Definition at line 4 of file LedPwmOut.cpp.

~LedPwmOut (  ) [virtual]

Destractor.

Definition at line 10 of file LedPwmOut.cpp.


Member Function Documentation

LedPwmOut & operator= ( float  rhs )

A shorthand for pwm()

Definition at line 19 of file LedPwmOut.cpp.

void pwm ( float  v ) [virtual]

Set PWM duty-cycle.

Parameters:
vRatio of duty-cycle. '0.0' for 0 %. '1.0' for 99.6 % on PCA9956A and 100 % for PCA9955A.

Definition at line 14 of file LedPwmOut.cpp.