Skip to content

Commit

Permalink
Save labor on doc rewriting
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Sep 5, 2021
1 parent 84ce27e commit 7249e21
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions Marlin/src/lcd/dogm/ultralcd_st7920_u8glib_rrd_AVR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,11 @@
#ifndef CPU_ST7920_DELAY_1
#define BOARD_ST7920_DELAY_1 0
#endif
#define ST7920_DELAY_1 _MAX(BOARD_ST7920_DELAY_1, CPU_ST7920_DELAY_1, LCD_ST7920_DELAY_1)
#if BOARD_ST7920_DELAY_1 || CPU_ST7920_DELAY_1 || LCD_ST7920_DELAY_1
#define ST7920_DELAY_1 DELAY_NS(_MAX(BOARD_ST7920_DELAY_1, CPU_ST7920_DELAY_1, LCD_ST7920_DELAY_1))
#else
#define ST7920_DELAY_1
#endif
#endif
#ifndef ST7920_DELAY_2
#ifndef LCD_ST7920_DELAY_2
Expand All @@ -58,7 +62,11 @@
#ifndef CPU_ST7920_DELAY_2
#define BOARD_ST7920_DELAY_2 0
#endif
#define ST7920_DELAY_2 _MAX(BOARD_ST7920_DELAY_2, CPU_ST7920_DELAY_2, LCD_ST7920_DELAY_2)
#if BOARD_ST7920_DELAY_2 || CPU_ST7920_DELAY_2 || LCD_ST7920_DELAY_2
#define ST7920_DELAY_2 DELAY_NS(_MAX(BOARD_ST7920_DELAY_2, CPU_ST7920_DELAY_2, LCD_ST7920_DELAY_2))
#else
#define ST7920_DELAY_2
#endif
#endif
#ifndef ST7920_DELAY_3
#ifndef LCD_ST7920_DELAY_3
Expand All @@ -70,7 +78,11 @@
#ifndef CPU_ST7920_DELAY_3
#define BOARD_ST7920_DELAY_3 0
#endif
#define ST7920_DELAY_3 _MAX(BOARD_ST7920_DELAY_3, CPU_ST7920_DELAY_3, LCD_ST7920_DELAY_3)
#if BOARD_ST7920_DELAY_3 || CPU_ST7920_DELAY_3 || LCD_ST7920_DELAY_3
#define ST7920_DELAY_3 DELAY_NS(_MAX(BOARD_ST7920_DELAY_3, CPU_ST7920_DELAY_3, LCD_ST7920_DELAY_3))
#else
#define ST7920_DELAY_3
#endif
#endif

#ifdef ARDUINO_ARCH_STM32F1
Expand All @@ -80,9 +92,9 @@
#endif

#define ST7920_SND_BIT do{ \
WRITE(ST7920_CLK_PIN, LOW); DELAY_NS(ST7920_DELAY_1); \
WRITE(ST7920_DAT_PIN, ST7920_DAT(val)); DELAY_NS(ST7920_DELAY_2); \
WRITE(ST7920_CLK_PIN, HIGH); DELAY_NS(ST7920_DELAY_3); \
WRITE(ST7920_CLK_PIN, LOW); ST7920_DELAY_1; \
WRITE(ST7920_DAT_PIN, ST7920_DAT(val)); ST7920_DELAY_2; \
WRITE(ST7920_CLK_PIN, HIGH); ST7920_DELAY_3; \
val <<= 1; }while(0)

// Optimize this code with -O3
Expand Down

0 comments on commit 7249e21

Please sign in to comment.