Skip to content

Commit

Permalink
πŸ§‘β€πŸ’» Fall back to SPI0 with YHCB2004 (#25856)
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead authored May 21, 2023
1 parent d22ce55 commit ae3b00d
Show file tree
Hide file tree
Showing 12 changed files with 118 additions and 115 deletions.
49 changes: 23 additions & 26 deletions Marlin/src/HAL/AVR/fastio/fastio_1280.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,39 +35,36 @@

#include "../fastio.h"

// change for your board
#define DEBUG_LED DIO21

// UART
#define RXD DIO0
#define TXD DIO1
#define RXD 0
#define TXD 1

// SPI
#define SCK DIO52
#define MISO DIO50
#define MOSI DIO51
#define SS DIO53
#define MISO 50
#define MOSI 51
#define SCK 52
#define SS 53

// TWI (I2C)
#define SCL DIO21
#define SDA DIO20
#define SCL 21
#define SDA 20

// Timers and PWM
#define OC0A DIO13
#define OC0B DIO4
#define OC1A DIO11
#define OC1B DIO12
#define OC2A DIO10
#define OC2B DIO9
#define OC3A DIO5
#define OC3B DIO2
#define OC3C DIO3
#define OC4A DIO6
#define OC4B DIO7
#define OC4C DIO8
#define OC5A DIO46
#define OC5B DIO45
#define OC5C DIO44
#define OC0A 13
#define OC0B 4
#define OC1A 11
#define OC1B 12
#define OC2A 10
#define OC2B 9
#define OC3A 5
#define OC3B 2
#define OC3C 3
#define OC4A 6
#define OC4B 7
#define OC4C 8
#define OC5A 46
#define OC5B 45
#define OC5C 44

// Digital I/O

Expand Down
35 changes: 16 additions & 19 deletions Marlin/src/HAL/AVR/fastio/fastio_1281.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,32 +33,29 @@

#include "../fastio.h"

// change for your board
#define DEBUG_LED DIO46

// UART
#define RXD DIO0
#define TXD DIO1
#define RXD 0
#define TXD 1

// SPI
#define SCK DIO10
#define MISO DIO12
#define MOSI DIO11
#define SS DIO16
#define SCK 10
#define MISO 12
#define MOSI 11
#define SS 16

// TWI (I2C)
#define SCL DIO17
#define SDA DIO18
#define SCL 17
#define SDA 18

// Timers and PWM
#define OC0A DIO9
#define OC0B DIO4
#define OC1A DIO7
#define OC1B DIO8
#define OC2A DIO6
#define OC3A DIO5
#define OC3B DIO2
#define OC3C DIO3
#define OC0A 9
#define OC0B 4
#define OC1A 7
#define OC1B 8
#define OC2A 6
#define OC3A 5
#define OC3B 2
#define OC3C 3

// Digital I/O

Expand Down
26 changes: 12 additions & 14 deletions Marlin/src/HAL/AVR/fastio/fastio_168.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,29 +33,27 @@

#include "../fastio.h"

#define DEBUG_LED AIO5

// UART
#define RXD DIO0
#define TXD DIO1
#define RXD 0
#define TXD 1

// SPI
#define SCK DIO13
#define MISO DIO12
#define MOSI DIO11
#define SS DIO10
#define SS 10
#define MOSI 11
#define MISO 12
#define SCK 13

// TWI (I2C)
#define SCL AIO5
#define SDA AIO4

// Timers and PWM
#define OC0A DIO6
#define OC0B DIO5
#define OC1A DIO9
#define OC1B DIO10
#define OC2A DIO11
#define OC2B DIO3
#define OC0A 6
#define OC0B 5
#define OC1A 9
#define OC1B 10
#define OC2A 11
#define OC2B 3

// Digital I/O

Expand Down
38 changes: 18 additions & 20 deletions Marlin/src/HAL/AVR/fastio/fastio_644.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,34 +59,32 @@

#include "../fastio.h"

#define DEBUG_LED DIO0

// UART
#define RXD DIO8
#define TXD DIO9
#define RXD0 DIO8
#define TXD0 DIO9
#define RXD 8
#define TXD 9
#define RXD0 8
#define TXD0 9

#define RXD1 DIO10
#define TXD1 DIO11
#define RXD1 10
#define TXD1 11

// SPI
#define SCK DIO7
#define MISO DIO6
#define MOSI DIO5
#define SS DIO4
#define SS 4
#define MOSI 5
#define MISO 6
#define SCK 7

// TWI (I2C)
#define SCL DIO16
#define SDA DIO17
#define SCL 16
#define SDA 17

// Timers and PWM
#define OC0A DIO3
#define OC0B DIO4
#define OC1A DIO13
#define OC1B DIO12
#define OC2A DIO15
#define OC2B DIO14
#define OC0A 3
#define OC0B 4
#define OC1A 13
#define OC1B 12
#define OC2A 15
#define OC2B 14

// Digital I/O

Expand Down
11 changes: 4 additions & 7 deletions Marlin/src/HAL/AVR/fastio/fastio_AT90USB.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,11 @@

#include "../fastio.h"

// change for your board
#define DEBUG_LED DIO31 /* led D5 red */

// SPI
#define SCK DIO21 // 9
#define MISO DIO23 // 11
#define MOSI DIO22 // 10
#define SS DIO20 // 8
#define SS 20 // 8
#define SCK 21 // 9
#define MOSI 22 // 10
#define MISO 23 // 11

// Digital I/O

Expand Down
8 changes: 4 additions & 4 deletions Marlin/src/HAL/DUE/fastio.h
Original file line number Diff line number Diff line change
Expand Up @@ -189,12 +189,12 @@
*/

// UART
#define RXD DIO0
#define TXD DIO1
#define RXD 0
#define TXD 1

// TWI (I2C)
#define SCL DIO21
#define SDA DIO20
#define SCL 21
#define SDA 20

/**
* pins
Expand Down
18 changes: 17 additions & 1 deletion Marlin/src/lcd/HD44780/marlinui_HD44780.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,23 @@

#elif ENABLED(YHCB2004)

LCD_CLASS lcd(YHCB2004_CLK, 20, 4, YHCB2004_MOSI, YHCB2004_MISO); // CLK, cols, rows, MOSI, MISO
#ifndef YHCB2004_SS_PIN
#define YHCB2004_SS_PIN SS
#endif
#ifndef YHCB2004_SCK_PIN
#define YHCB2004_SCK_PIN SCK
#endif
#ifndef YHCB2004_MOSI_PIN
#define YHCB2004_MOSI_PIN MOSI
#endif
#ifndef YHCB2004_MISO_PIN
#define YHCB2004_MISO_PIN MISO
#endif
#if !PINS_EXIST(YHCB2004_SS, YHCB2004_SCK, YHCB2004_MOSI, YHCB2004_MISO)
#error "YHCB2004 display requires YHCB2004_SS_PIN, YHCB2004_SCK_PIN, YHCB2004_MOSI_PIN, and YHCB2004_MISO_PIN."
#endif

LCD_CLASS lcd(YHCB2004_SS_PIN, 20, 4, YHCB2004_SCK_PIN, YHCB2004_MOSI_PIN, YHCB2004_MISO_PIN); // SS, cols, rows, SCK, MOSI, MISO

#else

Expand Down
16 changes: 4 additions & 12 deletions Marlin/src/pins/mega/pins_GT2560_V3.h
Original file line number Diff line number Diff line change
Expand Up @@ -168,18 +168,10 @@
#define BEEPER_PIN 18

#if ENABLED(YHCB2004)
#ifndef YHCB2004_CLK
#define YHCB2004_CLK 5
#define DIO52 YHCB2004_CLK
#endif
#ifndef YHCB2004_MOSI
#define YHCB2004_MOSI 21
#define DIO50 YHCB2004_MOSI
#endif
#ifndef YHCB2004_MISO
#define YHCB2004_MISO 36
#define DIO51 YHCB2004_MISO
#endif
#define YHCB2004_MOSI_PIN 21
#define YHCB2004_MISO_PIN 36
#define YHCB2004_SCK_PIN 5
#define YHCB2004_SS_PIN SS
#elif HAS_WIRED_LCD
#ifndef LCD_PINS_RS
#define LCD_PINS_RS 20
Expand Down
14 changes: 9 additions & 5 deletions Marlin/src/pins/mega/pins_GT2560_V3_A20.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,16 @@
* ATmega2560
*/

#define LCD_PINS_RS 5
#define LCD_PINS_EN 36
#define LCD_PINS_D4 21
#define LCD_PINS_D7 6
#if HAS_WIRED_LCD
#define LCD_PINS_RS 5
#define LCD_PINS_EN 36
#define LCD_PINS_D4 21
#define LCD_PINS_D7 6
#endif

#define SPEAKER // The speaker can produce tones
#ifndef SPEAKER
#define SPEAKER // The speaker can produce tones
#endif

#if IS_NEWPANEL
#define BTN_EN1 16
Expand Down
14 changes: 9 additions & 5 deletions Marlin/src/pins/mega/pins_GT2560_V4_A20.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,16 @@

#define BOARD_INFO_NAME "GT2560 4.x"

#define LCD_PINS_RS 5
#define LCD_PINS_EN 36
#define LCD_PINS_D4 21
#define LCD_PINS_D7 6
#if HAS_WIRED_LCD
#define LCD_PINS_RS 5
#define LCD_PINS_EN 36
#define LCD_PINS_D4 21
#define LCD_PINS_D7 6
#endif

#define SPEAKER // The speaker can produce tones
#ifndef SPEAKER
#define SPEAKER // The speaker can produce tones
#endif

#if IS_NEWPANEL
#define BTN_EN1 16
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/pins/pins.h
Original file line number Diff line number Diff line change
Expand Up @@ -795,7 +795,7 @@
#elif MB(BLACKPILL_CUSTOM)
#include "stm32f4/pins_BLACKPILL_CUSTOM.h" // STM32F4 env:STM32F401CD_blackpill_stlink
#elif MB(I3DBEEZ9_V1)
#include "stm32f4/pins_I3DBEEZ9.h" // STM32F4 env:I3DBEEZ9_V1
#include "stm32f4/pins_I3DBEEZ9.h" // STM32F4 env:I3DBEEZ9_V1

//
// ARM Cortex M7
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/pins/stm32f4/pins_BLACKPILL_CUSTOM.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
//#define SDIO_SUPPORT
#define NO_SD_HOST_DRIVE // This board's SD is only seen by the printer

#if SD_CONNECTION_IS(ONBOARD)
#if SD_CONNECTION_IS(ONBOARD)
#define SDSS PA4
#define SD_SCK_PIN PA5
#define SD_MISO_PIN PA6
Expand Down

0 comments on commit ae3b00d

Please sign in to comment.