Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/clib/u8g.h
Original file line number Diff line number Diff line change
Expand Up @@ -693,6 +693,8 @@ uint8_t u8g_com_msp430_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void
uint8_t u8g_com_raspberrypi_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr); /* u8g_com_rasperrypi_hw_spi.c */
uint8_t u8g_com_raspberrypi_ssd_i2c_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr); /* u8g_com_raspberrypi_ssd_i2c.c */

uint8_t u8g_com_stm32duino_ssd_i2c_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr); /* u8g_com_stm32duino_ssd_i2c.cpp */


/*
Translation of system specific com drives to generic com names
Expand Down Expand Up @@ -847,6 +849,12 @@ defined(__18CXX) || defined(__PIC32MX)
#endif
#endif

#ifndef U8G_COM_SSD_I2C
#if defined(STM32F1) || defined(STM32F1xx) || defined(STM32F4) || defined(STM32F4xx)
#define U8G_COM_SSD_I2C u8g_com_stm32duino_ssd_i2c_fn
#endif
#endif

#ifndef U8G_COM_SSD_I2C
#define U8G_COM_SSD_I2C u8g_com_null_fn
#endif
Expand Down
2 changes: 1 addition & 1 deletion src/clib/u8g_com_arduino_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

#include "u8g.h"

#if defined(ARDUINO)
#if defined(ARDUINO) && ! (defined(STM32F1) || defined(STM32F1xx) || defined(STM32F4) || defined(STM32F4xx))

#if ARDUINO < 100
#include <WProgram.h>
Expand Down
2 changes: 1 addition & 1 deletion src/clib/u8g_com_arduino_fast_parallel.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@

#include "u8g.h"

#if defined(ARDUINO)
#if defined(ARDUINO) && ! (defined(STM32F1) || defined(STM32F1xx) || defined(STM32F4) || defined(STM32F4xx))

#if ARDUINO < 100
//#include <WProgram.h>
Expand Down
2 changes: 1 addition & 1 deletion src/clib/u8g_com_arduino_no_en_parallel.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@

#include "u8g.h"

#if defined(ARDUINO)
#if defined(ARDUINO) && ! (defined(STM32F1) || defined(STM32F1xx) || defined(STM32F4) || defined(STM32F4xx))

#if ARDUINO < 100
//#include <WProgram.h>
Expand Down
2 changes: 1 addition & 1 deletion src/clib/u8g_com_arduino_parallel.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
#include "u8g.h"


#if defined(ARDUINO)
#if defined(ARDUINO) && ! (defined(STM32F1) || defined(STM32F1xx) || defined(STM32F4) || defined(STM32F4xx))

#if ARDUINO < 100
#include <WProgram.h>
Expand Down
2 changes: 1 addition & 1 deletion src/clib/u8g_com_arduino_port_d_wr.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
#include "u8g.h"


#if defined(ARDUINO) && defined(PORTD)
#if defined(ARDUINO) && defined(PORTD) && ! (defined(STM32F1) || defined(STM32F1xx) || defined(STM32F4) || defined(STM32F4xx))

#if ARDUINO < 100
#include <WProgram.h>
Expand Down
2 changes: 1 addition & 1 deletion src/clib/u8g_com_arduino_st7920_custom.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@

#include "u8g.h"

#if defined(ARDUINO)
#if defined(ARDUINO) && ! (defined(STM32F1) || defined(STM32F1xx) || defined(STM32F4) || defined(STM32F4xx))

#if ARDUINO < 100
#include <WProgram.h>
Expand Down
2 changes: 1 addition & 1 deletion src/clib/u8g_com_arduino_st7920_hw_spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

#include "u8g.h"

#if defined(ARDUINO)
#if defined(ARDUINO) && ! (defined(STM32F1) || defined(STM32F1xx) || defined(STM32F4) || defined(STM32F4xx))

#if ARDUINO < 100
#include <WProgram.h>
Expand Down
2 changes: 1 addition & 1 deletion src/clib/u8g_com_arduino_st7920_spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@

#include "u8g.h"

#if defined(ARDUINO)
#if defined(ARDUINO) && ! (defined(STM32F1) || defined(STM32F1xx) || defined(STM32F4) || defined(STM32F4xx))

#if ARDUINO < 100
#include <WProgram.h>
Expand Down
2 changes: 1 addition & 1 deletion src/clib/u8g_com_arduino_std_sw_spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
#include "u8g.h"


#if defined(ARDUINO)
#if defined(ARDUINO) && ! (defined(STM32F1) || defined(STM32F1xx) || defined(STM32F4) || defined(STM32F4xx))

#if ARDUINO < 100
#include <WProgram.h>
Expand Down
2 changes: 1 addition & 1 deletion src/clib/u8g_com_arduino_sw_spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@

#include "u8g.h"

#if defined(ARDUINO)
#if defined(ARDUINO) && ! (defined(STM32F1) || defined(STM32F1xx) || defined(STM32F4) || defined(STM32F4xx))

#if ARDUINO < 100
#include <WProgram.h>
Expand Down
2 changes: 1 addition & 1 deletion src/clib/u8g_com_arduino_t6963.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@

#include "u8g.h"

#if defined(ARDUINO)
#if defined(ARDUINO) && ! (defined(STM32F1) || defined(STM32F1xx) || defined(STM32F4) || defined(STM32F4xx))

#if ARDUINO < 100
//#include <WProgram.h>
Expand Down
87 changes: 87 additions & 0 deletions src/clib/u8g_com_stm32duino_ssd_i2c_fn.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
/*
u8g_com_stm32duino_ssd_i2c_fn.cpp

communication interface for SSDxxxx chip variant I2C protocol
*/

