Browse Source

PCA9632 PWM color LED support

Add support for the PCA9632 PWM color LED driver used on the Ultimaker 2 and Wanhao Duplicator 6.
dot-bob 7 years ago
parent
commit
0bc66bf22c
35 changed files with 292 additions and 41 deletions
  1. 6
    0
      .travis.yml
  2. 1
    1
      Marlin/Conditionals_LCD.h
  3. 4
    1
      Marlin/Configuration.h
  4. 16
    5
      Marlin/Marlin_main.cpp
  5. 2
    6
      Marlin/SanityCheck.h
  6. 4
    1
      Marlin/example_configurations/CL-260/Configuration.h
  7. 4
    1
      Marlin/example_configurations/Cartesio/Configuration.h
  8. 4
    1
      Marlin/example_configurations/Felix/Configuration.h
  9. 4
    1
      Marlin/example_configurations/Felix/DUAL/Configuration.h
  10. 4
    1
      Marlin/example_configurations/FolgerTech-i3-2020/Configuration.h
  11. 4
    1
      Marlin/example_configurations/Hephestos/Configuration.h
  12. 4
    1
      Marlin/example_configurations/Hephestos_2/Configuration.h
  13. 4
    1
      Marlin/example_configurations/K8200/Configuration.h
  14. 4
    1
      Marlin/example_configurations/K8400/Configuration.h
  15. 4
    1
      Marlin/example_configurations/K8400/Dual-head/Configuration.h
  16. 4
    1
      Marlin/example_configurations/M150/Configuration.h
  17. 4
    1
      Marlin/example_configurations/RepRapWorld/Megatronics/Configuration.h
  18. 4
    1
      Marlin/example_configurations/RigidBot/Configuration.h
  19. 4
    1
      Marlin/example_configurations/SCARA/Configuration.h
  20. 4
    1
      Marlin/example_configurations/TAZ4/Configuration.h
  21. 4
    1
      Marlin/example_configurations/TinyBoy2/Configuration.h
  22. 4
    1
      Marlin/example_configurations/WITBOX/Configuration.h
  23. 4
    1
      Marlin/example_configurations/adafruit/ST7565/Configuration.h
  24. 4
    1
      Marlin/example_configurations/delta/FLSUN/auto_calibrate/Configuration.h
  25. 4
    1
      Marlin/example_configurations/delta/FLSUN/kossel_mini/Configuration.h
  26. 4
    1
      Marlin/example_configurations/delta/generic/Configuration.h
  27. 4
    1
      Marlin/example_configurations/delta/kossel_mini/Configuration.h
  28. 4
    1
      Marlin/example_configurations/delta/kossel_pro/Configuration.h
  29. 4
    1
      Marlin/example_configurations/delta/kossel_xl/Configuration.h
  30. 4
    1
      Marlin/example_configurations/gCreate_gMax1.5+/Configuration.h
  31. 4
    1
      Marlin/example_configurations/makibox/Configuration.h
  32. 4
    1
      Marlin/example_configurations/tvrrug/Round2/Configuration.h
  33. 4
    1
      Marlin/example_configurations/wt150/Configuration.h
  34. 115
    0
      Marlin/pca9632.cpp
  35. 36
    0
      Marlin/pca9632.h

+ 6
- 0
.travis.yml View File

@@ -291,6 +291,12 @@ script:
291 291
   - opt_enable ULTIMAKERCONTROLLER
292 292
   - build_marlin
293 293
   #
294
+  # PCA9632
295
+  #
296
+  - restore_configs
297
+  - opt_enable PCA9632
298
+  - build_marlin
299
+  #
294 300
   # MAKRPANEL
295 301
   # Needs to use Melzi and Sanguino hardware
296 302
   #

+ 1
- 1
Marlin/Conditionals_LCD.h View File

@@ -398,6 +398,6 @@
398 398
 
399 399
   #define HAS_SOFTWARE_ENDSTOPS (ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS))
400 400
   #define HAS_RESUME_CONTINUE (ENABLED(NEWPANEL) || ENABLED(EMERGENCY_PARSER))
401
-  #define HAS_COLOR_LEDS (ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED))
401
+  #define HAS_COLOR_LEDS (ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED) || ENABLED(PCA9632))
402 402
 
403 403
 #endif // CONDITIONALS_LCD_H

+ 4
- 1
Marlin/Configuration.h View File

@@ -1482,6 +1482,9 @@
1482 1482
 //define BlinkM/CyzRgb Support
1483 1483
 //#define BLINKM
1484 1484
 
1485
+//define PCA9632 PWM LED driver Support
1486
+//#define PCA9632
1487
+
1485 1488
 /**
1486 1489
  * RGB LED / LED Strip Control
1487 1490
  *
@@ -1519,7 +1522,7 @@
1519 1522
  *  - Change to green once print has finished
1520 1523
  *  - Turn off after the print has finished and the user has pushed a button
1521 1524
  */
