Added new type definitions - moving towards V3.0

release/v2.9
inmarket 2018-06-23 13:02:07 +10:00
parent 3b97fb798e
commit 41271d632b
343 changed files with 4152 additions and 4551 deletions

View File

@ -76,44 +76,44 @@ static void eink_delay(int us) {
} }
/* Turn the E-ink panel Vdd supply (+3.3V) on or off. */ /* 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; (void) g;
palWritePad(GPIOB, GPIOB_SMPS_CTRL, !on); palWritePad(GPIOB, GPIOB_SMPS_CTRL, !on);
palWritePad(GPIOA, GPIOA_EINK_VDD, on); palWritePad(GPIOA, GPIOA_EINK_VDD, on);
} }
/* Turn the E-ink panel negative supplies (-15V, -20V) on or off. */ /* 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; (void) g;
palWritePad(GPIOA, GPIOA_VNEG_CTRL, on); palWritePad(GPIOA, GPIOA_VNEG_CTRL, on);
} }
/* Turn the E-ink panel positive supplies (-15V, -20V) on or off. */ /* 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; (void) g;
palWritePad(GPIOA, GPIOA_VPOS_CTRL, on); palWritePad(GPIOA, GPIOA_VPOS_CTRL, on);
} }
/* Set the state of the LE (source driver Latch Enable) pin. */ /* 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; (void) g;
palWritePad(GPIOB, GPIOB_EINK_LE, on); palWritePad(GPIOB, GPIOB_EINK_LE, on);
} }
/* Set the state of the OE (source driver Output Enable) pin. */ /* 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; (void) g;
palWritePad(GPIOB, GPIOB_EINK_OE, on); palWritePad(GPIOB, GPIOB_EINK_OE, on);
} }
/* Set the state of the CL (source driver Clock) pin. */ /* 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; (void) g;
palWritePad(GPIOB, GPIOB_EINK_CL, on); palWritePad(GPIOB, GPIOB_EINK_CL, on);
} }
/* Set the state of the SPH (source driver Start Pulse Horizontal) pin. */ /* 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; (void) g;
palWritePad(GPIOB, GPIOB_EINK_SPH, on); 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. */ /* 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; (void) g;
palWritePad(GPIOB, GPIOB_EINK_CKV, on); palWritePad(GPIOB, GPIOB_EINK_CKV, on);
} }
/* Set the state of the GMODE (gate driver Gate Mode) pin. */ /* 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; (void) g;
palWritePad(GPIOC, GPIOC_EINK_GMODE, on); palWritePad(GPIOC, GPIOC_EINK_GMODE, on);
} }
/* Set the state of the SPV (gate driver Start Pulse Vertical) pin. */ /* 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; (void) g;
palWritePad(GPIOB, GPIOB_EINK_SPV, on); palWritePad(GPIOB, GPIOB_EINK_SPV, on);
} }

View File

@ -103,7 +103,7 @@ static GFXINLINE void post_init_board(GDisplay *g) {
(void) 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) g;
if (state) { if (state) {
CLR_RST; CLR_RST;

View File

@ -68,7 +68,7 @@ static GFXINLINE void post_init_board(GDisplay *g) {
(void) g; (void) g;
} }
static noinline void setpin_reset(GDisplay *g, bool_t state) { static noinline void setpin_reset(GDisplay *g, gBool state) {
(void) g; (void) g;
if (state) if (state)
palClearPad(IOPORTA, 7); palClearPad(IOPORTA, 7);

View File

@ -68,7 +68,7 @@ static GFXINLINE void post_init_board(GDisplay *g) {
(void) 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) g;
if(state) if(state)
palClearPad(GPIOE, GPIOE_TFT_RST); palClearPad(GPIOE, GPIOE_TFT_RST);

View File

@ -83,14 +83,14 @@ static GFXINLINE void post_init_board(GDisplay *g) {
* @brief Set or clear the lcd reset pin. * @brief Set or clear the lcd reset pin.
* *
* @param[in] g The GDisplay structure * @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 * @notapi
*/ */
static GFXINLINE void setpin_reset(GDisplay *g, bool_t state) { static GFXINLINE void setpin_reset(GDisplay *g, gBool state) {
(void) g; (void) g;
if (state == TRUE) { if (state) {
palClearPad(LCD_PORT, LCD_RES); palClearPad(LCD_PORT, LCD_RES);
} else { } else {
palSetPad(LCD_PORT, LCD_RES); palSetPad(LCD_PORT, LCD_RES);

View File

@ -53,7 +53,7 @@ static GFXINLINE void post_init_board(GDisplay *g) {
(void) 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) g;
(void) state; (void) state;
} }

View File

@ -97,7 +97,7 @@ static GFXINLINE void post_init_board(GDisplay* g)
(void) 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) g;

View File

@ -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) g;
(void) state; (void) state;
} }

View File

@ -81,7 +81,7 @@ static GFXINLINE void soft_spi_write_9bit(uint16_t data){
} }
#endif #endif
static GFXINLINE void setpin_reset(GDisplay *g, bool_t state) { static GFXINLINE void setpin_reset(GDisplay *g, gBool state) {
(void) g; (void) g;
if(state) { if(state) {
CLR_RST; CLR_RST;
@ -100,7 +100,7 @@ static GFXINLINE void init_board(GDisplay *g) {
* SPI1 I/O pins setup. * SPI1 I/O pins setup.
*/ */
palSetPadMode(SPFD54124B_PIN_PORT, SPFD54124B_PIN_RST, PAL_MODE_OUTPUT_PUSHPULL); /* RESET */ palSetPadMode(SPFD54124B_PIN_PORT, SPFD54124B_PIN_RST, PAL_MODE_OUTPUT_PUSHPULL); /* RESET */
setpin_reset(g, TRUE); setpin_reset(g, gTrue);
#if USE_HARD_SPI #if USE_HARD_SPI
palSetPadMode(SPFD54124B_SPI_PORT, SPFD54124B_SPI_SCK, PAL_MODE_ALTERNATE(5) | PAL_STM32_OSPEED_HIGHEST); /* SCK. */ palSetPadMode(SPFD54124B_SPI_PORT, SPFD54124B_SPI_SCK, PAL_MODE_ALTERNATE(5) | PAL_STM32_OSPEED_HIGHEST); /* SCK. */

View File

@ -109,7 +109,7 @@ static GFXINLINE void post_init_board(GDisplay *g) {
(void) 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) g;
(void) state; (void) state;
} }

View File

@ -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; (void)g;

View File

@ -82,7 +82,7 @@ static GFXINLINE void post_init_board(GDisplay *g) {
(void) 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) g;
if(state) if(state)
CLR_RST CLR_RST

View File

@ -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);
}

View File

@ -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 */

View File

@ -8,17 +8,6 @@
#ifndef _GDISP_LLD_BOARD_H #ifndef _GDISP_LLD_BOARD_H
#define _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 init_board(g) ssd1351_init_board()
#define post_init_board(g) #define post_init_board(g)
#define setpin_reset(g, s) ssd1351_setpin_reset(s) #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_cmd(g, i) ssd1351_write_cmd(i)
#define write_data(g, d) ssd1351_write_cmd(d) #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 #ifdef __cplusplus
} }
#endif // __cplusplus #endif
#endif /* _GDISP_LLD_BOARD_H */ #endif /* _GDISP_LLD_BOARD_H */

View File

@ -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; 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) g;
(void) state; (void) state;
} }

View File

@ -72,7 +72,7 @@ static GFXINLINE void post_init_board(GDisplay *g) {
(void) 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) g;
(void) state; (void) state;
} }

View File

@ -16,7 +16,7 @@
static const nrf_drv_spi_t spi = NRF_DRV_SPI_INSTANCE(SPI_INSTANCE); 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; nrf_drv_spi_config_t spi_config;
ret_code_t err = NRF_SUCCESS; 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; spi_config.bit_order = NRF_DRV_SPI_BIT_ORDER_MSB_FIRST;
err = nrf_drv_spi_init(&spi, &spi_config, 0); err = nrf_drv_spi_init(&spi, &spi_config, 0);
if (err != NRF_SUCCESS) { if (err != NRF_SUCCESS) {
return FALSE; return gFalse;
} }
return TRUE; return gTrue;
} }
static GFXINLINE void post_init_board(GDisplay* g) static GFXINLINE void post_init_board(GDisplay* g)
@ -58,7 +58,7 @@ static GFXINLINE void post_init_board(GDisplay* g)
(void)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)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; (void)g;
if (nrf_gpio_pin_read(PIN_BUSY) == 1) { if (nrf_gpio_pin_read(PIN_BUSY) == 1) {
return TRUE; return gTrue;
} else { } else {
return FALSE; return gFalse;
} }
} }

View File

@ -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 // 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 #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; (void) m;
if (driverinstance) if (driverinstance)
return FALSE; return gFalse;
spiStart(&SPID2, &spicfg); spiStart(&SPID2, &spicfg);
return TRUE; return gTrue;
} }
static GFXINLINE bool_t getpin_pressed(GMouse* m) { static GFXINLINE gBool getpin_pressed(GMouse* m) {
(void) m; (void) m;
return (!palReadPad(GPIOG, 0)); return (!palReadPad(GPIOG, 0));

View File

@ -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 // 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 #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; (void) m;
if (driverinstance) if (driverinstance)
return FALSE; return gFalse;
palSetPadMode(GPIOB, 13, PAL_MODE_ALTERNATE(5) ); /* SCK */ palSetPadMode(GPIOB, 13, PAL_MODE_ALTERNATE(5) ); /* SCK */
palSetPadMode(GPIOB, 14, PAL_MODE_ALTERNATE(5) ); /* MISO */ 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 */ palSetPadMode(GPIOC, 4, PAL_MODE_OUTPUT_PUSHPULL); /* CS */
spiStart(&SPID2, &spicfg); spiStart(&SPID2, &spicfg);
return TRUE; return gTrue;
} }
static GFXINLINE bool_t getpin_pressed(GMouse* m) { static GFXINLINE gBool getpin_pressed(GMouse* m) {
(void) m; (void) m;
return (!palReadPad(GPIOC, 5)); return (!palReadPad(GPIOC, 5));

View File

@ -16,7 +16,7 @@
static SPI_HandleTypeDef _hspi; 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; 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.CRCCalculation = SPI_CRCCALCULATION_DISABLE;
_hspi.Init.CRCPolynomial = 10; _hspi.Init.CRCPolynomial = 10;
if (HAL_SPI_Init(&_hspi) != HAL_OK) { 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; (void)m;
if (HAL_GPIO_ReadPin(GPIOC, GPIO_PIN_4) == GPIO_PIN_RESET) 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) static GFXINLINE void aquire_bus(GMouse* m)

View File

@ -59,18 +59,18 @@ static const ADCConversionGroup ADC_Y_CG = {
.channels = 1 << YPOS, .channels = 1 << YPOS,
}; };
static bool_t init_board(GMouse *m, unsigned driverinstance) { static gBool init_board(GMouse *m, unsigned driverinstance) {
(void) m; (void) m;
if (driverinstance) if (driverinstance)
return FALSE; return gFalse;
adcObjectInit(&ADCD); adcObjectInit(&ADCD);
adcStart(&ADCD, &ADCC); 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]; adcsample_t samples[2];
prd->buttons = 0; 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. // Shortcut - no need to read X or Y if the touch is off.
if (pdr->z < GMOUSE_MCU_Z_TOUCHON) if (pdr->z < GMOUSE_MCU_Z_TOUCHON)
return TRUE; return gTrue;
// Read X // Read X
palSetPadMode(IOPORTB, XPOS, PAL_MODE_OUTPUT); 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); adcConvert(&ADCD, &ADC_X_CG, &samples[0], 1);
pdr->y = ADC_MAX - samples[0]; pdr->y = ADC_MAX - samples[0];
return TRUE; return gTrue;
} }
#endif /* _GINPUT_LLD_MOUSE_BOARD_H */ #endif /* _GINPUT_LLD_MOUSE_BOARD_H */

View File

@ -66,14 +66,14 @@ static unsigned int device_read_16(unsigned char device_address, unsigned char s
return (0xFFFF & ((rdata_h << 8) | rdata_l)); 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)m;
(void)instance; (void)instance;
I2C_init(I2C_OPENCORES_0_BASE, 50000000, 400000); I2C_init(I2C_OPENCORES_0_BASE, 50000000, 400000);
return TRUE; return gTrue;
} }
static void write_reg(GMouse* m, uint8_t reg, uint8_t val) static void write_reg(GMouse* m, uint8_t reg, uint8_t val)

View File

@ -16,6 +16,7 @@
#define write_cmd(g, cmd) SSD1331_write_cmd(cmd) #define write_cmd(g, cmd) SSD1331_write_cmd(cmd)
#define write_data(g, data) SSD1331_write_data(data) #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 #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif

View File

