Browse Source

Prevent compilation of unused u8g-oriented code

pull/1/head
Scott Lahteine 7 years ago
parent
commit
fb608938f8
  1. 54
      Marlin/src/HAL/HAL_DUE/u8g_com_HAL_DUE_shared_hw_spi.cpp
  2. 9
      Marlin/src/HAL/HAL_DUE/u8g_com_HAL_DUE_st7920_sw_spi.cpp
  3. 10
      Marlin/src/HAL/HAL_LPC1768/u8g_com_HAL_LPC1768_hw_spi.cpp
  4. 26
      Marlin/src/HAL/HAL_LPC1768/u8g_com_HAL_LPC1768_ssd_hw_i2c.cpp
  5. 16
      Marlin/src/HAL/HAL_LPC1768/u8g_com_HAL_LPC1768_ssd_sw_i2c.cpp under construction
  6. 51
      Marlin/src/HAL/HAL_LPC1768/u8g_com_HAL_LPC1768_st7920_hw_spi.cpp
  7. 37
      Marlin/src/HAL/HAL_LPC1768/u8g_com_HAL_LPC1768_st7920_sw_spi.cpp
  8. 6
      Marlin/src/HAL/HAL_LPC1768/u8g_com_HAL_LPC1768_sw_spi.cpp
  9. 2
      Marlin/src/lcd/dogm/u8g_dev_ssd1306_sh1106_128x64_I2C.cpp
  10. 1
      Marlin/src/lcd/dogm/u8g_dev_st7565_64128n_HAL.cpp
  11. 2
      Marlin/src/lcd/dogm/u8g_dev_st7920_128x64_HAL.cpp
  12. 14
      Marlin/src/lcd/dogm/u8g_dev_uc1701_mini12864_HAL.cpp
  13. 3
      Marlin/src/lcd/dogm/ultralcd_st7920_u8glib_rrd_AVR.cpp
  14. 13
      Marlin/src/lcd/lcdprint_u8g.cpp

54
Marlin/src/HAL/HAL_DUE/u8g_com_HAL_DUE_shared_hw_spi.cpp

@ -56,50 +56,46 @@
*/
#ifdef __SAM3X8E__
// #include <inttypes.h>
#include "../../inc/MarlinConfigPre.h"
// #include "src/core/macros.h"
// #include "Configuration.h"
#include "../../Marlin.h"
#include "../../inc/MarlinConfig.h"
#if ENABLED(DOGLCD)
#include <U8glib.h>
#include <U8glib.h>
#define SPI_FULL_SPEED 0
#define SPI_HALF_SPEED 1
#define SPI_QUARTER_SPEED 2
#define SPI_EIGHTH_SPEED 3
#define SPI_SIXTEENTH_SPEED 4
#define SPI_SPEED_5 5
#define SPI_SPEED_6 6
#include "../../Marlin.h"
void spiBegin();
void spiInit(uint8_t spiRate);
void spiSend(uint8_t b);
void spiSend(const uint8_t* buf, size_t n);
#define SPI_FULL_SPEED 0
#define SPI_HALF_SPEED 1
#define SPI_QUARTER_SPEED 2
#define SPI_EIGHTH_SPEED 3
#define SPI_SIXTEENTH_SPEED 4
#define SPI_SPEED_5 5
#define SPI_SPEED_6 6
#include <Arduino.h>
#include "../../core/macros.h"
#include "fastio_Due.h"
void spiBegin();
void spiInit(uint8_t spiRate);
void spiSend(uint8_t b);
void spiSend(const uint8_t* buf, size_t n);
#include <Arduino.h>
#include "fastio_Due.h"
void u8g_SetPIOutput_DUE_hw_spi(u8g_t *u8g, uint8_t pin_index) {
void u8g_SetPIOutput_DUE_hw_spi(u8g_t *u8g, uint8_t pin_index) {
PIO_Configure(g_APinDescription[u8g->pin_list[pin_index]].pPort, PIO_OUTPUT_1,
g_APinDescription[u8g->pin_list[pin_index]].ulPin, g_APinDescription[u8g->pin_list[pin_index]].ulPinConfiguration); // OUTPUT
}
}
void u8g_SetPILevel_DUE_hw_spi(u8g_t *u8g, uint8_t pin_index, uint8_t level) {
void u8g_SetPILevel_DUE_hw_spi(u8g_t *u8g, uint8_t pin_index, uint8_t level) {
volatile Pio* port = g_APinDescription[u8g->pin_list[pin_index]].pPort;
uint32_t mask = g_APinDescription[u8g->pin_list[pin_index]].ulPin;
if (level) port->PIO_SODR = mask;
else port->PIO_CODR = mask;
}
}
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)
{
switch(msg)
{
case U8G_COM_MSG_STOP:
@ -158,6 +154,8 @@
break;
}
return 1;
}
}
#endif // DOGLCD
#endif //__SAM3X8E__

