diff options
author | SchmartMaker <martijn@schiedon.net> | 2020-09-19 10:29:44 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-19 10:29:44 +0300 |
commit | 0a88a11513a4849b0a96119e6edfc7b3bc8593c6 (patch) | |
tree | d41508b4e5f9d0b3c19fbedfc09bf38f5ef04419 /src/Display/Display.cpp | |
parent | 215f1732776d8a9315cd4e77f27d7de3d3c0d002 (diff) |
Re-implementation of ST7567 support for Duet 2 Maestro on v3.02 (#424)
* Adapted the latest version (2020-08-07) of v3.02-dev to include support
for a ST7565 minipanel display in the Duet 2 Maestro. An experimental
contrast parameter "C" (range 0-100) has been added to the M918 as well.
This builds on previous code where a ST7576 display was made to work on
a Duet 3 Mini board.
* Added final comments, TODO's and clarifications
* Added a default define to set the LCD_CS on the Maestro high permanently
on display init. LCD_CS functions as a gate pin for ST7567 displays on
the Maestro, and that doesn't have to happen with every chip select. In
this specific case, EXP_1 functions as the alternative LCD_CS, since the
original LCD_CS cannot provide an active low.
Diffstat (limited to 'src/Display/Display.cpp')
-rw-r--r-- | src/Display/Display.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/Display/Display.cpp b/src/Display/Display.cpp index b0cc052a..fe95eb5e 100644 --- a/src/Display/Display.cpp +++ b/src/Display/Display.cpp @@ -145,9 +145,14 @@ void Display::ErrorBeep() noexcept void Display::InitDisplay(GCodeBuffer& gb, Lcd *newLcd, bool defaultCsPolarity) THROWS(GCodeException) { - newLcd->Init(LcdCSPin, LcdA0Pin, defaultCsPolarity, (gb.Seen('F')) ? gb.GetUIValue() : LcdSpiClockFrequency); - IoPort::SetPinMode(LcdBeepPin, OUTPUT_PWM_LOW); - newLcd->SetFont(SmallFontNumber); +#ifdef SRC_DUETM_PINS_DUETM_H_ + // Only for the Duet 2 Maestro since the LCD_CS gates the SPI0_SCK and SPI0_MOSI. + // NOTE: https://github.com/SchmartMaker/RepRapFirmware/tree/ST7565/src/Display did this on a higher level by using different display IDs + // NOTE: boundary checking is not implemented for the contrast (C) parameter yet + newLcd->Init(LcdCSAltPin, LcdA0Pin, defaultCsPolarity, (gb.Seen('F')) ? gb.GetUIValue() : LcdSpiClockFrequency, (gb.Seen('C')) ? gb.GetUIValue() : DefaultDisplayContrastRatio, LcdCSPin, true); +#else + newLcd->Init(LcdCSPin, LcdA0Pin, defaultCsPolarity, (gb.Seen('F')) ? gb.GetUIValue() : LcdSpiClockFrequency, (gb.Seen('C')) ? gb.GetUIValue() : DefaultDisplayContrastRatio); +#endif IoPort::SetPinMode(LcdBeepPin, OUTPUT_PWM_LOW); newLcd->SetFont(SmallFontNumber); @@ -163,6 +168,8 @@ void Display::InitDisplay(GCodeBuffer& gb, Lcd *newLcd, bool defaultCsPolarity) GCodeResult Display::Configure(GCodeBuffer& gb, const StringRef& reply) THROWS(GCodeException) { + // BUG: calling M918 a number of times in succession seems to crash the firmware on the Maestro. + // This could be unreleased memory or something else. bool seen = false; if (gb.Seen('P')) |