SAMD51 LCD support (#15113)
This commit is contained in:
parent
23bb40d0ea
commit
12c595c61f
@ -146,3 +146,11 @@ FORCE_INLINE void _delay_ms(const int delay_ms) { delay(delay_ms); }
|
|||||||
#pragma GCC diagnostic ignored "-Wunused-function"
|
#pragma GCC diagnostic ignored "-Wunused-function"
|
||||||
int freeMemory(void);
|
int freeMemory(void);
|
||||||
#pragma GCC diagnostic pop
|
#pragma GCC diagnostic pop
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
char *dtostrf(double __val, signed char __width, unsigned char __prec, char *__s);
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
@ -35,78 +35,83 @@
|
|||||||
|
|
||||||
#ifdef __SAM3X8E__
|
#ifdef __SAM3X8E__
|
||||||
uint8_t u8g_com_HAL_DUE_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
|
uint8_t u8g_com_HAL_DUE_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
|
||||||
#define U8G_COM_HAL_SW_SPI_FN u8g_com_HAL_DUE_sw_spi_fn
|
#define U8G_COM_HAL_SW_SPI_FN u8g_com_HAL_DUE_sw_spi_fn
|
||||||
uint8_t u8g_com_HAL_DUE_shared_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
|
uint8_t u8g_com_HAL_DUE_shared_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
|
||||||
#define U8G_COM_HAL_HW_SPI_FN u8g_com_HAL_DUE_shared_hw_spi_fn
|
#define U8G_COM_HAL_HW_SPI_FN u8g_com_HAL_DUE_shared_hw_spi_fn
|
||||||
uint8_t u8g_com_HAL_DUE_ST7920_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
|
uint8_t u8g_com_HAL_DUE_ST7920_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
|
||||||
#define U8G_COM_ST7920_HAL_SW_SPI u8g_com_HAL_DUE_ST7920_sw_spi_fn
|
#define U8G_COM_ST7920_HAL_SW_SPI u8g_com_HAL_DUE_ST7920_sw_spi_fn
|
||||||
#define U8G_COM_ST7920_HAL_HW_SPI u8g_com_arduino_st7920_hw_spi_fn
|
#define U8G_COM_ST7920_HAL_HW_SPI u8g_com_arduino_st7920_hw_spi_fn
|
||||||
#elif defined(__STM32F1__)
|
#elif defined(__STM32F1__)
|
||||||
uint8_t u8g_com_HAL_STM32F1_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
|
uint8_t u8g_com_HAL_STM32F1_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
|
||||||
#define U8G_COM_HAL_SW_SPI_FN u8g_com_HAL_STM32F1_sw_spi_fn
|
#define U8G_COM_HAL_SW_SPI_FN u8g_com_HAL_STM32F1_sw_spi_fn
|
||||||
uint8_t u8g_com_stm32duino_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
|
uint8_t u8g_com_stm32duino_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
|
||||||
#define U8G_COM_HAL_HW_SPI_FN u8g_com_stm32duino_hw_spi_fn
|
#define U8G_COM_HAL_HW_SPI_FN u8g_com_stm32duino_hw_spi_fn
|
||||||
#define U8G_COM_ST7920_HAL_SW_SPI u8g_com_std_sw_spi_fn
|
#define U8G_COM_ST7920_HAL_SW_SPI u8g_com_std_sw_spi_fn
|
||||||
#define U8G_COM_ST7920_HAL_HW_SPI u8g_com_stm32duino_hw_spi_fn
|
#define U8G_COM_ST7920_HAL_HW_SPI u8g_com_stm32duino_hw_spi_fn
|
||||||
#elif defined(ARDUINO_ARCH_STM32)
|
#elif defined(ARDUINO_ARCH_STM32)
|
||||||
#define U8G_COM_HAL_SW_SPI_FN u8g_com_arduino_std_sw_spi_fn
|
#define U8G_COM_HAL_SW_SPI_FN u8g_com_arduino_std_sw_spi_fn
|
||||||
uint8_t u8g_com_stm32duino_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
|
uint8_t u8g_com_stm32duino_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
|
||||||
#define U8G_COM_HAL_HW_SPI_FN u8g_com_stm32duino_hw_spi_fn
|
#define U8G_COM_HAL_HW_SPI_FN u8g_com_stm32duino_hw_spi_fn
|
||||||
#define U8G_COM_ST7920_HAL_SW_SPI u8g_com_arduino_st7920_spi_fn
|
#define U8G_COM_ST7920_HAL_SW_SPI u8g_com_arduino_st7920_spi_fn
|
||||||
#define U8G_COM_ST7920_HAL_HW_SPI u8g_com_arduino_st7920_hw_spi_fn
|
#define U8G_COM_ST7920_HAL_HW_SPI u8g_com_arduino_st7920_hw_spi_fn
|
||||||
#elif defined(__AVR__)
|
#elif defined(__AVR__)
|
||||||
uint8_t u8g_com_HAL_AVR_sw_sp_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
|
uint8_t u8g_com_HAL_AVR_sw_sp_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
|
||||||
#define U8G_COM_HAL_SW_SPI_FN u8g_com_HAL_AVR_sw_sp_fn
|
#define U8G_COM_HAL_SW_SPI_FN u8g_com_HAL_AVR_sw_sp_fn
|
||||||
#define U8G_COM_HAL_HW_SPI_FN u8g_com_arduino_hw_spi_fn
|
#define U8G_COM_HAL_HW_SPI_FN u8g_com_arduino_hw_spi_fn
|
||||||
#define U8G_COM_ST7920_HAL_SW_SPI u8g_com_arduino_st7920_spi_fn
|
#define U8G_COM_ST7920_HAL_SW_SPI u8g_com_arduino_st7920_spi_fn
|
||||||
#define U8G_COM_ST7920_HAL_HW_SPI u8g_com_arduino_st7920_hw_spi_fn
|
#define U8G_COM_ST7920_HAL_HW_SPI u8g_com_arduino_st7920_hw_spi_fn
|
||||||
|
#elif defined(__SAMD51__)
|
||||||
|
#define U8G_COM_HAL_SW_SPI_FN u8g_com_arduino_std_sw_spi_fn
|
||||||
|
#define U8G_COM_HAL_HW_SPI_FN u8g_com_samd51_hw_spi_fn
|
||||||
|
#define U8G_COM_ST7920_HAL_SW_SPI u8g_com_arduino_st7920_spi_fn
|
||||||
|
#define U8G_COM_ST7920_HAL_HW_SPI u8g_com_samd51_st7920_hw_spi_fn
|
||||||
#else
|
#else
|
||||||
#define U8G_COM_HAL_SW_SPI_FN u8g_com_arduino_std_sw_spi_fn
|
#define U8G_COM_HAL_SW_SPI_FN u8g_com_arduino_std_sw_spi_fn
|
||||||
#define U8G_COM_HAL_HW_SPI_FN u8g_com_arduino_hw_spi_fn
|
#define U8G_COM_HAL_HW_SPI_FN u8g_com_arduino_hw_spi_fn
|
||||||
#define U8G_COM_ST7920_HAL_SW_SPI u8g_com_arduino_st7920_spi_fn
|
#define U8G_COM_ST7920_HAL_SW_SPI u8g_com_arduino_st7920_spi_fn
|
||||||
#define U8G_COM_ST7920_HAL_HW_SPI u8g_com_arduino_st7920_hw_spi_fn
|
#define U8G_COM_ST7920_HAL_HW_SPI u8g_com_arduino_st7920_hw_spi_fn
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef TARGET_LPC1768
|
#ifdef TARGET_LPC1768
|
||||||
uint8_t u8g_com_HAL_LPC1768_ssd_hw_i2c_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
|
uint8_t u8g_com_HAL_LPC1768_ssd_hw_i2c_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define U8G_COM_SSD_I2C_HAL u8g_com_arduino_ssd_i2c_fn
|
#define U8G_COM_SSD_I2C_HAL u8g_com_arduino_ssd_i2c_fn
|
||||||
|
|
||||||
#if PIN_EXISTS(FSMC_CS)
|
#if PIN_EXISTS(FSMC_CS)
|
||||||
uint8_t u8g_com_stm32duino_fsmc_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
|
uint8_t u8g_com_stm32duino_fsmc_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
|
||||||
#define U8G_COM_HAL_FSMC_FN u8g_com_stm32duino_fsmc_fn
|
#define U8G_COM_HAL_FSMC_FN u8g_com_stm32duino_fsmc_fn
|
||||||
#else
|
#else
|
||||||
#define U8G_COM_HAL_FSMC_FN u8g_com_null_fn
|
#define U8G_COM_HAL_FSMC_FN u8g_com_null_fn
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#elif defined(TARGET_LPC1768)
|
#elif defined(TARGET_LPC1768)
|
||||||
|
|
||||||
uint8_t u8g_com_HAL_LPC1768_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
|
uint8_t u8g_com_HAL_LPC1768_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
|
||||||
#define U8G_COM_HAL_SW_SPI_FN u8g_com_HAL_LPC1768_sw_spi_fn
|
#define U8G_COM_HAL_SW_SPI_FN u8g_com_HAL_LPC1768_sw_spi_fn
|
||||||
|
|
||||||
uint8_t u8g_com_HAL_LPC1768_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
|
uint8_t u8g_com_HAL_LPC1768_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
|
||||||
#define U8G_COM_HAL_HW_SPI_FN u8g_com_HAL_LPC1768_hw_spi_fn
|
#define U8G_COM_HAL_HW_SPI_FN u8g_com_HAL_LPC1768_hw_spi_fn
|
||||||
|
|
||||||
uint8_t u8g_com_HAL_LPC1768_ST7920_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
|
uint8_t u8g_com_HAL_LPC1768_ST7920_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
|
||||||
#define U8G_COM_ST7920_HAL_SW_SPI u8g_com_HAL_LPC1768_ST7920_sw_spi_fn
|
#define U8G_COM_ST7920_HAL_SW_SPI u8g_com_HAL_LPC1768_ST7920_sw_spi_fn
|
||||||
|
|
||||||
uint8_t u8g_com_HAL_LPC1768_ST7920_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
|
uint8_t u8g_com_HAL_LPC1768_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_HAL_LPC1768_ST7920_hw_spi_fn
|
#define U8G_COM_ST7920_HAL_HW_SPI u8g_com_HAL_LPC1768_ST7920_hw_spi_fn
|
||||||
|
|
||||||
uint8_t u8g_com_HAL_LPC1768_ssd_hw_i2c_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
|
uint8_t u8g_com_HAL_LPC1768_ssd_hw_i2c_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
|
||||||
#define U8G_COM_SSD_I2C_HAL u8g_com_HAL_LPC1768_ssd_hw_i2c_fn
|
#define U8G_COM_SSD_I2C_HAL u8g_com_HAL_LPC1768_ssd_hw_i2c_fn
|
||||||
|
|
||||||
#define U8G_COM_HAL_FSMC_FN u8g_com_null_fn
|
#define U8G_COM_HAL_FSMC_FN u8g_com_null_fn
|
||||||
|
|
||||||
#else // need to give them some definition or else get compiler errors
|
#else // need to give them some definition or else get compiler errors
|
||||||
|
|
||||||
uint8_t u8g_com_null_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
|
uint8_t u8g_com_null_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
|
||||||
#define U8G_COM_HAL_SW_SPI_FN u8g_com_null_fn
|
#define U8G_COM_HAL_SW_SPI_FN u8g_com_null_fn
|
||||||
#define U8G_COM_HAL_HW_SPI_FN u8g_com_null_fn
|
#define U8G_COM_HAL_HW_SPI_FN u8g_com_null_fn
|
||||||
#define U8G_COM_ST7920_HAL_SW_SPI u8g_com_null_fn
|
#define U8G_COM_ST7920_HAL_SW_SPI u8g_com_null_fn
|
||||||
#define U8G_COM_ST7920_HAL_HW_SPI u8g_com_null_fn
|
#define U8G_COM_ST7920_HAL_HW_SPI u8g_com_null_fn
|
||||||
#define U8G_COM_SSD_I2C_HAL u8g_com_null_fn
|
#define U8G_COM_SSD_I2C_HAL u8g_com_null_fn
|
||||||
#define U8G_COM_HAL_FSMC_FN u8g_com_null_fn
|
#define U8G_COM_HAL_FSMC_FN u8g_com_null_fn
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -202,7 +202,7 @@ u8g_dev_t u8g_dev_st7920_128x64_HAL_4x_sw_spi = { u8g_dev_st7920_128x64_HAL_4x_f
|
|||||||
U8G_PB_DEV(u8g_dev_st7920_128x64_HAL_hw_spi, LCD_PIXEL_WIDTH, LCD_PIXEL_HEIGHT, PAGE_HEIGHT, u8g_dev_st7920_128x64_HAL_fn, U8G_COM_ST7920_HAL_HW_SPI);
|
U8G_PB_DEV(u8g_dev_st7920_128x64_HAL_hw_spi, LCD_PIXEL_WIDTH, LCD_PIXEL_HEIGHT, PAGE_HEIGHT, u8g_dev_st7920_128x64_HAL_fn, U8G_COM_ST7920_HAL_HW_SPI);
|
||||||
u8g_dev_t u8g_dev_st7920_128x64_HAL_4x_hw_spi = { u8g_dev_st7920_128x64_HAL_4x_fn, &u8g_dev_st7920_128x64_HAL_4x_pb, U8G_COM_ST7920_HAL_HW_SPI };
|
u8g_dev_t u8g_dev_st7920_128x64_HAL_4x_hw_spi = { u8g_dev_st7920_128x64_HAL_4x_fn, &u8g_dev_st7920_128x64_HAL_4x_pb, U8G_COM_ST7920_HAL_HW_SPI };
|
||||||
|
|
||||||
#if defined(U8G_HAL_LINKS) || defined(__SAM3X8E__)
|
#if !defined(__AVR__) || defined(U8G_HAL_LINKS)
|
||||||
// Also use this device for HAL version of rrd class. This results in the same device being used
|
// Also use this device for HAL version of rrd class. This results in the same device being used
|
||||||
// for the ST7920 for HAL systems no matter what is selected in ultralcd_impl_DOGM.h.
|
// for the ST7920 for HAL systems no matter what is selected in ultralcd_impl_DOGM.h.
|
||||||
u8g_dev_t u8g_dev_st7920_128x64_rrd_sw_spi = { u8g_dev_st7920_128x64_HAL_4x_fn, &u8g_dev_st7920_128x64_HAL_4x_pb, U8G_COM_ST7920_HAL_SW_SPI };
|
u8g_dev_t u8g_dev_st7920_128x64_rrd_sw_spi = { u8g_dev_st7920_128x64_HAL_4x_fn, &u8g_dev_st7920_128x64_HAL_4x_pb, U8G_COM_ST7920_HAL_SW_SPI };
|
||||||
|
@ -23,9 +23,11 @@
|
|||||||
// NOTE - the HAL version of the rrd device uses a generic ST7920 device. See the
|
// NOTE - the HAL version of the rrd device uses a generic ST7920 device. See the
|
||||||
// file u8g_dev_st7920_128x64_HAL.cpp for the HAL version.
|
// file u8g_dev_st7920_128x64_HAL.cpp for the HAL version.
|
||||||
|
|
||||||
|
#if defined(__AVR__) && !defined(U8G_HAL_LINKS)
|
||||||
|
|
||||||
#include "../../inc/MarlinConfig.h"
|
#include "../../inc/MarlinConfig.h"
|
||||||
|
|
||||||
#if ENABLED(U8GLIB_ST7920) && !defined(U8G_HAL_LINKS) && !defined(__SAM3X8E__)
|
#if ENABLED(U8GLIB_ST7920)
|
||||||
|
|
||||||
#include "ultralcd_st7920_u8glib_rrd_AVR.h"
|
#include "ultralcd_st7920_u8glib_rrd_AVR.h"
|
||||||
|
|
||||||
@ -135,8 +137,8 @@ uint8_t u8g_dev_rrd_st7920_128x64_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, vo
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint8_t u8g_dev_st7920_128x64_rrd_buf[(LCD_PIXEL_WIDTH) * (PAGE_HEIGHT) / 8] U8G_NOCOMMON;
|
uint8_t u8g_dev_st7920_128x64_rrd_buf[(LCD_PIXEL_WIDTH) * (PAGE_HEIGHT) / 8] U8G_NOCOMMON;
|
||||||
u8g_pb_t u8g_dev_st7920_128x64_rrd_pb = {{PAGE_HEIGHT, LCD_PIXEL_HEIGHT, 0, 0, 0}, LCD_PIXEL_WIDTH, u8g_dev_st7920_128x64_rrd_buf};
|
u8g_pb_t u8g_dev_st7920_128x64_rrd_pb = { { PAGE_HEIGHT, LCD_PIXEL_HEIGHT, 0, 0, 0 }, LCD_PIXEL_WIDTH, u8g_dev_st7920_128x64_rrd_buf };
|
||||||
u8g_dev_t u8g_dev_st7920_128x64_rrd_sw_spi = {u8g_dev_rrd_st7920_128x64_fn, &u8g_dev_st7920_128x64_rrd_pb, &u8g_com_null_fn};
|
u8g_dev_t u8g_dev_st7920_128x64_rrd_sw_spi = { u8g_dev_rrd_st7920_128x64_fn, &u8g_dev_st7920_128x64_rrd_pb, &u8g_com_null_fn };
|
||||||
|
|
||||||
#pragma GCC reset_options
|
#pragma GCC reset_options
|
||||||
|
|
||||||
@ -149,4 +151,5 @@ u8g_dev_t u8g_dev_st7920_128x64_rrd_sw_spi = {u8g_dev_rrd_st7920_128x64_fn, &u8g
|
|||||||
void ST7920_write_byte(const uint8_t val) { ST7920_WRITE_BYTE(val); }
|
void ST7920_write_byte(const uint8_t val) { ST7920_WRITE_BYTE(val); }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // U8GLIB_ST7920 && !U8G_HAL_LINKS && !__SAM3X8E__
|
#endif // U8GLIB_ST7920
|
||||||
|
#endif // __AVR__ && !U8G_HAL_LINKS
|
||||||
|
@ -25,9 +25,6 @@
|
|||||||
// file u8g_dev_st7920_128x64_HAL.cpp for the HAL version.
|
// file u8g_dev_st7920_128x64_HAL.cpp for the HAL version.
|
||||||
|
|
||||||
#include "../../inc/MarlinConfig.h"
|
#include "../../inc/MarlinConfig.h"
|
||||||
|
|
||||||
#if ENABLED(U8GLIB_ST7920) && !defined(U8G_HAL_LINKS) && !defined(__SAM3X8E__)
|
|
||||||
|
|
||||||
#include "../../HAL/shared/Delay.h"
|
#include "../../HAL/shared/Delay.h"
|
||||||
|
|
||||||
#define ST7920_CLK_PIN LCD_PINS_D4
|
#define ST7920_CLK_PIN LCD_PINS_D4
|
||||||
@ -94,5 +91,3 @@ void ST7920_SWSPI_SND_8BIT(uint8_t val);
|
|||||||
#define ST7920_SET_DAT() { ST7920_SWSPI_SND_8BIT(0xFA); U8G_DELAY(); }
|
#define ST7920_SET_DAT() { ST7920_SWSPI_SND_8BIT(0xFA); U8G_DELAY(); }
|
||||||
#define ST7920_WRITE_BYTE(a) { ST7920_SWSPI_SND_8BIT((uint8_t)((a)&0xF0u)); ST7920_SWSPI_SND_8BIT((uint8_t)((a)<<4u)); U8G_DELAY(); }
|
#define ST7920_WRITE_BYTE(a) { ST7920_SWSPI_SND_8BIT((uint8_t)((a)&0xF0u)); ST7920_SWSPI_SND_8BIT((uint8_t)((a)<<4u)); U8G_DELAY(); }
|
||||||
#define ST7920_WRITE_BYTES(p,l) { for (uint8_t i = l + 1; --i;) { ST7920_SWSPI_SND_8BIT(*p&0xF0); ST7920_SWSPI_SND_8BIT(*p<<4); p++; } U8G_DELAY(); }
|
#define ST7920_WRITE_BYTES(p,l) { for (uint8_t i = l + 1; --i;) { ST7920_SWSPI_SND_8BIT(*p&0xF0); ST7920_SWSPI_SND_8BIT(*p<<4); p++; } U8G_DELAY(); }
|
||||||
|
|
||||||
#endif // U8GLIB_ST7920 && !U8G_HAL_LINKS && !__SAM3X8E__
|
|
||||||
|
Loading…
Reference in New Issue
Block a user