@ -99,7 +99,7 @@ static GFXINLINE void post_init_board(GDisplay *g) {
(void) 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) g;
if (state) { if (state) {
CLR_RST; CLR_RST;

View File

@ -43,12 +43,12 @@ static const I2CConfig i2ccfg = {
FAST_DUTY_CYCLE_2, FAST_DUTY_CYCLE_2,
}; };
static bool_t init_board(GMouse* m, unsigned driverinstance) { static gBool init_board(GMouse* m, unsigned driverinstance) {
(void) m; (void) m;
// This board only supports one touch panel // This board only supports one touch panel
if (driverinstance) if (driverinstance)
return FALSE; return gFalse;
palSetPadMode(GPIOC, 13, PAL_MODE_INPUT | PAL_STM32_PUDR_FLOATING); /* TP IRQ */ 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, 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); i2cStart(&I2CD1, &i2ccfg);
return TRUE; return gTrue;
} }
#if GMOUSE_STMPE811_GPIO_IRQPIN #if GMOUSE_STMPE811_GPIO_IRQPIN
static bool_t getpin_irq(GMouse* m) { static gBool getpin_irq(GMouse* m) {
(void) m; (void) m;
return !palReadPad(GPIOC, 13); return !palReadPad(GPIOC, 13);

View File

@ -48,7 +48,7 @@ static GFXINLINE void post_init_board(GDisplay *g)
(void) 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) g;
(void) state; (void) state;

View File

@ -26,13 +26,13 @@ static const SPIConfig spicfg = {
/* SPI_CR1_BR_2 |*/ SPI_CR1_BR_1 | SPI_CR1_BR_0, /* 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; (void)m;
// Only one touch interface on this board // Only one touch interface on this board
if (driverinstance) if (driverinstance)
return FALSE; return gFalse;
// Set the GPIO modes // Set the GPIO modes
palSetPadMode(GPIOC, 4, PAL_MODE_INPUT_PULLUP); palSetPadMode(GPIOC, 4, PAL_MODE_INPUT_PULLUP);
@ -40,10 +40,10 @@ static bool_t init_board(GMouse* m, unsigned driverinstance)
// Start the SPI peripheral // Start the SPI peripheral
spiStart(&SPID1, &spicfg); spiStart(&SPID1, &spicfg);
return TRUE; return gTrue;
} }
static GFXINLINE bool_t getpin_pressed(GMouse* m) static GFXINLINE gBool getpin_pressed(GMouse* m)
{ {
(void) m; (void) m;

View File

@ -124,7 +124,7 @@ static GFXINLINE void post_init_board(GDisplay *g) {
(void) 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) g;
if(state) {} if(state) {}

View File

@ -46,7 +46,7 @@ static const SPIConfig spicfg = {
* TP_IRQ PB6 * TP_IRQ PB6
*/ */
static bool_t init_board(GMouse* m, unsigned driverinstance) { static gBool init_board(GMouse* m, unsigned driverinstance) {
(void) m; (void) m;
(void) driverinstance; (void) driverinstance;
@ -63,7 +63,7 @@ static bool_t init_board(GMouse* m, unsigned driverinstance) {
/* /*
* PB6 is connected to TP_IRQ (low active). * 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; (void)m;
return (!palReadPad(GPIOB, 6)); return (!palReadPad(GPIOB, 6));
} }

View File

@ -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; 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) g;
(void) state; (void) state;
} }

View File

@ -32,13 +32,13 @@ static const I2CConfig i2ccfg2 = {
FAST_DUTY_CYCLE_2, FAST_DUTY_CYCLE_2,
}; };
static bool_t init_board(GMouse* m, unsigned driverinstance) { static gBool init_board(GMouse* m, unsigned driverinstance) {
(void) m; (void) m;
// We only support one of these on this board // We only support one of these on this board
if (driverinstance) if (driverinstance)
return FALSE; return gFalse;
return TRUE; return gTrue;
} }
static GFXINLINE void aquire_bus(GMouse* m) { static GFXINLINE void aquire_bus(GMouse* m) {

View File

@ -68,7 +68,7 @@ static GFXINLINE void post_init_board(GDisplay *g) {
(void) 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) g;
if (state) { if (state) {
CLR_RST; CLR_RST;

View File

@ -43,12 +43,12 @@ static const I2CConfig i2ccfg = {
FAST_DUTY_CYCLE_2, FAST_DUTY_CYCLE_2,
}; };
static bool_t init_board(GMouse* m, unsigned driverinstance) { static gBool init_board(GMouse* m, unsigned driverinstance) {
(void) m; (void) m;
// This board only supports one touch panel // This board only supports one touch panel
if (driverinstance) if (driverinstance)
return FALSE; return gFalse;
palSetPadMode(GPIOA, 0, PAL_MODE_INPUT | PAL_STM32_PUDR_FLOATING); /* TP IRQ */ palSetPadMode(GPIOA, 0, PAL_MODE_INPUT | PAL_STM32_PUDR_FLOATING); /* TP IRQ */
palSetPadMode(GPIOB, 6, PAL_MODE_ALTERNATE(4) | PAL_STM32_OTYPE_OPENDRAIN); /* SCL */ 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); i2cStart(&I2CD1, &i2ccfg);
return TRUE; return gTrue;
} }
#if GMOUSE_STMPE610_GPIO_IRQPIN #if GMOUSE_STMPE610_GPIO_IRQPIN
static bool_t getpin_irq(GMouse* m) { static gBool getpin_irq(GMouse* m) {
(void) m; (void) m;
return !palReadPad(GPIOA, 0); return !palReadPad(GPIOA, 0);

View File

@ -39,7 +39,7 @@ static GFXINLINE void post_init_board(GDisplay *g) {
(void) 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) g;
if(state) { if(state) {
// reset lcd // reset lcd

View File

@ -41,12 +41,12 @@ static const ADCConversionGroup adcgrpcfg = {
ADC_SQR3_SQ2_N(ADC_CHANNEL_IN8) | ADC_SQR3_SQ1_N(ADC_CHANNEL_IN9) 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; (void) m;
// Only one touch interface on this board // Only one touch interface on this board
if (driverinstance) if (driverinstance)
return FALSE; return gFalse;
adcStart(&ADCD1, 0); adcStart(&ADCD1, 0);
@ -54,10 +54,10 @@ static bool_t init_board(GMouse *m, unsigned driverinstance) {
palClearPad(GPIOB, GPIOB_DRIVEA); palClearPad(GPIOB, GPIOB_DRIVEA);
palClearPad(GPIOB, GPIOB_DRIVEB); palClearPad(GPIOB, GPIOB_DRIVEB);
chThdSleepMilliseconds(1); // Settling time 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]; adcsample_t samples[ADC_NUM_CHANNELS * ADC_BUF_DEPTH];
(void) m; (void) m;
@ -89,7 +89,7 @@ static bool_t read_xyz(GMouse *m, GMouseReading *prd) {
palClearPad(GPIOB, GPIOB_DRIVEA); palClearPad(GPIOB, GPIOB_DRIVEA);
palClearPad(GPIOB, GPIOB_DRIVEB); palClearPad(GPIOB, GPIOB_DRIVEB);
} }
return TRUE; return gTrue;
} }
#endif /* _LLD_GMOUSE_MCU_BOARD_H */ #endif /* _LLD_GMOUSE_MCU_BOARD_H */

View File

@ -57,7 +57,7 @@ static const PWMConfig pwmcfg = {
}, },
}; };
static bool_t pwmRunning = FALSE; static gBool pwmRunning = gFalse;
/** /**
* @brief Initialise the board for the display. * @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 pSPI->SPI_CSR[0] = 0x01010311; //9bit, CPOL=1, ClockPhase=0, SCLK = 48Mhz/3 = 16MHz
/* Display backlight control at 100% */ /* Display backlight control at 100% */
pwmRunning = FALSE; pwmRunning = gFalse;
palSetPad(IOPORT2, PIOB_LCD_BL); palSetPad(IOPORT2, PIOB_LCD_BL);
break; break;
} }
@ -133,7 +133,7 @@ static GFXINLINE void post_init_board(GDisplay *g) {
(void) 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) g;
if (state) if (state)
palClearPad(IOPORT1, PIOA_LCD_RESET); 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 */ /* Turn the pin on - No PWM */
if (pwmRunning) { if (pwmRunning) {
pwmStop(&PWMD2); pwmStop(&PWMD2);
pwmRunning = FALSE; pwmRunning = gFalse;
} }
palSetPad(IOPORT2, PIOB_LCD_BL); palSetPad(IOPORT2, PIOB_LCD_BL);
} else if (percent == 0) { } else if (percent == 0) {
/* Turn the pin off - No PWM */ /* Turn the pin off - No PWM */
if (pwmRunning) { if (pwmRunning) {
pwmStop(&PWMD2); pwmStop(&PWMD2);
pwmRunning = FALSE; pwmRunning = gFalse;
} }
palClearPad(IOPORT2, PIOB_LCD_BL); palClearPad(IOPORT2, PIOB_LCD_BL);
} else { } else {
/* Use the PWM */ /* Use the PWM */
if (!pwmRunning) { if (!pwmRunning) {
pwmStart(&PWMD2, &pwmcfg); pwmStart(&PWMD2, &pwmcfg);
pwmRunning = TRUE; pwmRunning = gTrue;
} }
pwmEnableChannel(&PWMD2, 0, PWM_VALUE(percent)); pwmEnableChannel(&PWMD2, 0, PWM_VALUE(percent));
} }

View File

@ -56,7 +56,7 @@ static const PWMConfig pwmcfg = {
}, },
}; };
static bool_t pwmRunning = FALSE; static gBool pwmRunning = gFalse;
/** /**
* @brief Initialise the board for the display. * @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 pSPI->SPI_CSR[0] = 0x00000311; //9bit, CPOL=1, ClockPhase=0, SCLK = 48Mhz/3 = 16MHz
/* Display backlight control at 100% */ /* Display backlight control at 100% */
pwmRunning = FALSE; pwmRunning = gFalse;
palSetPad(IOPORT2, PIOB_LCD_BL); palSetPad(IOPORT2, PIOB_LCD_BL);
break; break;
} }
@ -131,7 +131,7 @@ static GFXINLINE void post_init_board(GDisplay *g) {
(void) 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) g;
if (state) if (state)
palClearPad(IOPORT1, PIOA_LCD_RESET); 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 */ /* Turn the pin on - No PWM */
if (pwmRunning) { if (pwmRunning) {
pwmStop(&PWMD2); pwmStop(&PWMD2);
pwmRunning = FALSE; pwmRunning = gFalse;
} }
palSetPad(IOPORT2, PIOB_LCD_BL); palSetPad(IOPORT2, PIOB_LCD_BL);
} else if (percent == 0) { } else if (percent == 0) {
/* Turn the pin off - No PWM */ /* Turn the pin off - No PWM */
if (pwmRunning) { if (pwmRunning) {
pwmStop(&PWMD2); pwmStop(&PWMD2);
pwmRunning = FALSE; pwmRunning = gFalse;
} }
palClearPad(IOPORT2, PIOB_LCD_BL); palClearPad(IOPORT2, PIOB_LCD_BL);
} else { } else {
/* Use the PWM */ /* Use the PWM */
if (!pwmRunning) { if (!pwmRunning) {
pwmStart(&PWMD2, &pwmcfg); pwmStart(&PWMD2, &pwmcfg);
pwmRunning = TRUE; pwmRunning = gTrue;
} }
pwmEnableChannel(&PWMD2, 0, PWM_VALUE(percent)); pwmEnableChannel(&PWMD2, 0, PWM_VALUE(percent));
} }

View File

@ -102,7 +102,7 @@ static GFXINLINE void post_init_board(GDisplay *g) {
(void) 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) g;
(void) state; (void) state;
} }

View File

@ -175,7 +175,7 @@ static GFXINLINE void post_init_board(GDisplay *g) {
(void) 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) g;
(void) state; (void) state;

View File

@ -172,7 +172,7 @@ static GFXINLINE void post_init_board(GDisplay *g) {
(void) 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) g;
(void) state; (void) state;

View File

@ -161,7 +161,7 @@ static GFXINLINE void post_init_board(GDisplay *g) {
(void) 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) g;
(void) state; (void) state;

View File

@ -35,15 +35,15 @@ static GPTConfig gptcfg = {
static uint16_t lastvalue; 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) if (format == ARRAY_DATA_10BITUNSIGNED)
pwmcfg.period = 1024; pwmcfg.period = 1024;
else if (format == ARRAY_DATA_8BITUNSIGNED) else if (format == ARRAY_DATA_8BITUNSIGNED)
pwmcfg.period = 256; pwmcfg.period = 256;
else else
return FALSE; return gFalse;
gptcfg.frequency = frequency; gptcfg.frequency = frequency;
return TRUE; return gTrue;
} }
static void gaudio_play_pwm_start(void) { static void gaudio_play_pwm_start(void) {

View File

@ -45,7 +45,7 @@ static GFXINLINE void post_init_board(GDisplay *g) {
(void) 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) g;
if(state) if(state)

View File

@ -58,22 +58,22 @@ static GFXINLINE void setup_z(void) {
palSetPad(GPIOC, 3); palSetPad(GPIOC, 3);
} }
static bool_t init_board(GMouse *m, unsigned driverinstance) { static gBool init_board(GMouse *m, unsigned driverinstance) {
(void) m; (void) m;
// Only one touch interface on this board // Only one touch interface on this board
if (driverinstance) if (driverinstance)
return FALSE; return gFalse;
adcStart(&ADCD1, 0); adcStart(&ADCD1, 0);
// Set up for reading Z // Set up for reading Z
setup_z(); setup_z();
chThdSleepMilliseconds(1); // Settling time 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]; adcsample_t samples[ADC_NUM_CHANNELS * ADC_BUF_DEPTH];
uint16_t val1, val2; uint16_t val1, val2;
(void) m; (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 // 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(); setup_z();
} }
return TRUE; return gTrue;
} }
#endif /* _LLD_GMOUSE_MCU_BOARD_H */ #endif /* _LLD_GMOUSE_MCU_BOARD_H */

View File

@ -42,12 +42,12 @@ static const I2CConfig i2ccfg = {
FAST_DUTY_CYCLE_2, FAST_DUTY_CYCLE_2,
}; };
static bool_t init_board(GMouse* m, unsigned driverinstance) { static gBool init_board(GMouse* m, unsigned driverinstance) {
(void) m; (void) m;
// This board only supports one touch panel // This board only supports one touch panel
if (driverinstance) if (driverinstance)
return FALSE; return gFalse;
// Set pin modes // Set pin modes
#if CH_KERNEL_MAJOR == 2 #if CH_KERNEL_MAJOR == 2
@ -63,11 +63,11 @@ static bool_t init_board(GMouse* m, unsigned driverinstance) {
// Start the I2C // Start the I2C
i2cStart(&I2CD3, &i2ccfg); i2cStart(&I2CD3, &i2ccfg);
return TRUE; return gTrue;
} }
#if GMOUSE_STMPE811_GPIO_IRQPIN #if GMOUSE_STMPE811_GPIO_IRQPIN
static bool_t getpin_irq(GMouse* m) { static gBool getpin_irq(GMouse* m) {
(void) m; (void) m;
return !palReadPad(GPIOA, 15); return !palReadPad(GPIOA, 15);

View File

@ -40,7 +40,7 @@
static I2C_HandleTypeDef _i2cHandle; 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; GPIO_InitTypeDef GPIO_InitStruct;
@ -79,17 +79,17 @@ static bool_t init_board(GMouse* m, unsigned driverinstance)
_i2cHandle.Init.NoStretchMode = I2C_NOSTRETCH_DISABLED; _i2cHandle.Init.NoStretchMode = I2C_NOSTRETCH_DISABLED;
HAL_I2C_Init(&_i2cHandle); 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; (void)m;
HAL_I2C_Master_Transmit(&_i2cHandle, (uint16_t)EXC7200_SLAVE_ADDR, (uint8_t*)&reg, 1, 10000); HAL_I2C_Master_Transmit(&_i2cHandle, (uint16_t)EXC7200_SLAVE_ADDR, (uint8_t*)&reg, 1, 10000);
HAL_I2C_Master_Receive(&_i2cHandle, (uint16_t)EXC7200_SLAVE_ADDR, buffer, nbrBytes, 10000); HAL_I2C_Master_Receive(&_i2cHandle, (uint16_t)EXC7200_SLAVE_ADDR, buffer, nbrBytes, 10000);
return TRUE; return gTrue;
} }
#endif /* _GINPUT_LLD_MOUSE_BOARD_H */ #endif /* _GINPUT_LLD_MOUSE_BOARD_H */

View File

@ -30,7 +30,7 @@ I2C_HandleTypeDef i2cHandle;
/* Maximum speed (400kHz) */ /* Maximum speed (400kHz) */
#define CLOCKSPEED 400000; #define CLOCKSPEED 400000;
static bool_t init_board(GMouse* m, unsigned instance) { static gBool init_board(GMouse* m, unsigned instance) {
(void)m; (void)m;
(void)instance; (void)instance;
@ -69,9 +69,9 @@ static bool_t init_board(GMouse* m, unsigned instance) {
__HAL_RCC_I2C1_CLK_ENABLE(); __HAL_RCC_I2C1_CLK_ENABLE();
if(HAL_I2C_Init(&i2cHandle) == HAL_OK) if(HAL_I2C_Init(&i2cHandle) == HAL_OK)
return TRUE; return gTrue;
return FALSE; return gFalse;
} }
static GFXINLINE void aquire_bus(GMouse* m) { static GFXINLINE void aquire_bus(GMouse* m) {

View File

@ -30,7 +30,7 @@
#define AFRH AFR[1] #define AFRH AFR[1]
#endif #endif
static bool_t init_board(GMouse* m, unsigned instance) static gBool init_board(GMouse* m, unsigned instance)
{ {
(void)m; (void)m;
(void)instance; (void)instance;
@ -51,10 +51,10 @@ static bool_t init_board(GMouse* m, unsigned instance)
// Initialize the I2C3 peripheral // Initialize the I2C3 peripheral
if (!(i2cInit(I2C3))) { if (!(i2cInit(I2C3))) {
return FALSE; return gFalse;
} }
return TRUE; return gTrue;
} }
static void write_reg(GMouse* m, uint8_t reg, uint8_t val) static void write_reg(GMouse* m, uint8_t reg, uint8_t val)

View File

@ -34,7 +34,7 @@ static void _i2cResetCr2(I2C_TypeDef* i2c)
i2c->CR2 &= (uint32_t) ~((uint32_t) (I2C_CR2_SADD | I2C_CR2_HEAD10R | I2C_CR2_NBYTES | I2C_CR2_RELOAD | I2C_CR2_RD_WRN)); i2c->CR2 &= (uint32_t) ~((uint32_t) (I2C_CR2_SADD | I2C_CR2_HEAD10R | I2C_CR2_NBYTES | I2C_CR2_RELOAD | I2C_CR2_RD_WRN));
} }
bool_t i2cInit(I2C_TypeDef* i2c) gBool i2cInit(I2C_TypeDef* i2c)
{ {
// Enable I2Cx peripheral clock. // Enable I2Cx peripheral clock.
// Select APB1 as clock source // Select APB1 as clock source
@ -51,7 +51,7 @@ bool_t i2cInit(I2C_TypeDef* i2c)
RCC->DCKCFGR2 &= ~RCC_DCKCFGR2_I2C4SEL; RCC->DCKCFGR2 &= ~RCC_DCKCFGR2_I2C4SEL;
RCC->APB1ENR |= RCC_APB1ENR_I2C4EN; RCC->APB1ENR |= RCC_APB1ENR_I2C4EN;
} else { } else {
return FALSE; return gFalse;
} }
// Disable the I2Cx peripheral // Disable the I2Cx peripheral
@ -76,7 +76,7 @@ bool_t i2cInit(I2C_TypeDef* i2c)
// Enable the I2Cx peripheral // Enable the I2Cx peripheral
i2c->CR1 |= I2C_CR1_PE; i2c->CR1 |= I2C_CR1_PE;
return TRUE; return gTrue;
} }
void i2cSend(I2C_TypeDef* i2c, uint8_t slaveAddr, uint8_t* data, uint16_t length) void i2cSend(I2C_TypeDef* i2c, uint8_t slaveAddr, uint8_t* data, uint16_t length)

View File

@ -3,7 +3,7 @@
#include "stm32f7xx.h" #include "stm32f7xx.h"
#include "gfx.h" #include "gfx.h"
bool_t i2cInit(I2C_TypeDef* i2c); gBool i2cInit(I2C_TypeDef* i2c);
void i2cSend(I2C_TypeDef* i2c, uint8_t slaveAddr, uint8_t* data, uint16_t length); void i2cSend(I2C_TypeDef* i2c, uint8_t slaveAddr, uint8_t* data, uint16_t length);
void i2cSendByte(I2C_TypeDef* i2c, uint8_t slaveAddr, uint8_t data); void i2cSendByte(I2C_TypeDef* i2c, uint8_t slaveAddr, uint8_t data);

View File

