A feature complete driver for the PCA9952/55 LED driver from NXP.
Dependents: PCA9955_HelloWorld
Diff: PCA9955.h
- Revision:
- 12:2b8adb10c605
- Parent:
- 11:dbf20a128eb6
--- a/PCA9955.h Tue May 06 17:03:59 2014 +0000 +++ b/PCA9955.h Mon May 12 14:58:54 2014 +0000 @@ -311,14 +311,14 @@ * * @returns The current group control duty cycle as an unsigned char (0 to 255). */ - char groupDuty_char(); + char groupDuty_u8(); /** Set the group control duty cycle of the PCA9952/55 * * @param duty The new group control duty cycle as an unsigned char (0 to 255). * @param altAddr An optional, alternate address such as a subaddress or LED All Call address (defaults to NULL). */ - void groupDuty_char(char duty, int altAddr = NULL); + void groupDuty_u8(char duty, int altAddr = NULL); /** Get the current group control blink period of the PCA9952/55 in seconds * @@ -337,14 +337,14 @@ * * @returns The current group control blink period as an unsigned char (0 to 255). */ - char groupBlinkPeriod_char(); + char groupBlinkPeriod_u8(); /** Set the current group control blink period of the PCA9952/55 * * @param period The new group control blink period as an unsigned char (0 to 255). * @param altAddr An optional, alternate address such as a subaddress or LED All Call address (defaults to NULL). */ - void groupBlinkPeriod_char(char period, int altAddr = NULL); + void groupBlinkPeriod_u8(char period, int altAddr = NULL); /** Get the specified output's duty cycle in percent * @@ -368,7 +368,7 @@ * * @returns The output's current duty cycle as an unsigned char (0 to 255). */ - char outputDuty_char(Output output); + char outputDuty_u8(Output output); /** Set the specified output's duty cycle * @@ -376,7 +376,7 @@ * @param duty The new output duty cycle as an unsigned char (0 to 255). * @param altAddr An optional, alternate address such as a subaddress or LED All Call address (defaults to NULL). */ - void outputDuty_char(Output output, char duty, int altAddr = NULL); + void outputDuty_u8(Output output, char duty, int altAddr = NULL); /** Get the specified output's current reference in percent * @@ -400,7 +400,7 @@ * * @returns The output's current reference as an unsigned char (0 to 255). */ - char outputCurrent_char(Output output); + char outputCurrent_u8(Output output); /** Set the specified output's current reference * @@ -408,7 +408,7 @@ * @param iref The new output current reference as an unsigned char (0 to 255). * @param altAddr An optional, alternate address such as a subaddress or LED All Call address (defaults to NULL). */ - void outputCurrent_char(Output output, char iref, int altAddr = NULL); + void outputCurrent_u8(Output output, char iref, int altAddr = NULL); /** Get the turn-on delay between LEDn outputs * @@ -475,6 +475,22 @@ */ void allCallAddr(char addr, int altAddr = NULL); + /** Read a range of output states into an array + * + * @param states Pointer to an array for up to 16 output states. + * @param start The first output to read (defaults to OUTPUT_0). + * @param end The last output to read (defaults to OUTPUT_15). + */ + void getOutputStates(OutputState* states, Output start = OUTPUT_0, Output end = OUTPUT_15); + + /** Set a range of output states from an array + * + * @param states Pointer to an array of up to 16 output states. + * @param start The first output to set (defaults to OUTPUT_0). + * @param end The last output to set (defaults to OUTPUT_15). + */ + void setOutputStates(OutputState* states, Output start = OUTPUT_0, Output end = OUTPUT_15); + /** Set all of the output states to the same state * * @param state The new output state for all outputs. @@ -482,18 +498,22 @@ */ void allOutputStates(OutputState state, int altAddr = NULL); - /** Read all of the output duty cycles into an array as percents + /** Read a range of output duty cycles into an array as percents * - * @param duties Pointer to any array for 16 duty cycles as floats (0.0 to 1.0). + * @param duties Pointer to an array for up to 16 duty cycles as floats (0.0 to 1.0). + * @param start The first output to read (defaults to OUTPUT_0). + * @param end The last output to read (defaults to OUTPUT_15). */ - void getOutputDuties(float* duties); + void getOutputDuties(float* duties, Output start = OUTPUT_0, Output end = OUTPUT_15); - /** Set all of the output duty cycles from an array of percents + /** Set a range of output duty cycles from an array of percents * - * @param duties Pointer to any array of 16 duty cycles as floats (0.0 to 1.0). + * @param duties Pointer to an array of up to 16 duty cycles as floats (0.0 to 1.0). + * @param start The first output to set (defaults to OUTPUT_0). + * @param end The last output to set (defaults to OUTPUT_15). * @param altAddr An optional, alternate address such as a subaddress or LED All Call address (defaults to NULL). */ - void setOutputDuties(float* duties, int altAddr = NULL); + void setOutputDuties(float* duties, Output start = OUTPUT_0, Output end = OUTPUT_15, int altAddr = NULL); /** Set all of the output duty cycles to the same value in percent * @@ -502,38 +522,46 @@ */ void allOutputDuties(float duty, int altAddr = NULL); - /** Read all of the output duty cycles into an array + /** Read a range of output duty cycles into an array * - * @param duties Pointer to any array for 16 duty cycles as unsigned chars (0 to 255). + * @param duties Pointer to an array for up to 16 duty cycles as unsigned chars (0 to 255). + * @param start The first output to read (defaults to OUTPUT_0). + * @param end The last output to read (defaults to OUTPUT_15). */ - void getOutputDuties_char(char* duties); + void getOutputDuties_u8(char* duties, Output start = OUTPUT_0, Output end = OUTPUT_15); - /** Set all of the output duty cycles from an array + /** Set a range of output duty cycles from an array * - * @param duties Pointer to any array of 16 duty cycles as unsigned chars (0 to 255). + * @param duties Pointer to any array of up to 16 duty cycles as unsigned chars (0 to 255). + * @param start The first output to set (defaults to OUTPUT_0). + * @param end The last output to set (defaults to OUTPUT_15). * @param altAddr An optional, alternate address such as a subaddress or LED All Call address (defaults to NULL). */ - void setOutputDuties_char(char* duties, int altAddr = NULL); + void setOutputDuties_u8(char* duties, Output start = OUTPUT_0, Output end = OUTPUT_15, int altAddr = NULL); /** Set all of the output duty cycles to the same value * * @param duty The new duty cycle for all outputs as an unsigned char (0 to 255). * @param altAddr An optional, alternate address such as a subaddress or LED All Call address (defaults to NULL). */ - void allOutputDuties_char(char duty, int altAddr = NULL); + void allOutputDuties_u8(char duty, int altAddr = NULL); - /** Read all of the output current references into an array as percents + /** Read a range of output current references into an array as percents * - * @param irefs Pointer to any array for 16 current references as floats (0.0 to 1.0). + * @param irefs Pointer to an array for up to 16 current references as floats (0.0 to 1.0). + * @param start The first output to read (defaults to OUTPUT_0). + * @param end The last output to read (defaults to OUTPUT_15). */ - void getOutputCurrents(float* irefs); + void getOutputCurrents(float* irefs, Output start = OUTPUT_0, Output end = OUTPUT_15); - /** Set all of the output current references from an array of percents + /** Set a range of output current references from an array of percents * - * @param irefs Pointer to any array of 16 current references as floats (0.0 to 1.0). + * @param irefs Pointer to an array of up to 16 current references as floats (0.0 to 1.0). + * @param start The first output to set (defaults to OUTPUT_0). + * @param end The last output to set (defaults to OUTPUT_15). * @param altAddr An optional, alternate address such as a subaddress or LED All Call address (defaults to NULL). */ - void setOutputCurrents(float* irefs, int altAddr = NULL); + void setOutputCurrents(float* irefs, Output start = OUTPUT_0, Output end = OUTPUT_15, int altAddr = NULL); /** Set all of the output current references to the same value in percent * @@ -542,25 +570,29 @@ */ void allOutputCurrents(float iref, int altAddr = NULL); - /** Read all of the output current references into an array + /** Read a range of output current references into an array * - * @param irefs Pointer to any array for 16 current references as unsigned chars (0 to 255). + * @param irefs Pointer to an array for up to 16 current references as unsigned chars (0 to 255). + * @param start The first output to read (defaults to OUTPUT_0). + * @param end The last output to read (defaults to OUTPUT_15). */ - void getOutputCurrents_char(char* irefs); + void getOutputCurrents_u8(char* irefs, Output start = OUTPUT_0, Output end = OUTPUT_15); - /** Set all of the output current references from an array + /** Set a range of output current references from an array * - * @param irefs Pointer to any array of 16 current references as unsigned chars (0 to 255). + * @param irefs Pointer to an array of up to 16 current references as unsigned chars (0 to 255). + * @param start The first output to set (defaults to OUTPUT_0). + * @param end The last output to set (defaults to OUTPUT_15). * @param altAddr An optional, alternate address such as a subaddress or LED All Call address (defaults to NULL). */ - void setOutputCurrents_char(char* irefs, int altAddr = NULL); + void setOutputCurrents_u8(char* irefs, Output start = OUTPUT_0, Output end = OUTPUT_15, int altAddr = NULL); /** Set all of the output current references to the same value * * @param iref The new current reference for all outputs as an unsigned char (0 to 255). * @param altAddr An optional, alternate address such as a subaddress or LED All Call address (defaults to NULL). */ - void allOutputCurrents_char(char iref, int altAddr = NULL); + void allOutputCurrents_u8(char iref, int altAddr = NULL); /** Perform a fault test on all enabled outputs *