Skip to content

Commit 9071cbe

Browse files
Serhiy-Kvgadreau
authored andcommitted
Fixes for TFTGLCD Panel, FastIO (MarlinFirmware#19614)
1 parent 52d8681 commit 9071cbe

File tree

12 files changed

+112
-162
lines changed

12 files changed

+112
-162
lines changed

Marlin/src/HAL/STM32/fastio.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -51,19 +51,19 @@ void FastIO_init(); // Must be called before using fast io macros
5151

5252
#if defined(STM32F0xx) || defined(STM32F1xx) || defined(STM32F3xx) || defined(STM32L0xx) || defined(STM32L4xx)
5353
#define _WRITE(IO, V) do { \
54-
if (V) FastIOPortMap[STM_PORT(digitalPin[IO])]->BSRR = _BV32(STM_PIN(digitalPin[IO])) ; \
55-
else FastIOPortMap[STM_PORT(digitalPin[IO])]->BRR = _BV32(STM_PIN(digitalPin[IO])) ; \
54+
if (V) FastIOPortMap[STM_PORT(digitalPin[IO])]->BSRR = _BV32(digitalPinToPinName(IO) & 0x1F) ; \
55+
else FastIOPortMap[STM_PORT(digitalPin[IO])]->BRR = _BV32(digitalPinToPinName(IO) & 0x1F) ; \
5656
}while(0)
5757
#else
58-
#define _WRITE(IO, V) (FastIOPortMap[STM_PORT(digitalPin[IO])]->BSRR = _BV32(STM_PIN(digitalPin[IO]) + ((V) ? 0 : 16)))
58+
#define _WRITE(IO, V) (FastIOPortMap[STM_PORT(digitalPin[IO])]->BSRR = _BV32(digitalPinToPinName(IO) + ((V) ? 0 : 16)))
5959
#endif
6060

61-
#define _READ(IO) bool(READ_BIT(FastIOPortMap[STM_PORT(digitalPin[IO])]->IDR, _BV32(STM_PIN(digitalPin[IO]))))
62-
#define _TOGGLE(IO) (FastIOPortMap[STM_PORT(digitalPin[IO])]->ODR ^= _BV32(STM_PIN(digitalPin[IO])))
61+
#define _READ(IO) bool(READ_BIT(FastIOPortMap[STM_PORT(digitalPin[IO])]->IDR, _BV32(digitalPinToPinName(IO) & 0x1F)))
62+
#define _TOGGLE(IO) (FastIOPortMap[STM_PORT(digitalPin[IO])]->ODR ^= _BV32(digitalPinToPinName(IO) & 0x1F))
6363

6464
#define _GET_MODE(IO)
6565
#define _SET_MODE(IO,M) pinMode(IO, M)
66-
#define _SET_OUTPUT(IO) pinMode(IO, OUTPUT) /*!< Output Push Pull Mode & GPIO_NOPULL */
66+
#define _SET_OUTPUT(IO) pinMode(IO, OUTPUT) //!< Output Push Pull Mode & GPIO_NOPULL
6767
#define _SET_OUTPUT_OD(IO) pinMode(IO, OUTPUT_OPEN_DRAIN)
6868

6969
#define WRITE(IO,V) _WRITE(IO,V)
@@ -73,9 +73,9 @@ void FastIO_init(); // Must be called before using fast io macros
7373
#define OUT_WRITE(IO,V) do{ _SET_OUTPUT(IO); WRITE(IO,V); }while(0)
7474
#define OUT_WRITE_OD(IO,V) do{ _SET_OUTPUT_OD(IO); WRITE(IO,V); }while(0)
7575

76-
#define SET_INPUT(IO) _SET_MODE(IO, INPUT) /*!< Input Floating Mode */
77-
#define SET_INPUT_PULLUP(IO) _SET_MODE(IO, INPUT_PULLUP) /*!< Input with Pull-up activation */
78-
#define SET_INPUT_PULLDOWN(IO) _SET_MODE(IO, INPUT_PULLDOWN) /*!< Input with Pull-down activation */
76+
#define SET_INPUT(IO) _SET_MODE(IO, INPUT) //!< Input Floating Mode
77+
#define SET_INPUT_PULLUP(IO) _SET_MODE(IO, INPUT_PULLUP) //!< Input with Pull-up activation
78+
#define SET_INPUT_PULLDOWN(IO) _SET_MODE(IO, INPUT_PULLDOWN) //!< Input with Pull-down activation
7979
#define SET_OUTPUT(IO) OUT_WRITE(IO, LOW)
8080
#define SET_PWM(IO) _SET_MODE(IO, PWM)
8181

Marlin/src/core/language.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@
303303
#define LCD_STR_C STR_C
304304
#define LCD_STR_E STR_E
305305

306-
#if HAS_MARLINUI_HD44780
306+
#if EITHER(HAS_MARLINUI_HD44780, IS_TFTGLCD_PANEL)
307307

308308
// Custom characters defined in the first 8 characters of the LCD
309309
#define LCD_STR_BEDTEMP "\x00" // Print only as a char. This will have 'unexpected' results when used in a string!

Marlin/src/core/utility.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ class restorer {
7171
inline void restore() { ref_ = val_; }
7272
};
7373

74-
#define REMEMBER(N,X,V...) restorer<typeof(X)> restorer_##N(X, ##V)
74+
#define REMEMBER(N,X,V...) restorer<__typeof__(X)> restorer_##N(X, ##V)
7575
#define RESTORE(N) restorer_##N.restore()
7676

7777
// Converts from an uint8_t in the range of 0-255 to an uint8_t

Marlin/src/inc/Conditionals_LCD.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,9 +226,9 @@
226226
#define LCD_PROGRESS_BAR
227227
#endif
228228
#if ENABLED(TFTGLCD_PANEL_I2C)
229-
#define LCD_USE_I2C_BUZZER // Enable buzzer on LCD for I2C and SPI buses (LiquidTWI2 not required)
230229
#define LCD_I2C_ADDRESS 0x27 // Must be equal to panel's I2C slave addres
231230
#endif
231+
#define LCD_USE_I2C_BUZZER // Enable buzzer on LCD, used for both I2C and SPI buses (LiquidTWI2 not required)
232232
#define STD_ENCODER_PULSES_PER_STEP 2
233233
#define STD_ENCODER_STEPS_PER_MENU_ITEM 1
234234
#define LCD_WIDTH 20 // 20 or 24 chars in line

Marlin/src/inc/Conditionals_post.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2457,7 +2457,7 @@
24572457
/**
24582458
* Buzzer/Speaker
24592459
*/
2460-
#if PIN_EXISTS(BEEPER) || ANY(LCD_USE_I2C_BUZZER, PCA9632_BUZZER, IS_TFTGLCD_PANEL)
2460+
#if PIN_EXISTS(BEEPER) || ANY(LCD_USE_I2C_BUZZER, PCA9632_BUZZER)
24612461
#define HAS_BUZZER 1
24622462
#if PIN_EXISTS(BEEPER)
24632463
#define USE_BEEPER 1

0 commit comments

Comments
 (0)