Added new type definitions - moving towards V3.0
parent
3b97fb798e
commit
41271d632b
|
@ -76,44 +76,44 @@ static void eink_delay(int us) {
|
|||
}
|
||||
|
||||
/* Turn the E-ink panel Vdd supply (+3.3V) on or off. */
|
||||
static GFXINLINE void setpower_vdd(GDisplay *g, bool_t on) {
|
||||
static GFXINLINE void setpower_vdd(GDisplay *g, gBool on) {
|
||||
(void) g;
|
||||
palWritePad(GPIOB, GPIOB_SMPS_CTRL, !on);
|
||||
palWritePad(GPIOA, GPIOA_EINK_VDD, on);
|
||||
}
|
||||
|
||||
/* Turn the E-ink panel negative supplies (-15V, -20V) on or off. */
|
||||
static GFXINLINE void setpower_vneg(GDisplay *g, bool_t on) {
|
||||
static GFXINLINE void setpower_vneg(GDisplay *g, gBool on) {
|
||||
(void) g;
|
||||
palWritePad(GPIOA, GPIOA_VNEG_CTRL, on);
|
||||
}
|
||||
|
||||
/* Turn the E-ink panel positive supplies (-15V, -20V) on or off. */
|
||||
static GFXINLINE void setpower_vpos(GDisplay *g, bool_t on) {
|
||||
static GFXINLINE void setpower_vpos(GDisplay *g, gBool on) {
|
||||
(void) g;
|
||||
palWritePad(GPIOA, GPIOA_VPOS_CTRL, on);
|
||||
}
|
||||
|
||||
/* Set the state of the LE (source driver Latch Enable) pin. */
|
||||
static GFXINLINE void setpin_le(GDisplay *g, bool_t on) {
|
||||
static GFXINLINE void setpin_le(GDisplay *g, gBool on) {
|
||||
(void) g;
|
||||
palWritePad(GPIOB, GPIOB_EINK_LE, on);
|
||||
}
|
||||
|
||||
/* Set the state of the OE (source driver Output Enable) pin. */
|
||||
static GFXINLINE void setpin_oe(GDisplay *g, bool_t on) {
|
||||
static GFXINLINE void setpin_oe(GDisplay *g, gBool on) {
|
||||
(void) g;
|
||||
palWritePad(GPIOB, GPIOB_EINK_OE, on);
|
||||
}
|
||||
|
||||
/* Set the state of the CL (source driver Clock) pin. */
|
||||
static GFXINLINE void setpin_cl(GDisplay *g, bool_t on) {
|
||||
static GFXINLINE void setpin_cl(GDisplay *g, gBool on) {
|
||||
(void) g;
|
||||
palWritePad(GPIOB, GPIOB_EINK_CL, on);
|
||||
}
|
||||
|
||||
/* Set the state of the SPH (source driver Start Pulse Horizontal) pin. */
|
||||
static GFXINLINE void setpin_sph(GDisplay *g, bool_t on) {
|
||||
static GFXINLINE void setpin_sph(GDisplay *g, gBool on) {
|
||||
(void) g;
|
||||
palWritePad(GPIOB, GPIOB_EINK_SPH, on);
|
||||
}
|
||||
|
@ -125,19 +125,19 @@ static GFXINLINE void setpins_data(GDisplay *g, uint8_t value) {
|
|||
}
|
||||
|
||||
/* Set the state of the CKV (gate driver Clock Vertical) pin. */
|
||||
static GFXINLINE void setpin_ckv(GDisplay *g, bool_t on) {
|
||||
static GFXINLINE void setpin_ckv(GDisplay *g, gBool on) {
|
||||
(void) g;
|
||||
palWritePad(GPIOB, GPIOB_EINK_CKV, on);
|
||||
}
|
||||
|
||||
/* Set the state of the GMODE (gate driver Gate Mode) pin. */
|
||||
static GFXINLINE void setpin_gmode(GDisplay *g, bool_t on) {
|
||||
static GFXINLINE void setpin_gmode(GDisplay *g, gBool on) {
|
||||
(void) g;
|
||||
palWritePad(GPIOC, GPIOC_EINK_GMODE, on);
|
||||
}
|
||||
|
||||
/* Set the state of the SPV (gate driver Start Pulse Vertical) pin. */
|
||||
static GFXINLINE void setpin_spv(GDisplay *g, bool_t on) {
|
||||
static GFXINLINE void setpin_spv(GDisplay *g, gBool on) {
|
||||
(void) g;
|
||||
palWritePad(GPIOB, GPIOB_EINK_SPV, on);
|
||||
}
|
||||
|
|
|
@ -103,7 +103,7 @@ static GFXINLINE void post_init_board(GDisplay *g) {
|
|||
(void) g;
|
||||
}
|
||||
|
||||
static GFXINLINE void setpin_reset(GDisplay *g, bool_t state) {
|
||||
static GFXINLINE void setpin_reset(GDisplay *g, gBool state) {
|
||||
(void) g;
|
||||
if (state) {
|
||||
CLR_RST;
|
||||
|
|
|
@ -68,7 +68,7 @@ static GFXINLINE void post_init_board(GDisplay *g) {
|
|||
(void) g;
|
||||
}
|
||||
|
||||
static noinline void setpin_reset(GDisplay *g, bool_t state) {
|
||||
static noinline void setpin_reset(GDisplay *g, gBool state) {
|
||||
(void) g;
|
||||
if (state)
|
||||
palClearPad(IOPORTA, 7);
|
||||
|
|
|
@ -68,7 +68,7 @@ static GFXINLINE void post_init_board(GDisplay *g) {
|
|||
(void) g;
|
||||
}
|
||||
|
||||
static GFXINLINE void setpin_reset(GDisplay *g, bool_t state) {
|
||||
static GFXINLINE void setpin_reset(GDisplay *g, gBool state) {
|
||||
(void) g;
|
||||
if(state)
|
||||
palClearPad(GPIOE, GPIOE_TFT_RST);
|
||||
|
|
|
@ -83,14 +83,14 @@ static GFXINLINE void post_init_board(GDisplay *g) {
|
|||
* @brief Set or clear the lcd reset pin.
|
||||
*
|
||||
* @param[in] g The GDisplay structure
|
||||
* @param[in] state TRUE = lcd in reset, FALSE = normal operation
|
||||
* @param[in] state gTrue = lcd in reset, gFalse = normal operation
|
||||
*
|
||||
* @notapi
|
||||
*/
|
||||
static GFXINLINE void setpin_reset(GDisplay *g, bool_t state) {
|
||||
static GFXINLINE void setpin_reset(GDisplay *g, gBool state) {
|
||||
(void) g;
|
||||
|
||||
if (state == TRUE) {
|
||||
if (state) {
|
||||
palClearPad(LCD_PORT, LCD_RES);
|
||||
} else {
|
||||
palSetPad(LCD_PORT, LCD_RES);
|
||||
|
|
|
@ -53,7 +53,7 @@ static GFXINLINE void post_init_board(GDisplay *g) {
|
|||
(void) g;
|
||||
}
|
||||
|
||||
static GFXINLINE void setpin_reset(GDisplay *g, bool_t state) {
|
||||
static GFXINLINE void setpin_reset(GDisplay *g, gBool state) {
|
||||
(void) g;
|
||||
(void) state;
|
||||
}
|
||||
|
|
|
@ -97,7 +97,7 @@ static GFXINLINE void post_init_board(GDisplay* g)
|
|||
(void) g;
|
||||
}
|
||||
|
||||
static GFXINLINE void setpin_reset(GDisplay* g, bool_t state)
|
||||
static GFXINLINE void setpin_reset(GDisplay *g, gBool state)
|
||||
{
|
||||
(void) g;
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ static GFXINLINE void init_board(GDisplay *g) {
|
|||
}
|
||||
}
|
||||
|
||||
static GFXINLINE void setpin_reset(GDisplay *g, bool_t state) {
|
||||
static GFXINLINE void setpin_reset(GDisplay *g, gBool state) {
|
||||
(void) g;
|
||||
(void) state;
|
||||
}
|
||||
|
|
|
@ -81,7 +81,7 @@ static GFXINLINE void soft_spi_write_9bit(uint16_t data){
|
|||
}
|
||||
#endif
|
||||
|
||||
static GFXINLINE void setpin_reset(GDisplay *g, bool_t state) {
|
||||
static GFXINLINE void setpin_reset(GDisplay *g, gBool state) {
|
||||
(void) g;
|
||||
if(state) {
|
||||
CLR_RST;
|
||||
|
@ -100,7 +100,7 @@ static GFXINLINE void init_board(GDisplay *g) {
|
|||
* SPI1 I/O pins setup.
|
||||
*/
|
||||
palSetPadMode(SPFD54124B_PIN_PORT, SPFD54124B_PIN_RST, PAL_MODE_OUTPUT_PUSHPULL); /* RESET */
|
||||
setpin_reset(g, TRUE);
|
||||
setpin_reset(g, gTrue);
|
||||
|
||||
#if USE_HARD_SPI
|
||||
palSetPadMode(SPFD54124B_SPI_PORT, SPFD54124B_SPI_SCK, PAL_MODE_ALTERNATE(5) | PAL_STM32_OSPEED_HIGHEST); /* SCK. */
|
||||
|
|
|
@ -109,7 +109,7 @@ static GFXINLINE void post_init_board(GDisplay *g) {
|
|||
(void) g;
|
||||
}
|
||||
|
||||
static GFXINLINE void setpin_reset(GDisplay *g, bool_t state) {
|
||||
static GFXINLINE void setpin_reset(GDisplay *g, gBool state) {
|
||||
(void) g;
|
||||
(void) state;
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ static GFXINLINE void post_init_board(GDisplay* g)
|
|||
}
|
||||
|
||||
|
||||
static GFXINLINE void setpin_reset(GDisplay* g, bool_t state)
|
||||
static GFXINLINE void setpin_reset(GDisplay *g, gBool state)
|
||||
{
|
||||
(void)g;
|
||||
|
||||
|
|
|
@ -82,7 +82,7 @@ static GFXINLINE void post_init_board(GDisplay *g) {
|
|||
(void) g;
|
||||
}
|
||||
|
||||
static GFXINLINE void setpin_reset(GDisplay *g, bool_t state) {
|
||||
static GFXINLINE void setpin_reset(GDisplay *g, gBool state) {
|
||||
(void) g;
|
||||
if(state)
|
||||
CLR_RST
|
||||
|
|
|
@ -1,88 +0,0 @@
|
|||
#include <Arduino.h>
|
||||
#include <SPI.h>
|
||||
#include <Wire.h>
|
||||
|
||||
#include "board_SSD1331.h"
|
||||
|
||||
#define LCD_BOARD_ID 0 // 0 or 1 - set by the position of a resistor near SX1505 (see schematic and board design)
|
||||
|
||||
// GPIO Pins
|
||||
#define GPIO_DC 0x01
|
||||
#define GPIO_CS 0x02
|
||||
#define GPIO_RES 0x08
|
||||
#define GPIO_BTN1 0x10
|
||||
#define GPIO_BTN2 0x20
|
||||
#define GPIO_BTN3 0x40
|
||||
#define GPIO_BTN4 0x80
|
||||
#define GPIO_CMD_START ~(GPIO_CS|GPIO_DC)
|
||||
#define GPIO_DATA_START ~GPIO_CS
|
||||
#define GPIO_TRANSFER_END GPIO_CS
|
||||
|
||||
//GPIO Registers
|
||||
#define GPIO_RegData 0x00
|
||||
#define GPIO_RegDir 0x01
|
||||
#define GPIO_RegPullUp 0x02
|
||||
|
||||
// Wire address of the SX1505 chip
|
||||
#define GPIO_ADDR 0x20
|
||||
|
||||
static void writeGPIO(uint8_t regAddr, uint8_t regData)
|
||||
{
|
||||
uint8_t oldTWBR=TWBR;
|
||||
TWBR=0;
|
||||
Wire.beginTransmission(GPIO_ADDR + LCD_BOARD_ID);
|
||||
Wire.write(regAddr);
|
||||
Wire.write(regData);
|
||||
Wire.endTransmission();
|
||||
TWBR=oldTWBR;
|
||||
}
|
||||
|
||||
static bool isDataMode = false;
|
||||
static bool isCmdMode = false;
|
||||
|
||||
void SSD1331_init_board(void) {
|
||||
//setup GPIO, reset SSD1331
|
||||
writeGPIO(GPIO_RegData,~GPIO_RES);//reset low, CS/other pins high
|
||||
writeGPIO(GPIO_RegDir,~GPIO_RES);//set reset to output
|
||||
delay(5);
|
||||
writeGPIO(GPIO_RegDir,~(GPIO_CS|GPIO_DC));//reset to input, CS/DC output
|
||||
writeGPIO(GPIO_RegPullUp,GPIO_BTN1|GPIO_BTN2|GPIO_BTN3|GPIO_BTN4);//button pullup enable
|
||||
//init SPI
|
||||
SPI.begin();
|
||||
SPI.setDataMode(SPI_MODE0);//wrong mode, works because we're only writing. this mode is compatible with SD cards.
|
||||
SPI.setClockDivider(SPI_CLOCK_DIV2);
|
||||
|
||||
isDataMode = isCmdMode = false;
|
||||
}
|
||||
|
||||
void SSD1331_setpin_reset(int state) {
|
||||
// Ignore this as we did it in the init_board
|
||||
}
|
||||
|
||||
void SSD1331_aquirebus(void) {
|
||||
// Do nothing as we do it in the data transfer
|
||||
}
|
||||
|
||||
void SSD1331_releasebus(void) {
|
||||
if (!isDataMode && !isCmdMode) return;
|
||||
writeGPIO(GPIO_RegData,GPIO_TRANSFER_END);
|
||||
isDataMode = isCmdMode = false;
|
||||
}
|
||||
|
||||
void SSD1331_write_cmd(uint8_t cmd) {
|
||||
if (!isCmdMode) {
|
||||
writeGPIO(GPIO_RegData,GPIO_CMD_START);
|
||||
isDataMode = false;
|
||||
isCmdMode = true;
|
||||
}
|
||||
SPI.transfer(cmd);
|
||||
}
|
||||
|
||||
void SSD1331_write_data(uint8_t data) {
|
||||
if (!isDataMode) {
|
||||
writeGPIO(GPIO_RegData,GPIO_DATA_START);
|
||||
isDataMode = true;
|
||||
isCmdMode = false;
|
||||
}
|
||||
SPI.transfer(data);
|
||||
}
|
|
@ -1,34 +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
|
||||
*/
|
||||
|
||||
#ifndef _GDISP_LLD_BOARD_H
|
||||
#define _GDISP_LLD_BOARD_H
|
||||
|
||||
#define init_board(g) SSD1331_init_board()
|
||||
#define post_init_board(g)
|
||||
#define setpin_reset(g, state) SSD1331_setpin_reset(state)
|
||||
#define acquire_bus(g) SSD1331_aquirebus()
|
||||
#define release_bus(g) SSD1331_releasebus()
|
||||
#define write_cmd(g, cmd) SSD1331_write_cmd(cmd)
|
||||
#define write_data(g, data) SSD1331_write_data(data)
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void SSD1331_init_board(void);
|
||||
void SSD1331_setpin_reset(int state);
|
||||
void SSD1331_aquirebus(void);
|
||||
void SSD1331_releasebus(void);
|
||||
void SSD1331_write_cmd(uint8_t cmd);
|
||||
void SSD1331_write_data(uint8_t data);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _GDISP_LLD_BOARD_H */
|
|
@ -8,17 +8,6 @@
|
|||
#ifndef _GDISP_LLD_BOARD_H
|
||||
#define _GDISP_LLD_BOARD_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif // __cplusplus
|
||||
|
||||
extern void ssd1351_init_board(void);
|
||||
extern void ssd1351_setpin_reset(int state);
|
||||
extern void ssd1351_acquire_bus(void);
|
||||
extern void ssd1351_release_bus(void);
|
||||
extern void ssd1351_write_cmd(unsigned char index);
|
||||
extern void ssd1351_write_data(unsigned char data);
|
||||
|
||||
#define init_board(g) ssd1351_init_board()
|
||||
#define post_init_board(g)
|
||||
#define setpin_reset(g, s) ssd1351_setpin_reset(s)
|
||||
|
@ -28,8 +17,20 @@ extern void ssd1351_write_data(unsigned char data);
|
|||
#define write_cmd(g, i) ssd1351_write_cmd(i)
|
||||
#define write_data(g, d) ssd1351_write_cmd(d)
|
||||
|
||||
/* This test is needed as this file is also included in the .cpp file providing the below functions */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void ssd1351_init_board(void);
|
||||
void ssd1351_setpin_reset(int state);
|
||||
void ssd1351_acquire_bus(void);
|
||||
void ssd1351_release_bus(void);
|
||||
void ssd1351_write_cmd(unsigned char index);
|
||||
void ssd1351_write_data(unsigned char data);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif // __cplusplus
|
||||
#endif
|
||||
|
||||
#endif /* _GDISP_LLD_BOARD_H */
|
||||
|
|
|
@ -81,7 +81,7 @@ static GFXINLINE void post_init_board(GDisplay *g) {
|
|||
FSMC_Bank1->BTCR[0] = FSMC_BCR1_MWID_0 | FSMC_BCR1_WREN | FSMC_BCR1_MBKEN;
|
||||
}
|
||||
|
||||
static GFXINLINE void setpin_reset(GDisplay *g, bool_t state) {
|
||||
static GFXINLINE void setpin_reset(GDisplay *g, gBool state) {
|
||||
(void) g;
|
||||
(void) state;
|
||||
}
|
||||
|
|
|
@ -72,7 +72,7 @@ static GFXINLINE void post_init_board(GDisplay *g) {
|
|||
(void) g;
|
||||
}
|
||||
|
||||
static GFXINLINE void setpin_reset(GDisplay *g, bool_t state) {
|
||||
static GFXINLINE void setpin_reset(GDisplay *g, gBool state) {
|
||||
(void) g;
|
||||
(void) state;
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
static const nrf_drv_spi_t spi = NRF_DRV_SPI_INSTANCE(SPI_INSTANCE);
|
||||
|
||||
static GFXINLINE bool_t init_board(GDisplay* g)
|
||||
static GFXINLINE gBool init_board(GDisplay* g)
|
||||
{
|
||||
nrf_drv_spi_config_t spi_config;
|
||||
ret_code_t err = NRF_SUCCESS;
|
||||
|
@ -47,10 +47,10 @@ static GFXINLINE bool_t init_board(GDisplay* g)
|
|||
spi_config.bit_order = NRF_DRV_SPI_BIT_ORDER_MSB_FIRST;
|
||||
err = nrf_drv_spi_init(&spi, &spi_config, 0);
|
||||
if (err != NRF_SUCCESS) {
|
||||
return FALSE;
|
||||
return gFalse;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
return gTrue;
|
||||
}
|
||||
|
||||
static GFXINLINE void post_init_board(GDisplay* g)
|
||||
|
@ -58,7 +58,7 @@ static GFXINLINE void post_init_board(GDisplay* g)
|
|||
(void)g;
|
||||
}
|
||||
|
||||
static GFXINLINE void setpin_reset(GDisplay* g, bool_t state)
|
||||
static GFXINLINE void setpin_reset(GDisplay *g, gBool state)
|
||||
{
|
||||
(void)g;
|
||||
|
||||
|
@ -69,14 +69,14 @@ static GFXINLINE void setpin_reset(GDisplay* g, bool_t state)
|
|||
}
|
||||
}
|
||||
|
||||
static GFXINLINE bool_t getpin_busy(GDisplay* g)
|
||||
static GFXINLINE gBool getpin_busy(GDisplay* g)
|
||||
{
|
||||
(void)g;
|
||||
|
||||
if (nrf_gpio_pin_read(PIN_BUSY) == 1) {
|
||||
return TRUE;
|
||||
return gTrue;
|
||||
} else {
|
||||
return FALSE;
|
||||
return gFalse;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -34,17 +34,17 @@ static const SPIConfig spicfg = {
|
|||
// How much extra data to allocate at the end of the GMouse structure for the board's use
|
||||
#define GMOUSE_ADS7843_BOARD_DATA_SIZE 0
|
||||
|
||||
static bool_t init_board(GMouse* m, unsigned driverinstance) {
|
||||
static gBool init_board(GMouse* m, unsigned driverinstance) {
|
||||
(void) m;
|
||||
|
||||
if (driverinstance)
|
||||
return FALSE;
|
||||
return gFalse;
|
||||
|
||||
spiStart(&SPID2, &spicfg);
|
||||
return TRUE;
|
||||
return gTrue;
|
||||
}
|
||||
|
||||
static GFXINLINE bool_t getpin_pressed(GMouse* m) {
|
||||
static GFXINLINE gBool getpin_pressed(GMouse* m) {
|
||||
(void) m;
|
||||
|
||||
return (!palReadPad(GPIOG, 0));
|
||||
|
|
|
@ -45,11 +45,11 @@ static const SPIConfig spicfg = {
|
|||
// How much extra data to allocate at the end of the GMouse structure for the board's use
|
||||
#define GMOUSE_ADS7843_BOARD_DATA_SIZE 0
|
||||
|
||||
static bool_t init_board(GMouse* m, unsigned driverinstance) {
|
||||
static gBool init_board(GMouse* m, unsigned driverinstance) {
|
||||
(void) m;
|
||||
|
||||
if (driverinstance)
|
||||
return FALSE;
|
||||
return gFalse;
|
||||
|
||||
palSetPadMode(GPIOB, 13, PAL_MODE_ALTERNATE(5) ); /* SCK */
|
||||
palSetPadMode(GPIOB, 14, PAL_MODE_ALTERNATE(5) ); /* MISO */
|
||||
|
@ -57,10 +57,10 @@ static bool_t init_board(GMouse* m, unsigned driverinstance) {
|
|||
palSetPadMode(GPIOC, 4, PAL_MODE_OUTPUT_PUSHPULL); /* CS */
|
||||
|
||||
spiStart(&SPID2, &spicfg);
|
||||
return TRUE;
|
||||
return gTrue;
|
||||
}
|
||||
|
||||
static GFXINLINE bool_t getpin_pressed(GMouse* m) {
|
||||
static GFXINLINE gBool getpin_pressed(GMouse* m) {
|
||||
(void) m;
|
||||
|
||||
return (!palReadPad(GPIOC, 5));
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
static SPI_HandleTypeDef _hspi;
|
||||
|
||||
static bool_t init_board(GMouse* m, unsigned driverinstance)
|
||||
static gBool init_board(GMouse* m, unsigned driverinstance)
|
||||
{
|
||||
GPIO_InitTypeDef GPIO_InitStruct;
|
||||
|
||||
|
@ -93,20 +93,20 @@ static bool_t init_board(GMouse* m, unsigned driverinstance)
|
|||
_hspi.Init.CRCCalculation = SPI_CRCCALCULATION_DISABLE;
|
||||
_hspi.Init.CRCPolynomial = 10;
|
||||
if (HAL_SPI_Init(&_hspi) != HAL_OK) {
|
||||
return FALSE;
|
||||
return gFalse;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
return gTrue;
|
||||
}
|
||||
|
||||
static GFXINLINE bool_t getpin_pressed(GMouse* m)
|
||||
static GFXINLINE gBool getpin_pressed(GMouse* m)
|
||||
{
|
||||
(void)m;
|
||||
|
||||
if (HAL_GPIO_ReadPin(GPIOC, GPIO_PIN_4) == GPIO_PIN_RESET)
|
||||
return TRUE;
|
||||
return gTrue;
|
||||
|
||||
return FALSE;
|
||||
return gFalse;
|
||||
}
|
||||
|
||||
static GFXINLINE void aquire_bus(GMouse* m)
|
||||
|
|
|
@ -59,18 +59,18 @@ static const ADCConversionGroup ADC_Y_CG = {
|
|||
.channels = 1 << YPOS,
|
||||
};
|
||||
|
||||
static bool_t init_board(GMouse *m, unsigned driverinstance) {
|
||||
static gBool init_board(GMouse *m, unsigned driverinstance) {
|
||||
(void) m;
|
||||
|
||||
if (driverinstance)
|
||||
return FALSE;
|
||||
return gFalse;
|
||||
|
||||
adcObjectInit(&ADCD);
|
||||
adcStart(&ADCD, &ADCC);
|
||||
return TRUE;
|
||||
return gTrue;
|
||||
}
|
||||
|
||||
static bool_t read_xyz(GMouse *m, GMouseReading *prd) {
|
||||
static gBool read_xyz(GMouse *m, GMouseReading *prd) {
|
||||
adcsample_t samples[2];
|
||||
|
||||
prd->buttons = 0;
|
||||
|
@ -89,7 +89,7 @@ static bool_t read_xyz(GMouse *m, GMouseReading *prd) {
|
|||
|
||||
// Shortcut - no need to read X or Y if the touch is off.
|
||||
if (pdr->z < GMOUSE_MCU_Z_TOUCHON)
|
||||
return TRUE;
|
||||
return gTrue;
|
||||
|
||||
// Read X
|
||||
palSetPadMode(IOPORTB, XPOS, PAL_MODE_OUTPUT);
|
||||
|
@ -111,7 +111,7 @@ static bool_t read_xyz(GMouse *m, GMouseReading *prd) {
|
|||
adcConvert(&ADCD, &ADC_X_CG, &samples[0], 1);
|
||||
pdr->y = ADC_MAX - samples[0];
|
||||
|
||||
return TRUE;
|
||||
return gTrue;
|
||||
}
|
||||
|
||||
#endif /* _GINPUT_LLD_MOUSE_BOARD_H */
|
||||
|
|
|
@ -66,14 +66,14 @@ static unsigned int device_read_16(unsigned char device_address, unsigned char s
|
|||
return (0xFFFF & ((rdata_h << 8) | rdata_l));
|
||||
}
|
||||
|
||||
static bool_t init_board(GMouse* m, unsigned instance)
|
||||
static gBool init_board(GMouse* m, unsigned instance)
|
||||
{
|
||||
(void)m;
|
||||
(void)instance;
|
||||
|
||||
I2C_init(I2C_OPENCORES_0_BASE, 50000000, 400000);
|
||||
|
||||
return TRUE;
|
||||
return gTrue;
|
||||
}
|
||||
|
||||
static void write_reg(GMouse* m, uint8_t reg, uint8_t val)
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#define write_cmd(g, cmd) SSD1331_write_cmd(cmd)
|
||||
#define write_data(g, data) SSD1331_write_data(data)
|
||||
|
||||
/* This test is needed as this file is also included in the .cpp file providing the below functions */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
|
|
@ -99,7 +99,7 @@ static GFXINLINE void post_init_board(GDisplay *g) {
|
|||
(void) g;
|
||||
}
|
||||
|
||||
static GFXINLINE void setpin_reset(GDisplay *g, bool_t state) {
|
||||
static GFXINLINE void setpin_reset(GDisplay *g, gBool state) {
|
||||
(void) g;
|
||||
if (state) {
|
||||
CLR_RST;
|
||||
|
|
|
@ -43,12 +43,12 @@ static const I2CConfig i2ccfg = {
|
|||
FAST_DUTY_CYCLE_2,
|
||||
};
|
||||
|
||||
static bool_t init_board(GMouse* m, unsigned driverinstance) {
|
||||
static gBool init_board(GMouse* m, unsigned driverinstance) {
|
||||
(void) m;
|
||||
|
||||
// This board only supports one touch panel
|
||||
if (driverinstance)
|
||||
return FALSE;
|
||||
return gFalse;
|
||||
|
||||
palSetPadMode(GPIOC, 13, PAL_MODE_INPUT | PAL_STM32_PUDR_FLOATING); /* TP IRQ */
|
||||
palSetPadMode(GPIOB, 8, PAL_MODE_ALTERNATE(4) | PAL_STM32_OTYPE_OPENDRAIN); /* SCL */
|
||||
|
@ -56,11 +56,11 @@ static bool_t init_board(GMouse* m, unsigned driverinstance) {
|
|||
|
||||
i2cStart(&I2CD1, &i2ccfg);
|
||||
|
||||
return TRUE;
|
||||
return gTrue;
|
||||
}
|
||||
|
||||
#if GMOUSE_STMPE811_GPIO_IRQPIN
|
||||
static bool_t getpin_irq(GMouse* m) {
|
||||
static gBool getpin_irq(GMouse* m) {
|
||||
(void) m;
|
||||
|
||||
return !palReadPad(GPIOC, 13);
|
||||
|
|
|
@ -48,7 +48,7 @@ static GFXINLINE void post_init_board(GDisplay *g)
|
|||
(void) g;
|
||||
}
|
||||
|
||||
static GFXINLINE void setpin_reset(GDisplay *g, bool_t state)
|
||||
static GFXINLINE void setpin_reset(GDisplay *g, gBool state)
|
||||
{
|
||||
(void) g;
|
||||
(void) state;
|
||||
|
|
|
@ -26,13 +26,13 @@ static const SPIConfig spicfg = {
|
|||
/* SPI_CR1_BR_2 |*/ SPI_CR1_BR_1 | SPI_CR1_BR_0,
|
||||
};
|
||||
|
||||
static bool_t init_board(GMouse* m, unsigned driverinstance)
|
||||
static gBool init_board(GMouse* m, unsigned driverinstance)
|
||||
{
|
||||
(void)m;
|
||||
|
||||
// Only one touch interface on this board
|
||||
if (driverinstance)
|
||||
return FALSE;
|
||||
return gFalse;
|
||||
|
||||
// Set the GPIO modes
|
||||
palSetPadMode(GPIOC, 4, PAL_MODE_INPUT_PULLUP);
|
||||
|
@ -40,10 +40,10 @@ static bool_t init_board(GMouse* m, unsigned driverinstance)
|
|||
// Start the SPI peripheral
|
||||
spiStart(&SPID1, &spicfg);
|
||||
|
||||
return TRUE;
|
||||
return gTrue;
|
||||
}
|
||||
|
||||
static GFXINLINE bool_t getpin_pressed(GMouse* m)
|
||||
static GFXINLINE gBool getpin_pressed(GMouse* m)
|
||||
{
|
||||
(void) m;
|
||||
|
||||
|
|
|
@ -124,7 +124,7 @@ static GFXINLINE void post_init_board(GDisplay *g) {
|
|||
(void) g;
|
||||
}
|
||||
|
||||
static GFXINLINE void setpin_reset(GDisplay *g, bool_t state) {
|
||||
static GFXINLINE void setpin_reset(GDisplay *g, gBool state) {
|
||||
(void) g;
|
||||
|
||||
if(state) {}
|
||||
|
|
|
@ -46,7 +46,7 @@ static const SPIConfig spicfg = {
|
|||
* TP_IRQ PB6
|
||||
*/
|
||||
|
||||
static bool_t init_board(GMouse* m, unsigned driverinstance) {
|
||||
static gBool init_board(GMouse* m, unsigned driverinstance) {
|
||||
(void) m;
|
||||
(void) driverinstance;
|
||||
|
||||
|
@ -63,7 +63,7 @@ static bool_t init_board(GMouse* m, unsigned driverinstance) {
|
|||
/*
|
||||
* PB6 is connected to TP_IRQ (low active).
|
||||
*/
|
||||
static GFXINLINE bool_t getpin_pressed(GMouse* m) {
|
||||
static GFXINLINE gBool getpin_pressed(GMouse* m) {
|
||||
(void)m;
|
||||
return (!palReadPad(GPIOB, 6));
|
||||
}
|
||||
|
|
|
@ -70,7 +70,7 @@ static GFXINLINE void post_init_board(GDisplay *g) {
|
|||
FSMC_Bank1->BTCR[2] = FSMC_BCR1_MWID_0 | FSMC_BCR1_WREN | FSMC_BCR1_MBKEN;
|
||||
}
|
||||
|
||||
static GFXINLINE void setpin_reset(GDisplay *g, bool_t state) {
|
||||
static GFXINLINE void setpin_reset(GDisplay *g, gBool state) {
|
||||
(void) g;
|
||||
(void) state;
|
||||
}
|
||||
|
|
|
@ -32,13 +32,13 @@ static const I2CConfig i2ccfg2 = {
|
|||
FAST_DUTY_CYCLE_2,
|
||||
};
|
||||
|
||||
static bool_t init_board(GMouse* m, unsigned driverinstance) {
|
||||
static gBool init_board(GMouse* m, unsigned driverinstance) {
|
||||
(void) m;
|
||||
|
||||
// We only support one of these on this board
|
||||
if (driverinstance)
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
return gFalse;
|
||||
return gTrue;
|
||||
}
|
||||
|
||||
static GFXINLINE void aquire_bus(GMouse* m) {
|
||||
|
|
|
@ -68,7 +68,7 @@ static GFXINLINE void post_init_board(GDisplay *g) {
|
|||
(void) g;
|
||||
}
|
||||
|
||||
static GFXINLINE void setpin_reset(GDisplay *g, bool_t state) {
|
||||
static GFXINLINE void setpin_reset(GDisplay *g, gBool state) {
|
||||
(void) g;
|
||||
if (state) {
|
||||
CLR_RST;
|
||||
|
|
|
@ -43,12 +43,12 @@ static const I2CConfig i2ccfg = {
|
|||
FAST_DUTY_CYCLE_2,
|
||||
};
|
||||
|
||||
static bool_t init_board(GMouse* m, unsigned driverinstance) {
|
||||
static gBool init_board(GMouse* m, unsigned driverinstance) {
|
||||
(void) m;
|
||||
|
||||
// This board only supports one touch panel
|
||||
if (driverinstance)
|
||||
return FALSE;
|
||||
return gFalse;
|
||||
|
||||
palSetPadMode(GPIOA, 0, PAL_MODE_INPUT | PAL_STM32_PUDR_FLOATING); /* TP IRQ */
|
||||
palSetPadMode(GPIOB, 6, PAL_MODE_ALTERNATE(4) | PAL_STM32_OTYPE_OPENDRAIN); /* SCL */
|
||||
|
@ -56,11 +56,11 @@ static bool_t init_board(GMouse* m, unsigned driverinstance) {
|
|||
|
||||
i2cStart(&I2CD1, &i2ccfg);
|
||||
|
||||
return TRUE;
|
||||
return gTrue;
|
||||
}
|
||||
|
||||
#if GMOUSE_STMPE610_GPIO_IRQPIN
|
||||
static bool_t getpin_irq(GMouse* m) {
|
||||
static gBool getpin_irq(GMouse* m) {
|
||||
(void) m;
|
||||
|
||||
return !palReadPad(GPIOA, 0);
|
||||
|
|
|
@ -39,7 +39,7 @@ static GFXINLINE void post_init_board(GDisplay *g) {
|
|||
(void) g;
|
||||
}
|
||||
|
||||
static GFXINLINE void setpin_reset(GDisplay *g, bool_t state) {
|
||||
static GFXINLINE void setpin_reset(GDisplay *g, gBool state) {
|
||||
(void) g;
|
||||
if(state) {
|
||||
// reset lcd
|
||||
|
|
|
@ -41,12 +41,12 @@ static const ADCConversionGroup adcgrpcfg = {
|
|||
ADC_SQR3_SQ2_N(ADC_CHANNEL_IN8) | ADC_SQR3_SQ1_N(ADC_CHANNEL_IN9)
|
||||
};
|
||||
|
||||
static bool_t init_board(GMouse *m, unsigned driverinstance) {
|
||||
static gBool init_board(GMouse *m, unsigned driverinstance) {
|
||||
(void) m;
|
||||
|
||||
// Only one touch interface on this board
|
||||
if (driverinstance)
|
||||
return FALSE;
|
||||
return gFalse;
|
||||
|
||||
adcStart(&ADCD1, 0);
|
||||
|
||||
|
@ -54,10 +54,10 @@ static bool_t init_board(GMouse *m, unsigned driverinstance) {
|
|||
palClearPad(GPIOB, GPIOB_DRIVEA);
|
||||
palClearPad(GPIOB, GPIOB_DRIVEB);
|
||||
chThdSleepMilliseconds(1); // Settling time
|
||||
return TRUE;
|
||||
return gTrue;
|
||||
}
|
||||
|
||||
static bool_t read_xyz(GMouse *m, GMouseReading *prd) {
|
||||
static gBool read_xyz(GMouse *m, GMouseReading *prd) {
|
||||
adcsample_t samples[ADC_NUM_CHANNELS * ADC_BUF_DEPTH];
|
||||
(void) m;
|
||||
|
||||
|
@ -89,7 +89,7 @@ static bool_t read_xyz(GMouse *m, GMouseReading *prd) {
|
|||
palClearPad(GPIOB, GPIOB_DRIVEA);
|
||||
palClearPad(GPIOB, GPIOB_DRIVEB);
|
||||
}
|
||||
return TRUE;
|
||||
return gTrue;
|
||||
}
|
||||
|
||||
#endif /* _LLD_GMOUSE_MCU_BOARD_H */
|
||||
|
|
|
@ -57,7 +57,7 @@ static const PWMConfig pwmcfg = {
|
|||
},
|
||||
};
|
||||
|
||||
static bool_t pwmRunning = FALSE;
|
||||
static gBool pwmRunning = gFalse;
|
||||
|
||||
/**
|
||||
* @brief Initialise the board for the display.
|
||||
|
@ -123,7 +123,7 @@ static GFXINLINE void init_board(GDisplay *g) {
|
|||
pSPI->SPI_CSR[0] = 0x01010311; //9bit, CPOL=1, ClockPhase=0, SCLK = 48Mhz/3 = 16MHz
|
||||
|
||||
/* Display backlight control at 100% */
|
||||
pwmRunning = FALSE;
|
||||
pwmRunning = gFalse;
|
||||
palSetPad(IOPORT2, PIOB_LCD_BL);
|
||||
break;
|
||||
}
|
||||
|
@ -133,7 +133,7 @@ static GFXINLINE void post_init_board(GDisplay *g) {
|
|||
(void) g;
|
||||
}
|
||||
|
||||
static GFXINLINE void setpin_reset(GDisplay *g, bool_t state) {
|
||||
static GFXINLINE void setpin_reset(GDisplay *g, gBool state) {
|
||||
(void) g;
|
||||
if (state)
|
||||
palClearPad(IOPORT1, PIOA_LCD_RESET);
|
||||
|
@ -147,21 +147,21 @@ static GFXINLINE void set_backlight(GDisplay *g, uint8_t percent) {
|
|||
/* Turn the pin on - No PWM */
|
||||
if (pwmRunning) {
|
||||
pwmStop(&PWMD2);
|
||||
pwmRunning = FALSE;
|
||||
pwmRunning = gFalse;
|
||||
}
|
||||
palSetPad(IOPORT2, PIOB_LCD_BL);
|
||||
} else if (percent == 0) {
|
||||
/* Turn the pin off - No PWM */
|
||||
if (pwmRunning) {
|
||||
pwmStop(&PWMD2);
|
||||
pwmRunning = FALSE;
|
||||
pwmRunning = gFalse;
|
||||
}
|
||||
palClearPad(IOPORT2, PIOB_LCD_BL);
|
||||
} else {
|
||||
/* Use the PWM */
|
||||
if (!pwmRunning) {
|
||||
pwmStart(&PWMD2, &pwmcfg);
|
||||
pwmRunning = TRUE;
|
||||
pwmRunning = gTrue;
|
||||
}
|
||||
pwmEnableChannel(&PWMD2, 0, PWM_VALUE(percent));
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@ static const PWMConfig pwmcfg = {
|
|||
},
|
||||
};
|
||||
|
||||
static bool_t pwmRunning = FALSE;
|
||||
static gBool pwmRunning = gFalse;
|
||||
|
||||
/**
|
||||
* @brief Initialise the board for the display.
|
||||
|
@ -121,7 +121,7 @@ static GFXINLINE void init_board(GDisplay *g) {
|
|||
pSPI->SPI_CSR[0] = 0x00000311; //9bit, CPOL=1, ClockPhase=0, SCLK = 48Mhz/3 = 16MHz
|
||||
|
||||
/* Display backlight control at 100% */
|
||||
pwmRunning = FALSE;
|
||||
pwmRunning = gFalse;
|
||||
palSetPad(IOPORT2, PIOB_LCD_BL);
|
||||
break;
|
||||
}
|
||||
|
@ -131,7 +131,7 @@ static GFXINLINE void post_init_board(GDisplay *g) {
|
|||
(void) g;
|
||||
}
|
||||
|
||||
static GFXINLINE void setpin_reset(GDisplay *g, bool_t state) {
|
||||
static GFXINLINE void setpin_reset(GDisplay *g, gBool state) {
|
||||
(void) g;
|
||||
if (state)
|
||||
palClearPad(IOPORT1, PIOA_LCD_RESET);
|
||||
|
@ -145,21 +145,21 @@ static GFXINLINE void set_backlight(GDisplay *g, uint8_t percent) {
|
|||
/* Turn the pin on - No PWM */
|
||||
if (pwmRunning) {
|
||||
pwmStop(&PWMD2);
|
||||
pwmRunning = FALSE;
|
||||
pwmRunning = gFalse;
|
||||
}
|
||||
palSetPad(IOPORT2, PIOB_LCD_BL);
|
||||
} else if (percent == 0) {
|
||||
/* Turn the pin off - No PWM */
|
||||
if (pwmRunning) {
|
||||
pwmStop(&PWMD2);
|
||||
pwmRunning = FALSE;
|
||||
pwmRunning = gFalse;
|
||||
}
|
||||
palClearPad(IOPORT2, PIOB_LCD_BL);
|
||||
} else {
|
||||
/* Use the PWM */
|
||||
if (!pwmRunning) {
|
||||
pwmStart(&PWMD2, &pwmcfg);
|
||||
pwmRunning = TRUE;
|
||||
pwmRunning = gTrue;
|
||||
}
|
||||
pwmEnableChannel(&PWMD2, 0, PWM_VALUE(percent));
|
||||
}
|
||||
|
|
|
@ -102,7 +102,7 @@ static GFXINLINE void post_init_board(GDisplay *g) {
|
|||
(void) g;
|
||||
}
|
||||
|
||||
static GFXINLINE void setpin_reset(GDisplay *g, bool_t state) {
|
||||
static GFXINLINE void setpin_reset(GDisplay *g, gBool state) {
|
||||
(void) g;
|
||||
(void) state;
|
||||
}
|
||||
|
|
|
@ -175,7 +175,7 @@ static GFXINLINE void post_init_board(GDisplay *g) {
|
|||
(void) g;
|
||||
}
|
||||
|
||||
static GFXINLINE void setpin_reset(GDisplay *g, bool_t state) {
|
||||
static GFXINLINE void setpin_reset(GDisplay *g, gBool state) {
|
||||
(void) g;
|
||||
(void) state;
|
||||
|
||||
|
|
|
@ -172,7 +172,7 @@ static GFXINLINE void post_init_board(GDisplay *g) {
|
|||
(void) g;
|
||||
}
|
||||
|
||||
static GFXINLINE void setpin_reset(GDisplay *g, bool_t state) {
|
||||
static GFXINLINE void setpin_reset(GDisplay *g, gBool state) {
|
||||
(void) g;
|
||||
(void) state;
|
||||
|
||||
|
|
|
@ -161,7 +161,7 @@ static GFXINLINE void post_init_board(GDisplay *g) {
|
|||
(void) g;
|
||||
}
|
||||
|
||||
static GFXINLINE void setpin_reset(GDisplay *g, bool_t state) {
|
||||
static GFXINLINE void setpin_reset(GDisplay *g, gBool state) {
|
||||
(void) g;
|
||||
(void) state;
|
||||
|
||||
|
|
|
@ -35,15 +35,15 @@ static GPTConfig gptcfg = {
|
|||
|
||||
static uint16_t lastvalue;
|
||||
|
||||
static bool gaudio_play_pwm_setup(uint32_t frequency, ArrayDataFormat format) {
|
||||
static gBool gaudio_play_pwm_setup(uint32_t frequency, ArrayDataFormat format) {
|
||||
if (format == ARRAY_DATA_10BITUNSIGNED)
|
||||
pwmcfg.period = 1024;
|
||||
else if (format == ARRAY_DATA_8BITUNSIGNED)
|
||||
pwmcfg.period = 256;
|
||||
else
|
||||
return FALSE;
|
||||
return gFalse;
|
||||
gptcfg.frequency = frequency;
|
||||
return TRUE;
|
||||
return gTrue;
|
||||
}
|
||||
|
||||
static void gaudio_play_pwm_start(void) {
|
||||
|
|
|
@ -45,7 +45,7 @@ static GFXINLINE void post_init_board(GDisplay *g) {
|
|||
(void) g;
|
||||
}
|
||||
|
||||
static GFXINLINE void setpin_reset(GDisplay *g, bool_t state) {
|
||||
static GFXINLINE void setpin_reset(GDisplay *g, gBool state) {
|
||||
(void) g;
|
||||
|
||||
if(state)
|
||||
|
|
|
@ -58,22 +58,22 @@ static GFXINLINE void setup_z(void) {
|
|||
palSetPad(GPIOC, 3);
|
||||
}
|
||||
|
||||
static bool_t init_board(GMouse *m, unsigned driverinstance) {
|
||||
static gBool init_board(GMouse *m, unsigned driverinstance) {
|
||||
(void) m;
|
||||
|
||||
// Only one touch interface on this board
|
||||
if (driverinstance)
|
||||
return FALSE;
|
||||
return gFalse;
|
||||
|
||||
adcStart(&ADCD1, 0);
|
||||
|
||||
// Set up for reading Z
|
||||
setup_z();
|
||||
chThdSleepMilliseconds(1); // Settling time
|
||||
return TRUE;
|
||||
return gTrue;
|
||||
}
|
||||
|
||||
static bool_t read_xyz(GMouse *m, GMouseReading *prd) {
|
||||
static gBool read_xyz(GMouse *m, GMouseReading *prd) {
|
||||
adcsample_t samples[ADC_NUM_CHANNELS * ADC_BUF_DEPTH];
|
||||
uint16_t val1, val2;
|
||||
(void) m;
|
||||
|
@ -130,7 +130,7 @@ static bool_t read_xyz(GMouse *m, GMouseReading *prd) {
|
|||
// Set up for reading z again. We know it will be 20ms before we get called again so don't worry about settling time
|
||||
setup_z();
|
||||
}
|
||||
return TRUE;
|
||||
return gTrue;
|
||||
}
|
||||
|
||||
#endif /* _LLD_GMOUSE_MCU_BOARD_H */
|
||||
|
|
|
@ -42,12 +42,12 @@ static const I2CConfig i2ccfg = {
|
|||
FAST_DUTY_CYCLE_2,
|
||||
};
|
||||
|
||||
static bool_t init_board(GMouse* m, unsigned driverinstance) {
|
||||
static gBool init_board(GMouse* m, unsigned driverinstance) {
|
||||
(void) m;
|
||||
|
||||
// This board only supports one touch panel
|
||||
if (driverinstance)
|
||||
return FALSE;
|
||||
return gFalse;
|
||||
|
||||
// Set pin modes
|
||||
#if CH_KERNEL_MAJOR == 2
|
||||
|
@ -63,11 +63,11 @@ static bool_t init_board(GMouse* m, unsigned driverinstance) {
|
|||
// Start the I2C
|
||||
i2cStart(&I2CD3, &i2ccfg);
|
||||
|
||||
return TRUE;
|
||||
return gTrue;
|
||||
}
|
||||
|
||||
#if GMOUSE_STMPE811_GPIO_IRQPIN
|
||||
static bool_t getpin_irq(GMouse* m) {
|
||||
static gBool getpin_irq(GMouse* m) {
|
||||
(void) m;
|
||||
|
||||
return !palReadPad(GPIOA, 15);
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
|
||||
static I2C_HandleTypeDef _i2cHandle;
|
||||
|
||||
static bool_t init_board(GMouse* m, unsigned driverinstance)
|
||||
static gBool init_board(GMouse* m, unsigned driverinstance)
|
||||
{
|
||||
GPIO_InitTypeDef GPIO_InitStruct;
|
||||
|
||||
|
@ -79,17 +79,17 @@ static bool_t init_board(GMouse* m, unsigned driverinstance)
|
|||
_i2cHandle.Init.NoStretchMode = I2C_NOSTRETCH_DISABLED;
|
||||
HAL_I2C_Init(&_i2cHandle);
|
||||
|
||||
return TRUE;
|
||||
return gTrue;
|
||||
}
|
||||
|
||||
static bool_t read_bytes(GMouse* m, uint8_t reg, uint8_t* buffer, uint8_t nbrBytes)
|
||||
static gBool read_bytes(GMouse* m, uint8_t reg, uint8_t* buffer, uint8_t nbrBytes)
|
||||
{
|
||||
(void)m;
|
||||
|
||||
HAL_I2C_Master_Transmit(&_i2cHandle, (uint16_t)EXC7200_SLAVE_ADDR, (uint8_t*)®, 1, 10000);
|
||||
HAL_I2C_Master_Receive(&_i2cHandle, (uint16_t)EXC7200_SLAVE_ADDR, buffer, nbrBytes, 10000);
|
||||
|
||||
return TRUE;
|
||||
return gTrue;
|
||||
}
|
||||
|
||||
#endif /* _GINPUT_LLD_MOUSE_BOARD_H */
|
||||
|
|
|
@ -30,7 +30,7 @@ I2C_HandleTypeDef i2cHandle;
|
|||
/* Maximum speed (400kHz) */
|
||||
#define CLOCKSPEED 400000;
|
||||
|
||||
static bool_t init_board(GMouse* m, unsigned instance) {
|
||||
static gBool init_board(GMouse* m, unsigned instance) {
|
||||
(void)m;
|
||||
(void)instance;
|
||||
|
||||
|
@ -69,9 +69,9 @@ static bool_t init_board(GMouse* m, unsigned instance) {
|
|||
__HAL_RCC_I2C1_CLK_ENABLE();
|
||||
|
||||
if(HAL_I2C_Init(&i2cHandle) == HAL_OK)
|
||||
return TRUE;
|
||||
return gTrue;
|
||||
|
||||
return FALSE;
|
||||
return gFalse;
|
||||
}
|
||||
|
||||
static GFXINLINE void aquire_bus(GMouse* m) {
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
#define AFRH AFR[1]
|
||||