public class PCA9685
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
PCA9685.PCA9685_MODE1_T |
static class |
PCA9685.PCA9685_MODE2_T |
static class |
PCA9685.PCA9685_REG_T |
| Constructor and Description |
|---|
PCA9685(int bus) |
PCA9685(int bus,
short address) |
PCA9685(int bus,
short address,
boolean raw)
PCA9685 constructor
|
| Modifier and Type | Method and Description |
|---|---|
void |
delete() |
void |
enableRestart(boolean enabled)
Enables or disables the restart capability of the controller
|
boolean |
ledFullOff(short led,
boolean val)
Sets or clears the FULL OFF bit for a given LED.
|
boolean |
ledFullOn(short led,
boolean val)
Sets or clears the FULL ON bit for a given LED
|
boolean |
ledOffTime(short led,
int time)
Sets the 'LED off' time (0-4,095).
|
boolean |
ledOnTime(short led,
int time)
Sets the 'LED on' time (0-4,095).
|
short |
readByte(short reg)
Reads a byte value from a register
|
int |
readWord(short reg)
Reads a word value from a register.
|
boolean |
setModeSleep(boolean sleep)
Puts the device in or out of the sleep mode.
|
boolean |
setPrescale(short prescale)
Sets the prescale value.
|
boolean |
setPrescaleFromHz(float hz) |
boolean |
setPrescaleFromHz(float hz,
float oscFreq)
Sets the prescale value based on a desired frequency in Hz.
|
boolean |
writeByte(short reg,
short arg1)
Writes a byte value into a register
|
boolean |
writeWord(short reg,
int word)
Writes a word value into a register.
|
public PCA9685(int bus,
short address,
boolean raw)
bus - I2C bus to useaddress - Address for this devicepublic PCA9685(int bus,
short address)
public PCA9685(int bus)
public void delete()
public boolean writeByte(short reg,
short arg1)
reg - Register location to write intobyte - Byte to writepublic boolean writeWord(short reg,
int word)
reg - Register location to write intoword - Word to writepublic short readByte(short reg)
reg - Register location to read frompublic int readWord(short reg)
reg - Register location to read frompublic boolean setModeSleep(boolean sleep)
sleep - True to put the device in the sleep mode, false to put outpublic boolean ledFullOn(short led,
boolean val)
led - LED number; valid values are 0-15, PCA9685_ALL_LEDval - True to set the bit, false to clear itpublic boolean ledFullOff(short led,
boolean val)
led - LED number; valid values are 0-15, PCA9685_ALL_LEDval - True to set the bit, false to clear itpublic boolean ledOnTime(short led,
int time)
led - LED number; valid values are 0-15, PCA9685_ALL_LEDtime - 12-bit value at which point the LED turns onpublic boolean ledOffTime(short led,
int time)
led - LED number; valid values are 0-15, PCA9685_ALL_LEDtime - 12-bit value at which point the LED turns offpublic boolean setPrescale(short prescale)
prescale - Prescale valuepublic boolean setPrescaleFromHz(float hz,
float oscFreq)
hz - Desired frequency in HzoscFreq - Oscillator frequency; default is 25 MHzpublic boolean setPrescaleFromHz(float hz)
public void enableRestart(boolean enabled)
enabled - True to enable, false to disable
It is enabled by default.