PCA9632 PWM color LED support
Add support for the PCA9632 PWM color LED driver used on the Ultimaker 2 and Wanhao Duplicator 6.
This commit is contained in:
parent
896dfa0577
commit
0bc66bf22c
@ -291,6 +291,12 @@ script:
|
||||
- opt_enable ULTIMAKERCONTROLLER
|
||||
- build_marlin
|
||||
#
|
||||
# PCA9632
|
||||
#
|
||||
- restore_configs
|
||||
- opt_enable PCA9632
|
||||
- build_marlin
|
||||
#
|
||||
# MAKRPANEL
|
||||
# Needs to use Melzi and Sanguino hardware
|
||||
#
|
||||
|
@ -398,6 +398,6 @@
|
||||
|
||||
#define HAS_SOFTWARE_ENDSTOPS (ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS))
|
||||
#define HAS_RESUME_CONTINUE (ENABLED(NEWPANEL) || ENABLED(EMERGENCY_PARSER))
|
||||
#define HAS_COLOR_LEDS (ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED))
|
||||
#define HAS_COLOR_LEDS (ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED) || ENABLED(PCA9632))
|
||||
|
||||
#endif // CONDITIONALS_LCD_H
|
||||
|
@ -1482,6 +1482,9 @@
|
||||
//define BlinkM/CyzRgb Support
|
||||
//#define BLINKM
|
||||
|
||||
//define PCA9632 PWM LED driver Support
|
||||
//#define PCA9632
|
||||
|
||||
/**
|
||||
* RGB LED / LED Strip Control
|
||||
*
|
||||
@ -1519,7 +1522,7 @@
|
||||
* - Change to green once print has finished
|
||||
* - Turn off after the print has finished and the user has pushed a button
|
||||
*/
|
||||
#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED)
|
||||
#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED) || ENABLED(PCA9632)
|
||||
#define PRINTER_EVENT_LEDS
|
||||
#endif
|
||||
|
||||
|
@ -138,7 +138,7 @@
|
||||
* M140 - Set bed target temp. S<temp>
|
||||
* M145 - Set heatup values for materials on the LCD. H<hotend> B<bed> F<fan speed> for S<material> (0=PLA, 1=ABS)
|
||||
* M149 - Set temperature units. (Requires TEMPERATURE_UNITS_SUPPORT)
|
||||
* M150 - Set Status LED Color as R<red> U<green> B<blue>. Values 0-255. (Requires BLINKM or RGB_LED)
|
||||
* M150 - Set Status LED Color as R<red> U<green> B<blue>. Values 0-255. (Requires BLINKM, RGB_LED, RGBW_LED, or PCA9632)
|
||||
* M155 - Auto-report temperatures with interval of S<seconds>. (Requires AUTO_REPORT_TEMPERATURES)
|
||||
* M163 - Set a single proportion for a mixing extruder. (Requires MIXING_EXTRUDER)
|
||||
* M164 - Save the mix as a virtual extruder. (Requires MIXING_EXTRUDER and MIXING_VIRTUAL_TOOLS)
|
||||
@ -280,6 +280,10 @@
|
||||
#include "Wire.h"
|
||||
#endif
|
||||
|
||||
#if ENABLED(PCA9632)
|
||||
#include "pca9632.h"
|
||||
#endif
|
||||
|
||||
#if HAS_SERVOS
|
||||
#include "servo.h"
|
||||
#endif
|
||||
@ -986,7 +990,9 @@ void servo_init() {
|
||||
// This variant uses i2c to send the RGB components to the device.
|
||||
SendColors(r, g, b);
|
||||
|
||||
#else
|
||||
#endif
|
||||
|
||||
#if ENABLED(RGB_LED) || ENABLED(RGBW_LED)
|
||||
|
||||
// This variant uses 3 separate pins for the RGB components.
|
||||
// If the pins can do PWM then their intensity will be set.
|
||||
@ -1003,6 +1009,11 @@ void servo_init() {
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#if ENABLED(PCA9632)
|
||||
// Update I2C LED driver
|
||||
PCA9632_SetColor(r, g, b);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif // HAS_COLOR_LEDS
|
||||
@ -5893,7 +5904,7 @@ inline void gcode_M17() {
|
||||
|
||||
if (!DEBUGGING(DRYRUN) && unload_length != 0) {
|
||||
#if ENABLED(PREVENT_COLD_EXTRUSION)
|
||||
if (!thermalManager.allow_cold_extrude &&
|
||||
if (!thermalManager.allow_cold_extrude &&
|
||||
thermalManager.degTargetHotend(active_extruder) < thermalManager.extrude_min_temp) {
|
||||
SERIAL_ERROR_START();
|
||||
SERIAL_ERRORLNPGM(MSG_TOO_COLD_FOR_M600);
|
||||
@ -8013,7 +8024,7 @@ inline void gcode_M121() { endstops.enable_globally(false); }
|
||||
);
|
||||
}
|
||||
|
||||
#endif // BLINKM || RGB_LED
|
||||
#endif // HAS_COLOR_LEDS
|
||||
|
||||
/**
|
||||
* M200: Set filament diameter and set E axis units to cubic units
|
||||
@ -10621,7 +10632,7 @@ void process_next_command() {
|
||||
gcode_M150();
|
||||
break;
|
||||
|
||||
#endif // BLINKM
|
||||
#endif // HAS_COLOR_LEDS
|
||||
|
||||
#if ENABLED(MIXING_EXTRUDER)
|
||||
case 163: // M163: Set a component weight for mixing extruder
|
||||
|
@ -1027,17 +1027,13 @@ static_assert(1 >= 0
|
||||
#error "RGB_LED requires RGB_LED_R_PIN, RGB_LED_G_PIN, and RGB_LED_B_PIN."
|
||||
#elif ENABLED(RGBW_LED)
|
||||
#error "Please enable only one of RGB_LED and RGBW_LED."
|
||||
#elif ENABLED(BLINKM)
|
||||
#error "RGB_LED and BLINKM are currently incompatible (both use M150)."
|
||||
#endif
|
||||
#elif ENABLED(RGBW_LED)
|
||||
#if !(_RGB_TEST && PIN_EXISTS(RGB_LED_W))
|
||||
#error "RGBW_LED requires RGB_LED_R_PIN, RGB_LED_G_PIN, RGB_LED_B_PIN, and RGB_LED_W_PIN."
|
||||
#elif ENABLED(BLINKM)
|
||||
#error "RGBW_LED and BLINKM are currently incompatible (both use M150)."
|
||||
#endif
|
||||
#elif DISABLED(BLINKM) && ENABLED(PRINTER_EVENT_LEDS)
|
||||
#error "PRINTER_EVENT_LEDS requires BLINKM, RGB_LED, or RGBW_LED."
|
||||
#elif ENABLED(PRINTER_EVENT_LEDS) && DISABLED(BLINKM) && DISABLED(PCA9632)
|
||||
#error "PRINTER_EVENT_LEDS requires BLINKM, PCA9632, RGB_LED, or RGBW_LED."
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -1482,6 +1482,9 @@
|
||||
//define BlinkM/CyzRgb Support
|
||||
//#define BLINKM
|
||||
|
||||
//define PCA9632 PWM LED driver Support
|
||||
//#define PCA9632
|
||||
|
||||
/**
|
||||
* RGB LED / LED Strip Control
|
||||
*
|
||||
@ -1519,7 +1522,7 @@
|
||||
* - Change to green once print has finished
|
||||
* - Turn off after the print has finished and the user has pushed a button
|
||||
*/
|
||||
#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED)
|
||||
#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED) || ENABLED(PCA9632)
|
||||
#define PRINTER_EVENT_LEDS
|
||||
#endif
|
||||
|
||||
|
@ -1479,6 +1479,9 @@
|
||||
//define BlinkM/CyzRgb Support
|
||||
//#define BLINKM
|
||||
|
||||
//define PCA9632 PWM LED driver Support
|
||||
//#define PCA9632
|
||||
|
||||
/**
|
||||
* RGB LED / LED Strip Control
|
||||
*
|
||||
@ -1516,7 +1519,7 @@
|
||||
* - Change to green once print has finished
|
||||
* - Turn off after the print has finished and the user has pushed a button
|
||||
*/
|
||||
#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED)
|
||||
#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED) || ENABLED(PCA9632)
|
||||
#define PRINTER_EVENT_LEDS
|
||||
#endif
|
||||
|
||||
|
@ -1463,6 +1463,9 @@
|
||||
//define BlinkM/CyzRgb Support
|
||||
//#define BLINKM
|
||||
|
||||
//define PCA9632 PWM LED driver Support
|
||||
//#define PCA9632
|
||||
|
||||
/**
|
||||
* RGB LED / LED Strip Control
|
||||
*
|
||||
@ -1500,7 +1503,7 @@
|
||||
* - Change to green once print has finished
|
||||
* - Turn off after the print has finished and the user has pushed a button
|
||||
*/
|
||||
#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED)
|
||||
#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED) || ENABLED(PCA9632)
|
||||
#define PRINTER_EVENT_LEDS
|
||||
#endif
|
||||
|
||||
|
@ -1463,6 +1463,9 @@
|
||||
//define BlinkM/CyzRgb Support
|
||||
//#define BLINKM
|
||||
|
||||
//define PCA9632 PWM LED driver Support
|
||||
//#define PCA9632
|
||||
|
||||
/**
|
||||
* RGB LED / LED Strip Control
|
||||
*
|
||||
@ -1500,7 +1503,7 @@
|
||||
* - Change to green once print has finished
|
||||
* - Turn off after the print has finished and the user has pushed a button
|
||||
*/
|
||||
#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED)
|
||||
#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED) || ENABLED(PCA9632)
|
||||
#define PRINTER_EVENT_LEDS
|
||||
#endif
|
||||
|
||||
|
@ -1485,6 +1485,9 @@
|
||||
//define BlinkM/CyzRgb Support
|
||||
//#define BLINKM
|
||||
|
||||
//define PCA9632 PWM LED driver Support
|
||||
//#define PCA9632
|
||||
|
||||
/**
|
||||
* RGB LED / LED Strip Control
|
||||
*
|
||||
@ -1522,7 +1525,7 @@
|
||||
* - Change to green once print has finished
|
||||
* - Turn off after the print has finished and the user has pushed a button
|
||||
*/
|
||||
#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED)
|
||||
#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED) || ENABLED(PCA9632)
|
||||
#define PRINTER_EVENT_LEDS
|
||||
#endif
|
||||
|
||||
|
@ -1471,6 +1471,9 @@
|
||||
//define BlinkM/CyzRgb Support
|
||||
//#define BLINKM
|
||||
|
||||
//define PCA9632 PWM LED driver Support
|
||||
//#define PCA9632
|
||||
|
||||
/**
|
||||
* RGB LED / LED Strip Control
|
||||
*
|
||||
@ -1508,7 +1511,7 @@
|
||||
* - Change to green once print has finished
|
||||
* - Turn off after the print has finished and the user has pushed a button
|
||||
*/
|
||||
#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED)
|
||||
#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED) || ENABLED(PCA9632)
|
||||
#define PRINTER_EVENT_LEDS
|
||||
#endif
|
||||
|
||||
|
@ -1474,6 +1474,9 @@
|
||||
//define BlinkM/CyzRgb Support
|
||||
//#define BLINKM
|
||||
|
||||
//define PCA9632 PWM LED driver Support
|
||||
//#define PCA9632
|
||||
|
||||
/**
|
||||
* RGB LED / LED Strip Control
|
||||
*
|
||||
@ -1511,7 +1514,7 @@
|
||||
* - Change to green once print has finished
|
||||
* - Turn off after the print has finished and the user has pushed a button
|
||||
*/
|
||||
#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED)
|
||||
#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED) || ENABLED(PCA9632)
|
||||
#define PRINTER_EVENT_LEDS
|
||||
#endif
|
||||
|
||||
|
@ -1515,6 +1515,9 @@
|
||||
//define BlinkM/CyzRgb Support
|
||||
//#define BLINKM
|
||||
|
||||
//define PCA9632 PWM LED driver Support
|
||||
//#define PCA9632
|
||||
|
||||
/**
|
||||
* RGB LED / LED Strip Control
|
||||
*
|
||||
@ -1552,7 +1555,7 @@
|
||||
* - Change to green once print has finished
|
||||
* - Turn off after the print has finished and the user has pushed a button
|
||||
*/
|
||||
#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED)
|
||||
#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED) || ENABLED(PCA9632)
|
||||
#define PRINTER_EVENT_LEDS
|
||||
#endif
|
||||
|
||||
|
@ -1481,6 +1481,9 @@
|
||||
//define BlinkM/CyzRgb Support
|
||||
//#define BLINKM
|
||||
|
||||
//define PCA9632 PWM LED driver Support
|
||||
//#define PCA9632
|
||||
|
||||
/**
|
||||
* RGB LED / LED Strip Control
|
||||
*
|
||||
@ -1518,7 +1521,7 @@
|
||||
* - Change to green once print has finished
|
||||
* - Turn off after the print has finished and the user has pushed a button
|
||||
*/
|
||||
#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED)
|
||||
#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED) || ENABLED(PCA9632)
|
||||
#define PRINTER_EVENT_LEDS
|
||||
#endif
|
||||
|
||||
|
@ -1481,6 +1481,9 @@
|
||||
//define BlinkM/CyzRgb Support
|
||||
//#define BLINKM
|
||||
|
||||
//define PCA9632 PWM LED driver Support
|
||||
//#define PCA9632
|
||||
|
||||
/**
|
||||
* RGB LED / LED Strip Control
|
||||
*
|
||||
@ -1518,7 +1521,7 @@
|
||||
* - Change to green once print has finished
|
||||
* - Turn off after the print has finished and the user has pushed a button
|
||||
*/
|
||||
#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED)
|
||||
#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED) || ENABLED(PCA9632)
|
||||
#define PRINTER_EVENT_LEDS
|
||||
#endif
|
||||
|
||||
|
@ -1508,6 +1508,9 @@
|
||||
//define BlinkM/CyzRgb Support
|
||||
//#define BLINKM
|
||||
|
||||
//define PCA9632 PWM LED driver Support
|
||||
//#define PCA9632
|
||||
|
||||
/**
|
||||
* RGB LED / LED Strip Control
|
||||
*
|
||||
@ -1545,7 +1548,7 @@
|
||||
* - Change to green once print has finished
|
||||
* - Turn off after the print has finished and the user has pushed a button
|
||||
*/
|
||||
#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED)
|
||||
#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED) || ENABLED(PCA9632)
|
||||
#define PRINTER_EVENT_LEDS
|
||||
#endif
|
||||
|
||||
|
@ -1481,6 +1481,9 @@
|
||||
//define BlinkM/CyzRgb Support
|
||||
//#define BLINKM
|
||||
|
||||
//define PCA9632 PWM LED driver Support
|
||||
//#define PCA9632
|
||||
|
||||
/**
|
||||
* RGB LED / LED Strip Control
|
||||
*
|
||||
@ -1518,7 +1521,7 @@
|
||||
* - Change to green once print has finished
|
||||
* - Turn off after the print has finished and the user has pushed a button
|
||||
*/
|
||||
#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED)
|
||||
#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED) || ENABLED(PCA9632)
|
||||
#define PRINTER_EVENT_LEDS
|
||||
#endif
|
||||
|
||||
|
@ -1481,6 +1481,9 @@
|
||||
//define BlinkM/CyzRgb Support
|
||||
//#define BLINKM
|
||||
|
||||
//define PCA9632 PWM LED driver Support
|
||||
//#define PCA9632
|
||||
|
||||
/**
|
||||
* RGB LED / LED Strip Control
|
||||
*
|
||||
@ -1518,7 +1521,7 @@
|
||||
* - Change to green once print has finished
|
||||
* - Turn off after the print has finished and the user has pushed a button
|
||||
*/
|
||||
#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED)
|
||||
#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED) || ENABLED(PCA9632)
|
||||
#define PRINTER_EVENT_LEDS
|
||||
#endif
|
||||
|
||||
|
@ -1496,6 +1496,9 @@
|
||||
//define BlinkM/CyzRgb Support
|
||||
//#define BLINKM
|
||||
|
||||
//define PCA9632 PWM LED driver Support
|
||||
//#define PCA9632
|
||||
|
||||
/**
|
||||
* RGB LED / LED Strip Control
|
||||
*
|
||||
@ -1533,7 +1536,7 @@
|
||||
* - Change to green once print has finished
|
||||
* - Turn off after the print has finished and the user has pushed a button
|
||||
*/
|
||||
#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED)
|
||||
#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED) || ENABLED(PCA9632)
|
||||
#define PRINTER_EVENT_LEDS
|
||||
#endif
|
||||
|
||||
|
@ -1500,6 +1500,9 @@
|
||||
//define BlinkM/CyzRgb Support
|
||||
//#define BLINKM
|
||||
|
||||
//define PCA9632 PWM LED driver Support
|
||||
//#define PCA9632
|
||||
|
||||
/**
|
||||
* RGB LED / LED Strip Control
|
||||
*
|
||||
@ -1537,7 +1540,7 @@
|
||||
* - Change to green once print has finished
|
||||
* - Turn off after the print has finished and the user has pushed a button
|
||||
*/
|
||||
#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED)
|
||||
#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED) || ENABLED(PCA9632)
|
||||
#define PRINTER_EVENT_LEDS
|
||||
#endif
|
||||
|
||||
|
@ -1537,6 +1537,9 @@
|
||||
//define BlinkM/CyzRgb Support
|
||||
//#define BLINKM
|
||||
|
||||
//define PCA9632 PWM LED driver Support
|
||||
//#define PCA9632
|
||||
|
||||
/**
|
||||
* RGB LED / LED Strip Control
|
||||
*
|
||||
@ -1574,7 +1577,7 @@
|
||||
* - Change to green once print has finished
|
||||
* - Turn off after the print has finished and the user has pushed a button
|
||||
*/
|
||||
#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED)
|
||||
#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED) || ENABLED(PCA9632)
|
||||
#define PRINTER_EVENT_LEDS
|
||||
#endif
|
||||
|
||||
|
@ -1471,6 +1471,9 @@
|
||||
//define BlinkM/CyzRgb Support
|
||||
//#define BLINKM
|
||||
|
||||
//define PCA9632 PWM LED driver Support
|
||||
//#define PCA9632
|
||||
|
||||
/**
|
||||
* RGB LED / LED Strip Control
|
||||
*
|
||||
@ -1508,7 +1511,7 @@
|
||||
* - Change to green once print has finished
|
||||
* - Turn off after the print has finished and the user has pushed a button
|
||||
*/
|
||||
#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED)
|
||||
#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED) || ENABLED(PCA9632)
|
||||
#define PRINTER_EVENT_LEDS
|
||||
#endif
|
||||
|
||||
|
@ -1481,6 +1481,9 @@
|
||||
//define BlinkM/CyzRgb Support
|
||||
//#define BLINKM
|
||||
|
||||
//define PCA9632 PWM LED driver Support
|
||||
//#define PCA9632
|
||||
|
||||
/**
|
||||
* RGB LED / LED Strip Control
|
||||
*
|
||||
@ -1518,7 +1521,7 @@
|
||||
* - Change to green once print has finished
|
||||
* - Turn off after the print has finished and the user has pushed a button
|
||||
*/
|
||||
#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED)
|
||||
#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED) || ENABLED(PCA9632)
|
||||
#define PRINTER_EVENT_LEDS
|
||||
#endif
|
||||
|
||||
|
@ -1602,6 +1602,9 @@
|
||||
//define BlinkM/CyzRgb Support
|
||||
//#define BLINKM
|
||||
|
||||
//define PCA9632 PWM LED driver Support
|
||||
//#define PCA9632
|
||||
|
||||
/**
|
||||
* RGB LED / LED Strip Control
|
||||
*
|
||||
@ -1639,7 +1642,7 @@
|
||||
* - Change to green once print has finished
|
||||
* - Turn off after the print has finished and the user has pushed a button
|
||||
*/
|
||||
#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED)
|
||||
#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED) || ENABLED(PCA9632)
|
||||
#define PRINTER_EVENT_LEDS
|
||||
#endif
|
||||
|
||||
|
@ -1603,6 +1603,9 @@
|
||||
//define BlinkM/CyzRgb Support
|
||||
//#define BLINKM
|
||||
|
||||
//define PCA9632 PWM LED driver Support
|
||||
//#define PCA9632
|
||||
|
||||
/**
|
||||
* RGB LED / LED Strip Control
|
||||
*
|
||||
@ -1640,7 +1643,7 @@
|
||||
* - Change to green once print has finished
|
||||
* - Turn off after the print has finished and the user has pushed a button
|
||||
*/
|
||||
#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED)
|
||||
#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED) || ENABLED(PCA9632)
|
||||
#define PRINTER_EVENT_LEDS
|
||||
#endif
|
||||
|
||||
|
@ -1592,6 +1592,9 @@
|
||||
//define BlinkM/CyzRgb Support
|
||||
//#define BLINKM
|
||||
|
||||
//define PCA9632 PWM LED driver Support
|
||||
//#define PCA9632
|
||||
|
||||
/**
|
||||
* RGB LED / LED Strip Control
|
||||
*
|
||||
@ -1629,7 +1632,7 @@
|
||||
* - Change to green once print has finished
|
||||
* - Turn off after the print has finished and the user has pushed a button
|
||||
*/
|
||||
#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED)
|
||||
#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED) || ENABLED(PCA9632)
|
||||
#define PRINTER_EVENT_LEDS
|
||||
#endif
|
||||
|
||||
|
@ -1595,6 +1595,9 @@
|
||||
//define BlinkM/CyzRgb Support
|
||||
//#define BLINKM
|
||||
|
||||
//define PCA9632 PWM LED driver Support
|
||||
//#define PCA9632
|
||||
|
||||
/**
|
||||
* RGB LED / LED Strip Control
|
||||
*
|
||||
@ -1632,7 +1635,7 @@
|
||||
* - Change to green once print has finished
|
||||
* - Turn off after the print has finished and the user has pushed a button
|
||||
*/
|
||||
#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED)
|
||||
#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED) || ENABLED(PCA9632)
|
||||
#define PRINTER_EVENT_LEDS
|
||||
#endif
|
||||
|
||||
|
@ -1600,6 +1600,9 @@
|
||||
//define BlinkM/CyzRgb Support
|
||||
//#define BLINKM
|
||||
|
||||
//define PCA9632 PWM LED driver Support
|
||||
//#define PCA9632
|
||||
|
||||
/**
|
||||
* RGB LED / LED Strip Control
|
||||
*
|
||||
@ -1637,7 +1640,7 @@
|
||||
* - Change to green once print has finished
|
||||
* - Turn off after the print has finished and the user has pushed a button
|
||||
*/
|
||||
#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED)
|
||||
#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED) || ENABLED(PCA9632)
|
||||
#define PRINTER_EVENT_LEDS
|
||||
#endif
|
||||
|
||||
|
@ -1658,6 +1658,9 @@
|
||||
//define BlinkM/CyzRgb Support
|
||||
//#define BLINKM
|
||||
|
||||
//define PCA9632 PWM LED driver Support
|
||||
//#define PCA9632
|
||||
|
||||
/**
|
||||
* RGB LED / LED Strip Control
|
||||
*
|
||||
@ -1695,7 +1698,7 @@
|
||||
* - Change to green once print has finished
|
||||
* - Turn off after the print has finished and the user has pushed a button
|
||||
*/
|
||||
#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED)
|
||||
#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED) || ENABLED(PCA9632)
|
||||
#define PRINTER_EVENT_LEDS
|
||||
#endif
|
||||
|
||||
|
@ -1497,6 +1497,9 @@
|
||||
//define BlinkM/CyzRgb Support
|
||||
//#define BLINKM
|
||||
|
||||
//define PCA9632 PWM LED driver Support
|
||||
//#define PCA9632
|
||||
|
||||
/**
|
||||
* RGB LED / LED Strip Control
|
||||
*
|
||||
@ -1534,7 +1537,7 @@
|
||||
* - Change to green once print has finished
|
||||
* - Turn off after the print has finished and the user has pushed a button
|
||||
*/
|
||||
#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED)
|
||||
#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED) || ENABLED(PCA9632)
|
||||
#define PRINTER_EVENT_LEDS
|
||||
#endif
|
||||
|
||||
|
@ -1484,6 +1484,9 @@
|
||||
//define BlinkM/CyzRgb Support
|
||||
//#define BLINKM
|
||||
|
||||
//define PCA9632 PWM LED driver Support
|
||||
//#define PCA9632
|
||||
|
||||
/**
|
||||
* RGB LED / LED Strip Control
|
||||
*
|
||||
@ -1521,7 +1524,7 @@
|
||||
* - Change to green once print has finished
|
||||
* - Turn off after the print has finished and the user has pushed a button
|
||||
*/
|
||||
#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED)
|
||||
#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED) || ENABLED(PCA9632)
|
||||
#define PRINTER_EVENT_LEDS
|
||||
#endif
|
||||
|
||||
|
@ -1476,6 +1476,9 @@
|
||||
//define BlinkM/CyzRgb Support
|
||||
//#define BLINKM
|
||||
|
||||
//define PCA9632 PWM LED driver Support
|
||||
//#define PCA9632
|
||||
|
||||
/**
|
||||
* RGB LED / LED Strip Control
|
||||
*
|
||||
@ -1513,7 +1516,7 @@
|
||||
* - Change to green once print has finished
|
||||
* - Turn off after the print has finished and the user has pushed a button
|
||||
*/
|
||||
#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED)
|
||||
#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED) || ENABLED(PCA9632)
|
||||
#define PRINTER_EVENT_LEDS
|
||||
#endif
|
||||
|
||||
|
@ -1486,6 +1486,9 @@
|
||||
//define BlinkM/CyzRgb Support
|
||||
//#define BLINKM
|
||||
|
||||
//define PCA9632 PWM LED driver Support
|
||||
//#define PCA9632
|
||||
|
||||
// Support for an RGB LED using 3 separate pins with optional PWM
|
||||
//#define RGB_LED
|
||||
//#define RGBW_LED
|
||||
@ -1507,7 +1510,7 @@
|
||||
* - Change to green once print has finished
|
||||
* - Turn off after the print has finished and the user has pushed a button
|
||||
*/
|
||||
#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED)
|
||||
#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED) || ENABLED(PCA9632)
|
||||
#define PRINTER_EVENT_LEDS
|
||||
#endif
|
||||
|
||||
|
115
Marlin/pca9632.cpp
Normal file
115
Marlin/pca9632.cpp
Normal file
@ -0,0 +1,115 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Driver for the Philips PCA9632 LED driver.
|
||||
* Written by Robert Mendon Feb 2017.
|
||||
*/
|
||||
|
||||
#include "MarlinConfig.h"
|
||||
|
||||
#if ENABLED(PCA9632)
|
||||
|
||||
#include "pca9632.h"
|
||||
|
||||
#define PCA9632_MODE1_VALUE 0b00000001 //(ALLCALL)
|
||||
#define PCA9632_MODE2_VALUE 0b00010101 //(DIMMING, INVERT, CHANGE ON STOP,TOTEM)
|
||||
#define PCA9632_LEDOUT_VALUE 0b00101010
|
||||
|
||||
|
||||
/* Register addresses */
|
||||
#define PCA9632_MODE1 0x00
|
||||
#define PCA9632_MODE2 0x01
|
||||
#define PCA9632_PWM0 0x02
|
||||
#define PCA9632_PWM1 0x03
|
||||
#define PCA9632_PWM2 0x04
|
||||
#define PCA9632_PWM3 0x05
|
||||
#define PCA9632_GRPPWM 0x06
|
||||
#define PCA9632_GRPFREQ 0x07
|
||||
#define PCA9632_LEDOUT 0X08
|
||||
#define PCA9632_SUBADR1 0x09
|
||||
#define PCA9632_SUBADR2 0x0A
|
||||
#define PCA9632_SUBADR3 0x0B
|
||||
#define PCA9632_ALLCALLADDR 0x0C
|
||||
|
||||
#define PCA9632_NO_AUTOINC 0x00
|
||||
#define PCA9632_AUTO_ALL 0x80
|
||||
#define PCA9632_AUTO_IND 0xA0
|
||||
#define PCA9632_AUTOGLO 0xC0
|
||||
#define PCA9632_AUTOGI 0xE0
|
||||
|
||||
// Red LED0
|
||||
// Green LED1
|
||||
// Blue LED2
|
||||
#define PCA9632_RED 0x00
|
||||
#define PCA9632_GRN 0x02
|
||||
#define PCA9632_BLU 0x04
|
||||
|
||||
#define LED_OFF 0x00
|
||||
#define LED_ON 0x01
|
||||
#define LED_PWM 0x02
|
||||
|
||||
#define PCA9632_ADDRESS 0b01100000
|
||||
|
||||
byte PCA_init = 0;
|
||||
|
||||
static void PCA9632_WriteRegister(const byte addr, const byte regadd, const byte value) {
|
||||
Wire.beginTransmission(addr);
|
||||
Wire.write(regadd);
|
||||
Wire.write(value);
|
||||
Wire.endTransmission();
|
||||
}
|
||||
|
||||
static void PCA9632_WriteAllRegisters(const byte addr, const byte regadd, const byte value1, const byte value2, const byte value3) {
|
||||
Wire.beginTransmission(addr);
|
||||
Wire.write(PCA9632_AUTO_IND | regadd);
|
||||
Wire.write(value1);
|
||||
Wire.write(value2);
|
||||
Wire.write(value3);
|
||||
Wire.endTransmission();
|
||||
}
|
||||
|
||||
static byte PCA9632_ReadRegister(const byte addr, const byte regadd) {
|
||||
Wire.beginTransmission(addr);
|
||||
Wire.write(regadd);
|
||||
const byte value = Wire.read();
|
||||
Wire.endTransmission();
|
||||
return value;
|
||||
}
|
||||
|
||||
void PCA9632_SetColor(const byte r, const byte g, const byte b) {
|
||||
if (!PCA_init) {
|
||||
PCA_init = 1;
|
||||
Wire.begin();
|
||||
PCA9632_WriteRegister(PCA9632_ADDRESS,PCA9632_MODE1, PCA9632_MODE1_VALUE);
|
||||
PCA9632_WriteRegister(PCA9632_ADDRESS,PCA9632_MODE2, PCA9632_MODE2_VALUE);
|
||||
}
|
||||
|
||||
const byte LEDOUT = (r ? LED_PWM << PCA9632_RED : 0)
|
||||
| (g ? LED_PWM << PCA9632_GRN : 0)
|
||||
| (b ? LED_PWM << PCA9632_BLU : 0);
|
||||
|
||||
PCA9632_WriteAllRegisters(PCA9632_ADDRESS,PCA9632_PWM0, r, g, b);
|
||||
PCA9632_WriteRegister(PCA9632_ADDRESS,PCA9632_LEDOUT, LEDOUT);
|
||||
}
|
||||
|
||||
#endif // PCA9632
|
36
Marlin/pca9632.h
Normal file
36
Marlin/pca9632.h
Normal file
@ -0,0 +1,36 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Driver for the Philips PCA9632 LED driver.
|
||||
* Written by Robert Mendon Feb 2017.
|
||||
*/
|
||||
|
||||
#ifndef __PCA9632_H__
|
||||
#define __PCA9632_H__
|
||||
|
||||
#include "Arduino.h"
|
||||
#include "Wire.h"
|
||||
|
||||
void PCA9632_SetColor(const byte r, const byte g, const byte b);
|
||||
|
||||
#endif // __PCA9632_H__
|
Loading…
Reference in New Issue
Block a user