mirror of
https://github.com/MarlinFirmware/Marlin.git
synced 2024-11-29 23:07:42 +00:00
⚡️ SAMD21 LCD uses HW SPI with media (#26012)
This commit is contained in:
parent
b956001d81
commit
205a679959
@ -70,7 +70,7 @@
|
||||
#include "../../shared/HAL_SPI.h"
|
||||
|
||||
#ifndef LCD_SPI_SPEED
|
||||
#define LCD_SPI_SPEED SPI_QUARTER_SPEED
|
||||
#define LCD_SPI_SPEED SPI_HALF_SPEED
|
||||
#endif
|
||||
|
||||
void u8g_SetPIOutput(u8g_t *u8g, uint8_t pin_index) {
|
||||
@ -85,7 +85,6 @@ void u8g_SetPILevel(u8g_t *u8g, uint8_t pin_index, uint8_t level) {
|
||||
|
||||
uint8_t u8g_com_samd21_st7920_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr) {
|
||||
|
||||
static SPISettings lcdSPIConfig;
|
||||
|
||||
switch (msg) {
|
||||
case U8G_COM_MSG_STOP:
|
||||
@ -99,7 +98,6 @@ uint8_t u8g_com_samd21_st7920_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val
|
||||
u8g_SetPILevel(u8g, U8G_PI_CS, LOW);
|
||||
|
||||
spiBegin();
|
||||
lcdSPIConfig = SPISettings(900000, MSBFIRST, SPI_MODE0);
|
||||
u8g->pin_list[U8G_PI_A0_STATE] = 0;
|
||||
break;
|
||||
|
||||
@ -117,7 +115,7 @@ uint8_t u8g_com_samd21_st7920_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_WRITE_BYTE:
|
||||
SPI.beginTransaction(lcdSPIConfig);
|
||||
spiBeginTransaction(LCD_SPI_SPEED, MSBFIRST, SPI_MODE0);
|
||||
|
||||
if (u8g->pin_list[U8G_PI_A0_STATE] == 0) { // command
|
||||
SPI.transfer(0x0f8); u8g->pin_list[U8G_PI_A0_STATE] = 2;
|
||||
@ -132,7 +130,7 @@ uint8_t u8g_com_samd21_st7920_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_WRITE_SEQ:
|
||||
SPI.beginTransaction(lcdSPIConfig);
|
||||
spiBeginTransaction(LCD_SPI_SPEED, MSBFIRST, SPI_MODE0);
|
||||
|
||||
if (u8g->pin_list[U8G_PI_A0_STATE] == 0 ) { // command
|
||||
SPI.transfer(0x0f8); u8g->pin_list[U8G_PI_A0_STATE] = 2;
|
||||
|
@ -41,11 +41,9 @@
|
||||
#define U8G_COM_HAL_HW_SPI_FN u8g_com_samd51_hw_spi_fn
|
||||
#define U8G_COM_ST7920_HAL_HW_SPI u8g_com_samd51_st7920_hw_spi_fn
|
||||
|
||||
|
||||
#elif defined(__SAMD21__)
|
||||
|
||||
uint8_t u8g_com_samd21_st7920_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
|
||||
|
||||
#define U8G_COM_ST7920_HAL_HW_SPI u8g_com_samd21_st7920_hw_spi_fn
|
||||
|
||||
#elif defined(__STM32F1__)
|
||||
|
@ -36,11 +36,15 @@
|
||||
|
||||
// RepRapWorld Graphical LCD
|
||||
|
||||
#if !HAS_MEDIA && (LCD_PINS_D4 == SD_SCK_PIN) && (LCD_PINS_EN == SD_MOSI_PIN)
|
||||
#if HAS_MEDIA
|
||||
#ifdef __SAMD21__
|
||||
#define U8G_CLASS U8GLIB_ST7920_128X64_4X_HAL
|
||||
#define U8G_PARAM LCD_PINS_RS
|
||||
#elif HAS_MEDIA && __SAMD21__
|
||||
#else
|
||||
#define U8G_CLASS U8GLIB_ST7920_128X64_4X
|
||||
#endif
|
||||
#define U8G_PARAM LCD_PINS_RS
|
||||
#elif (LCD_PINS_D4 == SD_SCK_PIN) && (LCD_PINS_EN == SD_MOSI_PIN)
|
||||
#define U8G_CLASS U8GLIB_ST7920_128X64_4X_HAL
|
||||
#define U8G_PARAM LCD_PINS_RS
|
||||
#else
|
||||
#define U8G_CLASS U8GLIB_ST7920_128X64_4X
|
||||
|
@ -16,7 +16,7 @@
|
||||
platform = atmelsam
|
||||
board = minitronics20
|
||||
build_flags = ${common.build_flags} -std=gnu++17
|
||||
-DUSBCON -DUSBD_USE_CDC -D__SAMD21__ -DARDUINO_SAMD_MINITRONICS20 -Wno-deprecated-declarations -DU8G_HAL_LINKS -DDEBUG
|
||||
-DUSBCON -DUSBD_USE_CDC -D__SAMD21__ -DARDUINO_SAMD_MINITRONICS20 -Wno-deprecated-declarations -DDEBUG
|
||||
-IMarlin/src/HAL/SAMD21/u8g
|
||||
build_unflags = -std=gnu++11
|
||||
build_src_filter = ${common.default_src_filter} +<src/HAL/SAMD21>
|
||||
|
Loading…
Reference in New Issue
Block a user