9
Marlin/src/HAL/HAL_DUE/u8g_com_HAL_DUE_st7920_sw_spi.cpp

@ -55,9 +55,12 @@
#ifdef ARDUINO_ARCH_SAM
#include "../../inc/MarlinConfigPre.h"
#if ENABLED(DOGLCD)
#include <U8glib.h>
#include <Arduino.h>
#include "../../core/macros.h"
#include "../Delay.h"
void u8g_SetPIOutput_DUE(u8g_t *u8g, uint8_t pin_index) {
@ -177,4 +180,6 @@ uint8_t u8g_com_HAL_DUE_ST7920_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_va
return 1;
}
#endif //ARDUINO_ARCH_SAM
#endif // DOGLCD
#endif // ARDUINO_ARCH_SAM

10
Marlin/src/HAL/HAL_LPC1768/u8g_com_HAL_LPC1768_hw_spi.cpp

@ -55,11 +55,11 @@
#ifdef TARGET_LPC1768
//#include <inttypes.h>
#include "../../inc/MarlinConfigPre.h"
//#include "src/core/macros.h"
//#include "Configuration.h"
#if ENABLED(DOGLCD)
//#include <inttypes.h>
#include <U8glib.h>
#define SPI_FULL_SPEED 0
@ -132,4 +132,6 @@ uint8_t u8g_com_HAL_LPC1768_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val,
return 1;
}
#endif //TARGET_LPC1768
#endif // DOGLCD
#endif // TARGET_LPC1768

26
Marlin/src/HAL/HAL_LPC1768/u8g_com_HAL_LPC1768_ssd_hw_i2c.cpp

@ -77,16 +77,20 @@
#ifdef TARGET_LPC1768
#include <U8glib.h>
#include "../../inc/MarlinConfigPre.h"
#define I2C_SLA (0x3C*2)
//#define I2C_CMD_MODE 0x080
#define I2C_CMD_MODE 0x000
#define I2C_DATA_MODE 0x040
#if ENABLED(DOGLCD)
//#define U8G_I2C_OPT_FAST 16
#include <U8glib.h>
uint8_t u8g_com_ssd_I2C_start_sequence(u8g_t *u8g) {
#define I2C_SLA (0x3C*2)
//#define I2C_CMD_MODE 0x080
#define I2C_CMD_MODE 0x000
#define I2C_DATA_MODE 0x040
//#define U8G_I2C_OPT_FAST 16
uint8_t u8g_com_ssd_I2C_start_sequence(u8g_t *u8g) {
/* are we requested to set the a0 state? */
if (u8g->pin_list[U8G_PI_SET_A0] == 0) return 1;
@ -101,9 +105,9 @@
u8g->pin_list[U8G_PI_SET_A0] = 0;
return 1;
}
}
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) {
switch(msg) {
case U8G_COM_MSG_INIT:
//u8g_com_arduino_digital_write(u8g, U8G_PI_SCL, HIGH);
@ -184,6 +188,8 @@
} // switch
return 1;
}
}
#endif // DOGLCD
#endif // TARGET_LPC1768

16
Marlin/src/HAL/HAL_LPC1768/u8g_com_HAL_LPC1768_ssd_sw_i2c.cpp under construction

@ -61,16 +61,20 @@
#ifdef TARGET_LPC1768
#include <U8glib.h>
#include "../../inc/MarlinConfigPre.h"
#if ENABLED(DOGLCD)
#include <U8glib.h>
//void pinMode(int16_t pin, uint8_t mode);
//void digitalWrite(int16_t pin, uint8_t pin_status);
#define I2C_SLA (0x3C*2)
//#define I2C_CMD_MODE 0x080
#define I2C_CMD_MODE 0x000
#define I2C_DATA_MODE 0x040
#define I2C_SLA (0x3C*2)
//#define I2C_CMD_MODE 0x080
#define I2C_CMD_MODE 0x000
#define I2C_DATA_MODE 0x040
//static uint8_t I2C_speed; // 3 - 400KHz, 13 - 100KHz
//#define SPEED_400KHz 3
@ -245,4 +249,6 @@ uint8_t u8g_com_HAL_LPC1768_ssd_sw_i2c_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_v
return 1;
}
#endif // DOGLCD
#endif // TARGET_LPC1768

51
Marlin/src/HAL/HAL_LPC1768/u8g_com_HAL_LPC1768_st7920_hw_spi.cpp