1522
-#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED)
1525
+#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED) || ENABLED(PCA9632)
1523 1526
   #define PRINTER_EVENT_LEDS
1524 1527
 #endif
1525 1528
 

+ 16
- 5
Marlin/Marlin_main.cpp View File

@@ -138,7 +138,7 @@
138 138
  * M140 - Set bed target temp. S<temp>
139 139
  * M145 - Set heatup values for materials on the LCD. H<hotend> B<bed> F<fan speed> for S<material> (0=PLA, 1=ABS)
140 140
  * M149 - Set temperature units. (Requires TEMPERATURE_UNITS_SUPPORT)
141
- * M150 - Set Status LED Color as R<red> U<green> B<blue>. Values 0-255. (Requires BLINKM or RGB_LED)
141
+ * M150 - Set Status LED Color as R<red> U<green> B<blue>. Values 0-255. (Requires BLINKM, RGB_LED, RGBW_LED, or PCA9632)
142 142
  * M155 - Auto-report temperatures with interval of S<seconds>. (Requires AUTO_REPORT_TEMPERATURES)
143 143
  * M163 - Set a single proportion for a mixing extruder. (Requires MIXING_EXTRUDER)
144 144
  * M164 - Save the mix as a virtual extruder. (Requires MIXING_EXTRUDER and MIXING_VIRTUAL_TOOLS)
@@ -280,6 +280,10 @@
280 280
   #include "Wire.h"
281 281
 #endif
282 282
 
283
+#if ENABLED(PCA9632)
284
+  #include "pca9632.h"
285
+#endif
286
+
283 287
 #if HAS_SERVOS
284 288
   #include "servo.h"
285 289
 #endif
