mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-12-28 16:01:18 +01:00
Merge pull request #7578 from PeterKietzmann/pr_pkg_u8g2_update
pkg/u8g2: update version
This commit is contained in:
commit
4a463c105d
@ -1,6 +1,6 @@
|
||||
PKG_NAME=u8g2
|
||||
PKG_URL=https://github.com/olikraus/u8g2
|
||||
PKG_VERSION=7346987f4e2eadc2e0791b77a1c1c8a27bd72a93
|
||||
PKG_VERSION=9833db01f3e8b865af94e40237fa8c937b732159
|
||||
PKG_LICENSE=BSD-2-Clause
|
||||
|
||||
.PHONY: all
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
From a2a2cfb145902cb36cbe82bdaf68d97686bb9724 Mon Sep 17 00:00:00 2001
|
||||
From: Bas Stottelaar <basstottelaar@gmail.com>
|
||||
Date: Tue, 24 May 2016 20:17:39 +0200
|
||||
Subject: [PATCH 1/3] u8g2: add riot-os makefiles.
|
||||
From 1e2d232135cb2ecbc4ea1668a668b74e242ba3fd Mon Sep 17 00:00:00 2001
|
||||
From: Peter Kietzmann <peter.kietzmann@haw-hamburg.de>
|
||||
Date: Wed, 6 Sep 2017 20:23:56 +0200
|
||||
Subject: [PATCH 1/2] u8g2: add RIOT makefiles
|
||||
|
||||
---
|
||||
Makefile | 22 ++++++++++++++++++++++
|
||||
@ -72,5 +72,5 @@ index 0000000..32e7913
|
||||
+
|
||||
+include $(RIOTBASE)/Makefile.base
|
||||
--
|
||||
1.9.1
|
||||
2.18.2
|
||||
|
||||
@ -1,20 +1,20 @@
|
||||
From 5acedd785fd31b43171c6855ecd5323bfd31c9e2 Mon Sep 17 00:00:00 2001
|
||||
From: Bas Stottelaar <basstottelaar@gmail.com>
|
||||
Date: Wed, 22 Jun 2016 18:04:31 +0200
|
||||
Subject: [PATCH 2/3] u8g2: add riot-os interface.
|
||||
From 452712c6a749a2d513c366abd9e819a2f68eacbd Mon Sep 17 00:00:00 2001
|
||||
From: Peter Kietzmann <peter.kietzmann@haw-hamburg.de>
|
||||
Date: Wed, 6 Sep 2017 20:26:46 +0200
|
||||
Subject: [PATCH 2/2] add RIOT interface
|
||||
|
||||
---
|
||||
csrc/u8g2.h | 3 +
|
||||
csrc/u8g2_riotos.c | 163 +++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
csrc/u8x8.h | 18 +++++-
|
||||
csrc/u8g2_riotos.c | 164 +++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
csrc/u8x8.h | 17 +++++-
|
||||
3 files changed, 181 insertions(+), 3 deletions(-)
|
||||
create mode 100644 csrc/u8g2_riotos.c
|
||||
|
||||
diff --git a/csrc/u8g2.h b/csrc/u8g2.h
|
||||
index 8f89ebc..6cf4440 100644
|
||||
index 46dcec3..bc76480 100644
|
||||
--- a/csrc/u8g2.h
|
||||
+++ b/csrc/u8g2.h
|
||||
@@ -375,6 +375,9 @@ void u8g2_ClearDisplay(u8g2_t *u8g2);
|
||||
@@ -387,6 +387,9 @@ void u8g2_ClearDisplay(u8g2_t *u8g2);
|
||||
#define u8g2_SetMenuDownPin(u8g2, val) u8x8_SetMenuDownPin(u8g2_GetU8x8(u8g2), (val))
|
||||
#endif
|
||||
|
||||
@ -26,10 +26,10 @@ index 8f89ebc..6cf4440 100644
|
||||
|
||||
diff --git a/csrc/u8g2_riotos.c b/csrc/u8g2_riotos.c
|
||||
new file mode 100644
|
||||
index 0000000..e0c042c
|
||||
index 0000000..bd06ccb
|
||||
--- /dev/null
|
||||
+++ b/csrc/u8g2_riotos.c
|
||||
@@ -0,0 +1,163 @@
|
||||
@@ -0,0 +1,164 @@
|
||||
+#include "u8g2.h"
|
||||
+
|
||||
+#include "xtimer.h"
|
||||
@ -40,29 +40,29 @@ index 0000000..e0c042c
|
||||
+
|
||||
+#include <stdio.h>
|
||||
+
|
||||
+#if SPI_NUMOF
|
||||
+static spi_speed_t u8x8_pulse_width_to_spi_speed(uint32_t pulse_width)
|
||||
+#ifdef SPI_NUMOF
|
||||
+static spi_clk_t u8x8_pulse_width_to_spi_speed(uint32_t pulse_width)
|
||||
+{
|
||||
+ uint32_t cycle_time = 2 * pulse_width;
|
||||
+
|
||||
+ if (cycle_time < 100) {
|
||||
+ return SPI_SPEED_10MHZ;
|
||||
+ return SPI_CLK_10MHZ;
|
||||
+ } else if (cycle_time < 200) {
|
||||
+ return SPI_SPEED_5MHZ;
|
||||
+ return SPI_CLK_5MHZ;
|
||||
+ } else if (cycle_time < 1000) {
|
||||
+ return SPI_SPEED_1MHZ;
|
||||
+ return SPI_CLK_1MHZ;
|
||||
+ } else if (cycle_time < 2500) {
|
||||
+ return SPI_SPEED_400KHZ;
|
||||
+ return SPI_CLK_400KHZ;
|
||||
+ }
|
||||
+
|
||||
+ return SPI_SPEED_100KHZ;
|
||||
+ return SPI_CLK_100KHZ;
|
||||
+}
|
||||
+#endif /* SPI_NUMOF */
|
||||
+
|
||||
+#if SPI_NUMOF
|
||||
+static spi_speed_t u8x8_spi_mode_to_spi_conf(uint32_t spi_mode)
|
||||
+#ifdef SPI_NUMOF
|
||||
+static spi_mode_t u8x8_spi_mode_to_spi_conf(uint32_t spi_mode)
|
||||
+{
|
||||
+ return (spi_speed_t) spi_mode;
|
||||
+ return (spi_mode_t) spi_mode;
|
||||
+}
|
||||
+#endif /* SPI_NUMOF */
|
||||
+
|
||||
@ -122,25 +122,26 @@ index 0000000..e0c042c
|
||||
+ return 1;
|
||||
+}
|
||||
+
|
||||
+#if SPI_NUMOF
|
||||
+#ifdef SPI_NUMOF
|
||||
+uint8_t u8x8_byte_riotos_hw_spi(u8x8_t *u8g2, uint8_t msg, uint8_t arg_int, void *arg_ptr)
|
||||
+{
|
||||
+ spi_t dev = (spi_t) u8g2->dev;
|
||||
+
|
||||
+ switch (msg) {
|
||||
+ case U8X8_MSG_BYTE_SEND:
|
||||
+ spi_transfer_bytes(dev, (char *) arg_ptr, NULL, arg_int);
|
||||
+ spi_transfer_bytes(dev, GPIO_UNDEF, true,
|
||||
+ arg_ptr, NULL, (size_t)arg_int);
|
||||
+ break;
|
||||
+ case U8X8_MSG_BYTE_INIT:
|
||||
+ spi_init_master(dev,
|
||||
+ u8x8_spi_mode_to_spi_conf(u8g2->display_info->spi_mode),
|
||||
+ u8x8_pulse_width_to_spi_speed(u8g2->display_info->sck_pulse_width_ns));
|
||||
+ spi_init_pins(dev);
|
||||
+ break;
|
||||
+ case U8X8_MSG_BYTE_SET_DC:
|
||||
+ u8x8_gpio_SetDC(u8g2, arg_int);
|
||||
+ break;
|
||||
+ case U8X8_MSG_BYTE_START_TRANSFER:
|
||||
+ spi_acquire(dev);
|
||||
+ spi_acquire(dev, GPIO_UNDEF,
|
||||
+ u8x8_spi_mode_to_spi_conf(u8g2->display_info->spi_mode),
|
||||
+ u8x8_pulse_width_to_spi_speed(u8g2->display_info->sck_pulse_width_ns));
|
||||
+
|
||||
+ u8x8_gpio_SetCS(u8g2, u8g2->display_info->chip_enable_level);
|
||||
+ u8g2->gpio_and_delay_cb(u8g2, U8X8_MSG_DELAY_NANO, u8g2->display_info->post_chip_enable_wait_ns, NULL);
|
||||
@ -194,10 +195,10 @@ index 0000000..e0c042c
|
||||
+}
|
||||
+#endif /* I2C_NUMOF */
|
||||
diff --git a/csrc/u8x8.h b/csrc/u8x8.h
|
||||
index b396344..7dcd659 100644
|
||||
index 2c93c87..b434893 100644
|
||||
--- a/csrc/u8x8.h
|
||||
+++ b/csrc/u8x8.h
|
||||
@@ -107,6 +107,8 @@
|
||||
@@ -111,6 +111,8 @@
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
@ -206,31 +207,31 @@ index b396344..7dcd659 100644
|
||||
#if defined(__GNUC__) && defined(__AVR__)
|
||||
#include <avr/pgmspace.h>
|
||||
#endif
|
||||
@@ -170,9 +172,9 @@ uint8_t u8x8_pgm_read_esp(const uint8_t * addr); /* u8x8_8x8.c */
|
||||
@@ -174,9 +176,9 @@ uint8_t u8x8_pgm_read_esp(const uint8_t * addr); /* u8x8_8x8.c */
|
||||
# define U8X8_PROGMEM
|
||||
#endif
|
||||
|
||||
-#ifdef ARDUINO
|
||||
-#define U8X8_USE_PINS
|
||||
-#endif
|
||||
+// #ifdef ARDUINO
|
||||
+// #define U8X8_USE_PINS
|
||||
+// #endif
|
||||
+//#ifdef ARDUINO
|
||||
+//#define U8X8_USE_PINS
|
||||
+//#endif
|
||||
|
||||
/*==========================================*/
|
||||
/* U8X8 typedefs and data structures */
|
||||
@@ -335,6 +337,10 @@ struct u8x8_struct
|
||||
@@ -342,6 +344,10 @@ struct u8x8_struct
|
||||
#ifdef U8X8_USE_PINS
|
||||
uint8_t pins[U8X8_PIN_CNT]; /* defines a pinlist: Mainly a list of pins for the Arduino Envionment, use U8X8_PIN_xxx to access */
|
||||
#endif
|
||||
+
|
||||
+ gpio_t* pins;
|
||||
+ uint32_t pins_enabled;
|
||||
+ uint32_t dev;
|
||||
+gpio_t* pins;
|
||||
+uint32_t pins_enabled;
|
||||
+uint32_t dev;
|
||||
};
|
||||
|
||||
#define u8x8_GetCols(u8x8) ((u8x8)->display_info->tile_width)
|
||||
@@ -358,6 +364,8 @@ struct u8x8_struct
|
||||
#ifdef U8X8_WITH_USER_PTR
|
||||
@@ -371,6 +377,8 @@ struct u8x8_struct
|
||||
#define u8x8_SetMenuDownPin(u8x8, val) u8x8_SetPin((u8x8),U8X8_PIN_MENU_DOWN,(val))
|
||||
#endif
|
||||
|
||||
@ -239,18 +240,16 @@ index b396344..7dcd659 100644
|
||||
|
||||
/*==========================================*/
|
||||
|
||||
@@ -900,6 +908,10 @@ extern const uint8_t u8x8_font_pxplustandynewtv_u[] U8X8_FONT_SECTION("u8x8_font
|
||||
@@ -939,6 +947,9 @@ extern const uint8_t u8x8_font_pxplustandynewtv_u[] U8X8_FONT_SECTION("u8x8_font
|
||||
|
||||
/* end font list */
|
||||
|
||||
+extern uint8_t u8x8_byte_riotos_hw_spi(u8x8_t *u8g2, uint8_t msg, uint8_t arg_int, void *arg_ptr);
|
||||
+extern uint8_t u8x8_gpio_and_delay_riotos(u8x8_t *u8g2, uint8_t msg, uint8_t arg_int, void *arg_ptr);
|
||||
+extern uint8_t u8x8_byte_riotos_hw_i2c(u8x8_t *u8g2, uint8_t msg, uint8_t arg_int, void *arg_ptr);
|
||||
+
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
--
|
||||
1.9.1
|
||||
|
||||
2.7.4
|
||||
|
||||
@ -1,89 +0,0 @@
|
||||
From 51897f66e18e291c3f3d528a0678eb195341d18d Mon Sep 17 00:00:00 2001
|
||||
From: Hauke Petersen <hauke.petersen@fu-berlin.de>
|
||||
Date: Wed, 25 Jan 2017 12:29:36 +0100
|
||||
Subject: [PATCH 3/3] u8g2: adapted RIOT interface to SPI changes
|
||||
|
||||
---
|
||||
csrc/u8g2_riotos.c | 33 +++++++++++++++++----------------
|
||||
1 file changed, 17 insertions(+), 16 deletions(-)
|
||||
|
||||
diff --git a/csrc/u8g2_riotos.c b/csrc/u8g2_riotos.c
|
||||
index e0c042c..bd06ccb 100644
|
||||
--- a/csrc/u8g2_riotos.c
|
||||
+++ b/csrc/u8g2_riotos.c
|
||||
@@ -8,29 +8,29 @@
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
-#if SPI_NUMOF
|
||||
-static spi_speed_t u8x8_pulse_width_to_spi_speed(uint32_t pulse_width)
|
||||
+#ifdef SPI_NUMOF
|
||||
+static spi_clk_t u8x8_pulse_width_to_spi_speed(uint32_t pulse_width)
|
||||
{
|
||||
uint32_t cycle_time = 2 * pulse_width;
|
||||
|
||||
if (cycle_time < 100) {
|
||||
- return SPI_SPEED_10MHZ;
|
||||
+ return SPI_CLK_10MHZ;
|
||||
} else if (cycle_time < 200) {
|
||||
- return SPI_SPEED_5MHZ;
|
||||
+ return SPI_CLK_5MHZ;
|
||||
} else if (cycle_time < 1000) {
|
||||
- return SPI_SPEED_1MHZ;
|
||||
+ return SPI_CLK_1MHZ;
|
||||
} else if (cycle_time < 2500) {
|
||||
- return SPI_SPEED_400KHZ;
|
||||
+ return SPI_CLK_400KHZ;
|
||||
}
|
||||
|
||||
- return SPI_SPEED_100KHZ;
|
||||
+ return SPI_CLK_100KHZ;
|
||||
}
|
||||
#endif /* SPI_NUMOF */
|
||||
|
||||
-#if SPI_NUMOF
|
||||
-static spi_speed_t u8x8_spi_mode_to_spi_conf(uint32_t spi_mode)
|
||||
+#ifdef SPI_NUMOF
|
||||
+static spi_mode_t u8x8_spi_mode_to_spi_conf(uint32_t spi_mode)
|
||||
{
|
||||
- return (spi_speed_t) spi_mode;
|
||||
+ return (spi_mode_t) spi_mode;
|
||||
}
|
||||
#endif /* SPI_NUMOF */
|
||||
|
||||
@@ -90,25 +90,26 @@ uint8_t u8x8_gpio_and_delay_riotos(u8x8_t *u8g2, uint8_t msg, uint8_t arg_int, v
|
||||
return 1;
|
||||
}
|
||||
|
||||
-#if SPI_NUMOF
|
||||
+#ifdef SPI_NUMOF
|
||||
uint8_t u8x8_byte_riotos_hw_spi(u8x8_t *u8g2, uint8_t msg, uint8_t arg_int, void *arg_ptr)
|
||||
{
|
||||
spi_t dev = (spi_t) u8g2->dev;
|
||||
|
||||
switch (msg) {
|
||||
case U8X8_MSG_BYTE_SEND:
|
||||
- spi_transfer_bytes(dev, (char *) arg_ptr, NULL, arg_int);
|
||||
+ spi_transfer_bytes(dev, GPIO_UNDEF, true,
|
||||
+ arg_ptr, NULL, (size_t)arg_int);
|
||||
break;
|
||||
case U8X8_MSG_BYTE_INIT:
|
||||
- spi_init_master(dev,
|
||||
- u8x8_spi_mode_to_spi_conf(u8g2->display_info->spi_mode),
|
||||
- u8x8_pulse_width_to_spi_speed(u8g2->display_info->sck_pulse_width_ns));
|
||||
+ spi_init_pins(dev);
|
||||
break;
|
||||
case U8X8_MSG_BYTE_SET_DC:
|
||||
u8x8_gpio_SetDC(u8g2, arg_int);
|
||||
break;
|
||||
case U8X8_MSG_BYTE_START_TRANSFER:
|
||||
- spi_acquire(dev);
|
||||
+ spi_acquire(dev, GPIO_UNDEF,
|
||||
+ u8x8_spi_mode_to_spi_conf(u8g2->display_info->spi_mode),
|
||||
+ u8x8_pulse_width_to_spi_speed(u8g2->display_info->sck_pulse_width_ns));
|
||||
|
||||
u8x8_gpio_SetCS(u8g2, u8g2->display_info->chip_enable_level);
|
||||
u8g2->gpio_and_delay_cb(u8g2, U8X8_MSG_DELAY_NANO, u8g2->display_info->post_chip_enable_wait_ns, NULL);
|
||||
--
|
||||
1.9.1
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user