#if defined(STM32F1) || defined(STM32F1xx) || defined(STM32F4) || defined(STM32F4xx)

#include "u8g.h"
#include "Wire.h"


/*
BUFFER_LENGTH is defined in libraries\Wire\utility\WireBase.h
Default value is 32
Increate this value to 144 to send U8G_COM_MSG_WRITE_SEQ in single block
*/

#if defined(BUFFER_LENGTH) && BUFFER_LENGTH < 144
#define I2C_MAX_LENGTH (BUFFER_LENGTH - 1)
#endif // BUFFER_LENGTH


static uint8_t control;
static uint8_t msgInitCount = 2; // Ignore all messages until 2nd U8G_COM_MSG_INIT


uint8_t u8g_com_stm32duino_ssd_i2c_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr)
{
if (msgInitCount) {
if (msg == U8G_COM_MSG_INIT) msgInitCount --;
if (msgInitCount) return -1;
}

switch(msg)
{
case U8G_COM_MSG_INIT:
Wire.setClock(400000);
Wire.begin();
break;

case U8G_COM_MSG_ADDRESS: /* define cmd (arg_val = 0) or data mode (arg_val = 1) */
if (arg_val == 0) {
control = 0x00;
} else {
control = 0x40;
}
break;

case U8G_COM_MSG_WRITE_BYTE:
Wire.beginTransmission(0x3c);
Wire.write(control);
Wire.write(arg_val);
Wire.endTransmission();
break;

case U8G_COM_MSG_WRITE_SEQ:
{
#ifdef I2C_MAX_LENGTH
while (arg_val > 0) {
Wire.beginTransmission(0x3c);
Wire.write(control);
if (arg_val <= I2C_MAX_LENGTH) {
Wire.write((uint8_t *) arg_ptr, arg_val);
arg_val = 0;
}
else {
Wire.write((uint8_t *) arg_ptr, I2C_MAX_LENGTH);
arg_val -= I2C_MAX_LENGTH;
arg_ptr += I2C_MAX_LENGTH;
}
Wire.endTransmission();
}
#else
Wire.beginTransmission(0x3c);
Wire.write(control);
Wire.write((uint8_t *) arg_ptr, arg_val);
Wire.endTransmission();
#endif // I2C_MAX_LENGTH
break;
}

}
return 1;
}

#endif // defined(STM32F1) || defined(STM32F1xx) || defined(STM32F4) || defined(STM32F4xx)
2 changes: 1 addition & 1 deletion src/clib/u8g_delay.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@

/*==== Part 1: Derive suitable delay procedure ====*/

#if defined(ARDUINO)
#if defined(ARDUINO) && ! (defined(STM32F1) || defined(STM32F1xx) || defined(STM32F4) || defined(STM32F4xx))

# if ARDUINO < 100
# include <WProgram.h>
Expand Down
10 changes: 10 additions & 0 deletions src/clib/u8g_delay.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#if defined(ARDUINO) && defined(STM32F1) || defined(STM32F1xx) || defined(STM32F4) || defined(STM32F4xx)

#include "u8g.h"
#include "Arduino.h"

void u8g_Delay(uint16_t val) {
delay(val);
}

#endif // defined(ARDUINO) && defined(STM32F1) || defined(STM32F1xx) || defined(STM32F4) || defined(STM32F4xx)
2 changes: 1 addition & 1 deletion src/clib/u8g_dev_ht1632.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ mapping
#define HT1632_DATA_LEN 8 // Data are 4*2 bits
#define HT1632_ADDR_LEN 7 // Address are 7 bits

#if defined(ARDUINO)
#if defined(ARDUINO) && ! (defined(STM32F1) || defined(STM32F1xx) || defined(STM32F4) || defined(STM32F4xx))

#if ARDUINO < 100
#include <WProgram.h>
Expand Down