Abstract class for 'constant current (CC)' LED driver component. Including "LedPwmOutCC API" class.

Dependents:   PCA995xA

Embed: (wiki syntax)

« Back to documentation index

LedPwmOutCC Class Reference

LedPwmOutCC Class Reference

LedPwmOutCC class. More...

#include <LedPwmOutCC.h>

Public Member Functions

 LedPwmOutCC (CompLedDvrCC &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 ~LedPwmOutCC ()
 Destractor.
virtual void pwm (float v)
 Set PWM duty-cycle.
virtual void current (float v)
 Set output current.
LedPwmOutCCoperator= (float rhs)
 A shorthand for pwm()

Detailed Description

LedPwmOutCC class.

"LedPwmOutCC" 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 "PCA9956A.h"
  
  PCA9956A    led_cntlr( p28, p27, 0xC4 );  //  SDA, SCL, Slave_address(option)
  LedPwmOutCC 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 LedPwmOutCC.h.


Constructor & Destructor Documentation

LedPwmOutCC ( CompLedDvrCC 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 LedPwmOutCC.cpp.

~LedPwmOutCC (  ) [virtual]

Destractor.

Definition at line 10 of file LedPwmOutCC.cpp.


Member Function Documentation

void current ( float  v ) [virtual]

Set output current.

Parameters:
vRatio of output current. 1.0 for 100 % output of hardware setting

Definition at line 19 of file LedPwmOutCC.cpp.

LedPwmOutCC & operator= ( float  rhs )

A shorthand for pwm()

Definition at line 23 of file LedPwmOutCC.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 LedPwmOutCC.cpp.