@ -15,8 +15,16 @@ FEATURE: Added GFX_COMPAT_V2 to maintain source compatibility with V2.x programs
FEATURE: Added GFX_COMPAT_OLDCOLORS to allow V2.x Red, Green, Blue color names. It is turned on by default. FEATURE: Added GFX_COMPAT_OLDCOLORS to allow V2.x Red, Green, Blue color names. It is turned on by default.
CHANGE: Added GFX_RED, GFX_BLUE, GFX_GREEN etc to replace V2.x Red, Gree, Blue color names CHANGE: Added GFX_RED, GFX_BLUE, GFX_GREEN etc to replace V2.x Red, Gree, Blue color names
CHANGE: Added GFXON/GFXOFF to replace V2.x TRUE/FALSE for configuration options. CHANGE: Added GFXON/GFXOFF to replace V2.x TRUE/FALSE for configuration options.
CHANGE: Added gBool type and gTrue/gFalse to replace TRUE/FALSE for booleans.
CHANGE: Added types gI8, gU8 .. gI32, gU32 to replace V2.x int8_t etc
CHANGE: Added types gPtr and gPtrDiff
FEATURE: Added gI64 and gU64 when the compiler supports it. GFX_TYPE_64 macro is defined as GFXON if it does.
FEATURE: Fixed headers to ensure size_t, NULL are always defined. size_t is not used as it may be 64bit.
FIX: Added gfxRealloc() to Qt port FIX: Added gfxRealloc() to Qt port
FIX: Fixed UC1610 driver private area initialisation FIX: Fixed UC1610 driver private area initialisation
FIX: Fixed ST7735 driver and added kapacuk changes
FEATURE: Added keyboard support to radio buttons (by Steffan)
FEATURE: Added internal use only GFX_COMPILESTAGE (used to control compilation)
*** Release 2.8 *** *** Release 2.8 ***

View File

