Skip to content

Commit 940c59d

Browse files
timmmoorethinkyhead
authored andcommitted
Overlord i2c LCD with LEDs and buzzer (#14801)
1 parent e194271 commit 940c59d

File tree

125 files changed

+696
-44
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

125 files changed

+696
-44
lines changed

Marlin/Configuration.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2014,6 +2014,11 @@
20142014
//
20152015
//#define U8GLIB_SH1106_EINSTART
20162016

2017+
//
2018+
// Overlord OLED display/controller with i2c buzzer and LEDs
2019+
//
2020+
//#define OVERLORD_OLED
2021+
20172022
//=============================================================================
20182023
//========================== Extensible UI Displays ===========================
20192024
//=============================================================================

Marlin/src/feature/leds/pca9632.cpp

Lines changed: 42 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,21 @@
5858
#define PCA9632_AUTOGLO 0xC0
5959
#define PCA9632_AUTOGI 0xE0
6060

61-
// Red LED0
62-
// Green LED1
63-
// Blue LED2
64-
#define PCA9632_RED 0x00
65-
#define PCA9632_GRN 0x02
66-
#define PCA9632_BLU 0x04
61+
// Red=LED0 Green=LED1 Blue=LED2
62+
#ifndef PCA9632_RED
63+
#define PCA9632_RED 0x00
64+
#endif
65+
#ifndef PCA9632_GRN
66+
#define PCA9632_GRN 0x02
67+
#endif
68+
#ifndef PCA9632_BLU
69+
#define PCA9632_BLU 0x04
70+
#endif
71+
72+
// If any of the color indexes are greater than 0x04 they can't use auto increment
73+
#if !defined(PCA9632_NO_AUTO_INC) && (PCA9632_RED > 0x04 || PCA9632_GRN > 0x04 || PCA9632_BLU > 0x04)
74+
#define PCA9632_NO_AUTO_INC
75+
#endif
6776

6877
#define LED_OFF 0x00
6978
#define LED_ON 0x01
@@ -80,12 +89,24 @@ static void PCA9632_WriteRegister(const byte addr, const byte regadd, const byte
8089
Wire.endTransmission();
8190
}
8291

83-
static void PCA9632_WriteAllRegisters(const byte addr, const byte regadd, const byte value1, const byte value2, const byte value3) {
92+
static void PCA9632_WriteAllRegisters(const byte addr, const byte regadd, const byte vr, const byte vg, const byte vb) {
93+
#if DISABLED(PCA9632_NO_AUTO_INC)
94+
uint8_t data[4], len = 4;
95+
data[0] = PCA9632_AUTO_IND | regadd;
96+
data[1 + (PCA9632_RED >> 1)] = vr;
97+
data[1 + (PCA9632_GRN >> 1)] = vg;
98+
data[1 + (PCA9632_BLU >> 1)] = vb;
99+
#else
100+
uint8_t data[6], len = 6;
101+
data[0] = regadd + (PCA9632_RED >> 1);
102+
data[1] = vr;
103+
data[2] = regadd + (PCA9632_GRN >> 1);
104+
data[3] = vg;
105+
data[4] = regadd + (PCA9632_BLU >> 1);
106+
data[5] = vb;
107+
#endif
84108
Wire.beginTransmission(I2C_ADDRESS(addr));
85-
Wire.write(PCA9632_AUTO_IND | regadd);
86-
Wire.write(value1);
87-
Wire.write(value2);
88-
Wire.write(value3);
109+
Wire.write(data, len);
89110
Wire.endTransmission();
90111
}
91112

@@ -115,4 +136,14 @@ void pca9632_set_led_color(const LEDColor &color) {
115136
PCA9632_WriteRegister(PCA9632_ADDRESS,PCA9632_LEDOUT, LEDOUT);
116137
}
117138

139+
#if ENABLED(PCA9632_BUZZER)
140+
void pca9632_buzz(uint16_t const f, uint16_t d) {
141+
UNUSED(f); UNUSED(d);
142+
uint8_t data[] = PCA9632_BUZZER_DATA;
143+
Wire.beginTransmission(I2C_ADDRESS(PCA9632_ADDRESS));
144+
Wire.write(data, sizeof(data));
145+
Wire.endTransmission();
146+
}
147+
#endif
148+
118149
#endif // PCA9632

Marlin/src/feature/leds/pca9632.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,7 @@ struct LEDColor;
3030
typedef LEDColor LEDColor;
3131

3232
void pca9632_set_led_color(const LEDColor &color);
33+
34+
#if ENABLED(PCA9632_BUZZER)
35+
void pca9632_buzz(uint16_t const, uint16_t);
36+
#endif

Marlin/src/inc/Conditionals_LCD.h

Lines changed: 39 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@
163163

164164
#elif ENABLED(ULTI_CONTROLLER)
165165

166+
#define IS_ULTIPANEL
166167
#define U8GLIB_SSD1309
167168
#define LCD_RESET_PIN LCD_PINS_D6 // This controller need a reset pin
168169
#define LCD_CONTRAST_MIN 0
@@ -198,48 +199,67 @@
198199
#define U8GLIB_SSD1306
199200
#endif
200201

202+
#if ENABLED(OVERLORD_OLED)
203+
#define IS_ULTIPANEL
204+
#define U8GLIB_SH1106
205+
/**
206+
* PCA9632 for buzzer and LEDs via i2c
207+
* No auto-inc, red and green leds switched, buzzer
208+
*/
209+
#define PCA9632
210+
#define PCA9632_NO_AUTO_INC
211+
#define PCA9632_GRN 0x00
212+
#define PCA9632_RED 0x02
213+
#define PCA9632_BUZZER
214+
#define PCA9632_BUZZER_DATA { 0x09, 0x02 }
215+
216+
#define ENCODER_PULSES_PER_STEP 1 // Overlord uses buttons
217+
#define ENCODER_STEPS_PER_MENU_ITEM 1
218+
#endif
219+
201220
// 128x64 I2C OLED LCDs - SSD1306/SSD1309/SH1106
202221
#define HAS_SSD1306_OLED_I2C ANY(U8GLIB_SSD1306, U8GLIB_SSD1309, U8GLIB_SH1106)
203222
#if HAS_SSD1306_OLED_I2C
204223
#define IS_ULTRA_LCD
205224
#define DOGLCD
206225
#endif
207226

227+
// ST7920-based graphical displays
208228
#if ANY(REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER, LCD_FOR_MELZI, SILVER_GATE_GLCD_CONTROLLER)
209229
#define DOGLCD
210230
#define U8GLIB_ST7920
211231
#define IS_RRD_SC
212232
#endif
213233

234+
// RepRapDiscount LCD or Graphical LCD with rotary click encoder
214235
#if ENABLED(IS_RRD_SC)
215236
#define REPRAP_DISCOUNT_SMART_CONTROLLER
216237
#endif
217238

218-
#if ANY(ULTIMAKERCONTROLLER, REPRAP_DISCOUNT_SMART_CONTROLLER, G3D_PANEL, RIGIDBOT_PANEL, ULTI_CONTROLLER, PANEL_ONE, U8GLIB_SH1106)
239+
/**
240+
* SPI Ultipanels
241+
*/
242+
243+
// Basic Ultipanel-like displays
244+
#if ANY(ULTIMAKERCONTROLLER, REPRAP_DISCOUNT_SMART_CONTROLLER, G3D_PANEL, RIGIDBOT_PANEL, PANEL_ONE, U8GLIB_SH1106)
219245
#define IS_ULTIPANEL
220246
#endif
221247

222-
/**
223-
* SPI PANELS
224-
*/
248+
// Einstart OLED has Cardinal nav via pins defined in pins_EINSTART-S.h
249+
#if ENABLED(U8GLIB_SH1106_EINSTART)
250+
#define DOGLCD
251+
#define IS_ULTIPANEL
252+
#endif
225253

226-
// Einstart OLED has Cardinal nav via pins defined in pins_EINSTART-S.h
227-
#if ENABLED(U8GLIB_SH1106_EINSTART)
228-
#define DOGLCD
229-
#define IS_ULTIPANEL
230-
#endif
231-
232-
/**
233-
* FSMC/SPI TFT PANELS
234-
*/
235-
#if ENABLED(FSMC_GRAPHICAL_TFT)
236-
#define DOGLCD
237-
#define IS_ULTIPANEL
238-
#define DELAYED_BACKLIGHT_INIT
239-
#endif
254+
// FSMC/SPI TFT Panels
255+
#if ENABLED(FSMC_GRAPHICAL_TFT)
256+
#define DOGLCD
257+
#define IS_ULTIPANEL
258+
#define DELAYED_BACKLIGHT_INIT
259+
#endif
240260

241261
/**
242-
* I2C PANELS
262+
* I2C Panels
243263
*/
244264

245265
#if EITHER(LCD_SAINSMART_I2C_1602, LCD_SAINSMART_I2C_2004)

Marlin/src/inc/Conditionals_post.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1024,7 +1024,7 @@
10241024
#define HAS_KILL (PIN_EXISTS(KILL))
10251025
#define HAS_SUICIDE (PIN_EXISTS(SUICIDE))
10261026
#define HAS_PHOTOGRAPH (PIN_EXISTS(PHOTOGRAPH))
1027-
#define HAS_BUZZER (PIN_EXISTS(BEEPER) || ENABLED(LCD_USE_I2C_BUZZER))
1027+
#define HAS_BUZZER (PIN_EXISTS(BEEPER) || ENABLED(LCD_USE_I2C_BUZZER) || ENABLED(PCA9632_BUZZER))
10281028
#define HAS_CASE_LIGHT (PIN_EXISTS(CASE_LIGHT) && ENABLED(CASE_LIGHT_ENABLE))
10291029

10301030
// Digital control

Marlin/src/inc/SanityCheck.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1889,6 +1889,7 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
18891889
+ ENABLED(MKS_12864OLED) \
18901890
+ ENABLED(MKS_12864OLED_SSD1306) \
18911891
+ ENABLED(U8GLIB_SH1106_EINSTART) \
1892+
+ ENABLED(OVERLORD_OLED) \
18921893
+ ENABLED(DGUS_LCD) \
18931894
+ ENABLED(MALYAN_LCD) \
18941895
+ ENABLED(FSMC_GRAPHICAL_TFT)

Marlin/src/lcd/ultralcd.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,8 @@ class MarlinUI {
264264
lcd.buzz(duration, freq);
265265
#elif PIN_EXISTS(BEEPER)
266266
buzzer.tone(duration, freq);
267+
#elif ENABLED(PCA9632_BUZZER)
268+
pca9632_buzz(duration, freq);
267269
#endif
268270
}
269271
#endif

Marlin/src/pins/mega/pins_OVERLORD.h

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -119,19 +119,23 @@
119119
//
120120
// LCD / Controller
121121
//
122-
#define BTN_ENC 16 // Enter Pin
123-
#define BTN_UP 19 // Button UP Pin
124-
#define BTN_DWN 17 // Button DOWN Pin
125-
126-
// OVERLORD OLED PINS
127-
#define LCD_PINS_RS 20
128-
#define LCD_PINS_D5 21
129-
#define LCD_PINS_ENABLE 15
130-
#define LCD_PINS_D4 14
131-
#define LCD_PINS_D6 5
132-
#define LCD_PINS_D7 6
133-
#ifndef LCD_RESET_PIN
134-
#define LCD_RESET_PIN 5 // LCD_PINS_D6
122+
#if HAS_GRAPHICAL_LCD
123+
// OVERLORD OLED pins
124+
#define LCD_PINS_RS 20
125+
#define LCD_PINS_D5 21
126+
#define LCD_PINS_ENABLE 15
127+
#define LCD_PINS_D4 14
128+
#define LCD_PINS_D6 5
129+
#define LCD_PINS_D7 6
130+
#ifndef LCD_RESET_PIN
131+
#define LCD_RESET_PIN 5 // LCD_PINS_D6
132+
#endif
133+
#endif
134+
135+
#if ENABLED(NEWPANEL)
136+
#define BTN_ENC 16 // Enter Pin
137+
#define BTN_UP 19 // Button UP Pin
138+
#define BTN_DWN 17 // Button DOWN Pin
135139
#endif
136140

137141
// Additional connectors/pins on the Overlord V1.X board

config/default/Configuration.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2013,6 +2013,11 @@
20132013
//
20142014
//#define U8GLIB_SH1106_EINSTART
20152015

2016+
//
2017+
// Overlord OLED display/controller with i2c buzzer and LEDs
2018+
//
2019+
//#define OVERLORD_OLED
2020+
20162021
//=============================================================================
20172022
//========================== Extensible UI Displays ===========================
20182023
//=============================================================================

config/examples/3DFabXYZ/Migbot/Configuration.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2044,6 +2044,11 @@
20442044
//
20452045
//#define U8GLIB_SH1106_EINSTART
20462046

2047+
//
2048+
// Overlord OLED display/controller with i2c buzzer and LEDs
2049+
//
2050+
//#define OVERLORD_OLED
2051+
20472052
//=============================================================================
20482053
//========================== Extensible UI Displays ===========================
20492054
//=============================================================================

0 commit comments

Comments
 (0)