@@ -986,7 +990,9 @@ void servo_init() {
986 990
       // This variant uses i2c to send the RGB components to the device.
987 991
       SendColors(r, g, b);
988 992
 
989
-    #else
993
+    #endif
994
+
995
+    #if ENABLED(RGB_LED) || ENABLED(RGBW_LED)
990 996
 
991 997
       // This variant uses 3 separate pins for the RGB components.
992 998
       // If the pins can do PWM then their intensity will be set.
@@ -1003,6 +1009,11 @@ void servo_init() {
1003 1009
       #endif
1004 1010
 
1005 1011
     #endif
1012
+
1013
+    #if ENABLED(PCA9632)
1014
+      // Update I2C LED driver
1015
+      PCA9632_SetColor(r, g, b);
1016
+    #endif
1006 1017
   }
1007 1018
 
1008 1019
 #endif // HAS_COLOR_LEDS
@@ -5893,7 +5904,7 @@ inline void gcode_M17() {
5893 5904
 
5894 5905
     if (!DEBUGGING(DRYRUN) && unload_length != 0) {
5895 5906
       #if ENABLED(PREVENT_COLD_EXTRUSION)
5896
-        if (!thermalManager.allow_cold_extrude && 
5907
+        if (!thermalManager.allow_cold_extrude &&
5897 5908
             thermalManager.degTargetHotend(active_extruder) < thermalManager.extrude_min_temp) {
5898 5909
           SERIAL_ERROR_START();
5899 5910
           SERIAL_ERRORLNPGM(MSG_TOO_COLD_FOR_M600);
@@ -8013,7 +8024,7 @@ inline void gcode_M121() { endstops.enable_globally(false); }
8013 8024
     );
8014 8025
   }
8015 8026
 
8016
-#endif // BLINKM || RGB_LED
8027
+#endif // HAS_COLOR_LEDS
8017 8028
 
8018 8029
 /**
8019 8030
  * M200: Set filament diameter and set E axis units to cubic units
@@ -10621,7 +10632,7 @@ void process_next_command() {
10621 10632
           gcode_M150();
10622 10633
           break;
10623 10634
 
10624
-      #endif // BLINKM
10635
+      #endif // HAS_COLOR_LEDS
10625 10636
 
10626 10637
       #if ENABLED(MIXING_EXTRUDER)
10627 10638
         case 163: // M163: Set a component weight for mixing extruder

+ 2
- 6
Marlin/SanityCheck.h View File

@@ -1027,17 +1027,13 @@ static_assert(1 >= 0
1027 1027
     #error "RGB_LED requires RGB_LED_R_PIN, RGB_LED_G_PIN, and RGB_LED_B_PIN."
1028 1028
   #elif ENABLED(RGBW_LED)
1029 1029
     #error "Please enable only one of RGB_LED and RGBW_LED."
1030
-  #elif ENABLED(BLINKM)
1031
-    #error "RGB_LED and BLINKM are currently incompatible (both use M150)."
1032 1030
   #endif
1033 1031
 #elif ENABLED(RGBW_LED)
1034 1032
   #if !(_RGB_TEST && PIN_EXISTS(RGB_LED_W))
1035 1033
     #error "RGBW_LED requires RGB_LED_R_PIN, RGB_LED_G_PIN, RGB_LED_B_PIN, and RGB_LED_W_PIN."
1036
-  #elif ENABLED(BLINKM)
1037
-    #error "RGBW_LED and BLINKM are currently incompatible (both use M150)."
1038 1034
   #endif
1039
-#elif DISABLED(BLINKM) && ENABLED(PRINTER_EVENT_LEDS)
1040
-  #error "PRINTER_EVENT_LEDS requires BLINKM, RGB_LED, or RGBW_LED."
1035
+#elif ENABLED(PRINTER_EVENT_LEDS) && DISABLED(BLINKM) && DISABLED(PCA9632)
1036
+  #error "PRINTER_EVENT_LEDS requires BLINKM, PCA9632, RGB_LED, or RGBW_LED."
1041 1037
 #endif
1042 1038
 
1043 1039
 /**

+ 4
- 1
Marlin/example_configurations/CL-260/Configuration.h View File

@@ -1482,6 +1482,9 @@
1482 1482
 //define BlinkM/CyzRgb Support
1483 1483
 //#define BLINKM
1484 1484
 
1485
+//define PCA9632 PWM LED driver Support
1486
+//#define PCA9632
1487
+
1485 1488
 /**
1486 1489
  * RGB LED / LED Strip Control
1487 1490
  *
@@ -1519,7 +1522,7 @@
1519 1522
  *  - Change to green once print has finished
1520 1523
  *  - Turn off after the print has finished and the user has pushed a button
1521 1524
  */
1522
-#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED)
1525
+#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED) || ENABLED(PCA9632)
1523 1526
   #define PRINTER_EVENT_LEDS
1524 1527
 #endif
1525 1528
 

+ 4
- 1
Marlin/example_configurations/Cartesio/Configuration.h View File

@@ -1479,6 +1479,9 @@
1479 1479
 //define BlinkM/CyzRgb Support
1480 1480
 //#define BLINKM
1481 1481
 
1482
+//define PCA9632 PWM LED driver Support
1483
+//#define PCA9632
1484
+
1482 1485
 /**
1483 1486
  * RGB LED / LED Strip Control
1484 1487
  *
@@ -1516,7 +1519,7 @@
1516 1519
  *  - Change to green once print has finished
1517 1520
  *  - Turn off after the print has finished and the user has pushed a button
1518 1521
  */
1519
-#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED)
1522
+#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED) || ENABLED(PCA9632)
1520 1523
   #define PRINTER_EVENT_LEDS
1521 1524
 #endif
1522 1525
 

+ 4
- 1
Marlin/example_configurations/Felix/Configuration.h View File

@@ -1463,6 +1463,9 @@
1463 1463
 //define BlinkM/CyzRgb Support
1464 1464
 //#define BLINKM
1465 1465
 
1466
+//define PCA9632 PWM LED driver Support
1467
+//#define PCA9632
1468
+
1466 1469
 /**
1467 1470
  * RGB LED / LED Strip Control
1468 1471
  *
@@ -1500,7 +1503,7 @@
1500 1503
  *  - Change to green once print has finished
1501 1504
  *  - Turn off after the print has finished and the user has pushed a button
1502 1505
  */
1503
-#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED)
1506
+#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED) || ENABLED(PCA9632)
1504 1507
   #define PRINTER_EVENT_LEDS
1505 1508
 #endif
1506 1509
 

+ 4
- 1
Marlin/example_configurations/Felix/DUAL/Configuration.h View File

@@ -1463,6 +1463,9 @@
1463 1463
 //define BlinkM/CyzRgb Support
1464 1464
 //#define BLINKM
1465 1465
 
1466
+//define PCA9632 PWM LED driver Support
1467
+//#define PCA9632
1468
+
1466 1469
 /**
1467 1470
  * RGB LED / LED Strip Control
1468 1471
  *
@@ -1500,7 +1503,7 @@
1500 1503
  *  - Change to green once print has finished
1501 1504
  *  - Turn off after the print has finished and the user has pushed a button
1502 1505
  */
1503
-#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED)
1506
+#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED) || ENABLED(PCA9632)
1504 1507
   #define PRINTER_EVENT_LEDS
1505 1508
 #endif
1506 1509
 

+ 4
- 1
Marlin/example_configurations/FolgerTech-i3-2020/Configuration.h View File

@@ -1485,6 +1485,9 @@
1485 1485
 //define BlinkM/CyzRgb Support
1486 1486
 //#define BLINKM
1487 1487
 
1488
+//define PCA9632 PWM LED driver Support
1489
+//#define PCA9632
1490
+
1488 1491
 /**
1489 1492
  * RGB LED / LED Strip Control
1490 1493
  *
@@ -1522,7 +1525,7 @@
1522 1525
  *  - Change to green once print has finished
1523 1526
  *  - Turn off after the print has finished and the user has pushed a button
1524 1527
  */
1525
-#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED)
1528
+#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED) || ENABLED(PCA9632)
1526 1529
   #define PRINTER_EVENT_LEDS
1527 1530
 #endif
1528 1531
 

+ 4
- 1
Marlin/example_configurations/Hephestos/Configuration.h View File

@@ -1471,6 +1471,9 @@
1471 1471
 //define BlinkM/CyzRgb Support
1472 1472
 //#define BLINKM
1473 1473
 
1474
+//define PCA9632 PWM LED driver Support
1475
+//#define PCA9632
1476
+
1474 1477
 /**
1475 1478
  * RGB LED / LED Strip Control
1476 1479
  *
@@ -1508,7 +1511,7 @@
1508 1511
  *  - Change to green once print has finished
1509 1512
  *  - Turn off after the print has finished and the user has pushed a button
1510 1513
  */
1511
-#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED)
1514
+#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED) || ENABLED(PCA9632)
1512 1515
   #define PRINTER_EVENT_LEDS
1513 1516
 #endif
1514 1517
 

+ 4
- 1
Marlin/example_configurations/Hephestos_2/Configuration.h View File

@@ -1474,6 +1474,9 @@
1474 1474
 //define BlinkM/CyzRgb Support
1475 1475
 //#define BLINKM
1476 1476
 
1477
+//define PCA9632 PWM LED driver Support
1478
+//#define PCA9632
1479
+
1477 1480
 /**
1478 1481
  * RGB LED / LED Strip Control
1479 1482
  *
@@ -1511,7 +1514,7 @@
1511 1514
  *  - Change to green once print has finished
1512 1515
  *  - Turn off after the print has finished and the user has pushed a button
1513 1516
  */
1514
-#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED)
1517
+#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED) || ENABLED(PCA9632)
1515 1518
   #define PRINTER_EVENT_LEDS
1516 1519
 #endif
1517 1520
 

+ 4
- 1
Marlin/example_configurations/K8200/Configuration.h View File

@@ -1515,6 +1515,9 @@
1515 1515
 //define BlinkM/CyzRgb Support
1516 1516
 //#define BLINKM
1517 1517
 
1518
+//define PCA9632 PWM LED driver Support
1519
+//#define PCA9632
1520
+
1518 1521
 /**
1519 1522
  * RGB LED / LED Strip Control
1520 1523
  *
@@ -1552,7 +1555,7 @@
1552 1555
  *  - Change to green once print has finished
1553 1556
  *  - Turn off after the print has finished and the user has pushed a button
1554 1557
  */
1555
-#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED)
1558
+#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED) || ENABLED(PCA9632)
1556 1559
   #define PRINTER_EVENT_LEDS
1557 1560
 #endif
1558 1561
 

+ 4
- 1
Marlin/example_configurations/K8400/Configuration.h View File

@@ -1481,6 +1481,9 @@
1481 1481
 //define BlinkM/CyzRgb Support
1482 1482
 //#define BLINKM
1483 1483
 
1484
+//define PCA9632 PWM LED driver Support
1485
+//#define PCA9632
1486
+
1484 1487
 /**
1485 1488
  * RGB LED / LED Strip Control
1486 1489
  *
@@ -1518,7 +1521,7 @@
1518 1521
  *  - Change to green once print has finished
1519 1522
  *  - Turn off after the print has finished and the user has pushed a button
1520 1523
  */
1521
-#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED)
1524
+#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED) || ENABLED(PCA9632)
1522 1525
   #define PRINTER_EVENT_LEDS
1523 1526
 #endif
1524 1527
 

+ 4
- 1
Marlin/example_configurations/K8400/Dual-head/Configuration.h View File

@@ -1481,6 +1481,9 @@
1481 1481
 //define BlinkM/CyzRgb Support
1482 1482
 //#define BLINKM
1483 1483
 
1484
+//define PCA9632 PWM LED driver Support
1485
+//#define PCA9632
1486
+
1484 1487
 /**
1485 1488
  * RGB LED / LED Strip Control
1486 1489
  *
@@ -1518,7 +1521,7 @@
1518 1521
  *  - Change to green once print has finished
1519 1522
  *  - Turn off after the print has finished and the user has pushed a button
1520 1523
  */
1521
-#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED)
1524
+#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED) || ENABLED(PCA9632)
1522 1525
   #define PRINTER_EVENT_LEDS
1523 1526
 #endif
1524 1527
 

+ 4
- 1
Marlin/example_configurations/M150/Configuration.h View File

@@ -1508,6 +1508,9 @@
1508 1508
 //define BlinkM/CyzRgb Support
1509 1509
 //#define BLINKM
1510 1510
 
1511
+//define PCA9632 PWM LED driver Support
1512
+//#define PCA9632
1513
+
1511 1514
 /**
1512 1515
  * RGB LED / LED Strip Control
1513 1516
  *
@@ -1545,7 +1548,7 @@
1545 1548
  *  - Change to green once print has finished
1546 1549
  *  - Turn off after the print has finished and the user has pushed a button
1547 1550
  */
1548
-#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED)
1551
+#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED) || ENABLED(PCA9632)
1549 1552
   #define PRINTER_EVENT_LEDS
1550 1553
 #endif
1551 1554
 

+ 4
- 1
Marlin/example_configurations/RepRapWorld/Megatronics/Configuration.h View File

@@ -1481,6 +1481,9 @@
1481 1481
 //define BlinkM/CyzRgb Support
1482 1482
 //#define BLINKM
1483 1483
 
1484
+//define PCA9632 PWM LED driver Support
1485
+//#define PCA9632
1486
+
1484 1487
 /**
1485 1488
  * RGB LED / LED Strip Control
1486 1489
  *
@@ -1518,7 +1521,7 @@
1518 1521
  *  - Change to green once print has finished
1519 1522
  *  - Turn off after the print has finished and the user has pushed a button
1520 1523
  */
1521
-#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED)
1524
+#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED) || ENABLED(PCA9632)
1522 1525
   #define PRINTER_EVENT_LEDS
1523 1526
 #endif
1524 1527
 

+ 4
- 1
Marlin/example_configurations/RigidBot/Configuration.h View File

@@ -1481,6 +1481,9 @@
1481 1481
 //define BlinkM/CyzRgb Support
1482 1482
 //#define BLINKM
1483 1483
 
1484
+//define PCA9632 PWM LED driver Support
1485
+//#define PCA9632
1486
+
1484 1487
 /**
1485 1488
  * RGB LED / LED Strip Control
1486 1489
  *
@@ -1518,7 +1521,7 @@
1518 1521
  *  - Change to green once print has finished
1519 1522
  *  - Turn off after the print has finished and the user has pushed a button
1520 1523
  */
1521
-#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED)
1524
+#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED) || ENABLED(PCA9632)
1522 1525
   #define PRINTER_EVENT_LEDS
1523 1526
 #endif
1524 1527
 

+ 4
- 1
Marlin/example_configurations/SCARA/Configuration.h View File

@@ -1496,6 +1496,9 @@
1496 1496
 //define BlinkM/CyzRgb Support
1497 1497
 //#define BLINKM
1498 1498
 
1499
+//define PCA9632 PWM LED driver Support
1500
+//#define PCA9632
1501
+
1499 1502
 /**
1500 1503
  * RGB LED / LED Strip Control
1501 1504
  *
@@ -1533,7 +1536,7 @@
1533 1536
  *  - Change to green once print has finished
1534 1537
  *  - Turn off after the print has finished and the user has pushed a button
1535 1538
  */
1536
-#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED)
1539
+#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED) || ENABLED(PCA9632)
1537 1540
   #define PRINTER_EVENT_LEDS
1538 1541
 #endif
1539 1542
 

+ 4
- 1
Marlin/example_configurations/TAZ4/Configuration.h View File

@@ -1500,6 +1500,9 @@
1500 1500
 //define BlinkM/CyzRgb Support
1501 1501
 //#define BLINKM
1502 1502
 
1503
+//define PCA9632 PWM LED driver Support
1504
+//#define PCA9632
1505
+
1503 1506
 /**
1504 1507
  * RGB LED / LED Strip Control
1505 1508
  *
@@ -1537,7 +1540,7 @@
1537 1540
  *  - Change to green once print has finished
1538 1541
  *  - Turn off after the print has finished and the user has pushed a button
1539 1542
  */
1540
-#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED)
1543
+#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED) || ENABLED(PCA9632)
1541 1544
   #define PRINTER_EVENT_LEDS
1542 1545
 #endif
1543 1546
 

+ 4
- 1
Marlin/example_configurations/TinyBoy2/Configuration.h View File

@@ -1537,6 +1537,9 @@
1537 1537
 //define BlinkM/CyzRgb Support
1538 1538
 //#define BLINKM
1539 1539
 
1540
+//define PCA9632 PWM LED driver Support
1541
+//#define PCA9632
1542
+
1540 1543
 /**
1541 1544
  * RGB LED / LED Strip Control
1542 1545
  *
@@ -1574,7 +1577,7 @@
1574 1577
  *  - Change to green once print has finished
1575 1578
  *  - Turn off after the print has finished and the user has pushed a button
1576 1579
  */
1577
-#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED)
1580
+#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED) || ENABLED(PCA9632)
1578 1581
   #define PRINTER_EVENT_LEDS
1579 1582
 #endif
1580 1583
 

+ 4
- 1
Marlin/example_configurations/WITBOX/Configuration.h View File

@@ -1471,6 +1471,9 @@
1471 1471
 //define BlinkM/CyzRgb Support
1472 1472
 //#define BLINKM
1473 1473
 
1474
+//define PCA9632 PWM LED driver Support
1475
+//#define PCA9632
1476
+
1474 1477
 /**
1475 1478
  * RGB LED / LED Strip Control
1476 1479
  *
@@ -1508,7 +1511,7 @@
1508 1511
  *  - Change to green once print has finished
1509 1512
  *  - Turn off after the print has finished and the user has pushed a button
1510 1513
  */
1511
-#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED)
1514
+#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED) || ENABLED(PCA9632)
1512 1515
   #define PRINTER_EVENT_LEDS
1513 1516
 #endif
1514 1517
 

+ 4
- 1
Marlin/example_configurations/adafruit/ST7565/Configuration.h View File

@@ -1481,6 +1481,9 @@
1481 1481
 //define BlinkM/CyzRgb Support
1482 1482
 //#define BLINKM
1483 1483
 
1484
+//define PCA9632 PWM LED driver Support
1485
+//#define PCA9632
1486
+
1484 1487
 /**
1485 1488
  * RGB LED / LED Strip Control
1486 1489
  *
@@ -1518,7 +1521,7 @@
1518 1521
  *  - Change to green once print has finished
1519 1522
  *  - Turn off after the print has finished and the user has pushed a button
1520 1523
  */
1521
-#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED)
1524
+#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED) || ENABLED(PCA9632)
1522 1525
   #define PRINTER_EVENT_LEDS
1523 1526
 #endif
1524 1527
 

+ 4
- 1
Marlin/example_configurations/delta/FLSUN/auto_calibrate/Configuration.h View File

@@ -1602,6 +1602,9 @@
1602 1602
 //define BlinkM/CyzRgb Support
1603 1603
 //#define BLINKM
1604 1604
 
1605
+//define PCA9632 PWM LED driver Support
1606
+//#define PCA9632
1607
+
1605 1608
 /**
1606 1609
  * RGB LED / LED Strip Control
1607 1610
  *
@@ -1639,7 +1642,7 @@
1639 1642
  *  - Change to green once print has finished
1640 1643
  *  - Turn off after the print has finished and the user has pushed a button
1641 1644
  */
1642
-#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED)
1645
+#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED) || ENABLED(PCA9632)
1643 1646
   #define PRINTER_EVENT_LEDS
1644 1647
 #endif
1645 1648
 

+ 4
- 1
Marlin/example_configurations/delta/FLSUN/kossel_mini/Configuration.h View File

@@ -1603,6 +1603,9 @@
1603 1603
 //define BlinkM/CyzRgb Support
1604 1604
 //#define BLINKM
1605 1605
 
1606
+//define PCA9632 PWM LED driver Support
1607
+//#define PCA9632
1608
+
1606 1609
 /**
1607 1610
  * RGB LED / LED Strip Control
1608 1611
  *
@@ -1640,7 +1643,7 @@
1640 1643
  *  - Change to green once print has finished
1641 1644
  *  - Turn off after the print has finished and the user has pushed a button
1642 1645
  */
1643
-#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED)
1646
+#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED) || ENABLED(PCA9632)
1644 1647
   #define PRINTER_EVENT_LEDS
1645 1648
 #endif
1646 1649
 

+ 4
- 1
Marlin/example_configurations/delta/generic/Configuration.h View File

@@ -1592,6 +1592,9 @@
1592 1592
 //define BlinkM/CyzRgb Support
1593 1593
 //#define BLINKM
1594 1594
 
1595
+//define PCA9632 PWM LED driver Support
1596
+//#define PCA9632
1597
+
1595 1598
 /**
1596 1599
  * RGB LED / LED Strip Control
1597 1600
  *
@@ -1629,7 +1632,7 @@
1629 1632
  *  - Change to green once print has finished
1630 1633
  *  - Turn off after the print has finished and the user has pushed a button
1631 1634
  */
1632
-#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED)
1635
+#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED) || ENABLED(PCA9632)
1633 1636
   #define PRINTER_EVENT_LEDS
1634 1637
 #endif
1635 1638
 

+ 4
- 1
Marlin/example_configurations/delta/kossel_mini/Configuration.h View File

@@ -1595,6 +1595,9 @@
1595 1595
 //define BlinkM/CyzRgb Support
1596 1596
 //#define BLINKM
1597 1597
 
1598
+//define PCA9632 PWM LED driver Support
1599
+//#define PCA9632
1600
+
1598 1601
 /**
1599 1602
  * RGB LED / LED Strip Control
1600 1603
  *
@@ -1632,7 +1635,7 @@
1632 1635
  *  - Change to green once print has finished
1633 1636
  *  - Turn off after the print has finished and the user has pushed a button
1634 1637
  */
1635
-#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED)
1638
+#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED) || ENABLED(PCA9632)
1636 1639
   #define PRINTER_EVENT_LEDS
1637 1640
 #endif
1638 1641
 

+ 4
- 1
Marlin/example_configurations/delta/kossel_pro/Configuration.h View File

@@ -1600,6 +1600,9 @@
1600 1600
 //define BlinkM/CyzRgb Support
1601 1601
 //#define BLINKM
1602 1602
 
1603
+//define PCA9632 PWM LED driver Support
1604
+//#define PCA9632
1605
+
1603 1606
 /**
1604 1607
  * RGB LED / LED Strip Control
1605 1608
  *
@@ -1637,7 +1640,7 @@
1637 1640
  *  - Change to green once print has finished
1638 1641
  *  - Turn off after the print has finished and the user has pushed a button
1639 1642
  */
1640
-#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED)
1643
+#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED) || ENABLED(PCA9632)
1641 1644
   #define PRINTER_EVENT_LEDS
1642 1645
 #endif
1643 1646
 

+ 4
- 1
Marlin/example_configurations/delta/kossel_xl/Configuration.h View File

@@ -1658,6 +1658,9 @@
1658 1658
 //define BlinkM/CyzRgb Support
1659 1659
 //#define BLINKM
1660 1660
 
1661
+//define PCA9632 PWM LED driver Support
1662
+//#define PCA9632
1663
+
1661 1664
 /**
1662 1665
  * RGB LED / LED Strip Control
1663 1666
  *
@@ -1695,7 +1698,7 @@
1695 1698
  *  - Change to green once print has finished
1696 1699
  *  - Turn off after the print has finished and the user has pushed a button
1697 1700
  */
1698
-#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED)
1701
+#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED) || ENABLED(PCA9632)
1699 1702
   #define PRINTER_EVENT_LEDS
1700 1703
 #endif
1701 1704
 

+ 4
- 1
Marlin/example_configurations/gCreate_gMax1.5+/Configuration.h View File

@@ -1497,6 +1497,9 @@
1497 1497
 //define BlinkM/CyzRgb Support
1498 1498
 //#define BLINKM
1499 1499
 
1500
+//define PCA9632 PWM LED driver Support
1501
+//#define PCA9632
1502
+
1500 1503
 /**
1501 1504
  * RGB LED / LED Strip Control
1502 1505
  *
@@ -1534,7 +1537,7 @@
1534 1537
  *  - Change to green once print has finished
1535 1538
  *  - Turn off after the print has finished and the user has pushed a button
1536 1539
  */
1537
-#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED)
1540
+#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED) || ENABLED(PCA9632)
1538 1541
   #define PRINTER_EVENT_LEDS
1539 1542
 #endif
1540 1543
 

+ 4
- 1
Marlin/example_configurations/makibox/Configuration.h View File

@@ -1484,6 +1484,9 @@
1484 1484
 //define BlinkM/CyzRgb Support
1485 1485
 //#define BLINKM
1486 1486
 
1487
+//define PCA9632 PWM LED driver Support
1488
+//#define PCA9632
1489
+
1487 1490
 /**
1488 1491
  * RGB LED / LED Strip Control
1489 1492
  *
@@ -1521,7 +1524,7 @@
1521 1524
  *  - Change to green once print has finished
1522 1525
  *  - Turn off after the print has finished and the user has pushed a button
1523 1526
  */
1524
-#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED)
1527
+#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED) || ENABLED(PCA9632)
1525 1528
   #define PRINTER_EVENT_LEDS
1526 1529
 #endif
1527 1530
 

+ 4
- 1
Marlin/example_configurations/tvrrug/Round2/Configuration.h View File

@@ -1476,6 +1476,9 @@
1476 1476
 //define BlinkM/CyzRgb Support
1477 1477
 //#define BLINKM
1478 1478
 
1479
+//define PCA9632 PWM LED driver Support
1480
+//#define PCA9632
1481
+
1479 1482
 /**
1480 1483
  * RGB LED / LED Strip Control
1481 1484
  *
@@ -1513,7 +1516,7 @@
1513 1516
  *  - Change to green once print has finished
1514 1517
  *  - Turn off after the print has finished and the user has pushed a button
1515 1518
  */
1516
-#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED)
1519
+#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED) || ENABLED(PCA9632)
1517 1520
   #define PRINTER_EVENT_LEDS
1518 1521
 #endif
1519 1522
 

+ 4
- 1
Marlin/example_configurations/wt150/Configuration.h View File

@@ -1486,6 +1486,9 @@
1486 1486
 //define BlinkM/CyzRgb Support
1487 1487
 //#define BLINKM
1488 1488
 
1489
+//define PCA9632 PWM LED driver Support
1490
+//#define PCA9632
1491
+
1489 1492
 // Support for an RGB LED using 3 separate pins with optional PWM
1490 1493
 //#define RGB_LED
1491 1494
 //#define RGBW_LED
@@ -1507,7 +1510,7 @@
1507 1510
  *  - Change to green once print has finished
1508 1511
  *  - Turn off after the print has finished and the user has pushed a button
1509 1512
  */
1510
-#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED)
1513
+#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED) || ENABLED(PCA9632)
1511 1514
   #define PRINTER_EVENT_LEDS
1512 1515
 #endif
1513 1516
 

+ 115
- 0
Marlin/pca9632.cpp View File

@@ -0,0 +1,115 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
+ *
5
+ * Based on Sprinter and grbl.
6
+ * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
7
+ *
8
+ * This program is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+
23
+/*
24
+ * Driver for the Philips PCA9632 LED driver.
25
+ * Written by Robert Mendon Feb 2017.
26
+ */
27
+
28
+#include "MarlinConfig.h"
29
+
30
+#if ENABLED(PCA9632)
31
+
32
+#include "pca9632.h"
33
+
34
+#define PCA9632_MODE1_VALUE   0b00000001 //(ALLCALL)
35
+#define PCA9632_MODE2_VALUE   0b00010101 //(DIMMING, INVERT, CHANGE ON STOP,TOTEM)
36
+#define PCA9632_LEDOUT_VALUE  0b00101010
37
+
38
+
39
+/* Register addresses */
40
+#define PCA9632_MODE1       0x00
41
+#define PCA9632_MODE2       0x01
42
+#define PCA9632_PWM0        0x02
43
+#define PCA9632_PWM1        0x03
44
+#define PCA9632_PWM2        0x04
45
+#define PCA9632_PWM3        0x05
46
+#define PCA9632_GRPPWM      0x06
47
+#define PCA9632_GRPFREQ     0x07
48
+#define PCA9632_LEDOUT      0X08
49
+#define PCA9632_SUBADR1     0x09
50
+#define PCA9632_SUBADR2     0x0A
51
+#define PCA9632_SUBADR3     0x0B
52
+#define PCA9632_ALLCALLADDR 0x0C
53
+
54
+#define PCA9632_NO_AUTOINC  0x00
55
+#define PCA9632_AUTO_ALL    0x80
56
+#define PCA9632_AUTO_IND    0xA0
57
+#define PCA9632_AUTOGLO     0xC0
58
+#define PCA9632_AUTOGI      0xE0
59
+
60
+// Red   LED0
61
+// Green LED1
62
+// Blue  LED2
63
+#define PCA9632_RED     0x00
64
+#define PCA9632_GRN     0x02
65
+#define PCA9632_BLU     0x04
66
+
67
+#define LED_OFF   0x00
68
+#define LED_ON    0x01
69
+#define LED_PWM   0x02
70
+
71
+#define PCA9632_ADDRESS 0b01100000
72
+
73
+byte PCA_init = 0;
74
+
75
+static void PCA9632_WriteRegister(const byte addr, const byte regadd, const byte value) {
76
+  Wire.beginTransmission(addr);
77
+  Wire.write(regadd);
78
+  Wire.write(value);
79
+  Wire.endTransmission();
80
+}
81
+
82
+static void PCA9632_WriteAllRegisters(const byte addr, const byte regadd, const byte value1, const byte value2, const byte value3) {
83
+  Wire.beginTransmission(addr);
84
+  Wire.write(PCA9632_AUTO_IND | regadd);
85
+  Wire.write(value1);
86
+  Wire.write(value2);
87
+  Wire.write(value3);
88
+  Wire.endTransmission();
89
+}
90
+
91
+static byte PCA9632_ReadRegister(const byte addr, const byte regadd) {
92
+  Wire.beginTransmission(addr);
93
+  Wire.write(regadd);
94
+  const byte value = Wire.read();
95
+  Wire.endTransmission();
96
+  return value;
97
+}
98
+
99
+void PCA9632_SetColor(const byte r, const byte g, const byte b) {
100
+  if (!PCA_init) {
101
+    PCA_init = 1;
102
+    Wire.begin();
103
+    PCA9632_WriteRegister(PCA9632_ADDRESS,PCA9632_MODE1, PCA9632_MODE1_VALUE);
104
+    PCA9632_WriteRegister(PCA9632_ADDRESS,PCA9632_MODE2, PCA9632_MODE2_VALUE);
105
+  }
106
+
107
+  const byte LEDOUT = (r ? LED_PWM << PCA9632_RED : 0)
108
+                    | (g ? LED_PWM << PCA9632_GRN : 0)
109
+                    | (b ? LED_PWM << PCA9632_BLU : 0);
110
+
111
+  PCA9632_WriteAllRegisters(PCA9632_ADDRESS,PCA9632_PWM0, r, g, b);
112
+  PCA9632_WriteRegister(PCA9632_ADDRESS,PCA9632_LEDOUT, LEDOUT);
113
+}
114
+
115
+#endif // PCA9632

+ 36
- 0
Marlin/pca9632.h View File

@@ -0,0 +1,36 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
+ *
5
+ * Based on Sprinter and grbl.
6
+ * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
7
+ *
8
+ * This program is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+
23
+/*
24
+ * Driver for the Philips PCA9632 LED driver.
25
+ * Written by Robert Mendon Feb 2017.
26
+ */
27
+
28
+#ifndef __PCA9632_H__
29
+#define __PCA9632_H__
30
+
31
+#include "Arduino.h"
32
+#include "Wire.h"
33
+
34
+void PCA9632_SetColor(const byte r, const byte g, const byte  b);
35
+
36
+#endif // __PCA9632_H__

Loading…
Cancel
Save