266 uint8_t bitPosition = (((port - 44) % 4) * 2) + 1;
267 uint8_t pcArrayIndex = (port - 44) / 4;
268 uint8_t portConfigRA = pcArrayIndex + 11;
269 I2Cdev::writeBits(
devAddr, portConfigRA, bitPosition, 2, portConfig);
273 portsConfig[pcArrayIndex] |= portConfig << bitPosition;
287 Serial.print(
"lower ");
288 Serial.print(lower, HEX);
289 Serial.print(
" upper ");
290 Serial.print(upper, HEX);
291 Serial.print(
" portConfig ");
292 Serial.println(portConfig, BIN);
294 uint8_t bitPosition = 0;
295 uint8_t pcArrayIndex = 0;
296 uint8_t portConfigRA = 0;
299 while ( i <= upper ) {
300 bitPosition = (((i - 44) % 4) * 2) + 1;
301 pcArrayIndex = (i - 44) / 4;
302 portConfigRA = pcArrayIndex + 11;
305 Serial.print(
" bitPosition ");
306 Serial.print(bitPosition);
307 Serial.print(
" pcArrayIndex");
308 Serial.print(pcArrayIndex);
309 Serial.print(
" portConfigRA ");
310 Serial.println(portConfigRA, HEX);
311 I2Cdev::writeBits(
devAddr, portConfigRA, bitPosition, 2, portConfig);
313 Serial.print(
"portsConfig ");
317 portsConfig[pcArrayIndex] |= portConfig << bitPosition;
318 Serial.print(
" >> ");
334 portConfig = portConfig << 6 + portConfig << 4 + portConfig << 2 +
portConfig;
347 if ( port >= 44 && port <= 63 && power >= 0 && power <= 15 ) {
356 if ( power < 15 ) power--;
373 #ifdef MAX6956_SERIAL_DEBUG
374 Serial.print(
"port ");
376 Serial.print(
" portCurrentBit ");
378 Serial.print(
" portCurrentRA ");
380 Serial.print(
" power ");
381 Serial.println(power );
389 #ifdef MAX6956_SERIAL_DEBUG
390 Serial.print(
"port ");
392 Serial.println(
" is off");
405 if ( port >= 44 && port <= 63 && power >= 0 && power <= 15 ) {
426 #ifdef MAX6956_SERIAL_DEBUG
427 Serial.print(
"port ");
429 Serial.print(
" portCurrentBit ");
431 Serial.print(
" portCurrentRA ");
433 Serial.print(
" power ");
434 Serial.println(power );
uint8_t devAddr
Holds the current device address.
uint8_t portCurrentRA
Holder for port current register.
uint8_t psArrayIndex
array index
bool getEnableTransitionDetection()
#define MAX6956_RA_GLOBAL_CURRENT
bool getEnableIndividualCurrent()
#define MAX6956_RA_DISPLAY_TEST
void setPower(bool power)
#define MAX6956_INPUT_WO_PULL
#define MAX6956_CONFIG_POWER_BIT
0 = Shutdown, 1 = Normal operation
void configPort(uint8_t port, uint8_t portConfig)
void setAllPortsCurrent(uint8_t power)
0-15, 0 = min brightness (not off) 15 = max
#define MAX6956_RA_CONFIG_P15P14P13P12
void configPorts(uint8_t lower, uint8_t upper, uint8_t portConfig)
uint8_t getGlobalCurrent()
#define MAX6956_DISPLAY_TEST_BIT
0 = Normal operation, 1 = Display test
#define MAX6956_RA_CONFIGURATION
uint8_t psBitPosition
bit position
#define MAX6956_RA_PORTS20_27
#define MAX6956_RA_PORTS28_31
data bits D0-D3; D4-D7 read as 0
#define MAX6956_RA_PORTS12_19
void setConfigReg(uint8_t config)
void configAllPorts(uint8_t portConfig)
void setEnableTransitionDetection(bool transition)
#define MAX6956_RA_CURRENT_0xP31P30
void setEnableIndividualCurrent(bool global)
void setPortCurrent(uint8_t port, uint8_t power)
0-15 brightness levels.
#define MAX6956_GLOBAL_CURRENT_LENGTH
nybble long
uint8_t portCurrentBit
Holder for the current bit offset.
#define MAX6956_RA_CURRENT_0xP13P12
void setPortLevel(uint8_t port, uint8_t power)
0 = off, 1-15 brightness levels.
#define MAX6956_GLOBAL_CURRENT_BIT
Global current start bit.
#define MAX6956_CONFIG_TRANSITION_BIT
0 = Disabled, 1 = Enabled
#define MAX6956_RA_CONFIG_P11P10P9P8
#define MAX6956_RA_CONFIG_P7P6P5P4
uint8_t buffer[1]
Buffer for reading data from the device.
void setGlobalCurrent(uint8_t current)
void setTestMode(bool test)
uint8_t portConfig
Holder for port config bit pair.
#define MAX6956_RA_TRANSITION_DETECT
void setInputMask(uint8_t mask)
#define MAX6956_DEFAULT_ADDRESS
#define MAX6956_CONFIG_GLOBAL_CURRENT_BIT
0 = Global control, 1 = Individual control