@ -55,32 +55,30 @@
#ifdef TARGET_LPC1768
//#include <inttypes.h>
//#include "src/core/macros.h"
//#include "Configuration.h"
#include "../../inc/MarlinConfigPre.h"
#include <U8glib.h>
#include "../Delay.h"
#if ENABLED(DOGLCD)
#define SPI_FULL_SPEED 0
#define SPI_HALF_SPEED 1
#define SPI_QUARTER_SPEED 2
#define SPI_EIGHTH_SPEED 3
#define SPI_SIXTEENTH_SPEED 4
#define SPI_SPEED_5 5
#define SPI_SPEED_6 6
//#include <inttypes.h>
#include <U8glib.h>
#include "../Delay.h"
#define SPI_FULL_SPEED 0
#define SPI_HALF_SPEED 1
#define SPI_QUARTER_SPEED 2
#define SPI_EIGHTH_SPEED 3
#define SPI_SIXTEENTH_SPEED 4
#define SPI_SPEED_5 5
#define SPI_SPEED_6 6
void spiBegin();
void spiInit(uint8_t spiRate);
void spiSend(uint8_t b);
void spiSend(const uint8_t* buf, size_t n);
void spiBegin();
void spiInit(uint8_t spiRate);
void spiSend(uint8_t b);
void spiSend(const uint8_t* buf, size_t n);
static uint8_t rs_last_state = 255;
static uint8_t rs_last_state = 255;
static void u8g_com_LPC1768_st7920_write_byte_hw_spi(uint8_t rs, uint8_t val)
{
static void u8g_com_LPC1768_st7920_write_byte_hw_spi(uint8_t rs, uint8_t val) {
uint8_t i;
if ( rs != rs_last_state) { // time to send a command/data byte
@ -98,13 +96,10 @@
spiSend(val & 0x0F0);
spiSend(val << 4);
}
}
uint8_t u8g_com_HAL_LPC1768_ST7920_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr)
{
switch(msg)
{
uint8_t u8g_com_HAL_LPC1768_ST7920_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr) {
switch(msg) {
case U8G_COM_MSG_INIT:
u8g_SetPILevel(u8g, U8G_PI_CS, 0);
u8g_SetPIOutput(u8g, U8G_PI_CS);
@ -152,6 +147,8 @@
break;
}
return 1;
}
}
#endif // DOGLCD
#endif // TARGET_LPC1768

37
Marlin/src/HAL/HAL_LPC1768/u8g_com_HAL_LPC1768_st7920_sw_spi.cpp

@ -55,24 +55,27 @@
#ifdef TARGET_LPC1768
#include <U8glib.h>
#include "SoftwareSPI.h"
#include "../Delay.h"
#include "../../inc/MarlinConfigPre.h"
#define SPI_SPEED 3 // About 1 MHz
#if ENABLED(DOGLCD)
static pin_t SCK_pin_ST7920_HAL, MOSI_pin_ST7920_HAL_HAL;
static uint8_t SPI_speed = 0;
static uint8_t rs_last_state = 255;
#include <U8glib.h>
#include "SoftwareSPI.h"
#include "../Delay.h"
static void u8g_com_LPC1768_st7920_write_byte_sw_spi(uint8_t rs, uint8_t val)
{
#define SPI_SPEED 3 // About 1 MHz
static pin_t SCK_pin_ST7920_HAL, MOSI_pin_ST7920_HAL_HAL;
static uint8_t SPI_speed = 0;
static uint8_t rs_last_state = 255;
static void u8g_com_LPC1768_st7920_write_byte_sw_spi(uint8_t rs, uint8_t val) {
uint8_t i;
if ( rs != rs_last_state) { // time to send a command/data byte
if (rs != rs_last_state) { // time to send a command/data byte
rs_last_state = rs;
if ( rs == 0 )
if (rs == 0)
/* command */
swSpiTransfer(0x0F8, SPI_speed, SCK_pin_ST7920_HAL, -1, MOSI_pin_ST7920_HAL_HAL);
else
@ -84,10 +87,10 @@
swSpiTransfer(val & 0x0F0, SPI_speed, SCK_pin_ST7920_HAL, -1, MOSI_pin_ST7920_HAL_HAL);
swSpiTransfer(val << 4, SPI_speed, SCK_pin_ST7920_HAL, -1, MOSI_pin_ST7920_HAL_HAL);
}
}
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)
{
switch(msg)
{
case U8G_COM_MSG_INIT:
@ -146,6 +149,8 @@
break;
}
return 1;
}
}
#endif // DOGLCD
#endif //TARGET_LPC1768
#endif // TARGET_LPC1768

6
Marlin/src/HAL/HAL_LPC1768/u8g_com_HAL_LPC1768_sw_spi.cpp

@ -55,6 +55,10 @@
#ifdef TARGET_LPC1768
#include "../../inc/MarlinConfigPre.h"
#if ENABLED(DOGLCD)
#include <U8glib.h>
#include "SoftwareSPI.h"
@ -120,4 +124,6 @@ uint8_t u8g_com_HAL_LPC1768_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val,
return 1;
}
#endif // DOGLCD
#endif // TARGET_LPC1768

