modm API documentation
modm::MAX6966< Spi, Cs, DRIVERS > Class Template Reference

MAX6966 10-channel, daisy-chainable, constant-current sink, 8bit PWM LED driver. More...

#include <modm/driver/pwm/max6966.hpp>

Public Types

enum  Register {
  REGISTER_PORT0 = 0x00, REGISTER_PORT1 = 0x01, REGISTER_PORT2 = 0x02, REGISTER_PORT3 = 0x03,
  REGISTER_PORT4 = 0x04, REGISTER_PORT5 = 0x05, REGISTER_PORT6 = 0x06, REGISTER_PORT7 = 0x07,
  REGISTER_PORT8 = 0x08, REGISTER_PORT9 = 0x09, REGISTER_PORT0_9 = 0x0A, REGISTER_PORT0_3 = 0x0B,
  REGISTER_PORT4_7 = 0x0C, REGISTER_PORT8_9 = 0x0D, REGISTER_READ_PORT7_0 = 0x0E, REGISTER_READ_PORT9_8 = 0x0F,
  REGISTER_CONFIGURATION = 0x10, REGISTER_RAMP_UP = 0x11, REGISTER_RAMP_DOWN = 0x12, REGISTER_CURRENT7_0 = 0x13,
  REGISTER_CURRENT9_8 = 0x14, REGISTER_GLOBAL_CURRENT = 0x15, REGISTER_NO_OP = 0x20
}
 
enum  Config {
  CONFIG_RUN_MODE = 0x01, CONFIG_CS_RUN = 0x02, CONFIG_RAMP_UP = 0x04, CONFIG_FADE_OFF = 0x08,
  CONFIG_HOLD_OFF = 0x10, CONFIG_PWM_STAGGER = 0x20, CONFIG_DOUT_OSC = 0x80
}
 
enum  Time {
  TIME_OFF = 0x00, TIME_1_16s = 0x01, TIME_1_8s = 0x02, TIME_1_4s = 0x03,
  TIME_1_2s = 0x04, TIME_1s = 0x05, TIME_2s = 0x06, TIME_4s = 0x07
}
 
enum  Current {
  CURRENT_2_5mA = 0x00, CURRENT_5mA = 0x01, CURRENT_7_5mA = 0x02, CURRENT_10mA = 0x03,
  CURRENT_12_5mA = 0x04, CURRENT_15mA = 0x05, CURRENT_17_5mA = 0x06, CURRENT_20mA = 0x07
}
 
enum  Brightness { ON = 0xfe, OFF = 0xff, MIN = 0x03 }
 None-intuitive correspondence between PWM value and brightness.
 

Static Public Member Functions

static void initialize (max6966::Current current, uint8_t config=0)
 
static void setConfiguration (uint8_t config, uint8_t driver=0)
 configure the Chip
 
static void setAllConfiguration (uint8_t config)
 configure the Chip
 
static uint8_t getConfiguration (uint8_t driver=0)
 get Chip configuration
 
static void setRampUpTime (max6966::Time time=max6966::TIME_1s, uint8_t driver=0)
 configure the ramp up time
 
static void setHoldTime (max6966::Time time=max6966::TIME_1s, uint8_t driver=0)
 configure the hold time
 
static void setRampDownTime (max6966::Time time=max6966::TIME_1s, uint8_t driver=0)
 configure the ramp down time
 
static void setChannel (uint16_t channel, uint8_t value)
 set the 8bit value of a single channel
 
static void setChannelIntensity (uint16_t channel, uint8_t intensity)
 set the intensity of a single channel
 
static void setChannels (uint8_t *values)
 
static void setChannelsIntensity (uint8_t *intensity)
 
static void setAllChannels (uint8_t value)
 
static void setAllChannelsIntensity (uint8_t value)
 
static uint8_t getChannel (uint16_t channel)
 get the 8bit value of a channel from the chip
 
static void setHalfCurrent (uint16_t channel, bool full=true)
 
static void setCurrent (max6966::Current current, uint8_t driver=0)
 set peak current of one driver
 
static void setAllCurrent (max6966::Current current)
 set peak current of all drivers
 

Static Public Attributes

static const uint8_t WRITE = 0x00
 
static const uint8_t READ = 0x80
 

Static Protected Member Functions

static void writeToDriver (uint8_t driver, max6966::Register reg, uint8_t data)
 
static uint8_t readFromDriver (uint8_t driver, max6966::Register reg)
 
static void writeToDriverMasked (uint8_t driver, max6966::Register reg, uint8_t data, uint8_t mask)
 
static uint8_t intensityToPwm (uint8_t intensity)
 

Detailed Description

template<typename Spi, typename Cs, uint8_t DRIVERS = 1>
class modm::MAX6966< Spi, Cs, DRIVERS >

MAX6966 10-channel, daisy-chainable, constant-current sink, 8bit PWM LED driver.

Template Parameters
SpiSpi interface
CsChip Select Pin
DRIVERSNumber of daisy-chained chips
Author
Niklas Hauser

Member Function Documentation

template<typename Spi , typename Cs , uint8_t DRIVERS = 1>
static void modm::MAX6966< Spi, Cs, DRIVERS >::initialize ( max6966::Current  current,
uint8_t  config = 0 
)
static
Parameters
currentSet the global current
configEnable Data Output, disable external Clock Input
template<typename Spi , typename Cs , uint8_t DRIVERS = 1>
static uint8_t modm::MAX6966< Spi, Cs, DRIVERS >::intensityToPwm ( uint8_t  intensity)
inlinestaticprotected

Fix the stupid PWM values of MAX6966

template<typename Spi , typename Cs , uint8_t DRIVERS = 1>
static void modm::MAX6966< Spi, Cs, DRIVERS >::setAllChannels ( uint8_t  value)
static
Parameters
valuethe 8bit value of all channels (same value for all channels)
template<typename Spi , typename Cs , uint8_t DRIVERS = 1>
static void modm::MAX6966< Spi, Cs, DRIVERS >::setChannels ( uint8_t *  values)
static

More efficient version to set all channels differently Avoids writing NO_OPS. Sets the same channels of all drivers at the same time.

Parameters
valuesarray with all pwm values for all channels and drivers.

The documentation for this class was generated from the following file: