aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--boards/addons/gdisp/ED060SC4_example_schematics.pngbin0 -> 305333 bytes
-rw-r--r--boards/addons/gdisp/board_ED060SC4_example.h (renamed from drivers/gdisp/ED060SC4/board_ED060SC4_example.h)0
-rw-r--r--boards/addons/gdisp/board_HX8347D_stm32f4discovery.h (renamed from drivers/gdisp/HX8347D/board_HX8347D_stm32f4discovery.h)0
-rw-r--r--boards/addons/gdisp/board_ILI9320_olimex_pic32mx_lcd.h (renamed from drivers/gdisp/ILI9320/board_ILI9320_olimex_pic32mx_lcd.h)0
-rw-r--r--boards/addons/gdisp/board_ILI9320_olimex_stm32_lcd.h (renamed from drivers/gdisp/ILI9320/board_ILI9320_olimex_stm32_lcd.h)0
-rw-r--r--boards/addons/gdisp/board_ILI9325_hy_stm32_100p.h (renamed from drivers/gdisp/ILI9325/board_ILI9325_hy_stm32_100p.h)0
-rw-r--r--boards/addons/gdisp/board_ILI9481_firebullstm32f103.h (renamed from drivers/gdisp/ILI9481/board_ILI9481_firebullstm32f103.h)0
-rw-r--r--boards/addons/gdisp/board_RA8875_marlin.h (renamed from drivers/gdisp/RA8875/board_RA8875_marlin.h)0
-rw-r--r--boards/addons/gdisp/board_S6D1121_olimex_e407.h (renamed from drivers/gdisp/S6D1121/board_S6D1121_olimex_e407.h)0
-rw-r--r--boards/addons/gdisp/board_SSD1289_firebullstm32f103.h (renamed from drivers/gdisp/SSD1289/board_SSD1289_firebullstm32f103.h)0
-rw-r--r--boards/addons/gdisp/board_SSD1289_stm32f4discovery.h (renamed from drivers/gdisp/SSD1289/board_SSD1289_stm32f4discovery.h)0
-rw-r--r--boards/addons/gdisp/board_SSD1306_i2c.h (renamed from drivers/gdisp/SSD1306/board_SSD1306_i2c.h)0
-rw-r--r--boards/addons/gdisp/board_SSD1306_spi.h (renamed from drivers/gdisp/SSD1306/board_SSD1306_spi.h)0
-rw-r--r--boards/addons/gdisp/board_SSD1963_fsmc.h (renamed from drivers/gdisp/SSD1963/board_SSD1963_fsmc.h)0
-rw-r--r--boards/addons/gdisp/board_SSD1963_gpio.h (renamed from drivers/gdisp/SSD1963/board_SSD1963_gpio.h)0
-rw-r--r--boards/addons/gdisp/board_SSD2119_embest_dmstf4bb.h (renamed from drivers/gdisp/SSD2119/board_SSD2119_embest_dmstf4bb.h)0
-rw-r--r--boards/addons/ginput/touch/ADS7843/ginput_lld_mouse_board_firebull_stm32f103.h (renamed from drivers/ginput/touch/ADS7843/ginput_lld_mouse_board_firebull_stm32f103.h)168
-rw-r--r--boards/addons/ginput/touch/ADS7843/ginput_lld_mouse_board_olimex_stm32_e407.h (renamed from drivers/ginput/touch/ADS7843/ginput_lld_mouse_board_olimex_stm32_e407.h)168
-rw-r--r--boards/addons/ginput/touch/ADS7843/ginput_lld_mouse_board_st_stm32f4_discovery.h (renamed from drivers/ginput/touch/ADS7843/ginput_lld_mouse_board_st_stm32f4_discovery.h)0
-rw-r--r--boards/addons/ginput/touch/FT5x06/ginput_lld_mouse_board_marlin.h (renamed from drivers/ginput/touch/FT5x06/ginput_lld_mouse_board_marlin.h)0
-rw-r--r--boards/addons/ginput/touch/MCU/ginput_lld_mouse_board_olimex_pic32mx_lcd.h (renamed from drivers/ginput/touch/MCU/ginput_lld_mouse_board_olimex_pic32mx_lcd.h)290
-rw-r--r--boards/addons/ginput/touch/MCU/ginput_lld_mouse_board_olimex_stm32_lcd.h (renamed from drivers/ginput/touch/MCU/ginput_lld_mouse_board_olimex_stm32_lcd.h)304
-rw-r--r--boards/addons/ginput/touch/STMPE811/ginput_lld_mouse_board_embest_dmstf4bb.h (renamed from drivers/ginput/touch/STMPE811/ginput_lld_mouse_board_embest_dmstf4bb.h)240
-rw-r--r--boards/addons/tdisp/HD44780/tdisp_lld_board_olimex_e407.h (renamed from drivers/tdisp/HD44780/tdisp_lld_board_olimex_e407.h)118
-rw-r--r--boards/addons/tdisp/HD44780/tdisp_lld_board_st_stm32f4_discovery.h (renamed from drivers/tdisp/HD44780/tdisp_lld_board_st_stm32f4_discovery.h)244
-rw-r--r--drivers/gdisp/ILI9341/board_ILI9341_mikromedia.h130
-rw-r--r--drivers/ginput/touch/MCU/ginput_lld_mouse.c10
-rw-r--r--drivers/tdisp/HD44780/tdisp_lld.c10
28 files changed, 768 insertions, 914 deletions
diff --git a/boards/addons/gdisp/ED060SC4_example_schematics.png b/boards/addons/gdisp/ED060SC4_example_schematics.png
new file mode 100644
index 00000000..0d9d095f
--- /dev/null
+++ b/boards/addons/gdisp/ED060SC4_example_schematics.png
Binary files differ
diff --git a/drivers/gdisp/ED060SC4/board_ED060SC4_example.h b/boards/addons/gdisp/board_ED060SC4_example.h
index cb5a92b8..cb5a92b8 100644
--- a/drivers/gdisp/ED060SC4/board_ED060SC4_example.h
+++ b/boards/addons/gdisp/board_ED060SC4_example.h
diff --git a/drivers/gdisp/HX8347D/board_HX8347D_stm32f4discovery.h b/boards/addons/gdisp/board_HX8347D_stm32f4discovery.h
index df287477..df287477 100644
--- a/drivers/gdisp/HX8347D/board_HX8347D_stm32f4discovery.h
+++ b/boards/addons/gdisp/board_HX8347D_stm32f4discovery.h
diff --git a/drivers/gdisp/ILI9320/board_ILI9320_olimex_pic32mx_lcd.h b/boards/addons/gdisp/board_ILI9320_olimex_pic32mx_lcd.h
index 5315127b..5315127b 100644
--- a/drivers/gdisp/ILI9320/board_ILI9320_olimex_pic32mx_lcd.h
+++ b/boards/addons/gdisp/board_ILI9320_olimex_pic32mx_lcd.h
diff --git a/drivers/gdisp/ILI9320/board_ILI9320_olimex_stm32_lcd.h b/boards/addons/gdisp/board_ILI9320_olimex_stm32_lcd.h
index bca5caf8..bca5caf8 100644
--- a/drivers/gdisp/ILI9320/board_ILI9320_olimex_stm32_lcd.h
+++ b/boards/addons/gdisp/board_ILI9320_olimex_stm32_lcd.h
diff --git a/drivers/gdisp/ILI9325/board_ILI9325_hy_stm32_100p.h b/boards/addons/gdisp/board_ILI9325_hy_stm32_100p.h
index 60508c1a..60508c1a 100644
--- a/drivers/gdisp/ILI9325/board_ILI9325_hy_stm32_100p.h
+++ b/boards/addons/gdisp/board_ILI9325_hy_stm32_100p.h
diff --git a/drivers/gdisp/ILI9481/board_ILI9481_firebullstm32f103.h b/boards/addons/gdisp/board_ILI9481_firebullstm32f103.h
index 17bc554d..17bc554d 100644
--- a/drivers/gdisp/ILI9481/board_ILI9481_firebullstm32f103.h
+++ b/boards/addons/gdisp/board_ILI9481_firebullstm32f103.h
diff --git a/drivers/gdisp/RA8875/board_RA8875_marlin.h b/boards/addons/gdisp/board_RA8875_marlin.h
index b1d55a92..b1d55a92 100644
--- a/drivers/gdisp/RA8875/board_RA8875_marlin.h
+++ b/boards/addons/gdisp/board_RA8875_marlin.h
diff --git a/drivers/gdisp/S6D1121/board_S6D1121_olimex_e407.h b/boards/addons/gdisp/board_S6D1121_olimex_e407.h
index e0bb8e26..e0bb8e26 100644
--- a/drivers/gdisp/S6D1121/board_S6D1121_olimex_e407.h
+++ b/boards/addons/gdisp/board_S6D1121_olimex_e407.h
diff --git a/drivers/gdisp/SSD1289/board_SSD1289_firebullstm32f103.h b/boards/addons/gdisp/board_SSD1289_firebullstm32f103.h
index 99d37299..99d37299 100644
--- a/drivers/gdisp/SSD1289/board_SSD1289_firebullstm32f103.h
+++ b/boards/addons/gdisp/board_SSD1289_firebullstm32f103.h
diff --git a/drivers/gdisp/SSD1289/board_SSD1289_stm32f4discovery.h b/boards/addons/gdisp/board_SSD1289_stm32f4discovery.h
index 866311dc..866311dc 100644
--- a/drivers/gdisp/SSD1289/board_SSD1289_stm32f4discovery.h
+++ b/boards/addons/gdisp/board_SSD1289_stm32f4discovery.h
diff --git a/drivers/gdisp/SSD1306/board_SSD1306_i2c.h b/boards/addons/gdisp/board_SSD1306_i2c.h
index 449d47ba..449d47ba 100644
--- a/drivers/gdisp/SSD1306/board_SSD1306_i2c.h
+++ b/boards/addons/gdisp/board_SSD1306_i2c.h
diff --git a/drivers/gdisp/SSD1306/board_SSD1306_spi.h b/boards/addons/gdisp/board_SSD1306_spi.h
index 5b481630..5b481630 100644
--- a/drivers/gdisp/SSD1306/board_SSD1306_spi.h
+++ b/boards/addons/gdisp/board_SSD1306_spi.h
diff --git a/drivers/gdisp/SSD1963/board_SSD1963_fsmc.h b/boards/addons/gdisp/board_SSD1963_fsmc.h
index 6c7119a4..6c7119a4 100644
--- a/drivers/gdisp/SSD1963/board_SSD1963_fsmc.h
+++ b/boards/addons/gdisp/board_SSD1963_fsmc.h
diff --git a/drivers/gdisp/SSD1963/board_SSD1963_gpio.h b/boards/addons/gdisp/board_SSD1963_gpio.h
index 0b9c0135..0b9c0135 100644
--- a/drivers/gdisp/SSD1963/board_SSD1963_gpio.h
+++ b/boards/addons/gdisp/board_SSD1963_gpio.h
diff --git a/drivers/gdisp/SSD2119/board_SSD2119_embest_dmstf4bb.h b/boards/addons/gdisp/board_SSD2119_embest_dmstf4bb.h
index 927e93a4..927e93a4 100644
--- a/drivers/gdisp/SSD2119/board_SSD2119_embest_dmstf4bb.h
+++ b/boards/addons/gdisp/board_SSD2119_embest_dmstf4bb.h
diff --git a/drivers/ginput/touch/ADS7843/ginput_lld_mouse_board_firebull_stm32f103.h b/boards/addons/ginput/touch/ADS7843/ginput_lld_mouse_board_firebull_stm32f103.h
index ebcc26c7..63e9e3dd 100644
--- a/drivers/ginput/touch/ADS7843/ginput_lld_mouse_board_firebull_stm32f103.h
+++ b/boards/addons/ginput/touch/ADS7843/ginput_lld_mouse_board_firebull_stm32f103.h
@@ -4,87 +4,87 @@
*
* http://ugfx.org/license.html
*/
-
-/**
- * @file drivers/ginput/touch/ADS7843/ginput_lld_mouse_board_firebull_stm32f103.h
- * @brief GINPUT ouch low level driver source for the ADS7843 on the FireBull STM32F103-FB board.
- *
- * @defgroup Mouse Mouse
- * @ingroup GINPUT
- * @{
- */
-
-#ifndef _GINPUT_LLD_MOUSE_BOARD_H
-#define _GINPUT_LLD_MOUSE_BOARD_H
-
-static const SPIConfig spicfg = {
- NULL,
- GPIOC,
- 6,
- /* SPI_CR1_BR_2 |*/ SPI_CR1_BR_1 | SPI_CR1_BR_0,
-};
-
-/**
- * @brief Initialise the board for the touch.
- *
- * @notapi
- */
-static inline void init_board(void) {
- spiStart(&SPID1, &spicfg);
-}
-
-/**
- * @brief Check whether the surface is currently touched
- * @return TRUE if the surface is currently touched
- *
- * @notapi
- */
-static inline bool_t getpin_pressed(void) {
- return (!palReadPad(GPIOC, 4));
-}
-/**
- * @brief Aquire the bus ready for readings
- *
- * @notapi
- */
-static inline void aquire_bus(void) {
- spiAcquireBus(&SPID1);
- //TOUCHSCREEN_SPI_PROLOGUE();
- palClearPad(GPIOC, 6);
-}
-
-/**
- * @brief Release the bus after readings
- *
- * @notapi
- */
-static inline void release_bus(void) {
- palSetPad(GPIOC, 6);
- spiReleaseBus(&SPID1);
- //TOUCHSCREEN_SPI_EPILOGUE();
-}
-
-/**
- * @brief Read a value from touch controller
- * @return The value read from the controller
- *
- * params[in] port The controller port to read.
- *
- * @notapi
- */
-static inline uint16_t read_value(uint16_t port) {
- static uint8_t txbuf[3] = {0};
- static uint8_t rxbuf[3] = {0};
- uint16_t ret;
-
- txbuf[0] = port;
-
- spiExchange(&SPID1, 3, txbuf, rxbuf);
-
- ret = (rxbuf[1] << 5) | (rxbuf[2] >> 3);
-
- return ret;
-}
-
-#endif /* _GINPUT_LLD_MOUSE_BOARD_H */
-/** @} */
+
+/**
+ * @file drivers/ginput/touch/ADS7843/ginput_lld_mouse_board_firebull_stm32f103.h
+ * @brief GINPUT ouch low level driver source for the ADS7843 on the FireBull STM32F103-FB board.
+ *
+ * @defgroup Mouse Mouse
+ * @ingroup GINPUT
+ * @{
+ */
+
+#ifndef _GINPUT_LLD_MOUSE_BOARD_H
+#define _GINPUT_LLD_MOUSE_BOARD_H
+
+static const SPIConfig spicfg = {
+ NULL,
+ GPIOC,
+ 6,
+ /* SPI_CR1_BR_2 |*/ SPI_CR1_BR_1 | SPI_CR1_BR_0,
+};
+
+/**
+ * @brief Initialise the board for the touch.
+ *
+ * @notapi
+ */
+static inline void init_board(void) {
+ spiStart(&SPID1, &spicfg);
+}
+
+/**
+ * @brief Check whether the surface is currently touched
+ * @return TRUE if the surface is currently touched
+ *
+ * @notapi
+ */
+static inline bool_t getpin_pressed(void) {
+ return (!palReadPad(GPIOC, 4));
+}
+/**
+ * @brief Aquire the bus ready for readings
+ *
+ * @notapi
+ */
+static inline void aquire_bus(void) {
+ spiAcquireBus(&SPID1);
+ //TOUCHSCREEN_SPI_PROLOGUE();
+ palClearPad(GPIOC, 6);
+}
+
+/**
+ * @brief Release the bus after readings
+ *
+ * @notapi
+ */
+static inline void release_bus(void) {
+ palSetPad(GPIOC, 6);
+ spiReleaseBus(&SPID1);
+ //TOUCHSCREEN_SPI_EPILOGUE();
+}
+
+/**
+ * @brief Read a value from touch controller
+ * @return The value read from the controller
+ *
+ * params[in] port The controller port to read.
+ *
+ * @notapi
+ */
+static inline uint16_t read_value(uint16_t port) {
+ static uint8_t txbuf[3] = {0};
+ static uint8_t rxbuf[3] = {0};
+ uint16_t ret;
+
+ txbuf[0] = port;
+
+ spiExchange(&SPID1, 3, txbuf, rxbuf);
+
+ ret = (rxbuf[1] << 5) | (rxbuf[2] >> 3);
+
+ return ret;
+}
+
+#endif /* _GINPUT_LLD_MOUSE_BOARD_H */
+/** @} */
diff --git a/drivers/ginput/touch/ADS7843/ginput_lld_mouse_board_olimex_stm32_e407.h b/boards/addons/ginput/touch/ADS7843/ginput_lld_mouse_board_olimex_stm32_e407.h
index 01572f0d..e0ab85dc 100644
--- a/drivers/ginput/touch/ADS7843/ginput_lld_mouse_board_olimex_stm32_e407.h
+++ b/boards/addons/ginput/touch/ADS7843/ginput_lld_mouse_board_olimex_stm32_e407.h
@@ -4,87 +4,87 @@
*
* http://ugfx.org/license.html
*/
-
-/**
- * @file drivers/ginput/touch/ADS7843/ginput_lld_mouse_board_olimex_stm32_e407.h
- * @brief GINPUT Touch low level driver source for the ADS7843 on an Olimex STM32E407.
- *
- * @defgroup Mouse Mouse
- * @ingroup GINPUT
- * @{
- */
-
-#ifndef _GINPUT_LLD_MOUSE_BOARD_H
-#define _GINPUT_LLD_MOUSE_BOARD_H
-
-static const SPIConfig spicfg = {
- NULL,
- GPIOG,
- 10,
- /* SPI_CR1_BR_2 |*/ SPI_CR1_BR_1 | SPI_CR1_BR_0,
-};
-
-/**
- * @brief Initialise the board for the touch.
- *
- * @notapi
- */
-static inline void init_board(void) {
- spiStart(&SPID2, &spicfg);
-}
-
-/**
- * @brief Check whether the surface is currently touched
- * @return TRUE if the surface is currently touched
- *
- * @notapi
- */
-static inline bool_t getpin_pressed(void) {
- return (!palReadPad(GPIOG, 0));
-}
-/**
- * @brief Aquire the bus ready for readings
- *
- * @notapi
- */
-static inline void aquire_bus(void) {
- spiAcquireBus(&SPID2);
- //TOUCHSCREEN_SPI_PROLOGUE();
- palClearPad(GPIOG, 10);
-}
-
-/**
- * @brief Release the bus after readings
- *
- * @notapi
- */
-static inline void release_bus(void) {
- palSetPad(GPIOG, 10);
- spiReleaseBus(&SPID2);
- //TOUCHSCREEN_SPI_EPILOGUE();
-}
-
-/**
- * @brief Read a value from touch controller
- * @return The value read from the controller
- *
- * params[in] port The controller port to read.
- *
- * @notapi
- */
-static inline uint16_t read_value(uint16_t port) {
- static uint8_t txbuf[3] = {0};
- static uint8_t rxbuf[3] = {0};
- uint16_t ret;
-
- txbuf[0] = port;
-
- spiExchange(&SPID2, 3, txbuf, rxbuf);
-
- ret = (rxbuf[1] << 5) | (rxbuf[2] >> 3);
-
- return ret;
-}
-
-#endif /* _GINPUT_LLD_MOUSE_BOARD_H */
-/** @} */
+
+/**
+ * @file drivers/ginput/touch/ADS7843/ginput_lld_mouse_board_olimex_stm32_e407.h
+ * @brief GINPUT Touch low level driver source for the ADS7843 on an Olimex STM32E407.
+ *
+ * @defgroup Mouse Mouse
+ * @ingroup GINPUT
+ * @{
+ */
+
+#ifndef _GINPUT_LLD_MOUSE_BOARD_H
+#define _GINPUT_LLD_MOUSE_BOARD_H
+
+static const SPIConfig spicfg = {
+ NULL,
+ GPIOG,
+ 10,
+ /* SPI_CR1_BR_2 |*/ SPI_CR1_BR_1 | SPI_CR1_BR_0,
+};
+
+/**
+ * @brief Initialise the board for the touch.
+ *
+ * @notapi
+ */
+static inline void init_board(void) {
+ spiStart(&SPID2, &spicfg);
+}
+
+/**
+ * @brief Check whether the surface is currently touched
+ * @return TRUE if the surface is currently touched
+ *
+ * @notapi
+ */
+static inline bool_t getpin_pressed(void) {
+ return (!palReadPad(GPIOG, 0));
+}
+/**
+ * @brief Aquire the bus ready for readings
+ *
+ * @notapi
+ */
+static inline void aquire_bus(void) {
+ spiAcquireBus(&SPID2);
+ //TOUCHSCREEN_SPI_PROLOGUE();
+ palClearPad(GPIOG, 10);
+}
+
+/**
+ * @brief Release the bus after readings
+ *
+ * @notapi
+ */
+static inline void release_bus(void) {
+ palSetPad(GPIOG, 10);
+ spiReleaseBus(&SPID2);
+ //TOUCHSCREEN_SPI_EPILOGUE();
+}
+
+/**
+ * @brief Read a value from touch controller
+ * @return The value read from the controller
+ *
+ * params[in] port The controller port to read.
+ *
+ * @notapi
+ */
+static inline uint16_t read_value(uint16_t port) {
+ static uint8_t txbuf[3] = {0};
+ static uint8_t rxbuf[3] = {0};
+ uint16_t ret;
+
+ txbuf[0] = port;
+
+ spiExchange(&SPID2, 3, txbuf, rxbuf);
+
+ ret = (rxbuf[1] << 5) | (rxbuf[2] >> 3);
+
+ return ret;
+}
+
+#endif /* _GINPUT_LLD_MOUSE_BOARD_H */
+/** @} */
diff --git a/drivers/ginput/touch/ADS7843/ginput_lld_mouse_board_st_stm32f4_discovery.h b/boards/addons/ginput/touch/ADS7843/ginput_lld_mouse_board_st_stm32f4_discovery.h
index 158934b6..158934b6 100644
--- a/drivers/ginput/touch/ADS7843/ginput_lld_mouse_board_st_stm32f4_discovery.h
+++ b/boards/addons/ginput/touch/ADS7843/ginput_lld_mouse_board_st_stm32f4_discovery.h
diff --git a/drivers/ginput/touch/FT5x06/ginput_lld_mouse_board_marlin.h b/boards/addons/ginput/touch/FT5x06/ginput_lld_mouse_board_marlin.h
index e3e18c24..e3e18c24 100644
--- a/drivers/ginput/touch/FT5x06/ginput_lld_mouse_board_marlin.h
+++ b/boards/addons/ginput/touch/FT5x06/ginput_lld_mouse_board_marlin.h
diff --git a/drivers/ginput/touch/MCU/ginput_lld_mouse_board_olimex_pic32mx_lcd.h b/boards/addons/ginput/touch/MCU/ginput_lld_mouse_board_olimex_pic32mx_lcd.h
index c4689ecb..a7435c95 100644
--- a/drivers/ginput/touch/MCU/ginput_lld_mouse_board_olimex_pic32mx_lcd.h
+++ b/boards/addons/ginput/touch/MCU/ginput_lld_mouse_board_olimex_pic32mx_lcd.h
@@ -4,148 +4,148 @@
*
* http://ugfx.org/license.html
*/
-
-/**
- * @file drivers/ginput/touch/MCU/ginput_lld_mouse_board_olimex_stm32_lcd.h
- * @brief GINPUT Touch low level driver source for the MCU on the example board.
- *
- * @defgroup Mouse Mouse
- * @ingroup GINPUT
- *
- * @{
- */
-
-#ifndef _GINPUT_LLD_MOUSE_BOARD_H
-#define _GINPUT_LLD_MOUSE_BOARD_H
-
-static const ADCConfig ADCC = {
- .vref = ADC_VREF_CFG_AVDD_AVSS,
- .stime = 15,
- .irq = EIC_IRQ_ADC,
- .base = _ADC10_BASE_ADDRESS,
-};
-static struct ADCDriver ADCD;
-
-#define YNEG 13 // U
-#define XNEG 15 // R
-#define XPOS 12 // L
-#define YPOS 11 // D
-
-#define ADC_MAX 1023
-
-#define TOUCH_THRESHOULD 50
-
-static const ADCConversionGroup ADC_X_CG = {
- .circular = FALSE,
- .num_channels = 1,
- .channels = 1 << XNEG,
-};
-
-static const ADCConversionGroup ADC_Y_CG = {
- .circular = FALSE,
- .num_channels = 1,
- .channels = 1 << YPOS,
-};
-
-/**
- * @brief Initialise the board for the touch.
- *
- * @notapi
- */
-static inline void init_board(void) {
- adcObjectInit(&ADCD);
- adcStart(&ADCD, &ADCC);
-}
-
-/**
- * @brief Check whether the surface is currently touched
- * @return TRUE if the surface is currently touched
- *
- * @notapi
- */
-static inline bool_t getpin_pressed(void) {
- adcsample_t samples[2] = {0, };
-
- // Set X+ to ground
- palSetPadMode(IOPORTB, XPOS, PAL_MODE_OUTPUT);
- palClearPad(IOPORTB, XPOS);
-
- // Set Y- to VCC
- palSetPadMode(IOPORTB, YNEG, PAL_MODE_OUTPUT);
- palSetPad(IOPORTB, YNEG);
-
- palSetPadMode(IOPORTB, XNEG, PAL_MODE_INPUT_ANALOG);
- palSetPadMode(IOPORTB, YPOS, PAL_MODE_INPUT_ANALOG);
-
- adcConvert(&ADCD, &ADC_X_CG, &samples[0], 1);
- adcConvert(&ADCD, &ADC_Y_CG, &samples[1], 1);
-
- return (ADC_MAX - (samples[1] - samples[0])) > TOUCH_THRESHOULD;
-}
-
-/**
- * @brief Aquire the bus ready for readings
- *
- * @notapi
- */
-static inline void aquire_bus(void) {
-}
-
-/**
- * @brief Release the bus after readings
- *
- * @notapi
- */
-static inline void release_bus(void) {
-}
-
-/**
- * @brief Read an x value from touch controller
- * @return The value read from the controller
- *
- * @notapi
- */
-static inline uint16_t read_x_value(void) {
- adcsample_t sample;
-
- palSetPadMode(IOPORTB, XPOS, PAL_MODE_OUTPUT);
- palSetPad(IOPORTB, XPOS);
-
- palSetPadMode(IOPORTB, XNEG, PAL_MODE_OUTPUT);
- palClearPad(IOPORTB, XNEG);
-
- palSetPadMode(IOPORTB, YNEG, PAL_MODE_INPUT);
-
- palSetPadMode(IOPORTB, YPOS, PAL_MODE_INPUT_ANALOG);
-
- adcConvert(&ADCD, &ADC_Y_CG, &sample, 1);
-
- return ADC_MAX - sample;
-}
-
-/**
- * @brief Read an y value from touch controller
- * @return The value read from the controller
- *
- * @notapi
- */
-static inline uint16_t read_y_value(void) {
- adcsample_t sample;
-
- palSetPadMode(IOPORTB, YNEG, PAL_MODE_OUTPUT);
- palClearPad(IOPORTB, YNEG);
-
- palSetPadMode(IOPORTB, YPOS, PAL_MODE_OUTPUT);
- palSetPad(IOPORTB, YPOS);
-
- palSetPadMode(IOPORTB, XPOS, PAL_MODE_INPUT);
-
- palSetPadMode(IOPORTB, XNEG, PAL_MODE_INPUT_ANALOG);
-
- adcConvert(&ADCD, &ADC_X_CG, &sample, 1);
-
- return ADC_MAX - sample;
-}
-
-#endif /* _GINPUT_LLD_MOUSE_BOARD_H */
-/** @} */
+
+/**
+ * @file drivers/ginput/touch/MCU/ginput_lld_mouse_board_olimex_stm32_lcd.h
+ * @brief GINPUT Touch low level driver source for the MCU on the example board.
+ *
+ * @defgroup Mouse Mouse
+ * @ingroup GINPUT
+ *
+ * @{
+ */
+
+#ifndef _GINPUT_LLD_MOUSE_BOARD_H
+#define _GINPUT_LLD_MOUSE_BOARD_H
+
+static const ADCConfig ADCC = {
+ .vref = ADC_VREF_CFG_AVDD_AVSS,
+ .stime = 15,
+ .irq = EIC_IRQ_ADC,
+ .base = _ADC10_BASE_ADDRESS,
+};
+static struct ADCDriver ADCD;
+
+#define YNEG 13 // U
+#define XNEG 15 // R
+#define XPOS 12 // L
+#define YPOS 11 // D
+
+#define ADC_MAX 1023
+
+#define TOUCH_THRESHOULD 50
+
+static const ADCConversionGroup ADC_X_CG = {
+ .circular = FALSE,
+ .num_channels = 1,
+ .channels = 1 << XNEG,
+};
+
+static const ADCConversionGroup ADC_Y_CG = {
+ .circular = FALSE,
+ .num_channels = 1,
+ .channels = 1 << YPOS,
+};
+
+/**
+ * @brief Initialise the board for the touch.
+ *
+ * @notapi
+ */
+static inline void init_board(void) {
+ adcObjectInit(&ADCD);
+ adcStart(&ADCD, &ADCC);
+}
+
+/**
+ * @brief Check whether the surface is currently touched
+ * @return TRUE if the surface is currently touched
+ *
+ * @notapi
+ */
+static inline bool_t getpin_pressed(void) {
+ adcsample_t samples[2] = {0, };
+
+ // Set X+ to ground
+ palSetPadMode(IOPORTB, XPOS, PAL_MODE_OUTPUT);
+ palClearPad(IOPORTB, XPOS);
+
+ // Set Y- to VCC
+ palSetPadMode(IOPORTB, YNEG, PAL_MODE_OUTPUT);
+ palSetPad(IOPORTB, YNEG);
+
+ palSetPadMode(IOPORTB, XNEG, PAL_MODE_INPUT_ANALOG);
+ palSetPadMode(IOPORTB, YPOS, PAL_MODE_INPUT_ANALOG);
+
+ adcConvert(&ADCD, &ADC_X_CG, &samples[0], 1);
+ adcConvert(&ADCD, &ADC_Y_CG, &samples[1], 1);
+
+ return (ADC_MAX - (samples[1] - samples[0])) > TOUCH_THRESHOULD;
+}
+
+/**
+ * @brief Aquire the bus ready for readings
+ *
+ * @notapi
+ */
+static inline void aquire_bus(void) {
+}
+
+/**
+ * @brief Release the bus after readings
+ *
+ * @notapi
+ */
+static inline void release_bus(void) {
+}
+
+/**
+ * @brief Read an x value from touch controller
+ * @return The value read from the controller
+ *
+ * @notapi
+ */
+static inline uint16_t read_x_value(void) {
+ adcsample_t sample;
+
+ palSetPadMode(IOPORTB, XPOS, PAL_MODE_OUTPUT);
+ palSetPad(IOPORTB, XPOS);
+
+ palSetPadMode(IOPORTB, XNEG, PAL_MODE_OUTPUT);
+ palClearPad(IOPORTB, XNEG);
+
+ palSetPadMode(IOPORTB, YNEG, PAL_MODE_INPUT);
+
+ palSetPadMode(IOPORTB, YPOS, PAL_MODE_INPUT_ANALOG);
+
+ adcConvert(&ADCD, &ADC_Y_CG, &sample, 1);
+
+ return ADC_MAX - sample;
+}
+
+/**
+ * @brief Read an y value from touch controller
+ * @return The value read from the controller
+ *
+ * @notapi
+ */
+static inline uint16_t read_y_value(void) {
+ adcsample_t sample;
+
+ palSetPadMode(IOPORTB, YNEG, PAL_MODE_OUTPUT);
+ palClearPad(IOPORTB, YNEG);
+
+ palSetPadMode(IOPORTB, YPOS, PAL_MODE_OUTPUT);
+ palSetPad(IOPORTB, YPOS);
+
+ palSetPadMode(IOPORTB, XPOS, PAL_MODE_INPUT);
+
+ palSetPadMode(IOPORTB, XNEG, PAL_MODE_INPUT_ANALOG);
+
+ adcConvert(&ADCD, &ADC_X_CG, &sample, 1);
+
+ return ADC_MAX - sample;
+}
+
+#endif /* _GINPUT_LLD_MOUSE_BOARD_H */
+/** @} */
diff --git a/drivers/ginput/touch/MCU/ginput_lld_mouse_board_olimex_stm32_lcd.h b/boards/addons/ginput/touch/MCU/ginput_lld_mouse_board_olimex_stm32_lcd.h
index 2cc58f3c..ca177a89 100644
--- a/drivers/ginput/touch/MCU/ginput_lld_mouse_board_olimex_stm32_lcd.h
+++ b/boards/addons/ginput/touch/MCU/ginput_lld_mouse_board_olimex_stm32_lcd.h
@@ -1,152 +1,152 @@
-/*
- * This file is subject to the terms of the GFX License. If a copy of
- * the license was not distributed with this file, you can obtain one at:
- *
- * http://ugfx.org/license.html
- */
-
-/**
- * @file drivers/ginput/touch/MCU/ginput_lld_mouse_board_olimex_stm32_lcd.h
- * @brief GINPUT Touch low level driver source for the MCU on the example board.
- *
- * @defgroup Mouse Mouse
- * @ingroup GINPUT
- *
- * @{
- */
-
-#ifndef _GINPUT_LLD_MOUSE_BOARD_H
-#define _GINPUT_LLD_MOUSE_BOARD_H
-
-#define ADC_NUM_CHANNELS 2
-#define ADC_BUF_DEPTH 1
-
-static const ADCConversionGroup adc_y_config = {
- FALSE,
- ADC_NUM_CHANNELS,
- NULL,
- NULL,
- 0, 0,
- 0, 0,
- ADC_SQR1_NUM_CH(ADC_NUM_CHANNELS),
- 0,
- ADC_SQR3_SQ2_N(ADC_CHANNEL_IN12) | ADC_SQR3_SQ1_N(ADC_CHANNEL_IN13)
-};
-
-static const ADCConversionGroup adc_x_config = {
- FALSE,
- ADC_NUM_CHANNELS,
- NULL,
- NULL,
- 0, 0,
- 0, 0,
- ADC_SQR1_NUM_CH(ADC_NUM_CHANNELS),
- 0,
- ADC_SQR3_SQ2_N(ADC_CHANNEL_IN10) | ADC_SQR3_SQ1_N(ADC_CHANNEL_IN11)
-};
-
-/**
- * @brief Initialise the board for the touch.
- *
- * @notapi
- */
-static inline void init_board(void) {
- adcStart(&ADCD1, NULL);
-}
-
-/**
- * @brief Check whether the surface is currently touched
- * @return TRUE if the surface is currently touched
- *
- * @notapi
- */
-static inline bool_t getpin_pressed(void) {
- palSetPadMode(GPIOC, 0, PAL_MODE_INPUT_PULLDOWN);
- palSetPadMode(GPIOC, 1, PAL_MODE_INPUT);
- palSetPadMode(GPIOC, 2, PAL_MODE_INPUT);
- palSetPadMode(GPIOC, 3, PAL_MODE_OUTPUT_PUSHPULL);
- palSetPad(GPIOC, 3);
-
- return palReadPad(GPIOC, 0);
-}
-
-/**
- * @brief Aquire the bus ready for readings
- *
- * @notapi
- */
-static inline void aquire_bus(void) {
-
-}
-
-/**
- * @brief Release the bus after readings
- *
- * @notapi
- */
-static inline void release_bus(void) {
-
-}
-
-/**
- * @brief Read an x value from touch controller
- * @return The value read from the controller
- *
- * @notapi
- */
-static inline uint16_t read_x_value(void) {
- uint16_t val1, val2;
- adcsample_t samples[ADC_NUM_CHANNELS * ADC_BUF_DEPTH];
-
- palSetPadMode(GPIOC, 0, PAL_MODE_INPUT_ANALOG);
- palSetPadMode(GPIOC, 1, PAL_MODE_INPUT_ANALOG);
- palSetPadMode(GPIOC, 2, PAL_MODE_OUTPUT_PUSHPULL);
- palSetPadMode(GPIOC, 3, PAL_MODE_OUTPUT_PUSHPULL);
-
- palSetPad(GPIOC, 2);
- palClearPad(GPIOC, 3);
- gfxSleepMilliseconds(1);
- adcConvert(&ADCD1, &adc_x_config, samples, ADC_BUF_DEPTH);
- val1 = ((samples[0] + samples[1])/2);
-
- palClearPad(GPIOC, 2);
- palSetPad(GPIOC, 3);
- gfxSleepMilliseconds(1);
- adcConvert(&ADCD1, &adc_x_config, samples, ADC_BUF_DEPTH);
- val2 = ((samples[0] + samples[1])/2);
-
- return ((val1+((1<<12)-val2))/4);
-}
-
-/**
- * @brief Read an y value from touch controller
- * @return The value read from the controller
- *
- * @notapi
- */
-static inline uint16_t read_y_value(void) {
- uint16_t val1, val2;
- adcsample_t samples[ADC_NUM_CHANNELS * ADC_BUF_DEPTH];
-
- palSetPadMode(GPIOC, 2, PAL_MODE_INPUT_ANALOG);
- palSetPadMode(GPIOC, 3, PAL_MODE_INPUT_ANALOG);
- palSetPadMode(GPIOC, 0, PAL_MODE_OUTPUT_PUSHPULL);
- palSetPadMode(GPIOC, 1, PAL_MODE_OUTPUT_PUSHPULL);
-
- palSetPad(GPIOC, 1);
- palClearPad(GPIOC, 0);
- gfxSleepMilliseconds(1);
- adcConvert(&ADCD1, &adc_y_config, samples, ADC_BUF_DEPTH);
- val1 = ((samples[0] + samples[1])/2);
-
- palClearPad(GPIOC, 1);
- palSetPad(GPIOC, 0);
- gfxSleepMilliseconds(1);
- adcConvert(&ADCD1, &adc_y_config, samples, ADC_BUF_DEPTH);
- val2 = ((samples[0] + samples[1])/2);
-
- return ((val1+((1<<12)-val2))/4);
-}
-
-#endif /* _GINPUT_LLD_MOUSE_BOARD_H */
-/** @} */
+/*
+ * This file is subject to the terms of the GFX License. If a copy of
+ * the license was not distributed with this file, you can obtain one at:
+ *
+ * http://ugfx.org/license.html
+ */
+
+/**
+ * @file drivers/ginput/touch/MCU/ginput_lld_mouse_board_olimex_stm32_lcd.h
+ * @brief GINPUT Touch low level driver source for the MCU on the example board.
+ *
+ * @defgroup Mouse Mouse
+ * @ingroup GINPUT
+ *
+ * @{
+ */
+
+#ifndef _GINPUT_LLD_MOUSE_BOARD_H
+#define _GINPUT_LLD_MOUSE_BOARD_H
+
+#define ADC_NUM_CHANNELS 2
+#define ADC_BUF_DEPTH 1
+
+static const ADCConversionGroup adc_y_config = {
+ FALSE,
+ ADC_NUM_CHANNELS,
+ NULL,
+ NULL,
+ 0, 0,
+ 0, 0,
+ ADC_SQR1_NUM_CH(ADC_NUM_CHANNELS),
+ 0,
+ ADC_SQR3_SQ2_N(ADC_CHANNEL_IN12) | ADC_SQR3_SQ1_N(ADC_CHANNEL_IN13)
+};
+
+static const ADCConversionGroup adc_x_config = {
+ FALSE,
+ ADC_NUM_CHANNELS,
+ NULL,
+ NULL,
+ 0, 0,
+ 0, 0,
+ ADC_SQR1_NUM_CH(ADC_NUM_CHANNELS),
+ 0,
+ ADC_SQR3_SQ2_N(ADC_CHANNEL_IN10) | ADC_SQR3_SQ1_N(ADC_CHANNEL_IN11)
+};
+
+/**
+ * @brief Initialise the board for the touch.
+ *
+ * @notapi
+ */
+static inline void init_board(void) {
+ adcStart(&ADCD1, NULL);
+}
+
+/**
+ * @brief Check whether the surface is currently touched
+ * @return TRUE if the surface is currently touched
+ *
+ * @notapi
+ */
+static inline bool_t getpin_pressed(void) {
+ palSetPadMode(GPIOC, 0, PAL_MODE_INPUT_PULLDOWN);
+ palSetPadMode(GPIOC, 1, PAL_MODE_INPUT);
+ palSetPadMode(GPIOC, 2, PAL_MODE_INPUT);
+ palSetPadMode(GPIOC, 3, PAL_MODE_OUTPUT_PUSHPULL);
+ palSetPad(GPIOC, 3);
+
+ return palReadPad(GPIOC, 0);
+}
+
+/**
+ * @brief Aquire the bus ready for readings
+ *
+ * @notapi
+ */
+static inline void aquire_bus(void) {
+
+}
+
+/**
+ * @brief Release the bus after readings
+ *
+ * @notapi
+ */
+static inline void release_bus(void) {
+
+}
+
+/**
+ * @brief Read an x value from touch controller
+ * @return The value read from the controller
+ *
+ * @notapi
+ */
+static inline uint16_t read_x_value(void) {
+ uint16_t val1, val2;
+ adcsample_t samples[ADC_NUM_CHANNELS * ADC_BUF_DEPTH];
+
+ palSetPadMode(GPIOC, 0, PAL_MODE_INPUT_ANALOG);
+ palSetPadMode(GPIOC, 1, PAL_MODE_INPUT_ANALOG);
+ palSetPadMode(GPIOC, 2, PAL_MODE_OUTPUT_PUSHPULL);
+ palSetPadMode(GPIOC, 3, PAL_MODE_OUTPUT_PUSHPULL);
+
+ palSetPad(GPIOC, 2);
+ palClearPad(GPIOC, 3);
+ gfxSleepMilliseconds(1);
+ adcConvert(&ADCD1, &adc_x_config, samples, ADC_BUF_DEPTH);
+ val1 = ((samples[0] + samples[1])/2);
+
+ palClearPad(GPIOC, 2);
+ palSetPad(GPIOC, 3);
+ gfxSleepMilliseconds(1);
+ adcConvert(&ADCD1, &adc_x_config, samples, ADC_BUF_DEPTH);
+ val2 = ((samples[0] + samples[1])/2);
+
+ return ((val1+((1<<12)-val2))/4);
+}
+
+/**
+ * @brief Read an y value from touch controller
+ * @return The value read from the controller
+ *
+ * @notapi
+ */
+static inline uint16_t read_y_value(void) {
+ uint16_t val1, val2;
+ adcsample_t samples[ADC_NUM_CHANNELS * ADC_BUF_DEPTH];
+
+ palSetPadMode(GPIOC, 2, PAL_MODE_INPUT_ANALOG);
+ palSetPadMode(GPIOC, 3, PAL_MODE_INPUT_ANALOG);
+ palSetPadMode(GPIOC, 0, PAL_MODE_OUTPUT_PUSHPULL);
+ palSetPadMode(GPIOC, 1, PAL_MODE_OUTPUT_PUSHPULL);
+
+ palSetPad(GPIOC, 1);
+ palClearPad(GPIOC, 0);
+ gfxSleepMilliseconds(1);
+ adcConvert(&ADCD1, &adc_y_config, samples, ADC_BUF_DEPTH);
+ val1 = ((samples[0] + samples[1])/2);
+
+ palClearPad(GPIOC, 1);
+ palSetPad(GPIOC, 0);
+ gfxSleepMilliseconds(1);
+ adcConvert(&ADCD1, &adc_y_config, samples, ADC_BUF_DEPTH);
+ val2 = ((samples[0] + samples[1])/2);
+
+ return ((val1+((1<<12)-val2))/4);
+}
+
+#endif /* _GINPUT_LLD_MOUSE_BOARD_H */
+/** @} */
diff --git a/drivers/ginput/touch/STMPE811/ginput_lld_mouse_board_embest_dmstf4bb.h b/boards/addons/ginput/touch/STMPE811/ginput_lld_mouse_board_embest_dmstf4bb.h
index 7246378d..a2d38d34 100644
--- a/drivers/ginput/touch/STMPE811/ginput_lld_mouse_board_embest_dmstf4bb.h
+++ b/boards/addons/ginput/touch/STMPE811/ginput_lld_mouse_board_embest_dmstf4bb.h
@@ -4,123 +4,123 @@
*
* http://ugfx.org/license.html
*/
-
-/**
- * @file drivers/ginput/touch/STMPE811/ginput_lld_mouse_board_embest_dmstf4bb.h
- * @brief GINPUT Touch low level driver source for the STMPE811 on the Embest DM-STF4BB board.
- *
- * @defgroup Mouse Mouse
- * @ingroup GINPUT
- * @{
- */
-
-#ifndef _GINPUT_LLD_MOUSE_BOARD_H
-#define _GINPUT_LLD_MOUSE_BOARD_H
-
-static const I2CConfig i2ccfg = {
- OPMODE_I2C,
- 400000,
- FAST_DUTY_CYCLE_2,
-};
-
-/**
- * @brief Initialise the board for the touch.
- *
- * @notapi
- */
-static void init_board(void)
-{
- palSetPadMode(GPIOC, 13, PAL_MODE_INPUT | PAL_STM32_PUDR_FLOATING); /* TP IRQ */
- palSetPadMode(GPIOB, 8, PAL_MODE_ALTERNATE(4) | PAL_STM32_OTYPE_OPENDRAIN); /* SCL */
- palSetPadMode(GPIOB, 9, PAL_MODE_ALTERNATE(4) | PAL_STM32_OTYPE_OPENDRAIN); /* SDA */
-
- i2cStart(&I2CD1, &i2ccfg);
-}
-
-/**
- * @brief Check whether an interrupt is raised
- * @return TRUE if there is an interrupt signal present
- *
- * @notapi
- */
-static inline bool_t getpin_irq(void) {
- return (!(palReadPad(GPIOC, 13)));
-}
-
-/**
- * @brief Write a value into a certain register
- *
- * @param[in] reg The register address
- * @param[in] n The amount of bytes (one or two)
- * @param[in] val The value
- *
- * @notapi
- */
-static void write_reg(uint8_t reg, uint8_t n, uint16_t val)
-{
- uint8_t txbuf[3];
-
- i2cAcquireBus(&I2CD1);
-
- txbuf[0] = reg;
-
- if (n == 1) {
- txbuf[1] = val;
- i2cMasterTransmitTimeout(&I2CD1, STMPE811_ADDR, txbuf, 2, NULL, 0, MS2ST(STMPE811_TIMEOUT));
- } else if (n == 2) {
- txbuf[1] = ((val & 0xFF00) >> 8);
- txbuf[2] = (val & 0x00FF);
- i2cMasterTransmitTimeout(&I2CD1, STMPE811_ADDR, txbuf, 3, NULL, 0, MS2ST(STMPE811_TIMEOUT));
- }
-
- i2cReleaseBus(&I2CD1);
-}
-
-/**
- * @brief Read the value of a certain register
- *
- * @param[in] reg The register address
- * @param[in] n The amount of bytes (one or two)
- *
- * @return Data read from device (one byte or two depending on n param)
- *
- * @notapi
- */
-static uint16_t read_reg(uint8_t reg, uint8_t n)
-{
- uint8_t txbuf[1], rxbuf[2];
- uint16_t ret;
-
- rxbuf[0] = 0;
- rxbuf[1] = 0;
-
- i2cAcquireBus(&I2CD1);
-
- txbuf[0] = reg;
- i2cMasterTransmitTimeout(&I2CD1, STMPE811_ADDR, txbuf, 1, rxbuf, n, MS2ST(STMPE811_TIMEOUT));
-
- if (n == 1) {
- ret = rxbuf[0];
- } else if (n == 2) {
- ret = ((rxbuf[0] << 8) | (rxbuf[1] & 0xFF));
- }
-
- i2cReleaseBus(&I2CD1);
-
- return ret;
-}
-
-static void read_reg_n(uint8_t reg, uint8_t n, uint8_t *rxbuf)
-{
- uint8_t txbuf[1];
-
- i2cAcquireBus(&I2CD1);
-
- txbuf[0] = reg;
- i2cMasterTransmitTimeout(&I2CD1, STMPE811_ADDR, txbuf, 1, rxbuf, n, MS2ST(STMPE811_TIMEOUT));
-
- i2cReleaseBus(&I2CD1);
-}
-
-#endif /* _GINPUT_LLD_MOUSE_BOARD_H */
-/** @} */
+
+/**
+ * @file drivers/ginput/touch/STMPE811/ginput_lld_mouse_board_embest_dmstf4bb.h
+ * @brief GINPUT Touch low level driver source for the STMPE811 on the Embest DM-STF4BB board.
+ *
+ * @defgroup Mouse Mouse
+ * @ingroup GINPUT
+ * @{
+ */
+
+#ifndef _GINPUT_LLD_MOUSE_BOARD_H
+#define _GINPUT_LLD_MOUSE_BOARD_H
+
+static const I2CConfig i2ccfg = {
+ OPMODE_I2C,
+ 400000,
+ FAST_DUTY_CYCLE_2,
+};
+
+/**
+ * @brief Initialise the board for the touch.
+ *
+ * @notapi
+ */
+static void init_board(void)
+{
+ palSetPadMode(GPIOC, 13, PAL_MODE_INPUT | PAL_STM32_PUDR_FLOATING); /* TP IRQ */
+ palSetPadMode(GPIOB, 8, PAL_MODE_ALTERNATE(4) | PAL_STM32_OTYPE_OPENDRAIN); /* SCL */
+ palSetPadMode(GPIOB, 9, PAL_MODE_ALTERNATE(4) | PAL_STM32_OTYPE_OPENDRAIN); /* SDA */
+
+ i2cStart(&I2CD1, &i2ccfg);
+}
+
+/**
+ * @brief Check whether an interrupt is raised
+ * @return TRUE if there is an interrupt signal present
+ *
+ * @notapi
+ */
+static inline bool_t getpin_irq(void) {
+ return (!(palReadPad(GPIOC, 13)));
+}
+
+/**
+ * @brief Write a value into a certain register
+ *
+ * @param[in] reg The register address
+ * @param[in] n The amount of bytes (one or two)
+ * @param[in] val The value
+ *
+ * @notapi
+ */
+static void write_reg(uint8_t reg, uint8_t n, uint16_t val)
+{
+ uint8_t txbuf[3];
+
+ i2cAcquireBus(&I2CD1);
+
+ txbuf[0] = reg;
+
+ if (n == 1) {
+ txbuf[1] = val;
+ i2cMasterTransmitTimeout(&I2CD1, STMPE811_ADDR, txbuf, 2, NULL, 0, MS2ST(STMPE811_TIMEOUT));
+ } else if (n == 2) {
+ txbuf[1] = ((val & 0xFF00) >> 8);
+ txbuf[2] = (val & 0x00FF);
+ i2cMasterTransmitTimeout(&I2CD1, STMPE811_ADDR, txbuf, 3, NULL, 0, MS2ST(STMPE811_TIMEOUT));
+ }
+
+ i2cReleaseBus(&I2CD1);
+}
+
+/**
+ * @brief Read the value of a certain register
+ *
+ * @param[in] reg The register address
+ * @param[in] n The amount of bytes (one or two)
+ *
+ * @return Data read from device (one byte or two depending on n param)
+ *
+ * @notapi
+ */
+static uint16_t read_reg(uint8_t reg, uint8_t n)
+{
+ uint8_t txbuf[1], rxbuf[2];
+ uint16_t ret;
+
+ rxbuf[0] = 0;
+ rxbuf[1] = 0;
+
+ i2cAcquireBus(&I2CD1);
+
+ txbuf[0] = reg;
+ i2cMasterTransmitTimeout(&I2CD1, STMPE811_ADDR, txbuf, 1, rxbuf, n, MS2ST(STMPE811_TIMEOUT));
+
+ if (n == 1) {
+ ret = rxbuf[0];
+ } else if (n == 2) {
+ ret = ((rxbuf[0] << 8) | (rxbuf[1] & 0xFF));
+ }
+
+ i2cReleaseBus(&I2CD1);
+
+ return ret;
+}
+
+static void read_reg_n(uint8_t reg, uint8_t n, uint8_t *rxbuf)
+{
+ uint8_t txbuf[1];
+
+ i2cAcquireBus(&I2CD1);
+
+ txbuf[0] = reg;
+ i2cMasterTransmitTimeout(&I2CD1, STMPE811_ADDR, txbuf, 1, rxbuf, n, MS2ST(STMPE811_TIMEOUT));
+
+ i2cReleaseBus(&I2CD1);
+}
+
+#endif /* _GINPUT_LLD_MOUSE_BOARD_H */
+/** @} */
diff --git a/drivers/tdisp/HD44780/tdisp_lld_board_olimex_e407.h b/boards/addons/tdisp/HD44780/tdisp_lld_board_olimex_e407.h
index 7eda4e38..12407356 100644
--- a/drivers/tdisp/HD44780/tdisp_lld_board_olimex_e407.h
+++ b/boards/addons/tdisp/HD44780/tdisp_lld_board_olimex_e407.h
@@ -1,59 +1,59 @@
-/*
- * This file is subject to the terms of the GFX License. If a copy of
- * the license was not distributed with this file, you can obtain one at:
- *
- * http://ugfx.org/license.html
- */
-
-/**
- * @file drivers/tdisp/HD44780/tdisp_lld_board_olimex_e407.h
- * @brief TDISP driver subsystem board interface for the HD44780 display
- *
- * @addtogroup TDISP
- * @{
- */
-
-#ifndef _TDISP_LLD_BOARD_H
-#define _TDISP_LLD_BOARD_H
-
-/* Configure these to match the hardware connections on your board */
-#define BUS_4BITS FALSE
-#define PORT_DATA GPIOG
-#define PORT_CTRL GPIOE
-#define PIN_RS 0
-#define PIN_RW 1
-#define PIN_EN 2
-
-static void init_board(void) {
- palSetGroupMode(PORT_CTRL, PAL_WHOLE_PORT, 0, PAL_MODE_OUTPUT_PUSHPULL);
- palSetGroupMode(PORT_DATA, PAL_WHOLE_PORT, 0, PAL_MODE_OUTPUT_PUSHPULL);
- palClearPad(PORT_CTRL, PIN_RW);
-}
-
-static void writeToLCD(uint8_t data) {
- palWritePort(PORT_DATA, data);
- palSetPad(PORT_CTRL, PIN_EN);
- gfxSleepMicroseconds(1);
- palClearPad(PORT_CTRL, PIN_EN);
- gfxSleepMicroseconds(5);
-}
-
-static void write_cmd(uint8_t data) {
- palClearPad(PORT_CTRL, PIN_RS);
- #if BUS_4BITS
- writeToLCD(data>>4);
- #endif
- writeToLCD(data);
-}
-
-static void write_data(uint8_t data) {
- palSetPad(PORT_CTRL, PIN_RS);
- #if BUS_4BITS
- writeToLCD(data>>4);
- #endif
- writeToLCD(data);
-}
-
-#endif /* _TDISP_LLD_BOARD_H */
-/** @} */
-
+/*
+ * This file is subject to the terms of the GFX License. If a copy of
+ * the license was not distributed with this file, you can obtain one at:
+ *
+ * http://ugfx.org/license.html
+ */
+
+/**
+ * @file drivers/tdisp/HD44780/tdisp_lld_board_olimex_e407.h
+ * @brief TDISP driver subsystem board interface for the HD44780 display
+ *
+ * @addtogroup TDISP
+ * @{
+ */
+
+#ifndef _TDISP_LLD_BOARD_H
+#define _TDISP_LLD_BOARD_H
+
+/* Configure these to match the hardware connections on your board */
+#define BUS_4BITS FALSE
+#define PORT_DATA GPIOG
+#define PORT_CTRL GPIOE
+#define PIN_RS 0
+#define PIN_RW 1
+#define PIN_EN 2
+
+static void init_board(void) {
+ palSetGroupMode(PORT_CTRL, PAL_WHOLE_PORT, 0, PAL_MODE_OUTPUT_PUSHPULL);
+ palSetGroupMode(PORT_DATA, PAL_WHOLE_PORT, 0, PAL_MODE_OUTPUT_PUSHPULL);
+ palClearPad(PORT_CTRL, PIN_RW);
+}
+
+static void writeToLCD(uint8_t data) {
+ palWritePort(PORT_DATA, data);
+ palSetPad(PORT_CTRL, PIN_EN);
+ gfxSleepMicroseconds(1);
+ palClearPad(PORT_CTRL, PIN_EN);
+ gfxSleepMicroseconds(5);
+}
+
+static void write_cmd(uint8_t data) {
+ palClearPad(PORT_CTRL, PIN_RS);
+ #if BUS_4BITS
+ writeToLCD(data>>4);
+ #endif
+ writeToLCD(data);
+}
+
+static void write_data(uint8_t data) {
+ palSetPad(PORT_CTRL, PIN_RS);
+ #if BUS_4BITS
+ writeToLCD(data>>4);
+ #endif
+ writeToLCD(data);
+}
+
+#endif /* _TDISP_LLD_BOARD_H */
+/** @} */
+
diff --git a/drivers/tdisp/HD44780/tdisp_lld_board_st_stm32f4_discovery.h b/boards/addons/tdisp/HD44780/tdisp_lld_board_st_stm32f4_discovery.h
index e9a7ae33..43e161f1 100644
--- a/drivers/tdisp/HD44780/tdisp_lld_board_st_stm32f4_discovery.h
+++ b/boards/addons/tdisp/HD44780/tdisp_lld_board_st_stm32f4_discovery.h
@@ -1,122 +1,122 @@
-/*
- * This file is subject to the terms of the GFX License. If a copy of
- * the license was not distributed with this file, you can obtain one at:
- *
- * http://ugfx.org/license.html
- */
-
-/**
- * @file drivers/tdisp/HD44780/tdisp_lld_board_st_stm32f4_discovery.h
- * @brief TDISP driver subsystem board interface for the HD44780 display
- *
- * @addtogroup TDISP
- * @{
- */
-
-#ifndef _TDISP_LLD_BOARD_H
-#define _TDISP_LLD_BOARD_H
-
-/* Configure these to match the hardware connections on your board */
-#define BUS_4BITS TRUE
-
-/* Configure the bitoffset in the dataport so they match with the
- * hardware pins. An offset of 0 means bit0 stays at bit0 of the dataport.
- * If the offset is set to 3, bit0 of the nibble will be positioned at
- * P[A..G]3 of the hardware-port.
- */
-#define hardware_offset 3
-
-/* The port where the data is sent to. In the
- * low-leveldriver het hardware_offset is taken
- * into account. If for example the hardware_offset
- * is set to 3, then de data will be sent to
- * PE3, PE4, PE5 en PE6, if the dataport where GPIOE.
- */
-#define PORT_DATA GPIOE
-
-/* The port used to controle the controle lines of
- * the display.
- */
-#define PORT_CTRL GPIOD
-/* Pin to controle the R/S-line of the display */
-#define PIN_RS 0
-/* Pin to controle the EN-line of the display */
-#define PIN_EN 1
-/* Pin to controle the R/W-pin of the display.
- * If reading of the display is not used disable
- * reading in the gfxconf.h and put a dummy value here
- * as it will not be used.
- */
-#define PIN_RW 7
-
-
-static void init_board(void) {
- /* Initialize the ports for data and controle-lines */
- palSetGroupMode(PORT_CTRL, PAL_WHOLE_PORT, 0, PAL_MODE_OUTPUT_PUSHPULL);
- palSetGroupMode(PORT_DATA, PAL_WHOLE_PORT, 0, PAL_MODE_OUTPUT_PUSHPULL);
- /* Set alle controle pins to low */
- palClearPad(PORT_CTRL, PIN_RS);
- palClearPad(PORT_CTRL, PIN_EN);
- #if TDISP_NEED_READ
- palClearPad(PORT_CTRL, PIN_RW);
- #endif
-}
-
-/* This is the low-level routine for sending the bits
- * to the LCD-display. This routine shifts
- * the bits so they match the hardware port.
- */
-static void writeToLCD(uint8_t data) {
- palWritePort(PORT_DATA, data<<hardware_offset);
- palSetPad(PORT_CTRL, PIN_EN);
- gfxSleepMicroseconds(1);
- palClearPad(PORT_CTRL, PIN_EN);
- /* wait a little while so that de display can process the data */
- gfxSleepMicroseconds(5);
-}
-
-/* Writes a command to the display. The
- * RS-line is pulled low and than the
- * data is send.
- */
-static void write_cmd(uint8_t data) {
- palClearPad(PORT_CTRL, PIN_RS);
- #if BUS_4BITS
- /* first send the high-nibble */
- writeToLCD(data>>4);
- #endif
- /* send the low-nibble */
- #if BUS_4BITS
- /* in 4-bit mode the high-nibble is zeroed out */
- writeToLCD(data & 0x0F);
- #else
- writeToLCD(data);
- #endif
-}
-
-// static void write_initcmd(uint8_t data) {
-// write_cmd(data);
-// }
-
-/* Write data to the display. The
- * RS-line is pulled high and than the
- * data is send.
- */
-static void write_data(uint8_t data) {
- palSetPad(PORT_CTRL, PIN_RS);
- #if BUS_4BITS
- /* first send the high-nibble */
- writeToLCD(data>>4);
- #endif
- /* send the low-nibble */
- #if BUS_4BITS
- /* in 4-bit mode the high-nibble is zeroed out */
- writeToLCD(data & 0x0F);
- #else
- writeToLCD(data);
- #endif
-}
-
-#endif /* _TDISP_LLD_BOARD_H */
-/** @} */
-
+/*
+ * This file is subject to the terms of the GFX License. If a copy of
+ * the license was not distributed with this file, you can obtain one at:
+ *
+ * http://ugfx.org/license.html
+ */
+
+/**
+ * @file drivers/tdisp/HD44780/tdisp_lld_board_st_stm32f4_discovery.h
+ * @brief TDISP driver subsystem board interface for the HD44780 display
+ *
+ * @addtogroup TDISP
+ * @{
+ */
+
+#ifndef _TDISP_LLD_BOARD_H
+#define _TDISP_LLD_BOARD_H
+
+/* Configure these to match the hardware connections on your board */
+#define BUS_4BITS TRUE
+
+/* Configure the bitoffset in the dataport so they match with the
+ * hardware pins. An offset of 0 means bit0 stays at bit0 of the dataport.
+ * If the offset is set to 3, bit0 of the nibble will be positioned at
+ * P[A..G]3 of the hardware-port.
+ */
+#define hardware_offset 3
+
+/* The port where the data is sent to. In the
+ * low-leveldriver het hardware_offset is taken
+ * into account. If for example the hardware_offset
+ * is set to 3, then de data will be sent to
+ * PE3, PE4, PE5 en PE6, if the dataport where GPIOE.
+ */
+#define PORT_DATA GPIOE
+
+/* The port used to controle the controle lines of
+ * the display.
+ */
+#define PORT_CTRL GPIOD
+/* Pin to controle the R/S-line of the display */
+#define PIN_RS 0
+/* Pin to controle the EN-line of the display */
+#define PIN_EN 1
+/* Pin to controle the R/W-pin of the display.
+ * If reading of the display is not used disable
+ * reading in the gfxconf.h and put a dummy value here
+ * as it will not be used.
+ */
+#define PIN_RW 7
+
+
+static void init_board(void) {
+ /* Initialize the ports for data and controle-lines */
+ palSetGroupMode(PORT_CTRL, PAL_WHOLE_PORT, 0, PAL_MODE_OUTPUT_PUSHPULL);
+ palSetGroupMode(PORT_DATA, PAL_WHOLE_PORT, 0, PAL_MODE_OUTPUT_PUSHPULL);
+ /* Set alle controle pins to low */
+ palClearPad(PORT_CTRL, PIN_RS);
+ palClearPad(PORT_CTRL, PIN_EN);
+ #if TDISP_NEED_READ
+ palClearPad(PORT_CTRL, PIN_RW);
+ #endif
+}
+
+/* This is the low-level routine for sending the bits
+ * to the LCD-display. This routine shifts
+ * the bits so they match the hardware port.
+ */
+static void writeToLCD(uint8_t data) {
+ palWritePort(PORT_DATA, data<<hardware_offset);
+ palSetPad(PORT_CTRL, PIN_EN);
+ gfxSleepMicroseconds(1);
+ palClearPad(PORT_CTRL, PIN_EN);
+ /* wait a little while so that de display can process the data */
+ gfxSleepMicroseconds(5);
+}
+
+/* Writes a command to the display. The
+ * RS-line is pulled low and than the
+ * data is send.
+ */
+static void write_cmd(uint8_t data) {
+ palClearPad(PORT_CTRL, PIN_RS);
+ #if BUS_4BITS
+ /* first send the high-nibble */
+ writeToLCD(data>>4);
+ #endif
+ /* send the low-nibble */
+ #if BUS_4BITS
+ /* in 4-bit mode the high-nibble is zeroed out */
+ writeToLCD(data & 0x0F);
+ #else
+ writeToLCD(data);
+ #endif
+}
+
+// static void write_initcmd(uint8_t data) {
+// write_cmd(data);
+// }
+
+/* Write data to the display. The
+ * RS-line is pulled high and than the
+ * data is send.
+ */
+static void write_data(uint8_t data) {
+ palSetPad(PORT_CTRL, PIN_RS);
+ #if BUS_4BITS
+ /* first send the high-nibble */
+ writeToLCD(data>>4);
+ #endif
+ /* send the low-nibble */
+ #if BUS_4BITS
+ /* in 4-bit mode the high-nibble is zeroed out */
+ writeToLCD(data & 0x0F);
+ #else
+ writeToLCD(data);
+ #endif
+}
+
+#endif /* _TDISP_LLD_BOARD_H */
+/** @} */
+
diff --git a/drivers/gdisp/ILI9341/board_ILI9341_mikromedia.h b/drivers/gdisp/ILI9341/board_ILI9341_mikromedia.h
deleted file mode 100644
index a0eed13b..00000000
--- a/drivers/gdisp/ILI9341/board_ILI9341_mikromedia.h
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * This file is subject to the terms of the GFX License. If a copy of
- * the license was not distributed with this file, you can obtain one at:
- *
- * http://ugfx.org/license.html
- */
-
-/**
- * @file drivers/gdisp/ILI9341/board_ILI9341_mikromedia.h
- * @brief GDISP Graphics Driver subsystem low level driver source for the ILI9341 display.
- */
-
-#ifndef _GDISP_LLD_BOARD_H
-#define _GDISP_LLD_BOARD_H
-
-// For a multiple display configuration we would put all this in a structure and then
-// set g->board to that structure.
-#define SET_CS palSetPad(GPIOE, GPIOE_LCD_CS);
-#define CLR_CS palClearPad(GPIOE, GPIOE_LCD_CS);
-#define SET_RS palSetPad(GPIOE, GPIOE_LCD_RS);
-#define CLR_RS palClearPad(GPIOE, GPIOE_LCD_RS);
-#define SET_WR palSetPad(GPIOE, GPIOE_PMWR);
-#define CLR_WR palClearPad(GPIOE, GPIOE_PMWR);
-#define SET_RD palSetPad(GPIOE, GPIOE_PMRD);
-#define CLR_RD palClearPad(GPIOE, GPIOE_PMRD);
-
-static inline void init_board(GDisplay *g) {
-
- // As we are not using multiple displays we set g->board to NULL as we don't use it.
- g->board = 0;
-
- switch(g->controllerdisplay) {
- case 0: // Set up for Display 0
- /* Configure the pins to a well know state */
- SET_RS;
- SET_RD;
- SET_WR;
- CLR_CS;
-
- /* Hardware reset */
- palSetPad(GPIOE, GPIOE_LCD_RST);
- chThdSleepMilliseconds(100);
- palClearPad(GPIOE, GPIOE_LCD_RST);
- chThdSleepMilliseconds(100);
- palSetPad(GPIOE, GPIOE_LCD_RST);
- chThdSleepMilliseconds(100);
- break;
- }
-}
-
-static inline void post_init_board(GDisplay *g) {
- (void) g;
-}
-
-static inline void setpin_reset(GDisplay *g, bool_t state) {
- (void) g;
- if(state) {
- // reset lcd
- palClearPad(GPIOE, GPIOE_LCD_RST);
- } else {
- palSetPad(GPIOE, GPIOE_LCD_RST);
- }
-}
-
-static inline void set_backlight(GDisplay *g, uint8_t percent) {
- (void) g;
- // TODO: can probably pwm this
- if(percent) {
- // turn back light on
- palSetPad(GPIOE, GPIOE_LCD_BLED);
- } else {
- // turn off
- palClearPad(GPIOE, GPIOE_LCD_BLED);
- }
-}
-
-static inline void acquire_bus(GDisplay *g) {
- (void) g;
-}
-
-static inline void release_bus(GDisplay *g) {
- (void) g;
-}
-
-/**
- * @brief Short delay
- *
- * @param[in] dly Length of delay
- *
- * @notapi
- */
-static inline void ili9341_delay(uint16_t dly) {
- static uint16_t i;
- for(i = 0; i < dly; i++)
- asm("nop");
-}
-
-static inline void write_index(GDisplay *g, uint16_t index) {
- (void) g;
- palWriteGroup(GPIOE, 0x00FF, 0, index);
- CLR_RS; CLR_WR; ili9341_delay(1); SET_WR; ili9341_delay(1); SET_RS;
-}
-
-static inline void write_data(GDisplay *g, uint16_t data) {
- (void) g;
- palWriteGroup(GPIOE, 0x00FF, 0, data);
- CLR_WR; ili9341_delay(1); SET_WR; ili9341_delay(1);
-}
-
-static inline void setreadmode(GDisplay *g) {
- (void) g;
- // change pin mode to digital input
- palSetGroupMode(GPIOE, PAL_WHOLE_PORT, 0, PAL_MODE_INPUT);
-}
-
-static inline void setwritemode(GDisplay *g) {
- (void) g;
- // change pin mode back to digital output
- palSetGroupMode(GPIOE, PAL_WHOLE_PORT, 0, PAL_MODE_OUTPUT_PUSHPULL);
-}
-
-static inline uint16_t read_data(GDisplay *g) {
- CLR_RD;
- value = palReadPort(GPIOE);
- value = palReadPort(GPIOE);
- SET_RD;
- return value;
-}
-
-#endif /* _GDISP_LLD_BOARD_H */
diff --git a/drivers/ginput/touch/MCU/ginput_lld_mouse.c b/drivers/ginput/touch/MCU/ginput_lld_mouse.c
index 1bb7cd50..a64bf6cb 100644
--- a/drivers/ginput/touch/MCU/ginput_lld_mouse.c
+++ b/drivers/ginput/touch/MCU/ginput_lld_mouse.c
@@ -21,15 +21,7 @@
#include "ginput/lld/mouse.h"
-#if defined(GINPUT_MOUSE_USE_CUSTOM_BOARD) && GINPUT_MOUSE_USE_CUSTOM_BOARD
- #include "ginput_lld_mouse_board.h"
-#elif defined(BOARD_OLIMEX_STM32_LCD)
- #include "ginput_lld_mouse_board_olimex_stm32_lcd.h"
-#elif defined(BOARD_OLIMEX_PIC32MX_LCD)
- #include "ginput_lld_mouse_board_olimex_pic32mx_lcd.h"
-#else
- #include "ginput_lld_mouse_board.h"
-#endif
+#include "ginput_lld_mouse_board.h"
static uint16_t sampleBuf[7];
static coord_t lastx, lasty;
diff --git a/drivers/tdisp/HD44780/tdisp_lld.c b/drivers/tdisp/HD44780/tdisp_lld.c
index 2232955c..7b731c34 100644
--- a/drivers/tdisp/HD44780/tdisp_lld.c
+++ b/drivers/tdisp/HD44780/tdisp_lld.c
@@ -17,15 +17,7 @@
#if GFX_USE_TDISP /*|| defined(__DOXYGEN__)*/
-/* check first if the user has defined his/her own lowlevel-board file */
-#if defined(TDISP_USE_CUSTOM_BOARD) && TDISP_USE_CUSTOM_BOARD
- /* Include the user supplied board definitions */
- #include "tdisp_lld_board.h"
-#elif defined(BOARD_OLIMEX_STM32_E407)
- #include "tdisp_lld_board_olimex_e407.h"
-#elif defined(BOARD_ST_STM32F4_DISCOVERY)
- #include "tdisp_lld_board_example.h"
-#endif
+#include "tdisp_lld_board.h"
/* Controller Specific Properties */
#define CUSTOM_CHAR_COUNT 8