2
Marlin/src/lcd/dogm/u8g_dev_ssd1306_sh1106_128x64_I2C.cpp

@ -65,7 +65,7 @@
* beginning.
*/
#include "../../inc/MarlinConfig.h"
#include "../../inc/MarlinConfigPre.h"
#if ENABLED(DOGLCD)

1
Marlin/src/lcd/dogm/u8g_dev_st7565_64128n_HAL.cpp

@ -211,7 +211,6 @@ uint8_t u8g_dev_st7565_64128n_HAL_2x_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg,
return u8g_dev_pb16v1_base_fn(u8g, dev, msg, arg);
}
U8G_PB_DEV(u8g_dev_st7565_64128n_HAL_sw_spi, WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_st7565_64128n_HAL_fn, U8G_COM_HAL_SW_SPI_FN);
uint8_t u8g_dev_st7565_64128n_HAL_2x_buf[WIDTH*2] U8G_NOCOMMON ;

2
Marlin/src/lcd/dogm/u8g_dev_st7920_128x64_HAL.cpp

@ -53,7 +53,7 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "../../inc/MarlinConfig.h"
#include "../../inc/MarlinConfigPre.h"
#if ENABLED(DOGLCD)

14
Marlin/src/lcd/dogm/u8g_dev_uc1701_mini12864_HAL.cpp

@ -57,7 +57,7 @@
*/
#include "../../inc/MarlinConfig.h"
#include "../../inc/MarlinConfigPre.h"
#if ENABLED(DOGLCD)
@ -108,10 +108,8 @@ static const uint8_t u8g_dev_uc1701_mini12864_HAL_data_start[] PROGMEM = {
U8G_ESC_END /* end of sequence */
};
uint8_t u8g_dev_uc1701_mini12864_HAL_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg)
{
switch(msg)
{
uint8_t u8g_dev_uc1701_mini12864_HAL_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg) {
switch(msg) {
case U8G_DEV_MSG_INIT:
u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_300NS);
u8g_WriteEscSeqP(u8g, dev, u8g_dev_uc1701_mini12864_HAL_init_seq);
@ -140,10 +138,8 @@ uint8_t u8g_dev_uc1701_mini12864_HAL_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg,
return u8g_dev_pb8v1_base_fn(u8g, dev, msg, arg);
}
uint8_t u8g_dev_uc1701_mini12864_HAL_2x_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg)
{
switch(msg)
{
uint8_t u8g_dev_uc1701_mini12864_HAL_2x_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg) {
switch(msg) {
case U8G_DEV_MSG_INIT:
u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_300NS);
u8g_WriteEscSeqP(u8g, dev, u8g_dev_uc1701_mini12864_HAL_init_seq);

3
Marlin/src/lcd/dogm/ultralcd_st7920_u8glib_rrd_AVR.cpp

@ -24,12 +24,13 @@
// file u8g_dev_st7920_128x64_HAL.cpp for the HAL version.
#include "../../inc/MarlinConfig.h"
#include "../../HAL/Delay.h"
#if ENABLED(U8GLIB_ST7920)
#if !(defined(U8G_HAL_LINKS) || defined(__SAM3X8E__))
#include "../../HAL/Delay.h"
#define ST7920_CLK_PIN LCD_PINS_D4
#define ST7920_DAT_PIN LCD_PINS_ENABLE
#define ST7920_CS_PIN LCD_PINS_RS

13
Marlin/src/lcd/lcdprint_u8g.cpp

@ -8,11 +8,8 @@
*/
#include "../inc/MarlinConfigPre.h"
#include "../inc/MarlinConfig.h"
#define USE_LCDPRINT_U8G ENABLED(ULTRA_LCD) && ENABLED(DOGLCD)
#if USE_LCDPRINT_U8G
#if ENABLED(DOGLCD)
#include <U8glib.h>
extern U8GLIB *pu8g;
@ -72,9 +69,9 @@ int lcd_put_u8str_max_rom(const char * utf8_str_P, pixel_len_t max_length) {
return ret;
}
#else // !USE_LCDPRINT_U8G
#else // !ULTRA_LCD
#define _lcd_write(a) TRACE("Write LCD: %c (%d)", (a), (int)(a));
#define _lcd_setcursor(col, row) TRACE("Set cursor LCD: (%d,%d)", (col), (row));
#define _lcd_write(a) TRACE("Write LCD: %c (%d)", (a), (int)(a));
#define _lcd_setcursor(col, row) TRACE("Set cursor LCD: (%d,%d)", (col), (row));
#endif // !USE_LCDPRINT_U8G
#endif // !ULTRA_LCD

Loading…
Cancel
Save