@ -81,13 +81,13 @@ int main(void) {
gfxInit(); gfxInit();
/* Calibrate the touchscreen */ /* Calibrate the touchscreen */
ginputSetMouseCalibrationRoutines(0, NULL, tsCalibRead, FALSE); ginputSetMouseCalibrationRoutines(0, NULL, tsCalibRead, gFalse);
ginputGetMouse(0); ginputGetMouse(0);
// Set the color scheme // Set the color scheme
nSetColorScheme(schemeDefault); nSetColorScheme(schemeDefault);
while (TRUE) { while (1) {
gfxThreadWait(nLaunchNotepadApp()); gfxThreadWait(nLaunchNotepadApp());
gdispSetClip(0, 0, gdispGetWidth(), gdispGetHeight()); gdispSetClip(0, 0, gdispGetWidth(), gdispGetHeight());

View File

@ -73,7 +73,7 @@ static NColorScheme nCurColorScheme;
static DECLARE_THREAD_FUNCTION(notepadThread, param); static DECLARE_THREAD_FUNCTION(notepadThread, param);
// Custom drawing functions for the buttons // Custom drawing functions for the buttons
static void nbtnColorBarDraw(GHandle gh, bool_t enabled, bool_t isdown, const char *txt, const GButtonDrawStyle *pstyle, void *param) { static void nbtnColorBarDraw(GHandle gh, gBool enabled, gBool isdown, const char *txt, const GButtonDrawStyle *pstyle, void *param) {
#define ccs nCurColorScheme #define ccs nCurColorScheme
int i, j, k; int i, j, k;
@ -152,7 +152,7 @@ static void nbtnColorBarDraw(GHandle gh, bool_t enabled, bool_t isdown, const ch
#undef ccs #undef ccs
} }
static void nbtnColorBarSelDraw(GHandle gh, bool_t enabled, bool_t isdown, const char *txt, const GButtonDrawStyle *pstyle, void *param) { static void nbtnColorBarSelDraw(GHandle gh, gBool enabled, gBool isdown, const char *txt, const GButtonDrawStyle *pstyle, void *param) {
#define ccs nCurColorScheme #define ccs nCurColorScheme
int i, j = 0, k; int i, j = 0, k;
@ -215,7 +215,7 @@ static void nbtnColorBarSelDraw(GHandle gh, bool_t enabled, bool_t isdown, const
#undef ccs #undef ccs
} }
static void nToolbarImageButtonDraw(GHandle gh, bool_t isenabled, bool_t isdown, const char *txt, const GButtonDrawStyle *pstyle, void *param) { static void nToolbarImageButtonDraw(GHandle gh, gBool isenabled, gBool isdown, const char *txt, const GButtonDrawStyle *pstyle, void *param) {
(void)txt; (void)pstyle; (void)isenabled; (void)txt; (void)pstyle; (void)isenabled;
color_t cl = isdown ? nCurColorScheme.toolbarBgActive : nCurColorScheme.toolbarBgUnsel; color_t cl = isdown ? nCurColorScheme.toolbarBgActive : nCurColorScheme.toolbarBgUnsel;
@ -228,7 +228,7 @@ static void nToolbarImageButtonDraw(GHandle gh, bool_t isenabled, bool_t isdown,
gdispDrawBox(gh->x, gh->y, gh->width, gh->height, nCurColorScheme.toolbarSeparator); gdispDrawBox(gh->x, gh->y, gh->width, gh->height, nCurColorScheme.toolbarSeparator);
} }
static void nCloseButtonDraw(GHandle gh, bool_t isenabled, bool_t isdown, const char *txt, const GButtonDrawStyle *pstyle, void *param) { static void nCloseButtonDraw(GHandle gh, gBool isenabled, gBool isdown, const char *txt, const GButtonDrawStyle *pstyle, void *param) {
(void) isenabled; (void) isenabled;
(void) isdown; (void) isdown;
(void) txt; (void) txt;
@ -401,7 +401,7 @@ static DECLARE_THREAD_FUNCTION(notepadThread, param) {
ncoreSpawnDrawThread(nDrawingArea, gstatusConsole); ncoreSpawnDrawThread(nDrawingArea, gstatusConsole);
while(TRUE) { while(1) {
pem = (GEventMouse *) geventEventWait(&gl, TIME_INFINITE); pem = (GEventMouse *) geventEventWait(&gl, TIME_INFINITE);
/* button pressed... */ /* button pressed... */

View File

@ -53,7 +53,7 @@ static gfxThreadHandle nThd;
static GHandle ncoreDrawingArea = NULL; static GHandle ncoreDrawingArea = NULL;
static GHandle nStatusConsole = NULL; static GHandle nStatusConsole = NULL;
static volatile bool_t doExit; static volatile gBool doExit;
static void draw_point(coord_t x, coord_t y) { static void draw_point(coord_t x, coord_t y) {
color_t c = ncoreDrawingArea->color; color_t c = ncoreDrawingArea->color;
@ -204,7 +204,7 @@ void ncoreSpawnDrawThread(GHandle drawingArea, GHandle statusConsole) {
ncoreDrawingArea = drawingArea; ncoreDrawingArea = drawingArea;
nStatusConsole = statusConsole; nStatusConsole = statusConsole;
doExit = FALSE; doExit = gFalse;
nThd = gfxThreadCreate(waDrawThread, nThd = gfxThreadCreate(waDrawThread,
sizeof(waDrawThread), sizeof(waDrawThread),
@ -216,7 +216,7 @@ void ncoreSpawnDrawThread(GHandle drawingArea, GHandle statusConsole) {
/* Terminate the core thread, wait for control release */ /* Terminate the core thread, wait for control release */
void ncoreTerminateDrawThread(void) { void ncoreTerminateDrawThread(void) {
doExit = TRUE; doExit = gTrue;
gfxThreadWait(nThd); gfxThreadWait(nThd);
nThd = 0; nThd = 0;
} }

View File

@ -33,7 +33,7 @@
#include "tasks.h" #include "tasks.h"
static volatile bool_t run; static volatile gBool run;
static GHandle gh; static GHandle gh;
static gfxThreadHandle thread; static gfxThreadHandle thread;
@ -149,13 +149,13 @@ static DECLARE_THREAD_FUNCTION(task, param) {
return 0; return 0;
} }
void doBounce(GHandle parent, bool_t start) { void doBounce(GHandle parent, gBool start) {
if (start) { if (start) {
run = TRUE; run = gTrue;
gh = parent; gh = parent;
thread = gfxThreadCreate(0, 0x200, LOW_PRIORITY, task, 0); thread = gfxThreadCreate(0, 0x200, LOW_PRIORITY, task, 0);
} else if (run) { } else if (run) {
run = FALSE; run = gFalse;
gfxThreadWait(thread); gfxThreadWait(thread);
gfxYield(); gfxYield();
} }

View File

@ -146,18 +146,18 @@ static void createWidgets(void) {
border = ScrWidth < 450 ? 1 : 5; border = ScrWidth < 450 ? 1 : 5;
// Create the Tabs // Create the Tabs
wi.g.show = TRUE; wi.g.show = gTrue;
wi.g.x = border; wi.g.y = 0; wi.g.x = border; wi.g.y = 0;
wi.g.width = ScrWidth - 2*border; wi.g.height = ScrHeight-wi.g.y-border; wi.g.width = ScrWidth - 2*border; wi.g.height = ScrHeight-wi.g.y-border;
ghTabset = gwinTabsetCreate(0, &wi, GWIN_TABSET_BORDER); ghTabset = gwinTabsetCreate(0, &wi, GWIN_TABSET_BORDER);
ghPgControls = gwinTabsetAddTab(ghTabset, "Controls", FALSE); ghPgControls = gwinTabsetAddTab(ghTabset, "Controls", gFalse);
ghPgSliders = gwinTabsetAddTab(ghTabset, "Sliders", FALSE); ghPgSliders = gwinTabsetAddTab(ghTabset, "Sliders", gFalse);
ghPgRadios = gwinTabsetAddTab(ghTabset, "Radios", FALSE); ghPgRadios = gwinTabsetAddTab(ghTabset, "Radios", gFalse);
ghPgLists = gwinTabsetAddTab(ghTabset, "Lists", FALSE); ghPgLists = gwinTabsetAddTab(ghTabset, "Lists", gFalse);
ghPgLabels = gwinTabsetAddTab(ghTabset, "Labels", FALSE); ghPgLabels = gwinTabsetAddTab(ghTabset, "Labels", gFalse);
ghPgImages = gwinTabsetAddTab(ghTabset, "Images", FALSE); ghPgImages = gwinTabsetAddTab(ghTabset, "Images", gFalse);
ghPgBounce = gwinTabsetAddTab(ghTabset, "Bounce", FALSE); ghPgBounce = gwinTabsetAddTab(ghTabset, "Bounce", gFalse);
ghPgMandelbrot = gwinTabsetAddTab(ghTabset, "Mandelbrot", FALSE); ghPgMandelbrot = gwinTabsetAddTab(ghTabset, "Mandelbrot", gFalse);
pagewidth = gwinGetInnerWidth(ghTabset)/2; pagewidth = gwinGetInnerWidth(ghTabset)/2;
@ -266,62 +266,62 @@ static void createWidgets(void) {
wi.g.parent = ghPgLists; wi.g.parent = ghPgLists;
wi.g.width = LIST_WIDTH; wi.g.height = LIST_HEIGHT; wi.g.y = border; wi.g.width = LIST_WIDTH; wi.g.height = LIST_HEIGHT; wi.g.y = border;
wi.g.x = border; wi.text = "L1"; wi.g.x = border; wi.text = "L1";
ghList1 = gwinListCreate(0, &wi, FALSE); ghList1 = gwinListCreate(0, &wi, gFalse);
gwinListAddItem(ghList1, "Item 0", FALSE); gwinListAddItem(ghList1, "Item 0", gFalse);
gwinListAddItem(ghList1, "Item 1", FALSE); gwinListAddItem(ghList1, "Item 1", gFalse);
gwinListAddItem(ghList1, "Item 2", FALSE); gwinListAddItem(ghList1, "Item 2", gFalse);
gwinListAddItem(ghList1, "Item 3", FALSE); gwinListAddItem(ghList1, "Item 3", gFalse);
gwinListAddItem(ghList1, "Item 4", FALSE); gwinListAddItem(ghList1, "Item 4", gFalse);
gwinListAddItem(ghList1, "Item 5", FALSE); gwinListAddItem(ghList1, "Item 5", gFalse);
gwinListAddItem(ghList1, "Item 6", FALSE); gwinListAddItem(ghList1, "Item 6", gFalse);
gwinListAddItem(ghList1, "Item 7", FALSE); gwinListAddItem(ghList1, "Item 7", gFalse);
gwinListAddItem(ghList1, "Item 8", FALSE); gwinListAddItem(ghList1, "Item 8", gFalse);
gwinListAddItem(ghList1, "Item 9", FALSE); gwinListAddItem(ghList1, "Item 9", gFalse);
gwinListAddItem(ghList1, "Item 10", FALSE); gwinListAddItem(ghList1, "Item 10", gFalse);
gwinListAddItem(ghList1, "Item 11", FALSE); gwinListAddItem(ghList1, "Item 11", gFalse);
gwinListAddItem(ghList1, "Item 12", FALSE); gwinListAddItem(ghList1, "Item 12", gFalse);
gwinListAddItem(ghList1, "Item 13", FALSE); gwinListAddItem(ghList1, "Item 13", gFalse);
wi.text = "L2"; wi.g.x += LIST_WIDTH+border; if (wi.g.x + LIST_WIDTH > pagewidth) { wi.g.x = border; wi.g.y += LIST_HEIGHT+border; } wi.text = "L2"; wi.g.x += LIST_WIDTH+border; if (wi.g.x + LIST_WIDTH > pagewidth) { wi.g.x = border; wi.g.y += LIST_HEIGHT+border; }
ghList2 = gwinListCreate(0, &wi, TRUE); ghList2 = gwinListCreate(0, &wi, gTrue);
gwinListAddItem(ghList2, "Item 0", FALSE); gwinListAddItem(ghList2, "Item 0", gFalse);
gwinListAddItem(ghList2, "Item 1", FALSE); gwinListAddItem(ghList2, "Item 1", gFalse);
gwinListAddItem(ghList2, "Item 2", FALSE); gwinListAddItem(ghList2, "Item 2", gFalse);
gwinListAddItem(ghList2, "Item 3", FALSE); gwinListAddItem(ghList2, "Item 3", gFalse);
gwinListAddItem(ghList2, "Item 4", FALSE); gwinListAddItem(ghList2, "Item 4", gFalse);
gwinListAddItem(ghList2, "Item 5", FALSE); gwinListAddItem(ghList2, "Item 5", gFalse);
gwinListAddItem(ghList2, "Item 6", FALSE); gwinListAddItem(ghList2, "Item 6", gFalse);
gwinListAddItem(ghList2, "Item 7", FALSE); gwinListAddItem(ghList2, "Item 7", gFalse);
gwinListAddItem(ghList2, "Item 8", FALSE); gwinListAddItem(ghList2, "Item 8", gFalse);
gwinListAddItem(ghList2, "Item 9", FALSE); gwinListAddItem(ghList2, "Item 9", gFalse);
gwinListAddItem(ghList2, "Item 10", FALSE); gwinListAddItem(ghList2, "Item 10", gFalse);
gwinListAddItem(ghList2, "Item 11", FALSE); gwinListAddItem(ghList2, "Item 11", gFalse);
gwinListAddItem(ghList2, "Item 12", FALSE); gwinListAddItem(ghList2, "Item 12", gFalse);
gwinListAddItem(ghList2, "Item 13", FALSE); gwinListAddItem(ghList2, "Item 13", gFalse);
wi.text = "L3"; wi.g.x += LIST_WIDTH+border; if (wi.g.x + LIST_WIDTH > pagewidth) { wi.g.x = border; wi.g.y += LIST_HEIGHT+border; } wi.text = "L3"; wi.g.x += LIST_WIDTH+border; if (wi.g.x + LIST_WIDTH > pagewidth) { wi.g.x = border; wi.g.y += LIST_HEIGHT+border; }
ghList3 = gwinListCreate(0, &wi, TRUE); ghList3 = gwinListCreate(0, &wi, gTrue);
gwinListAddItem(ghList3, "Item 0", FALSE); gwinListAddItem(ghList3, "Item 0", gFalse);
gwinListAddItem(ghList3, "Item 1", FALSE); gwinListAddItem(ghList3, "Item 1", gFalse);
gwinListAddItem(ghList3, "Item 2", FALSE); gwinListAddItem(ghList3, "Item 2", gFalse);
gwinListAddItem(ghList3, "Item 3", FALSE); gwinListAddItem(ghList3, "Item 3", gFalse);
gdispImageOpenFile(&imgYesNo, "image_yesno.gif"); gdispImageOpenFile(&imgYesNo, "image_yesno.gif");
gwinListItemSetImage(ghList3, 1, &imgYesNo); gwinListItemSetImage(ghList3, 1, &imgYesNo);
gwinListItemSetImage(ghList3, 3, &imgYesNo); gwinListItemSetImage(ghList3, 3, &imgYesNo);
wi.text = "L4"; wi.g.x += LIST_WIDTH+border; if (wi.g.x + LIST_WIDTH > pagewidth) { wi.g.x = border; wi.g.y += LIST_HEIGHT+border; } wi.text = "L4"; wi.g.x += LIST_WIDTH+border; if (wi.g.x + LIST_WIDTH > pagewidth) { wi.g.x = border; wi.g.y += LIST_HEIGHT+border; }
ghList4 = gwinListCreate(0, &wi, TRUE); ghList4 = gwinListCreate(0, &wi, gTrue);
gwinListAddItem(ghList4, "Item 0", FALSE); gwinListAddItem(ghList4, "Item 0", gFalse);
gwinListAddItem(ghList4, "Item 1", FALSE); gwinListAddItem(ghList4, "Item 1", gFalse);
gwinListAddItem(ghList4, "Item 2", FALSE); gwinListAddItem(ghList4, "Item 2", gFalse);
gwinListAddItem(ghList4, "Item 3", FALSE); gwinListAddItem(ghList4, "Item 3", gFalse);
gwinListAddItem(ghList4, "Item 4", FALSE); gwinListAddItem(ghList4, "Item 4", gFalse);
gwinListAddItem(ghList4, "Item 5", FALSE); gwinListAddItem(ghList4, "Item 5", gFalse);
gwinListAddItem(ghList4, "Item 6", FALSE); gwinListAddItem(ghList4, "Item 6", gFalse);
gwinListAddItem(ghList4, "Item 7", FALSE); gwinListAddItem(ghList4, "Item 7", gFalse);
gwinListAddItem(ghList4, "Item 8", FALSE); gwinListAddItem(ghList4, "Item 8", gFalse);
gwinListAddItem(ghList4, "Item 9", FALSE); gwinListAddItem(ghList4, "Item 9", gFalse);
gwinListAddItem(ghList4, "Item 10", FALSE); gwinListAddItem(ghList4, "Item 10", gFalse);
gwinListAddItem(ghList4, "Item 11", FALSE); gwinListAddItem(ghList4, "Item 11", gFalse);
gwinListAddItem(ghList4, "Item 12", FALSE); gwinListAddItem(ghList4, "Item 12", gFalse);
gwinListAddItem(ghList4, "Item 13", FALSE); gwinListAddItem(ghList4, "Item 13", gFalse);
gwinListSetScroll(ghList4, scrollSmooth); gwinListSetScroll(ghList4, scrollSmooth);
// Image // Image
@ -339,25 +339,25 @@ static void setLabels(void) {
// The sliders // The sliders
snprintg(tmp, sizeof(tmp), "%d%%", gwinSliderGetPosition(ghSlider1)); snprintg(tmp, sizeof(tmp), "%d%%", gwinSliderGetPosition(ghSlider1));
gwinSetText(ghLabelSlider1, tmp, TRUE); gwinSetText(ghLabelSlider1, tmp, gTrue);
snprintg(tmp, sizeof(tmp), "%d%%", gwinSliderGetPosition(ghSlider2)); snprintg(tmp, sizeof(tmp), "%d%%", gwinSliderGetPosition(ghSlider2));
gwinSetText(ghLabelSlider2, tmp, TRUE); gwinSetText(ghLabelSlider2, tmp, gTrue);
snprintg(tmp, sizeof(tmp), "%d%%", gwinSliderGetPosition(ghSlider3)); snprintg(tmp, sizeof(tmp), "%d%%", gwinSliderGetPosition(ghSlider3));
gwinSetText(ghLabelSlider3, tmp, TRUE); gwinSetText(ghLabelSlider3, tmp, gTrue);
snprintg(tmp, sizeof(tmp), "%d%%", gwinSliderGetPosition(ghSlider4)); snprintg(tmp, sizeof(tmp), "%d%%", gwinSliderGetPosition(ghSlider4));
gwinSetText(ghLabelSlider4, tmp, TRUE); gwinSetText(ghLabelSlider4, tmp, gTrue);
// The radio buttons // The radio buttons
if (gwinRadioIsPressed(ghRadio1)) if (gwinRadioIsPressed(ghRadio1))
gwinSetText(ghLabelRadio1, "Yes", TRUE); gwinSetText(ghLabelRadio1, "Yes", gTrue);
else if (gwinRadioIsPressed(ghRadio2)) else if (gwinRadioIsPressed(ghRadio2))
gwinSetText(ghLabelRadio1, "No", TRUE); gwinSetText(ghLabelRadio1, "No", gTrue);
} }
/** /**
* Control the progress bar auto-increment * Control the progress bar auto-increment
*/ */
static void setProgressbar(bool_t onoff) { static void setProgressbar(gBool onoff) {
if (onoff) if (onoff)
gwinProgressbarStart(ghProgressbar1, 500); gwinProgressbarStart(ghProgressbar1, 500);
else { else {
@ -369,7 +369,7 @@ static void setProgressbar(bool_t onoff) {
/** /**
* Set the enabled state of every widget (except the tabs etc) * Set the enabled state of every widget (except the tabs etc)
*/ */
static void setEnabled(bool_t ena) { static void setEnabled(gBool ena) {
//gwinSetEnabled(ghPgControls, ena); //gwinSetEnabled(ghPgControls, ena);
gwinSetEnabled(ghPgSliders, ena); gwinSetEnabled(ghPgSliders, ena);
gwinSetEnabled(ghPgLabels, ena); gwinSetEnabled(ghPgLabels, ena);
@ -386,7 +386,7 @@ static void setEnabled(bool_t ena) {
gwinSetEnabled(ghCheckbox1, ena); gwinSetEnabled(ghCheckbox1, ena);
gwinSetEnabled(ghCheckbox2, ena); gwinSetEnabled(ghCheckbox2, ena);
gwinSetEnabled(ghCheckbox3, ena); gwinSetEnabled(ghCheckbox3, ena);
//gwinSetEnabled(ghCheckDisableAll, TRUE); //gwinSetEnabled(ghCheckDisableAll, gTrue);
} }
static void FlashOffFn(void *param) { static void FlashOffFn(void *param) {
@ -404,7 +404,7 @@ int main(void) {
// Set the widget defaults // Set the widget defaults
font = gdispOpenFont("*"); // Get the first defined font. font = gdispOpenFont("*"); // Get the first defined font.
gwinSetDefaultFont(font); gwinSetDefaultFont(font);
gwinSetDefaultStyle(&WhiteWidgetStyle, FALSE); gwinSetDefaultStyle(&WhiteWidgetStyle, gFalse);
gdispClear(GFX_WHITE); gdispClear(GFX_WHITE);
// Create the gwin windows/widgets // Create the gwin windows/widgets
@ -458,7 +458,7 @@ int main(void) {
// If it is the toggle button checkbox start the flash. // If it is the toggle button checkbox start the flash.
} else if (((GEventGWinCheckbox *)pe)->gwin == ghCheckbox3) { } else if (((GEventGWinCheckbox *)pe)->gwin == ghCheckbox3) {
gwinFlash(ghCheckbox3); gwinFlash(ghCheckbox3);
gtimerStart(&FlashTimer, FlashOffFn, 0, FALSE, 3000); gtimerStart(&FlashTimer, FlashOffFn, 0, gFalse, 3000);
} }
break; break;
@ -501,7 +501,7 @@ int main(void) {
gdispClear(pstyle->background); gdispClear(pstyle->background);
// Update the style on all controls // Update the style on all controls
gwinSetDefaultStyle(pstyle, TRUE); gwinSetDefaultStyle(pstyle, gTrue);
} }
break; break;
} }

View File

@ -30,7 +30,7 @@
#include "gfx.h" #include "gfx.h"
#include "tasks.h" #include "tasks.h"
static volatile bool_t run; static volatile gBool run;
static GHandle gh; static GHandle gh;
static gfxThreadHandle thread; static gfxThreadHandle thread;
@ -85,13 +85,13 @@ static DECLARE_THREAD_FUNCTION(task, param) {
return 0; return 0;
} }
void doMandlebrot(GHandle parent, bool_t start) { void doMandlebrot(GHandle parent, gBool start) {
if (start) { if (start) {
run = TRUE; run = gTrue;
gh = parent; gh = parent;
thread = gfxThreadCreate(0, 0x400, LOW_PRIORITY, task, 0); thread = gfxThreadCreate(0, 0x400, LOW_PRIORITY, task, 0);
} else if (run) { } else if (run) {
run = FALSE; run = gFalse;
gfxThreadWait(thread); gfxThreadWait(thread);
} }
} }

View File

@ -1,7 +1,7 @@
#ifndef _TASKS_INCLUDED #ifndef _TASKS_INCLUDED
#define _TASKS_INCLUDED #define _TASKS_INCLUDED
void doMandlebrot(GHandle parent, bool_t start); void doMandlebrot(GHandle parent, gBool start);
void doBounce(GHandle parent, bool_t start); void doBounce(GHandle parent, gBool start);
#endif #endif

View File

@ -72,7 +72,7 @@ int main(void) {
cx = -0.086f; cx = -0.086f;
cy = 0.85f; cy = 0.85f;
while(TRUE) { while(1) {
mandelbrot(-2.0f*zoom+cx, -1.5f*zoom+cy, 2.0f*zoom+cx, 1.5f*zoom+cy); mandelbrot(-2.0f*zoom+cx, -1.5f*zoom+cy, 2.0f*zoom+cx, 1.5f*zoom+cy);
zoom *= 0.7f; zoom *= 0.7f;

View File

@ -82,7 +82,7 @@ int main(void) {
drawScreen(); drawScreen();
while (TRUE) { while (1) {
ginputGetMouseStatus(0, &ev); ginputGetMouseStatus(0, &ev);
if (!(ev.buttons & GINPUT_MOUSE_BTN_LEFT)) if (!(ev.buttons & GINPUT_MOUSE_BTN_LEFT))
continue; continue;

View File

@ -141,7 +141,7 @@ int main(void) {
benchmark(); benchmark();
while(TRUE) { while(1) {
gfxSleepMilliseconds(500); gfxSleepMilliseconds(500);
} }

View File

@ -17,12 +17,12 @@ GHandle jg10SelectionWidgetGCreate(GDisplay* g, jg10WidgetObject* wo, GWidgetIni
typedef struct { // Node properties typedef struct { // Node properties
uint8_t num; // Node number uint8_t num; // Node number
bool_t check; // Node needs to be checked or not gBool check; // Node needs to be checked or not
bool_t sel; // Node selected or not gBool sel; // Node selected or not
} nodeProps; } nodeProps;
nodeProps jg10Field[JG10_FIELD_WIDTH][JG10_FIELD_HEIGHT]; // jg10 field array nodeProps jg10Field[JG10_FIELD_WIDTH][JG10_FIELD_HEIGHT]; // jg10 field array
bool_t jg10GameOver = FALSE; gBool jg10GameOver = gFalse;
const char *jg10Graph[] = {"background.bmp", "1.bmp","2.bmp","3.bmp","4.bmp","5.bmp","6.bmp","7.bmp","8.bmp", "9.bmp", "10.bmp", "11.bmp", "12.bmp", "13.bmp", "14.bmp", "15.bmp", "16.bmp", "17.bmp", "18.bmp", "19.bmp", "20.bmp"}; // 21 elements (0-20) const char *jg10Graph[] = {"background.bmp", "1.bmp","2.bmp","3.bmp","4.bmp","5.bmp","6.bmp","7.bmp","8.bmp", "9.bmp", "10.bmp", "11.bmp", "12.bmp", "13.bmp", "14.bmp", "15.bmp", "16.bmp", "17.bmp", "18.bmp", "19.bmp", "20.bmp"}; // 21 elements (0-20)
gdispImage jg10Image[JG10_MAX_COUNT]; gdispImage jg10Image[JG10_MAX_COUNT];
#define JG10_ANIM_IMAGES 5 #define JG10_ANIM_IMAGES 5
@ -33,7 +33,7 @@ uint8_t jg10MaxVal=4; // Max v
font_t font; font_t font;
#if JG10_SHOW_SPLASH #if JG10_SHOW_SPLASH
GTimer jg10SplashBlink; GTimer jg10SplashBlink;
bool_t jg10SplashTxtVisible = FALSE; gBool jg10SplashTxtVisible = gFalse;
gdispImage jg10SplashImage; gdispImage jg10SplashImage;
#endif #endif
@ -86,16 +86,16 @@ static int uitoa(unsigned int value, char * buf, int max) {
return n; return n;
} }
static bool_t inRange(int16_t x, int16_t y) { static gBool inRange(int16_t x, int16_t y) {
if ((x >= 0) && (x < JG10_FIELD_WIDTH) && (y >= 0) && (y < JG10_FIELD_HEIGHT)) return TRUE; else return FALSE; if ((x >= 0) && (x < JG10_FIELD_WIDTH) && (y >= 0) && (y < JG10_FIELD_HEIGHT)) return gTrue; else return gFalse;
} }
static void clean_SelCheck(void) { static void clean_SelCheck(void) {
uint16_t i ,j; uint16_t i ,j;
for (i = 0; i < JG10_FIELD_WIDTH; i++) { for (i = 0; i < JG10_FIELD_WIDTH; i++) {
for (j = 0; j < JG10_FIELD_HEIGHT; j++) { for (j = 0; j < JG10_FIELD_HEIGHT; j++) {
jg10Field[i][j].check = FALSE; jg10Field[i][j].check = gFalse;
jg10Field[i][j].sel = FALSE; jg10Field[i][j].sel = gFalse;
} }
} }
} }
@ -121,7 +121,7 @@ static void remove_Selected(void) {
for (i = 0; i < JG10_FIELD_WIDTH; i++) { for (i = 0; i < JG10_FIELD_WIDTH; i++) {
for (j = 0; j < JG10_FIELD_HEIGHT; j++) { for (j = 0; j < JG10_FIELD_HEIGHT; j++) {
if (jg10Field[i][j].sel) { if (jg10Field[i][j].sel) {
jg10Field[i][j].sel = FALSE; jg10Field[i][j].sel = gFalse;
jg10Field[i][j].num = 0; jg10Field[i][j].num = 0;
} }
} }
@ -148,9 +148,9 @@ static uint8_t jg10_randomer(uint8_t max, uint8_t th) {
static void movePiecesDown(void) { static void movePiecesDown(void) {
uint8_t tmp = 0; uint8_t tmp = 0;
bool_t needToCheck = TRUE; gBool needToCheck = gTrue;
while (needToCheck) { while (needToCheck) {
needToCheck = FALSE; needToCheck = gFalse;
for (int8_t y = (JG10_FIELD_HEIGHT-1); y >= 0; y--) { for (int8_t y = (JG10_FIELD_HEIGHT-1); y >= 0; y--) {
for (uint8_t x = 0; x < JG10_FIELD_WIDTH; x++) { for (uint8_t x = 0; x < JG10_FIELD_WIDTH; x++) {
if (jg10Field[x][y].num == 0) { if (jg10Field[x][y].num == 0) {
@ -164,7 +164,7 @@ static void movePiecesDown(void) {
jg10Field[x][tmpy].num = jg10Field[x][tmpy-1].num; jg10Field[x][tmpy].num = jg10Field[x][tmpy-1].num;
} }
jg10Field[x][0].num = 0; jg10Field[x][0].num = 0;
needToCheck = TRUE; needToCheck = gTrue;
} }
} }
} }
@ -172,9 +172,9 @@ static void movePiecesDown(void) {
} }
gwinRedraw(mainWin); gwinRedraw(mainWin);
// Add new pieces // Add new pieces
needToCheck = TRUE; needToCheck = gTrue;
while (needToCheck) { while (needToCheck) {
needToCheck = FALSE; needToCheck = gFalse;
for (int8_t y = (JG10_FIELD_HEIGHT-1); y >= 0; y--) { for (int8_t y = (JG10_FIELD_HEIGHT-1); y >= 0; y--) {
for (uint8_t x = 0; x < JG10_FIELD_WIDTH; x++) { for (uint8_t x = 0; x < JG10_FIELD_WIDTH; x++) {
if (jg10Field[x][y].num == 0) { if (jg10Field[x][y].num == 0) {
@ -182,7 +182,7 @@ static void movePiecesDown(void) {
jg10Field[x][tmpy].num = jg10Field[x][tmpy-1].num; jg10Field[x][tmpy].num = jg10Field[x][tmpy-1].num;
} }
jg10Field[x][0].num = jg10_randomer(jg10MaxVal, 3); jg10Field[x][0].num = jg10_randomer(jg10MaxVal, 3);
needToCheck = TRUE; needToCheck = gTrue;
} }
} }
} }
@ -191,8 +191,8 @@ static void movePiecesDown(void) {
} }
} }
static bool_t checkForPossibleMove(void) { static gBool checkForPossibleMove(void) {
bool_t canMove = FALSE; gBool canMove = gFalse;
uint16_t i ,j; uint16_t i ,j;
for (i = 0; i < JG10_FIELD_WIDTH; i++) { for (i = 0; i < JG10_FIELD_WIDTH; i++) {
for (j = 0; j < JG10_FIELD_HEIGHT; j++) { for (j = 0; j < JG10_FIELD_HEIGHT; j++) {
@ -200,7 +200,7 @@ static bool_t checkForPossibleMove(void) {
(inRange(i-1,j) && jg10Field[i-1][j].num == jg10Field[i][j].num) || (inRange(i-1,j) && jg10Field[i-1][j].num == jg10Field[i][j].num) ||
(inRange(i,j+1) && jg10Field[i][j+1].num == jg10Field[i][j].num) || (inRange(i,j+1) && jg10Field[i][j+1].num == jg10Field[i][j].num) ||
(inRange(i+1,j) && jg10Field[i+1][j].num == jg10Field[i][j].num)) { (inRange(i+1,j) && jg10Field[i+1][j].num == jg10Field[i][j].num)) {
canMove = TRUE; canMove = gTrue;
return canMove; return canMove;
} }
} }
@ -242,10 +242,10 @@ static DECLARE_THREAD_FUNCTION(thdJg10, msg) {
(inRange(x-1,y) && jg10Field[x-1][y].num == jg10Field[x][y].num) || (inRange(x-1,y) && jg10Field[x-1][y].num == jg10Field[x][y].num) ||
(inRange(x,y+1) && jg10Field[x][y+1].num == jg10Field[x][y].num) || (inRange(x,y+1) && jg10Field[x][y+1].num == jg10Field[x][y].num) ||
(inRange(x+1,y) && jg10Field[x+1][y].num == jg10Field[x][y].num)) { (inRange(x+1,y) && jg10Field[x+1][y].num == jg10Field[x][y].num)) {
gwinSetVisible(Jg10SelectWidget, FALSE); gwinSetVisible(Jg10SelectWidget, gFalse);
clean_SelCheck(); clean_SelCheck();
jg10Field[x][y].check = TRUE; jg10Field[x][y].check = gTrue;
gwinSetVisible(Jg10SelectWidget, TRUE); gwinSetVisible(Jg10SelectWidget, gTrue);
} }
} else { } else {
// already selected section clicked... // already selected section clicked...
@ -254,19 +254,19 @@ static DECLARE_THREAD_FUNCTION(thdJg10, msg) {
jg10MaxVal = jg10Field[x][y].num; jg10MaxVal = jg10Field[x][y].num;
if (jg10MaxVal >= 10) printCongrats(); if (jg10MaxVal >= 10) printCongrats();
if (jg10MaxVal == 20) { // Just in case someone got so far :D I cannot imaginge though if (jg10MaxVal == 20) { // Just in case someone got so far :D I cannot imaginge though
jg10GameOver = TRUE; jg10GameOver = gTrue;
printGameOver(); printGameOver();
} }
} }
jg10Field[x][y].sel = FALSE; jg10Field[x][y].sel = gFalse;
gwinSetVisible(Jg10SelectWidget, FALSE); gwinSetVisible(Jg10SelectWidget, gFalse);
remove_Selected(); remove_Selected();
movePiecesDown(); movePiecesDown();
if (checkForPossibleMove()) { if (checkForPossibleMove()) {
clean_SelCheck(); clean_SelCheck();
//gwinRedraw(mainWin); //gwinRedraw(mainWin);
} else { } else {
jg10GameOver = TRUE; jg10GameOver = gTrue;
printGameOver(); printGameOver();
} }
} }
@ -284,11 +284,11 @@ static void initField(void) {
//jg10Field[x][y].num = 1; // good for animation testing //jg10Field[x][y].num = 1; // good for animation testing
//jg10Field[x][y].num = x+x+5; // good to get high score fast //jg10Field[x][y].num = x+x+5; // good to get high score fast
//jg10Field[x][y].num = x+y+5; // good demo to check out pieces :D //jg10Field[x][y].num = x+y+5; // good demo to check out pieces :D
jg10Field[x][y].check = FALSE; jg10Field[x][y].check = gFalse;
jg10Field[x][y].sel = FALSE; jg10Field[x][y].sel = gFalse;
} }
} }
jg10GameOver = FALSE; jg10GameOver = gFalse;
printGameOver(); printGameOver();
} }
@ -304,21 +304,21 @@ static void mainWinDraw(GWidgetObject* gw, void* param) {
static void jg10SelectionWidget_Draw(GWidgetObject* gw, void* param) { static void jg10SelectionWidget_Draw(GWidgetObject* gw, void* param) {
int16_t x, y; int16_t x, y;
bool_t needToCheck = TRUE; gBool needToCheck = gTrue;
(void)param; (void)param;
while (needToCheck) { while (needToCheck) {
needToCheck = FALSE; needToCheck = gFalse;
for (x = 0; x < JG10_FIELD_WIDTH; x++) { for (x = 0; x < JG10_FIELD_WIDTH; x++) {
for (y = 0; y < JG10_FIELD_HEIGHT; y++) { for (y = 0; y < JG10_FIELD_HEIGHT; y++) {
if (jg10Field[x][y].check && !jg10Field[x][y].sel) { if (jg10Field[x][y].check && !jg10Field[x][y].sel) {
jg10Field[x][y].sel = TRUE; jg10Field[x][y].sel = gTrue;
jg10Field[x][y].check = FALSE; jg10Field[x][y].check = gFalse;
// Up // Up
if (inRange(x, y-1) && !jg10Field[x][y-1].sel && (jg10Field[x][y-1].num == jg10Field[x][y].num)) { if (inRange(x, y-1) && !jg10Field[x][y-1].sel && (jg10Field[x][y-1].num == jg10Field[x][y].num)) {
jg10Field[x][y-1].check = TRUE; jg10Field[x][y-1].check = gTrue;
needToCheck = TRUE; needToCheck = gTrue;
} else if (!inRange(x, y-1) || (inRange(x, y-1) && !jg10Field[x][y-1].sel)) { } else if (!inRange(x, y-1) || (inRange(x, y-1) && !jg10Field[x][y-1].sel)) {
// We need longer line if this is wide corner inside shape // We need longer line if this is wide corner inside shape
if (inRange(x+1, y) && inRange(x+1, y-1) && (jg10Field[x][y].num == jg10Field[x+1][y].num) && (jg10Field[x][y].num == jg10Field[x+1][y-1].num)) { if (inRange(x+1, y) && inRange(x+1, y-1) && (jg10Field[x][y].num == jg10Field[x+1][y].num) && (jg10Field[x][y].num == jg10Field[x+1][y-1].num)) {
@ -329,8 +329,8 @@ static void jg10SelectionWidget_Draw(GWidgetObject* gw, void* param) {
} }
// Down // Down
if (inRange(x, y+1) && !jg10Field[x][y+1].sel && (jg10Field[x][y+1].num == jg10Field[x][y].num)) { if (inRange(x, y+1) && !jg10Field[x][y+1].sel && (jg10Field[x][y+1].num == jg10Field[x][y].num)) {
jg10Field[x][y+1].check = TRUE; jg10Field[x][y+1].check = gTrue;
needToCheck = TRUE; needToCheck = gTrue;
} else if (!inRange(x, y+1) || (inRange(x, y+1) && !jg10Field[x][y+1].sel)) { } else if (!inRange(x, y+1) || (inRange(x, y+1) && !jg10Field[x][y+1].sel)) {
// We need longer line if this is wide corner inside shape // We need longer line if this is wide corner inside shape
if (inRange(x-1, y) && inRange(x-1, y+1) && (jg10Field[x][y].num == jg10Field[x-1][y].num) && (jg10Field[x][y].num == jg10Field[x-1][y+1].num)) { if (inRange(x-1, y) && inRange(x-1, y+1) && (jg10Field[x][y].num == jg10Field[x-1][y].num) && (jg10Field[x][y].num == jg10Field[x-1][y+1].num)) {
@ -341,8 +341,8 @@ static void jg10SelectionWidget_Draw(GWidgetObject* gw, void* param) {
} }
// Left // Left
if (inRange(x-1, y) && !jg10Field[x-1][y].sel && (jg10Field[x-1][y].num == jg10Field[x][y].num)) { if (inRange(x-1, y) && !jg10Field[x-1][y].sel && (jg10Field[x-1][y].num == jg10Field[x][y].num)) {
jg10Field[x-1][y].check = TRUE; jg10Field[x-1][y].check = gTrue;
needToCheck = TRUE; needToCheck = gTrue;
} else if (!inRange(x-1, y) || (inRange(x-1, y) && !jg10Field[x-1][y].sel)) { } else if (!inRange(x-1, y) || (inRange(x-1, y) && !jg10Field[x-1][y].sel)) {
// We need longer line if this is wide corner inside shape // We need longer line if this is wide corner inside shape
if (inRange(x, y-1) && inRange(x-1, y-1) && (jg10Field[x][y].num == jg10Field[x][y-1].num) && (jg10Field[x][y].num == jg10Field[x-1][y-1].num)) { if (inRange(x, y-1) && inRange(x-1, y-1) && (jg10Field[x][y].num == jg10Field[x][y-1].num) && (jg10Field[x][y].num == jg10Field[x-1][y-1].num)) {
@ -353,8 +353,8 @@ static void jg10SelectionWidget_Draw(GWidgetObject* gw, void* param) {
} }
// Right // Right
if (inRange(x+1, y) && !jg10Field[x+1][y].sel && (jg10Field[x+1][y].num == jg10Field[x][y].num)) { if (inRange(x+1, y) && !jg10Field[x+1][y].sel && (jg10Field[x+1][y].num == jg10Field[x][y].num)) {
jg10Field[x+1][y].check = TRUE; jg10Field[x+1][y].check = gTrue;
needToCheck = TRUE; needToCheck = gTrue;
} else if (!inRange(x+1, y) || (inRange(x+1, y) && !jg10Field[x+1][y].sel)) { } else if (!inRange(x+1, y) || (inRange(x+1, y) && !jg10Field[x+1][y].sel)) {
// We need longer line if this is wide corner inside shape // We need longer line if this is wide corner inside shape
if (inRange(x, y+1) && inRange(x+1, y+1) && (jg10Field[x][y].num == jg10Field[x][y+1].num) && (jg10Field[x][y].num == jg10Field[x+1][y+1].num)) { if (inRange(x, y+1) && inRange(x+1, y+1) && (jg10Field[x][y].num == jg10Field[x][y+1].num) && (jg10Field[x][y].num == jg10Field[x+1][y+1].num)) {
@ -422,7 +422,7 @@ static void createMainWin(void) {
GWidgetInit wi; GWidgetInit wi;
gwinWidgetClearInit(&wi); gwinWidgetClearInit(&wi);
// Container - mainWin // Container - mainWin
wi.g.show = FALSE; wi.g.show = gFalse;
wi.g.x = 0; wi.g.x = 0;
wi.g.y = 0; wi.g.y = 0;
wi.g.width = gdispGetWidth(); wi.g.width = gdispGetWidth();
@ -435,7 +435,7 @@ static void createMainWin(void) {
mainWin = gwinContainerCreate(0, &wi, 0); mainWin = gwinContainerCreate(0, &wi, 0);
// create selection widget // create selection widget
wi.g.show = FALSE; wi.g.show = gFalse;
wi.g.x = 0; wi.g.x = 0;
wi.g.y = 0; wi.g.y = 0;
wi.g.width = 272; wi.g.width = 272;
@ -496,6 +496,6 @@ void jg10ShowSplash(void) {
gdispImageOpenFile(&jg10SplashImage, "splash.bmp"); gdispImageOpenFile(&jg10SplashImage, "splash.bmp");
gdispImageDraw(&jg10SplashImage, (gdispGetWidth()/2)-150, (gdispGetHeight()/2)-100, 300, 200, 0, 0); gdispImageDraw(&jg10SplashImage, (gdispGetWidth()/2)-150, (gdispGetHeight()/2)-100, 300, 200, 0, 0);
gdispImageClose(&jg10SplashImage); gdispImageClose(&jg10SplashImage);
gtimerStart(&jg10SplashBlink, jg10SplashBlinker, 0, TRUE, 400); gtimerStart(&jg10SplashBlink, jg10SplashBlinker, 0, gTrue, 400);
} }
#endif #endif

View File

@ -21,7 +21,7 @@ int main(void)
gdispCloseFont(font); gdispCloseFont(font);
#endif #endif
while (TRUE) { while (1) {
ginputGetMouseStatus(0, &ev); ginputGetMouseStatus(0, &ev);
if (ev.buttons & GINPUT_MOUSE_BTN_LEFT) { if (ev.buttons & GINPUT_MOUSE_BTN_LEFT) {
while (ev.buttons & GINPUT_MOUSE_BTN_LEFT) { // Wait until release while (ev.buttons & GINPUT_MOUSE_BTN_LEFT) { // Wait until release

View File

@ -55,7 +55,7 @@ int main(void)
gdispCloseFont(font); gdispCloseFont(font);
#endif #endif
while (TRUE) { while (1) {
ginputGetMouseStatus(0, &ev); ginputGetMouseStatus(0, &ev);
if (ev.buttons & GINPUT_MOUSE_BTN_LEFT) { if (ev.buttons & GINPUT_MOUSE_BTN_LEFT) {
while (ev.buttons & GINPUT_MOUSE_BTN_LEFT) { // Wait until release while (ev.buttons & GINPUT_MOUSE_BTN_LEFT) { // Wait until release

View File

@ -4,16 +4,16 @@
typedef struct { // Node properties typedef struct { // Node properties
uint8_t num; // Node number, how many mines around uint8_t num; // Node number, how many mines around
bool_t open; // Node shown or hidden gBool open; // Node shown or hidden
bool_t check; // Node needs to be checked or not, used for opening up empty nodes gBool check; // Node needs to be checked or not, used for opening up empty nodes
bool_t flag; // Node is marked with flag by player gBool flag; // Node is marked with flag by player
uint16_t fieldNum; // Node number, used to randomize gamestart "animation" uint16_t fieldNum; // Node number, used to randomize gamestart "animation"
} nodeProps; } nodeProps;
static GEventMouse ev; static GEventMouse ev;
static nodeProps minesField[MINES_FIELD_WIDTH][MINES_FIELD_HEIGHT]; // Mines field array static nodeProps minesField[MINES_FIELD_WIDTH][MINES_FIELD_HEIGHT]; // Mines field array
static bool_t minesGameOver = FALSE; static gBool minesGameOver = gFalse;
static bool_t minesGameWinner = FALSE; static gBool minesGameWinner = gFalse;
static int16_t minesEmptyNodes; // Empty node counter static int16_t minesEmptyNodes; // Empty node counter
static int16_t minesFlags; // Flag counter static int16_t minesFlags; // Flag counter
static int16_t minesTime; // Time counter static int16_t minesTime; // Time counter
@ -22,8 +22,8 @@ static const char* minesGraph[] = {"1.bmp","2.bmp","3.bmp","4.bmp","5.bmp","6.bm
static gdispImage minesImage; static gdispImage minesImage;
static uint8_t minesStatusIconWidth = 0; static uint8_t minesStatusIconWidth = 0;
static uint8_t minesStatusIconHeight = 0; static uint8_t minesStatusIconHeight = 0;
static bool_t minesFirstGame = TRUE; // Just don't clear field for the first time, as we have black screen already... :/ static gBool minesFirstGame = gTrue; // Just don't clear field for the first time, as we have black screen already... :/
static bool_t minesSplashTxtVisible = FALSE; static gBool minesSplashTxtVisible = gFalse;
#if MINES_SHOW_SPLASH #if MINES_SHOW_SPLASH
static GTimer minesSplashBlink; static GTimer minesSplashBlink;
#endif #endif
@ -125,19 +125,19 @@ static void minesTimeCounter(void* arg)
minesUpdateTime(); minesUpdateTime();
} }
static bool_t inRange(int16_t x, int16_t y) static gBool inRange(int16_t x, int16_t y)
{ {
if ((x >= 0) && (x < MINES_FIELD_WIDTH) && (y >= 0) && (y < MINES_FIELD_HEIGHT)) if ((x >= 0) && (x < MINES_FIELD_WIDTH) && (y >= 0) && (y < MINES_FIELD_HEIGHT))
return TRUE; return gTrue;
else else
return FALSE; return gFalse;
} }
static void showOne(int16_t x, int16_t y) static void showOne(int16_t x, int16_t y)
{ {
minesField[x][y].open = TRUE; minesField[x][y].open = gTrue;
if (minesField[x][y].flag) { if (minesField[x][y].flag) {
minesField[x][y].flag = FALSE; minesField[x][y].flag = gFalse;
minesFlags--; minesFlags--;
} }
@ -149,8 +149,8 @@ static void showOne(int16_t x, int16_t y)
gdispImageClose(&minesImage); gdispImageClose(&minesImage);
minesEmptyNodes--; minesEmptyNodes--;
} else if (minesField[x][y].num == 9) { } else if (minesField[x][y].num == 9) {
minesGameOver = TRUE; minesGameOver = gTrue;
minesGameWinner = FALSE; minesGameWinner = gFalse;
gdispImageOpenFile(&minesImage, minesGraph[10]); gdispImageOpenFile(&minesImage, minesGraph[10]);
gdispImageDraw(&minesImage, (x*MINES_CELL_HEIGHT)+1, (y*MINES_CELL_WIDTH)+1, MINES_CELL_WIDTH, MINES_CELL_HEIGHT, 0, 0); gdispImageDraw(&minesImage, (x*MINES_CELL_HEIGHT)+1, (y*MINES_CELL_WIDTH)+1, MINES_CELL_WIDTH, MINES_CELL_HEIGHT, 0, 0);
gdispImageClose(&minesImage); gdispImageClose(&minesImage);
@ -160,7 +160,7 @@ static void showOne(int16_t x, int16_t y)
gdispImageOpenFile(&minesImage, minesGraph[9]); gdispImageOpenFile(&minesImage, minesGraph[9]);
gdispImageDraw(&minesImage, (x*MINES_CELL_HEIGHT)+1, (y*MINES_CELL_WIDTH)+1, MINES_CELL_WIDTH, MINES_CELL_HEIGHT, 0, 0); gdispImageDraw(&minesImage, (x*MINES_CELL_HEIGHT)+1, (y*MINES_CELL_WIDTH)+1, MINES_CELL_WIDTH, MINES_CELL_HEIGHT, 0, 0);
gdispImageClose(&minesImage); gdispImageClose(&minesImage);
minesField[x][y].check = TRUE; minesField[x][y].check = gTrue;
minesEmptyNodes--; minesEmptyNodes--;
} }
} }
@ -168,10 +168,10 @@ static void showOne(int16_t x, int16_t y)
static void openEmptyNodes(void) static void openEmptyNodes(void)
{ {
int16_t x, y, i, j; int16_t x, y, i, j;
bool_t needToCheck = TRUE; gBool needToCheck = gTrue;
while (needToCheck) { while (needToCheck) {
needToCheck = FALSE; needToCheck = gFalse;
for (x = 0; x < MINES_FIELD_WIDTH; x++) { for (x = 0; x < MINES_FIELD_WIDTH; x++) {
for (y = 0; y < MINES_FIELD_HEIGHT; y++) { for (y = 0; y < MINES_FIELD_HEIGHT; y++) {
if (minesField[x][y].check) { if (minesField[x][y].check) {
@ -180,12 +180,12 @@ static void openEmptyNodes(void)
if ((i != 0) || (j != 0)) { // We don't need to check middle node as it is the one we are checking right now! :D if ((i != 0) || (j != 0)) { // We don't need to check middle node as it is the one we are checking right now! :D
if (inRange(x+i,y+j)) { if (inRange(x+i,y+j)) {
if (!minesField[x+i][y+j].open) showOne(x+i,y+j); if (!minesField[x+i][y+j].open) showOne(x+i,y+j);
if (minesField[x+i][y+j].check) needToCheck = TRUE; if (minesField[x+i][y+j].check) needToCheck = gTrue;
} }
} }
} }
} }
minesField[x][y].check = FALSE; minesField[x][y].check = gFalse;
} }
} }
} }
@ -196,15 +196,15 @@ static DECLARE_THREAD_FUNCTION(thdMines, msg)
{ {
(void)msg; (void)msg;
uint16_t x,y, delay; uint16_t x,y, delay;
bool_t delayed = FALSE; gBool delayed = gFalse;
while (!minesGameOver) { while (!minesGameOver) {
if (minesEmptyNodes == 0) { if (minesEmptyNodes == 0) {
minesGameOver = TRUE; minesGameOver = gTrue;
minesGameWinner = TRUE; minesGameWinner = gTrue;
} }
initRng(); initRng();
ginputGetMouseStatus(0, &ev); ginputGetMouseStatus(0, &ev);
delayed = FALSE; delayed = gFalse;
if (ev.buttons & GINPUT_MOUSE_BTN_LEFT) { if (ev.buttons & GINPUT_MOUSE_BTN_LEFT) {
x = ev.x/MINES_CELL_WIDTH; x = ev.x/MINES_CELL_WIDTH;
y = ev.y/MINES_CELL_WIDTH; y = ev.y/MINES_CELL_WIDTH;
@ -220,18 +220,18 @@ static DECLARE_THREAD_FUNCTION(thdMines, msg)
gdispImageOpenFile(&minesImage, minesGraph[8]); gdispImageOpenFile(&minesImage, minesGraph[8]);
gdispImageDraw(&minesImage, (x*MINES_CELL_HEIGHT)+1, (y*MINES_CELL_WIDTH)+1, MINES_CELL_WIDTH-1, MINES_CELL_HEIGHT-1, 0, 0); gdispImageDraw(&minesImage, (x*MINES_CELL_HEIGHT)+1, (y*MINES_CELL_WIDTH)+1, MINES_CELL_WIDTH-1, MINES_CELL_HEIGHT-1, 0, 0);
gdispImageClose(&minesImage); gdispImageClose(&minesImage);
minesField[x][y].flag = FALSE; minesField[x][y].flag = gFalse;
minesFlags--; minesFlags--;
printStats(); printStats();
} else { } else {
gdispImageOpenFile(&minesImage, minesGraph[11]); gdispImageOpenFile(&minesImage, minesGraph[11]);
gdispImageDraw(&minesImage, (x*MINES_CELL_HEIGHT)+1, (y*MINES_CELL_WIDTH)+1, MINES_CELL_WIDTH, MINES_CELL_HEIGHT, 0, 0); gdispImageDraw(&minesImage, (x*MINES_CELL_HEIGHT)+1, (y*MINES_CELL_WIDTH)+1, MINES_CELL_WIDTH, MINES_CELL_HEIGHT, 0, 0);
gdispImageClose(&minesImage); gdispImageClose(&minesImage);
minesField[x][y].flag = TRUE; minesField[x][y].flag = gTrue;
minesFlags++; minesFlags++;
printStats(); printStats();
} }
delayed = TRUE; delayed = gTrue;
} }
} }
} }
@ -268,7 +268,7 @@ static void initField(void)
int16_t x, y, mines, i, j; int16_t x, y, mines, i, j;
minesFlags = 0; minesFlags = 0;
minesGameOver = FALSE; minesGameOver = gFalse;
printGameOver(); printGameOver();
font_t font = gdispOpenFont("fixed_5x8"); font_t font = gdispOpenFont("fixed_5x8");
@ -291,9 +291,9 @@ static void initField(void)
for (x = 0; x < MINES_FIELD_WIDTH; x++) { for (x = 0; x < MINES_FIELD_WIDTH; x++) {
for (y = 0; y < MINES_FIELD_HEIGHT; y++) { for (y = 0; y < MINES_FIELD_HEIGHT; y++) {
minesField[x][y].num = 0; minesField[x][y].num = 0;
minesField[x][y].open = FALSE; minesField[x][y].open = gFalse;
minesField[x][y].check = FALSE; minesField[x][y].check = gFalse;
minesField[x][y].flag = FALSE; minesField[x][y].flag = gFalse;
minesField[x][y].fieldNum = i; minesField[x][y].fieldNum = i;
i++; i++;
} }
@ -322,7 +322,7 @@ static void initField(void)
} }
} }
} else { } else {
minesFirstGame = FALSE; minesFirstGame = gFalse;
} }
// Drawing closed nodes randomly // Drawing closed nodes randomly
@ -369,7 +369,7 @@ static void initField(void)
minesTime = 0; minesTime = 0;
minesUpdateTime(); minesUpdateTime();
gtimerStart(&minesTimeCounterTimer, minesTimeCounter, 0, TRUE, 1000); gtimerStart(&minesTimeCounterTimer, minesTimeCounter, 0, gTrue, 1000);
} }
void minesStart(void) void minesStart(void)
@ -434,7 +434,7 @@ void minesStart(void)
gdispImageDraw(&minesImage, (gdispGetWidth()/2)-150, (gdispGetHeight()/2)-100, 300, 200, 0, 0); gdispImageDraw(&minesImage, (gdispGetWidth()/2)-150, (gdispGetHeight()/2)-100, 300, 200, 0, 0);
gdispImageClose(&minesImage); gdispImageClose(&minesImage);
gtimerStart(&minesSplashBlink, minesSplashBlinker, 0, TRUE, 400); gtimerStart(&minesSplashBlink, minesSplashBlinker, 0, gTrue, 400);
} }
#endif #endif

View File

@ -111,7 +111,7 @@ static GFXINLINE void post_init_board(GDisplay *g) {
(void) 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) g;
(void) state; (void) state;
} }

View File

@ -26,7 +26,7 @@ static GFXINLINE void init_board(void)
spiStart(&SPID1, &spicfg); spiStart(&SPID1, &spicfg);
} }
static GFXINLINE bool_t getpin_pressed(void) static GFXINLINE gBool getpin_pressed(void)
{ {
return (!palReadPad(GPIOC, 4)); return (!palReadPad(GPIOC, 4));
} }

View File

@ -45,12 +45,12 @@ static const SPIConfig spicfg = {
// How much extra data to allocate at the end of the GMouse structure for the board's use // 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 #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; (void)m;
// Only one touch interface on this board // Only one touch interface on this board
if (driverinstance) if (driverinstance)
return FALSE; return gFalse;
// Set the GPIO modes // Set the GPIO modes
palSetPadMode(GPIOC, 6, PAL_MODE_OUTPUT_PUSHPULL); palSetPadMode(GPIOC, 6, PAL_MODE_OUTPUT_PUSHPULL);
@ -62,10 +62,10 @@ static bool_t init_board(GMouse* m, unsigned driverinstance) {
// Start the SPI peripheral // Start the SPI peripheral
spiStart(&SPID1, &spicfg); spiStart(&SPID1, &spicfg);
return TRUE; return gTrue;
} }
static GFXINLINE bool_t getpin_pressed(GMouse* m) { static GFXINLINE gBool getpin_pressed(GMouse* m) {
(void) m; (void) m;
return (!palReadPad(GPIOC, 4)); return (!palReadPad(GPIOC, 4));

View File

@ -22,13 +22,13 @@ static const SPIConfig spicfg = {
/* SPI_CR1_BR_2 |*/ SPI_CR1_BR_1 | SPI_CR1_BR_0, /* 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; (void)m;
// Only one touch interface on this board // Only one touch interface on this board
if (driverinstance) if (driverinstance)
return FALSE; return gFalse;
// Set the GPIO modes // Set the GPIO modes
palSetPadMode(GPIOC, 6, PAL_MODE_OUTPUT_PUSHPULL); palSetPadMode(GPIOC, 6, PAL_MODE_OUTPUT_PUSHPULL);
@ -40,10 +40,10 @@ static bool_t init_board(GMouse* m, unsigned driverinstance)
// Start the SPI peripheral // Start the SPI peripheral
spiStart(&SPID1, &spicfg); spiStart(&SPID1, &spicfg);
return TRUE; return gTrue;
} }
GFXINLINE bool_t getpin_pressed(void) { GFXINLINE gBool getpin_pressed(void) {
return (!palReadPad(GPIOC, 4)); return (!palReadPad(GPIOC, 4));
} }

View File

@ -109,7 +109,7 @@ static GFXINLINE void post_init_board(GDisplay *g) {
(void) 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) g;
(void) state; (void) state;
} }

View File

@ -26,7 +26,7 @@ static GFXINLINE void init_board(void)
spiStart(&SPID1, &spicfg); spiStart(&SPID1, &spicfg);
} }
static GFXINLINE bool_t getpin_pressed(void) static GFXINLINE gBool getpin_pressed(void)
{ {
return (!palReadPad(GPIOC, 4)); return (!palReadPad(GPIOC, 4));
} }

View File

@ -22,13 +22,13 @@ static const SPIConfig spicfg = {
/* SPI_CR1_BR_2 |*/ SPI_CR1_BR_1 | SPI_CR1_BR_0, /* 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; (void)m;
// Only one touch interface on this board // Only one touch interface on this board
if (driverinstance) if (driverinstance)
return FALSE; return gFalse;
// Set the GPIO modes // Set the GPIO modes
palSetPadMode(GPIOC, 6, PAL_MODE_OUTPUT_PUSHPULL); palSetPadMode(GPIOC, 6, PAL_MODE_OUTPUT_PUSHPULL);
@ -40,10 +40,10 @@ static bool_t init_board(GMouse* m, unsigned driverinstance)
// Start the SPI peripheral // Start the SPI peripheral
spiStart(&SPID1, &spicfg); spiStart(&SPID1, &spicfg);
return TRUE; return gTrue;
} }
GFXINLINE bool_t getpin_pressed(void) { GFXINLINE gBool getpin_pressed(void) {
return (!palReadPad(GPIOC, 4)); return (!palReadPad(GPIOC, 4));
} }

View File

@ -43,7 +43,7 @@ int main(void)
tetrisInit(); tetrisInit();
while (TRUE) { while (1) {
// Start a new game // Start a new game
// Will return when game is over // Will return when game is over
tetrisStart(); tetrisStart();

View File

@ -86,9 +86,9 @@ int tetrisOldShape[4][2];
int tetrisNextShapeNum, tetrisOldShapeNum; int tetrisNextShapeNum, tetrisOldShapeNum;
unsigned long tetrisLines = 0; unsigned long tetrisLines = 0;
unsigned long tetrisScore = 0; unsigned long tetrisScore = 0;
bool_t tetrisKeysPressed[5] = {FALSE, FALSE, FALSE, FALSE, FALSE}; // left/down/right/up/pause gBool tetrisKeysPressed[5] = {gFalse, gFalse, gFalse, gFalse, gFalse}; // left/down/right/up/pause
bool_t tetrisPaused = FALSE; gBool tetrisPaused = gFalse;
bool_t tetrisGameOver = FALSE; gBool tetrisGameOver = gFalse;
font_t font16; font_t font16;
font_t font12; font_t font12;
@ -274,34 +274,34 @@ static void printTouchAreas(void) {
gdispDrawLine(gdispGetWidth()-(gdispGetWidth()/4), gdispGetHeight()-gdispGetHeight()/4, gdispGetWidth()-(gdispGetWidth()/4), gdispGetHeight()-1, GFX_GRAY); gdispDrawLine(gdispGetWidth()-(gdispGetWidth()/4), gdispGetHeight()-gdispGetHeight()/4, gdispGetWidth()-(gdispGetWidth()/4), gdispGetHeight()-1, GFX_GRAY);
} }
static bool_t stay(bool_t down) { static gBool stay(gBool down) {
int sk, k; int sk, k;
bool_t stay; gBool stay;
if (down == TRUE) sk = 1; else sk = 0; if (down) sk = 1; else sk = 0;
stay = FALSE; stay = gFalse;
for (k = 0; k <= 3; k++) { for (k = 0; k <= 3; k++) {
if (tetrisCurrentShape[k][1] == 0) { if (tetrisCurrentShape[k][1] == 0) {
return TRUE; return gTrue;
} }
} }
for (k = 0; k <= 3; k++) { for (k = 0; k <= 3; k++) {
if ((tetrisCurrentShape[k][0] < 0) || (tetrisCurrentShape[k][0] > 9)) return TRUE; if ((tetrisCurrentShape[k][0] < 0) || (tetrisCurrentShape[k][0] > 9)) return gTrue;
if (tetrisCurrentShape[k][1] <= 16) if (tetrisCurrentShape[k][1] <= 16)
if (tetrisField[tetrisCurrentShape[k][1]-sk][tetrisCurrentShape[k][0]] != 0) return TRUE; if (tetrisField[tetrisCurrentShape[k][1]-sk][tetrisCurrentShape[k][0]] != 0) return gTrue;
} }
return stay; return stay;
} }
static void clearCompleteLines(void) { static void clearCompleteLines(void) {
bool_t t; gBool t;
uint8_t reiz = 0; uint8_t reiz = 0;
int l,k,j; int l,k,j;
l = 0; l = 0;
while (l <= 16) { while (l <= 16) {
t = TRUE; t = gTrue;
for (j = 0; j <= 9; j++) for (j = 0; j <= 9; j++)
if (tetrisField[l][j] == 0) t = FALSE; if (tetrisField[l][j] == 0) t = gFalse;
if (t == TRUE) { if (t) {
for (j = 4; j >= 0; j--) { // cheap & dirty line removal animation :D for (j = 4; j >= 0; j--) { // cheap & dirty line removal animation :D
drawCell(j,l, 0); drawCell(j,l, 0);
drawCell(9-j,l, 0); drawCell(9-j,l, 0);
@ -331,7 +331,7 @@ static void clearCompleteLines(void) {
static void goDown(void) { static void goDown(void) {
int i; int i;
if (stay(TRUE) == FALSE) { if (!stay(gTrue)) {
drawShape(0); drawShape(0);
for (i = 0; i <= 3; i++) { for (i = 0; i <= 3; i++) {
tetrisCurrentShape[i][1]--; tetrisCurrentShape[i][1]--;
@ -340,7 +340,7 @@ static void goDown(void) {
} else { } else {
for (i = 0; i <= 3; i++) { for (i = 0; i <= 3; i++) {
if (tetrisCurrentShape[i][1] >=17) { if (tetrisCurrentShape[i][1] >=17) {
tetrisGameOver = TRUE; tetrisGameOver = gTrue;
return; return;
} else { } else {
tetrisField[tetrisCurrentShape[i][1]][tetrisCurrentShape[i][0]] = tetrisOldShapeNum+1; tetrisField[tetrisCurrentShape[i][1]][tetrisCurrentShape[i][0]] = tetrisOldShapeNum+1;
@ -348,8 +348,8 @@ static void goDown(void) {
} }
clearCompleteLines(); clearCompleteLines();
createShape(); createShape();
if (stay(FALSE) == TRUE) { if (stay(gFalse)) {
tetrisGameOver = TRUE; tetrisGameOver = gTrue;
return; return;
} }
drawShape(tetrisOldShapeNum+1); drawShape(tetrisOldShapeNum+1);
@ -383,7 +383,7 @@ static void rotateShape(void) {
tetrisCurrentShape[i][0] = ox+(round((tx-ox)*cos(90*(3.14/180))-(ty-oy)*sin(90*(3.14/180)))); tetrisCurrentShape[i][0] = ox+(round((tx-ox)*cos(90*(3.14/180))-(ty-oy)*sin(90*(3.14/180))));
tetrisCurrentShape[i][1] = oy+(round((tx-ox)*sin(90*(3.14/180))+(ty-oy)*cos(90*(3.14/180)))); tetrisCurrentShape[i][1] = oy+(round((tx-ox)*sin(90*(3.14/180))+(ty-oy)*cos(90*(3.14/180))));
} }
if (stay(FALSE) == FALSE) { if (!stay(gFalse)) {
memcpy(tetrisNextShape, tetrisCurrentShape, sizeof(tetrisNextShape)); // tetrisNextShape = tetrisCurrentShape; memcpy(tetrisNextShape, tetrisCurrentShape, sizeof(tetrisNextShape)); // tetrisNextShape = tetrisCurrentShape;
memcpy(tetrisCurrentShape, tetrisOldShape, sizeof(tetrisCurrentShape)); // tetrisCurrentShape = tetrisOldShape; memcpy(tetrisCurrentShape, tetrisOldShape, sizeof(tetrisCurrentShape)); // tetrisCurrentShape = tetrisOldShape;
drawShape(0); drawShape(0);
@ -394,20 +394,20 @@ static void rotateShape(void) {
} }
} }
static bool_t checkSides(bool_t left) { static gBool checkSides(gBool left) {
int sk,k; int sk,k;
if (left == TRUE) sk = 1; else sk = -1; if (left) sk = 1; else sk = -1;
for (k = 0; k <= 3; k++) { for (k = 0; k <= 3; k++) {
if ((tetrisCurrentShape[k][0]+sk < 0) || (tetrisCurrentShape[k][0]+sk > 9)) return TRUE; if ((tetrisCurrentShape[k][0]+sk < 0) || (tetrisCurrentShape[k][0]+sk > 9)) return gTrue;
if (tetrisCurrentShape[k][1] <= 16) if (tetrisCurrentShape[k][1] <= 16)
if (tetrisField[tetrisCurrentShape[k][1]][tetrisCurrentShape[k][0]+sk] != 0) return TRUE; if (tetrisField[tetrisCurrentShape[k][1]][tetrisCurrentShape[k][0]+sk] != 0) return gTrue;
} }
return FALSE; return gFalse;
} }
static void goRight(void) { static void goRight(void) {
int i; int i;
if (checkSides(TRUE) == FALSE) { if (!checkSides(gTrue)) {
drawShape(0); drawShape(0);
for (i = 0; i <= 3; i++) { for (i = 0; i <= 3; i++) {
tetrisCurrentShape[i][0]++; tetrisCurrentShape[i][0]++;
@ -418,7 +418,7 @@ static void goRight(void) {
static void goLeft(void) { static void goLeft(void) {
int i; int i;
if (checkSides(FALSE) == FALSE) { if (!checkSides(gFalse)) {
drawShape(0); drawShape(0);
for (i = 0; i <= 3; i++) { for (i = 0; i <= 3; i++) {
tetrisCurrentShape[i][0]--; tetrisCurrentShape[i][0]--;
@ -434,8 +434,8 @@ static DECLARE_THREAD_FUNCTION(thdTetris, arg) {
// key handling // key handling
if (gfxSystemTicks() - tetrisPreviousKeyTime >= gfxMillisecondsToTicks(tetrisKeySpeed) || gfxSystemTicks() <= gfxMillisecondsToTicks(tetrisKeySpeed)) { if (gfxSystemTicks() - tetrisPreviousKeyTime >= gfxMillisecondsToTicks(tetrisKeySpeed) || gfxSystemTicks() <= gfxMillisecondsToTicks(tetrisKeySpeed)) {
for (i = 0; i < sizeof(tetrisKeysPressed); i++) { for (i = 0; i < sizeof(tetrisKeysPressed); i++) {
if (tetrisKeysPressed[i] == TRUE) { if (tetrisKeysPressed[i]) {
tetrisKeysPressed[i] = FALSE; tetrisKeysPressed[i] = gFalse;
} }
} }
tetrisPreviousKeyTime = gfxSystemTicks(); tetrisPreviousKeyTime = gfxSystemTicks();
@ -447,28 +447,28 @@ static DECLARE_THREAD_FUNCTION(thdTetris, arg) {
tetrisPreviousGameTime = gfxSystemTicks(); tetrisPreviousGameTime = gfxSystemTicks();
} }
if (!(ev.buttons & GINPUT_MOUSE_BTN_LEFT)) continue; if (!(ev.buttons & GINPUT_MOUSE_BTN_LEFT)) continue;
if (ev.x <= gdispGetWidth()/4 && ev.y >= gdispGetHeight()-(gdispGetHeight()/4) && tetrisKeysPressed[0] == FALSE && !tetrisPaused) { if (ev.x <= gdispGetWidth()/4 && ev.y >= gdispGetHeight()-(gdispGetHeight()/4) && !tetrisKeysPressed[0] && !tetrisPaused) {
goLeft(); goLeft();
tetrisKeysPressed[0] = TRUE; tetrisKeysPressed[0] = gTrue;
tetrisPreviousKeyTime = gfxSystemTicks(); tetrisPreviousKeyTime = gfxSystemTicks();
} }
if (ev.x > gdispGetWidth()-(gdispGetWidth()/4) && ev.y >= gdispGetHeight()-(gdispGetHeight()/4) && tetrisKeysPressed[2] == FALSE && !tetrisPaused) { if (ev.x > gdispGetWidth()-(gdispGetWidth()/4) && ev.y >= gdispGetHeight()-(gdispGetHeight()/4) && !tetrisKeysPressed[2] && !tetrisPaused) {
goRight(); goRight();
tetrisKeysPressed[2] = TRUE; tetrisKeysPressed[2] = gTrue;
tetrisPreviousKeyTime = gfxSystemTicks(); tetrisPreviousKeyTime = gfxSystemTicks();
} }
if (ev.y > gdispGetHeight()/4 && ev.y < gdispGetHeight()-(gdispGetHeight()/4) && tetrisKeysPressed[3] == FALSE && !tetrisPaused) { if (ev.y > gdispGetHeight()/4 && ev.y < gdispGetHeight()-(gdispGetHeight()/4) && !tetrisKeysPressed[3] && !tetrisPaused) {
rotateShape(); rotateShape();
tetrisKeysPressed[3] = TRUE; tetrisKeysPressed[3] = gTrue;
tetrisPreviousKeyTime = gfxSystemTicks(); tetrisPreviousKeyTime = gfxSystemTicks();
} }
if (ev.x > gdispGetWidth()/4 && ev.x <= gdispGetWidth()-(gdispGetWidth()/4) && ev.y >= gdispGetHeight()-(gdispGetHeight()/4) && tetrisKeysPressed[1] == FALSE && !tetrisPaused) { if (ev.x > gdispGetWidth()/4 && ev.x <= gdispGetWidth()-(gdispGetWidth()/4) && ev.y >= gdispGetHeight()-(gdispGetHeight()/4) && !tetrisKeysPressed[1] && !tetrisPaused) {
goDown(); goDown();
tetrisKeysPressed[1] = TRUE; tetrisKeysPressed[1] = gTrue;
tetrisPreviousKeyTime = gfxSystemTicks(); tetrisPreviousKeyTime = gfxSystemTicks();
} }
if (ev.y <= gdispGetHeight()/4 && tetrisKeysPressed[4] == FALSE) { if (ev.y <= gdispGetHeight()/4 && !tetrisKeysPressed[4]) {
tetrisKeysPressed[4] = TRUE; tetrisKeysPressed[4] = gTrue;
tetrisPaused = !tetrisPaused; tetrisPaused = !tetrisPaused;
printPaused(); printPaused();
tetrisPreviousKeyTime = gfxSystemTicks(); tetrisPreviousKeyTime = gfxSystemTicks();
@ -495,8 +495,8 @@ void tetrisStart(void) {
// Away we go // Away we go
initField(); initField();
tetrisGameOver = FALSE; tetrisGameOver = gFalse;
printGameOver(); // removes "Game Over!" if tetrisGameOver == FALSE printGameOver(); // removes "Game Over!" if tetrisGameOver == gFalse
tetrisPreviousGameTime = gfxSystemTicks(); tetrisPreviousGameTime = gfxSystemTicks();
gfxThreadCreate(0, 1024, NORMAL_PRIORITY, thdTetris, 0); gfxThreadCreate(0, 1024, NORMAL_PRIORITY, thdTetris, 0);
while (!tetrisGameOver) { while (!tetrisGameOver) {

View File

@ -89,10 +89,10 @@ void gwinScopeWaitForTrace(GHandle gh) {
GDataBuffer *pd; GDataBuffer *pd;
uint8_t shr; uint8_t shr;
#if TRIGGER_METHOD == TRIGGER_POSITIVERAMP #if TRIGGER_METHOD == TRIGGER_POSITIVERAMP
bool_t rdytrigger; gBool rdytrigger;
int flsamples; int flsamples;
#elif TRIGGER_METHOD == TRIGGER_MINVALUE #elif TRIGGER_METHOD == TRIGGER_MINVALUE
bool_t rdytrigger; gBool rdytrigger;
int flsamples; int flsamples;
coord_t scopemin; coord_t scopemin;
#endif #endif
@ -116,10 +116,10 @@ void gwinScopeWaitForTrace(GHandle gh) {
pc = gs->lastscopetrace+x; pc = gs->lastscopetrace+x;
pa = (adcsample_t *)(pd+1); pa = (adcsample_t *)(pd+1);
#if TRIGGER_METHOD == TRIGGER_POSITIVERAMP #if TRIGGER_METHOD == TRIGGER_POSITIVERAMP
rdytrigger = FALSE; rdytrigger = gFalse;
flsamples = 0; flsamples = 0;
#elif TRIGGER_METHOD == TRIGGER_MINVALUE #elif TRIGGER_METHOD == TRIGGER_MINVALUE
rdytrigger = FALSE; rdytrigger = gFalse;
flsamples = 0; flsamples = 0;
scopemin = 0; scopemin = 0;
#endif #endif
@ -144,7 +144,7 @@ void gwinScopeWaitForTrace(GHandle gh) {
#if TRIGGER_METHOD == TRIGGER_MINVALUE #if TRIGGER_METHOD == TRIGGER_MINVALUE
/* Arm when we reach the sample minimum (y value maximum) of the previous trace */ /* Arm when we reach the sample minimum (y value maximum) of the previous trace */
if (!rdytrigger && y >= gs->scopemin) if (!rdytrigger && y >= gs->scopemin)
rdytrigger = TRUE; rdytrigger = gTrue;
#endif #endif
if (y == gs->lasty) { if (y == gs->lasty) {
@ -157,7 +157,7 @@ void gwinScopeWaitForTrace(GHandle gh) {
flsamples = 0; flsamples = 0;
#if TRIGGER_METHOD == TRIGGER_POSITIVERAMP #if TRIGGER_METHOD == TRIGGER_POSITIVERAMP
/* Arm the trigger when samples fall (y increases) ie. negative slope */ /* Arm the trigger when samples fall (y increases) ie. negative slope */
rdytrigger = TRUE; rdytrigger = gTrue;
#endif #endif
continue; continue;
} else { } else {
@ -169,7 +169,7 @@ void gwinScopeWaitForTrace(GHandle gh) {
} }
/* Ready for a the next trigger cycle */ /* Ready for a the next trigger cycle */
rdytrigger = FALSE; rdytrigger = gFalse;
#endif #endif
/* Prepare for a scope trace */ /* Prepare for a scope trace */

View File

@ -154,7 +154,7 @@ int main(void) {
GWindowInit wi; GWindowInit wi;
gwinClearInit(&wi); gwinClearInit(&wi);
wi.show = TRUE; wi.show = gTrue;
wi.x = wi.y = 0; wi.x = wi.y = 0;
wi.width = swidth-SCOPE_CX; wi.width = swidth-SCOPE_CX;
wi.height = sheight; wi.height = sheight;
@ -166,7 +166,7 @@ int main(void) {
/* Start our timer for reading the dial */ /* Start our timer for reading the dial */
gtimerInit(&lsTimer); gtimerInit(&lsTimer);
gtimerStart(&lsTimer, LowSpeedTimer, ghText, TRUE, MY_LS_DELAY); gtimerStart(&lsTimer, LowSpeedTimer, ghText, gTrue, MY_LS_DELAY);
#endif #endif
/** /**
@ -188,7 +188,7 @@ int main(void) {
GWindowInit wi; GWindowInit wi;
gwinClearInit(&wi); gwinClearInit(&wi);
wi.show = TRUE; wi.show = gTrue;
wi.x = swidth-SCOPE_CX; wi.x = swidth-SCOPE_CX;
wi.y = 0; wi.y = 0;
wi.width = SCOPE_CX; wi.width = SCOPE_CX;
@ -200,7 +200,7 @@ int main(void) {
gwinClear(ghScope); gwinClear(ghScope);
/* Just keep displaying the scope traces */ /* Just keep displaying the scope traces */
while (TRUE) { while (1) {
/** /**
* The function below internally performs a wait thus giving the timer thread a * The function below internally performs a wait thus giving the timer thread a
* chance to run. * chance to run.

View File

@ -106,10 +106,10 @@ void gwinScopeWaitForTrace(GHandle gh) {
uint8_t shr; uint8_t shr;
#if TRIGGER_METHOD == TRIGGER_POSITIVERAMP #if TRIGGER_METHOD == TRIGGER_POSITIVERAMP
bool_t rdytrigger; gBool rdytrigger;
int flsamples; int flsamples;
#elif TRIGGER_METHOD == TRIGGER_MINVALUE #elif TRIGGER_METHOD == TRIGGER_MINVALUE
bool_t rdytrigger; gBool rdytrigger;
int flsamples; int flsamples;
coord_t scopemin; coord_t scopemin;
#endif #endif
@ -136,10 +136,10 @@ void gwinScopeWaitForTrace(GHandle gh) {
pa16 = (uint16_t *)(paud+1); pa16 = (uint16_t *)(paud+1);
#if TRIGGER_METHOD == TRIGGER_POSITIVERAMP #if TRIGGER_METHOD == TRIGGER_POSITIVERAMP
rdytrigger = FALSE; rdytrigger = gFalse;
flsamples = 0; flsamples = 0;
#elif TRIGGER_METHOD == TRIGGER_MINVALUE #elif TRIGGER_METHOD == TRIGGER_MINVALUE
rdytrigger = FALSE; rdytrigger = gFalse;
flsamples = 0; flsamples = 0;
scopemin = 0; scopemin = 0;
#endif #endif
@ -167,7 +167,7 @@ void gwinScopeWaitForTrace(GHandle gh) {
#if TRIGGER_METHOD == TRIGGER_MINVALUE #if TRIGGER_METHOD == TRIGGER_MINVALUE
/* Arm when we reach the sample minimum (y value maximum) of the previous trace */ /* Arm when we reach the sample minimum (y value maximum) of the previous trace */
if (!rdytrigger && y >= gs->scopemin) if (!rdytrigger && y >= gs->scopemin)
rdytrigger = TRUE; rdytrigger = gTrue;
#endif #endif
if (y == gs->lasty) { if (y == gs->lasty) {
@ -180,7 +180,7 @@ void gwinScopeWaitForTrace(GHandle gh) {
flsamples = 0; flsamples = 0;
#if TRIGGER_METHOD == TRIGGER_POSITIVERAMP #if TRIGGER_METHOD == TRIGGER_POSITIVERAMP
/* Arm the trigger when samples fall (y increases) ie. negative slope */ /* Arm the trigger when samples fall (y increases) ie. negative slope */
rdytrigger = TRUE; rdytrigger = gTrue;
#endif #endif
continue; continue;
} else { } else {
@ -192,7 +192,7 @@ void gwinScopeWaitForTrace(GHandle gh) {
} }
/* Ready for a the next trigger cycle */ /* Ready for a the next trigger cycle */
rdytrigger = FALSE; rdytrigger = gFalse;
#endif #endif
/* Prepare for a scope trace */ /* Prepare for a scope trace */

View File

@ -74,7 +74,7 @@ int main(void) {
GWindowInit wi; GWindowInit wi;
gwinClearInit(&wi); gwinClearInit(&wi);
wi.show = TRUE; wi.show = gTrue;
wi.x = wi.y = 0; wi.x = wi.y = 0;
wi.width = swidth; wi.height = sheight; wi.width = swidth; wi.height = sheight;
ghScope = gwinScopeCreate(&gScopeWindow, &wi, MY_AUDIO_CHANNEL, MY_AUDIO_FREQUENCY, MY_AUDIO_FORMAT); ghScope = gwinScopeCreate(&gScopeWindow, &wi, MY_AUDIO_CHANNEL, MY_AUDIO_FREQUENCY, MY_AUDIO_FORMAT);
@ -84,7 +84,7 @@ int main(void) {
gwinClear(ghScope); gwinClear(ghScope);
/* Just keep displaying the scope traces */ /* Just keep displaying the scope traces */
while (TRUE) { while (1) {
gwinScopeWaitForTrace(ghScope); gwinScopeWaitForTrace(ghScope);
} }
} }

View File

@ -114,6 +114,6 @@ theend:
if (errmsg) if (errmsg)
gdispDrawString(0, gdispGetHeight()/2, errmsg, font, GFX_RED); gdispDrawString(0, gdispGetHeight()/2, errmsg, font, GFX_RED);
while(TRUE) while(1)
gfxSleepMilliseconds(1000); gfxSleepMilliseconds(1000);
} }

View File

@ -139,7 +139,7 @@ repeatplay:
len += 20; len += 20;
// Read RIFF blocks until we get to the data RIFF block (contains the audio) // Read RIFF blocks until we get to the data RIFF block (contains the audio)
while(TRUE) { while(1) {
if (gfileRead(f, whdr, 8) != 8) { if (gfileRead(f, whdr, 8) != 8) {
errmsg = "Err: Read block"; errmsg = "Err: Read block";
goto theend; goto theend;
@ -196,6 +196,6 @@ theend:
if (errmsg) if (errmsg)
gdispDrawString(0, gdispGetHeight()/2, errmsg, font, GFX_RED); gdispDrawString(0, gdispGetHeight()/2, errmsg, font, GFX_RED);
while(TRUE) while(1)
gfxSleepMilliseconds(1000); gfxSleepMilliseconds(1000);
} }

View File

@ -48,7 +48,7 @@ int main(void) {
for(i = 5, j = 0; i < width && j < height; i += 7, j += i/20) for(i = 5, j = 0; i < width && j < height; i += 7, j += i/20)
gdispDrawPixel(i, j, GFX_WHITE); gdispDrawPixel(i, j, GFX_WHITE);
while(TRUE) { while(1) {
gfxSleepMilliseconds(500); gfxSleepMilliseconds(500);
} }
} }

View File

@ -47,7 +47,7 @@ int main(void) {
gdispFillEllipse (width-width/6, height-height/6, width/8, height/16, GFX_BLUE); gdispFillEllipse (width-width/6, height-height/6, width/8, height/16, GFX_BLUE);
gdispDrawEllipse (width-width/6, height-height/6, width/16, height/8, GFX_YELLOW); gdispDrawEllipse (width-width/6, height-height/6, width/16, height/8, GFX_YELLOW);
while(TRUE) { while(1) {
gfxSleepMilliseconds(500); gfxSleepMilliseconds(500);
} }
} }

View File

@ -88,7 +88,7 @@ int main(void) {
gdispFillStringBox(0, y, width, fheight1, buf, font1, GFX_RED, GFX_WHITE, justifyCenter); gdispFillStringBox(0, y, width, fheight1, buf, font1, GFX_RED, GFX_WHITE, justifyCenter);
// Wait forever // Wait forever
while(TRUE) { while(1) {
gfxSleepMilliseconds(500); gfxSleepMilliseconds(500);
} }
} }

View File

@ -42,7 +42,7 @@ int main(void) {
gdispDrawString(10, 10, "привет мир", font1, GFX_YELLOW); gdispDrawString(10, 10, "привет мир", font1, GFX_YELLOW);
// Wait forever // Wait forever
while(TRUE) { while(1) {
gfxSleepMilliseconds(500); gfxSleepMilliseconds(500);
} }
} }

View File

@ -83,7 +83,7 @@
gdispGDrawPixel(g, i, j, GFX_WHITE); gdispGDrawPixel(g, i, j, GFX_WHITE);
} }
while(TRUE) { while(1) {
gfxSleepMilliseconds(500); gfxSleepMilliseconds(500);
} }
} }
@ -126,7 +126,7 @@
gdispDrawPixel(i, j, GFX_WHITE); gdispDrawPixel(i, j, GFX_WHITE);
} }
while(TRUE) { while(1) {
gfxSleepMilliseconds(500); gfxSleepMilliseconds(500);
} }
} }

View File

@ -62,7 +62,7 @@ int main(void) {
gdispGDrawLine(pixmap, 0, 0, gdispGGetWidth(pixmap)-1, gdispGGetHeight(pixmap)-1, GFX_WHITE); gdispGDrawLine(pixmap, 0, 0, gdispGGetWidth(pixmap)-1, gdispGGetHeight(pixmap)-1, GFX_WHITE);
i = j = 0; i = j = 0;
while(TRUE) { while(1) {
// Clear the old position // Clear the old position
gdispFillArea(i, j, PIXMAP_WIDTH, PIXMAP_HEIGHT, GFX_BLACK); gdispFillArea(i, j, PIXMAP_WIDTH, PIXMAP_HEIGHT, GFX_BLACK);

View File

@ -103,7 +103,7 @@ int main(void) {
transmaxy = INT2MTYPE(height - 15); transmaxy = INT2MTYPE(height - 15);
transminy = INT2MTYPE(15); transminy = INT2MTYPE(15);
while(TRUE) { while(1) {
// Move to the new location, rotation and scale // Move to the new location, rotation and scale
scalex += scaleincx; scalex += scaleincx;

View File

@ -43,7 +43,7 @@ int main(void)
// Initialize the uGFX library // Initialize the uGFX library
gfxInit(); gfxInit();
while(TRUE) { while(1) {
// Clear the entire screen // Clear the entire screen
gdispClear(GFX_BLACK); gdispClear(GFX_BLACK);

View File

@ -54,7 +54,7 @@ int main(void) {
GWindowInit wi; GWindowInit wi;
gwinClearInit(&wi); gwinClearInit(&wi);
wi.show = TRUE; wi.show = gTrue;
wi.x = 0; wi.y = 0; wi.width = gdispGetWidth(); wi.height = gdispGetHeight(); wi.x = 0; wi.y = 0; wi.width = gdispGetWidth(); wi.height = gdispGetHeight();
GW = gwinConsoleCreate(0, &wi); GW = gwinConsoleCreate(0, &wi);

View File

@ -26,7 +26,7 @@ threadreturn_t heartbeat1(void* param)
{ {
(void)param; (void)param;
while (TRUE) { while (1) {
DEBUGWRITE("thread 1\n"); DEBUGWRITE("thread 1\n");
gfxSleepMilliseconds(500); gfxSleepMilliseconds(500);
} }
@ -38,7 +38,7 @@ threadreturn_t heartbeat2(void* param)
{ {
(void)param; (void)param;
while (TRUE) { while (1) {
DEBUGWRITE("thread 2\n"); DEBUGWRITE("thread 2\n");
gfxSleepMilliseconds(900); gfxSleepMilliseconds(900);
} }
@ -54,7 +54,7 @@ int main(void)
gfxThreadCreate(0, 2048, NORMAL_PRIORITY, heartbeat1, 0); gfxThreadCreate(0, 2048, NORMAL_PRIORITY, heartbeat1, 0);
gfxThreadCreate(0, 2048, NORMAL_PRIORITY, heartbeat2, 0); gfxThreadCreate(0, 2048, NORMAL_PRIORITY, heartbeat2, 0);
while (TRUE) { while (1) {
DEBUGWRITE("thread main\n"); DEBUGWRITE("thread main\n");
gfxSleepMilliseconds(1400); gfxSleepMilliseconds(1400);
} }

View File

@ -65,11 +65,11 @@ gfxThreadHandle thd;
*/ */
threadreturn_t Thread_function(void* param) threadreturn_t Thread_function(void* param)
{ {
/* Cast the paramter into a bool pointer so we can use it */ /* Cast the paramter into a gBool pointer so we can use it */
bool_t* doExit = (bool_t*)param; gBool* doExit = (gBool*)param;
/* Execute this until we shall be terminated */ /* Execute this until we shall be terminated */
while (*doExit == FALSE) { while (!*doExit) {
DEBUGWRITE("Message from Thread\n"); DEBUGWRITE("Message from Thread\n");
gfxSleepMilliseconds(500); gfxSleepMilliseconds(500);
} }
@ -84,12 +84,12 @@ threadreturn_t Thread_function(void* param)
*/ */
void timerCallback(void* param) void timerCallback(void* param)
{ {
/* Cast the paramter into a bool pointer so we can use it */ /* Cast the paramter into a gBool pointer so we can use it */
bool_t* threadExit = (bool_t*)param; gBool* threadExit = (gBool*)param;
/* Ask the Thread to fall over the end */ /* Ask the Thread to fall over the end */
DEBUGWRITE("Closing thread!\n"); DEBUGWRITE("Closing thread!\n");
*threadExit = TRUE; *threadExit = gTrue;
} }
/* /*
@ -97,7 +97,7 @@ void timerCallback(void* param)
*/ */
int main(void) int main(void)
{ {
bool_t exitThread = FALSE; gBool exitThread = gFalse;
gfxInit(); gfxInit();
@ -112,9 +112,9 @@ int main(void)
/* Start the timer. The callback function will be called once after 2000ms /* Start the timer. The callback function will be called once after 2000ms
* We will pass the thread handle as a parameter so the timer can ask the thread to terminate * We will pass the thread handle as a parameter so the timer can ask the thread to terminate
*/ */
gtimerStart(&gt, timerCallback, (void*)&exitThread, FALSE, 2000); gtimerStart(&gt, timerCallback, (void*)&exitThread, gFalse, 2000);
while(TRUE) { while(1) {
DEBUGWRITE("Message from main!\n"); DEBUGWRITE("Message from main!\n");
gfxSleepMilliseconds(500); gfxSleepMilliseconds(500);
} }

View File

@ -51,12 +51,12 @@ int main(void) {
gtimerInit(&GT2); gtimerInit(&GT2);
/* continious mode - callback1() called without any argument every 250ms */ /* continious mode - callback1() called without any argument every 250ms */
gtimerStart(&GT1, callback1, 0, TRUE, 250); gtimerStart(&GT1, callback1, 0, gTrue, 250);
/* single shot mode - callback2() called without any argument once after 1s */ /* single shot mode - callback2() called without any argument once after 1s */
gtimerStart(&GT2, callback2, 0, FALSE, 1000); gtimerStart(&GT2, callback2, 0, gFalse, 1000);
while(TRUE) { while(1) {
gfxSleepMilliseconds(500); gfxSleepMilliseconds(500);
} }

View File

@ -91,7 +91,7 @@ int main(void)
gtransSetBaseLanguage(&EnglishTranslation); gtransSetBaseLanguage(&EnglishTranslation);
// Loop through the languages // Loop through the languages
while (TRUE) { while (1) {
// English // English
gtransSetLanguage(&EnglishTranslation); gtransSetLanguage(&EnglishTranslation);
updateText(); updateText();

View File

@ -44,9 +44,9 @@ int main(void) {
GWindowInit wi; GWindowInit wi;
gwinClearInit(&wi); gwinClearInit(&wi);
wi.show = TRUE; wi.x = 20; wi.y = 10; wi.width = 200; wi.height = 150; wi.show = gTrue; wi.x = 20; wi.y = 10; wi.width = 200; wi.height = 150;
GW1 = gwinWindowCreate(0, &wi); GW1 = gwinWindowCreate(0, &wi);
wi.show = TRUE; wi.x = 50; wi.y = 190; wi.width = 150; wi.height = 100; wi.show = gTrue; wi.x = 50; wi.y = 190; wi.width = 150; wi.height = 100;
GW2 = gwinWindowCreate(0, &wi); GW2 = gwinWindowCreate(0, &wi);
} }
@ -72,7 +72,7 @@ int main(void) {
gwinFillCircle(GW1, 20, 20, 15); gwinFillCircle(GW1, 20, 20, 15);
gwinFillCircle(GW2, 20, 20, 15); gwinFillCircle(GW2, 20, 20, 15);
while(TRUE) { while(1) {
gfxSleepMilliseconds(500); gfxSleepMilliseconds(500);
} }
} }

View File

@ -37,7 +37,7 @@ static void createWidgets(void) {
// Apply some default values for GWIN // Apply some default values for GWIN
gwinWidgetClearInit(&wi); gwinWidgetClearInit(&wi);
wi.g.show = TRUE; wi.g.show = gTrue;
// Apply the button parameters // Apply the button parameters
wi.g.width = 100; wi.g.width = 100;
@ -64,7 +64,7 @@ int main(void) {
// Set the widget defaults // Set the widget defaults
gwinSetDefaultFont(gdispOpenFont("UI2")); gwinSetDefaultFont(gdispOpenFont("UI2"));
gwinSetDefaultStyle(&WhiteWidgetStyle, FALSE); gwinSetDefaultStyle(&WhiteWidgetStyle, gFalse);
gdispClear(GFX_WHITE); gdispClear(GFX_WHITE);
// create the widget // create the widget
@ -90,7 +90,7 @@ int main(void) {
// corner which should translate safely into any orientation. // corner which should translate safely into any orientation.
gdispSetOrientation(orients[which]); gdispSetOrientation(orients[which]);
gdispClear(GFX_WHITE); gdispClear(GFX_WHITE);
gwinRedrawDisplay(GDISP, FALSE); gwinRedrawDisplay(GDISP, gFalse);
} }
break; break;

View File

@ -37,7 +37,7 @@ static void createWidgets(void) {
// Apply some default values for GWIN // Apply some default values for GWIN
gwinWidgetClearInit(&wi); gwinWidgetClearInit(&wi);
wi.g.show = TRUE; wi.g.show = gTrue;
// Apply the checkbox parameters // Apply the checkbox parameters
wi.g.width = 100; // includes text wi.g.width = 100; // includes text
@ -58,7 +58,7 @@ int main(void) {
// Set the widget defaults // Set the widget defaults
gwinSetDefaultFont(gdispOpenFont("UI2")); gwinSetDefaultFont(gdispOpenFont("UI2"));
gwinSetDefaultStyle(&WhiteWidgetStyle, FALSE); gwinSetDefaultStyle(&WhiteWidgetStyle, gFalse);
gdispClear(GFX_WHITE); gdispClear(GFX_WHITE);
// create the widget // create the widget

View File

@ -49,7 +49,7 @@ int main(void) {
GWindowInit wi; GWindowInit wi;
gwinClearInit(&wi); gwinClearInit(&wi);
wi.show = TRUE; wi.show = gTrue;
wi.x = 0; wi.y = 0; wi.width = gdispGetWidth(); wi.height = gdispGetHeight()/2; wi.x = 0; wi.y = 0; wi.width = gdispGetWidth(); wi.height = gdispGetHeight()/2;
GW1 = gwinConsoleCreate(0, &wi); GW1 = gwinConsoleCreate(0, &wi);
wi.y = gdispGetHeight()/2; wi.width = gdispGetWidth()/2; wi.height = gdispGetHeight(); wi.y = gdispGetHeight()/2; wi.width = gdispGetWidth()/2; wi.height = gdispGetHeight();
@ -92,13 +92,13 @@ int main(void) {
/* Make console 3 invisible and then visible again to demonstrate the history buffer */ /* Make console 3 invisible and then visible again to demonstrate the history buffer */
gwinPrintf(GW2, "Making red window \033uinvisible\033U\n"); gwinPrintf(GW2, "Making red window \033uinvisible\033U\n");
gwinSetVisible(GW3, FALSE); gwinSetVisible(GW3, gFalse);
gfxSleepMilliseconds(1000); gfxSleepMilliseconds(1000);
gwinPrintf(GW2, "Making red window \033uvisible\033U\n"); gwinPrintf(GW2, "Making red window \033uvisible\033U\n");
gwinSetVisible(GW3, TRUE); gwinSetVisible(GW3, gTrue);
gwinPrintf(GW3, "\033bI'm back!!!\033B\n", i+1); gwinPrintf(GW3, "\033bI'm back!!!\033B\n", i+1);
while(TRUE) { while(1) {
gfxSleepMilliseconds(500); gfxSleepMilliseconds(500);
} }
} }

View File

@ -10,14 +10,14 @@ static void createWidgets(void) {
gwinWidgetClearInit(&wi); gwinWidgetClearInit(&wi);
// Apply the container parameters // Apply the container parameters
wi.g.show = FALSE; wi.g.show = gFalse;
wi.g.width = 200; wi.g.width = 200;
wi.g.height = 150; wi.g.height = 150;
wi.g.y = 10; wi.g.y = 10;
wi.g.x = 10; wi.g.x = 10;
wi.text = "Container"; wi.text = "Container";
ghContainer = gwinContainerCreate(0, &wi, GWIN_CONTAINER_BORDER); ghContainer = gwinContainerCreate(0, &wi, GWIN_CONTAINER_BORDER);
wi.g.show = TRUE; wi.g.show = gTrue;
// Apply the button parameters // Apply the button parameters
wi.g.width = 120; wi.g.width = 120;
@ -39,7 +39,7 @@ int main(void) {
// Set the widget defaults // Set the widget defaults
gwinSetDefaultFont(gdispOpenFont("*")); gwinSetDefaultFont(gdispOpenFont("*"));
gwinSetDefaultStyle(&WhiteWidgetStyle, FALSE); gwinSetDefaultStyle(&WhiteWidgetStyle, gFalse);
gdispClear(GFX_WHITE); gdispClear(GFX_WHITE);
// Create the widget // Create the widget

View File

@ -10,7 +10,7 @@ static void createWidgets(void) {
// Apply some default values for GWIN // Apply some default values for GWIN
gwinWidgetClearInit(&wi); gwinWidgetClearInit(&wi);
wi.g.show = FALSE; wi.g.show = gFalse;
// Container 1 // Container 1
wi.g.width = 300; wi.g.width = 300;
@ -20,7 +20,7 @@ static void createWidgets(void) {
wi.text = "Container 1"; wi.text = "Container 1";
ghContainer1 = gwinContainerCreate(0, &wi, GWIN_CONTAINER_BORDER); ghContainer1 = gwinContainerCreate(0, &wi, GWIN_CONTAINER_BORDER);
wi.g.show = TRUE; wi.g.show = gTrue;
// Container 2 // Container 2
wi.g.width = 100; wi.g.width = 100;
@ -117,7 +117,7 @@ int main(void) {
// Set the widget defaults // Set the widget defaults
gwinSetDefaultFont(gdispOpenFont("*")); gwinSetDefaultFont(gdispOpenFont("*"));
gwinSetDefaultStyle(&WhiteWidgetStyle, FALSE); gwinSetDefaultStyle(&WhiteWidgetStyle, gFalse);
gdispClear(GFX_WHITE); gdispClear(GFX_WHITE);
// Create the widget // Create the widget
@ -128,9 +128,9 @@ int main(void) {
gwinAttachListener(&gl); gwinAttachListener(&gl);
// Set the initial state of the checkboxes // Set the initial state of the checkboxes
gwinCheckboxCheck(ghCheckbox1, TRUE); gwinCheckboxCheck(ghCheckbox1, gTrue);
gwinCheckboxCheck(ghCheckbox2, TRUE); gwinCheckboxCheck(ghCheckbox2, gTrue);
gwinCheckboxCheck(ghCheckbox3, TRUE); gwinCheckboxCheck(ghCheckbox3, gTrue);
while(1) { while(1) {
// Get an Event // Get an Event

Some files were not shown because too many files have changed in this diff Show More