From 41271d632b74f5cf47c30d3b699eb6b2786f2136 Mon Sep 17 00:00:00 2001 From: inmarket Date: Sat, 23 Jun 2018 13:02:07 +1000 Subject: [PATCH] Added new type definitions - moving towards V3.0 --- boards/addons/gdisp/board_ED060SC4_example.h | 20 +- .../gdisp/board_HX8347D_stm32f4discovery.h | 2 +- .../gdisp/board_ILI9320_olimex_pic32mx_lcd.h | 2 +- .../gdisp/board_ILI9325_hy_stm32_100p.h | 2 +- boards/addons/gdisp/board_ILI9341_spi.h | 6 +- .../gdisp/board_ILI9481_firebullstm32f103.h | 2 +- .../gdisp/board_ILI9488_stm32f4cube_hal.h | 2 +- .../addons/gdisp/board_S6D1121_olimex_e407.h | 2 +- .../addons/gdisp/board_SPFD54124B_stm32f3.h | 4 +- .../gdisp/board_SSD1289_stm32f4discovery.h | 2 +- .../board_SSD1306_chibios_16.1.3_stm32f4.h | 2 +- boards/addons/gdisp/board_SSD1306_i2c.h | 2 +- .../board_SSD1331_tinyscreen_arduino.cpp | 88 - .../gdisp/board_SSD1331_tinyscreen_arduino.h | 34 - boards/addons/gdisp/board_SSD1351_teensy.h | 25 +- boards/addons/gdisp/board_SSD1963_fsmc.h | 2 +- boards/addons/gdisp/board_SSD1963_gpio.h | 2 +- .../gdisp/board_UC8173_nordic_nrf52_sdk11.h | 14 +- ...ginput_lld_mouse_board_olimex_stm32_e407.h | 8 +- ...put_lld_mouse_board_st_stm32f4_discovery.h | 8 +- .../ginput/touch/ADS7843/stm32f4cube_hal.h | 12 +- ...input_lld_mouse_board_olimex_pic32mx_lcd.h | 12 +- .../gmouse_lld_FT5316_board.h | 4 +- .../ArduinoTinyScreen/gfx/board_SSD1331.h | 1 + .../Embest-STM32-DMSTF4BB/board_SSD2119.h | 2 +- .../gmouse_lld_STMPE811_board.h | 8 +- .../FireBull-STM32F103-FB/board_SSD1289.h | 2 +- .../gmouse_lld_ADS7843_board.h | 8 +- boards/base/HY-MiniSTM32V/board_SSD1289.h | 2 +- .../HY-MiniSTM32V/gmouse_lld_ADS7843_board.h | 4 +- boards/base/Marlin/board_RA8875.h | 2 +- boards/base/Marlin/gmouse_lld_FT5x06_board.h | 6 +- .../Mikromedia-Plus-STM32-M4/board_SSD1963.h | 2 +- .../gmouse_lld_STMPE610_board.h | 8 +- .../board_ILI9341.h | 2 +- .../gmouse_lld_MCU_board.h | 10 +- .../board_Nokia6610GE12.h | 12 +- .../Olimex-SAM7EX256-GE8/board_Nokia6610GE8.h | 12 +- .../Olimex-SAM7EX256-GE8/board_SSD1306_i2c.h | 2 +- .../Olimex-SAM7EX256-GE8/board_SSD1306_spi.h | 2 +- .../base/Olimex-SAM7EX256-GE8/board_SSD1331.h | 2 +- .../base/Olimex-SAM7EX256-GE8/board_TLS8204.h | 2 +- .../Olimex-SAM7EX256-GE8/gaudio_play_board.h | 6 +- boards/base/Olimex-STM32-LCD/board_ILI9320.h | 2 +- .../Olimex-STM32-LCD/gmouse_lld_MCU_board.h | 10 +- .../chibios/gmouse_lld_STMPE811_board.h | 8 +- .../CubeHal/gmouse_lld_EXC7200_board.h | 8 +- .../CubeHAL/gmouse_lld_FT6x06_board.h | 6 +- .../gmouse_lld_FT5336_board.h | 6 +- boards/base/STM32F746-Discovery/stm32f7_i2c.c | 6 +- boards/base/STM32F746-Discovery/stm32f7_i2c.h | 2 +- changelog.txt | 8 + demos/3rdparty/notepad-2/main.c | 4 +- demos/3rdparty/notepad-2/notepadApp.c | 10 +- demos/3rdparty/notepad-2/notepadCore.c | 6 +- demos/applications/combo/bounce.c | 8 +- demos/applications/combo/main.c | 142 +- demos/applications/combo/mandelbrot.c | 8 +- demos/applications/combo/tasks.h | 4 +- demos/applications/mandelbrot/main.c | 2 +- demos/applications/notepad/main.c | 2 +- demos/benchmarks/main.c | 2 +- demos/games/justget10/jg10.c | 86 +- demos/games/justget10/main.c | 2 +- demos/games/minesweeper/main.c | 2 +- demos/games/minesweeper/mines.c | 66 +- .../Example_Makefiles/stm32f4/board_SSD1289.h | 2 +- .../stm32f4/ginput_lld_mouse_board.h | 2 +- .../stm32f4/gmouse_lld_ADS7843_board.h | 8 +- .../stm32f4/gmouse_lld_ADS7843_board.h.old | 8 +- .../stm32f4_chibios_3.x/board_SSD1289.h | 2 +- .../ginput_lld_mouse_board.h | 2 +- .../gmouse_lld_ADS7843_board.h | 8 +- demos/games/tetris/main.c | 2 +- demos/games/tetris/tetris.c | 80 +- demos/modules/gadc/gwinosc.c | 14 +- demos/modules/gadc/main.c | 8 +- demos/modules/gaudio/oscilloscope/gwinosc.c | 14 +- demos/modules/gaudio/oscilloscope/main.c | 4 +- demos/modules/gaudio/play-vs1053/main.c | 2 +- demos/modules/gaudio/play-wave/main.c | 4 +- demos/modules/gdisp/basics/main.c | 2 +- demos/modules/gdisp/circles/main.c | 2 +- demos/modules/gdisp/fonts/main.c | 2 +- demos/modules/gdisp/fonts_cyrillic/main.c | 2 +- demos/modules/gdisp/multiple_displays/main.c | 4 +- demos/modules/gdisp/pixmap/main.c | 2 +- demos/modules/gdisp/polygons/main.c | 2 +- demos/modules/gdisp/thickarcs/main.c | 2 +- demos/modules/ginput/keyboard/main.c | 2 +- demos/modules/gos/threads/main.c | 6 +- demos/modules/gos/threads_advanced/main.c | 18 +- demos/modules/gtimer/main.c | 6 +- demos/modules/gtrans/basic/main.c | 2 +- demos/modules/gwin/basic/main.c | 6 +- demos/modules/gwin/button/main.c | 6 +- demos/modules/gwin/checkbox/main.c | 4 +- demos/modules/gwin/console/main.c | 8 +- demos/modules/gwin/container/main.c | 6 +- demos/modules/gwin/container_nested/main.c | 12 +- demos/modules/gwin/frame/main.c | 4 +- demos/modules/gwin/gl3d-gears/main.c | 4 +- demos/modules/gwin/gl3d-spin/main.c | 4 +- demos/modules/gwin/graph/main.c | 4 +- demos/modules/gwin/imagebox/main.c | 4 +- demos/modules/gwin/keyboard/main.c | 6 +- demos/modules/gwin/label/main.c | 4 +- demos/modules/gwin/list/main.c | 68 +- demos/modules/gwin/progressbar/main.c | 4 +- demos/modules/gwin/radio/main.c | 4 +- demos/modules/gwin/slider/main.c | 6 +- demos/modules/gwin/tabset/main.c | 10 +- demos/modules/gwin/textedit/main.c | 16 +- .../gwin/textedit_virtual_keyboard/main.c | 10 +- demos/modules/gwin/widgets/main.c | 148 +- demos/tools/touch_calibration_grabber/main.c | 2 +- demos/tools/touch_driver_test/main.c | 30 +- demos/tools/touch_raw_readings/main.c | 2 +- demos/tools/uGFXnetDisplay/main.c | 12 +- drivers/gaudio/Win32/gaudio_play_Win32.c | 22 +- drivers/gaudio/Win32/gaudio_record_Win32.c | 18 +- drivers/gaudio/gadc/gaudio_record_gadc.c | 6 +- .../gaudio/pwm/gaudio_play_board_template.h | 4 +- drivers/gaudio/pwm/gaudio_play_pwm.c | 8 +- .../vs1053/gaudio_play_board_template.h | 2 +- drivers/gaudio/vs1053/gaudio_play_vs1053.c | 18 +- .../gdisp_lld_alteraframereader.c | 4 +- .../gdisp/ED060SC4/board_ED060SC4_example.h | 20 +- .../gdisp/ED060SC4/board_ED060SC4_template.h | 20 +- drivers/gdisp/ED060SC4/gdisp_lld_ED060SC4.c | 98 +- drivers/gdisp/Fb24bpp/gdisp_lld_fb24bpp.c | 4 +- .../gdisp/HX8347D/board_HX8347D_template.h | 2 +- drivers/gdisp/HX8347D/gdisp_lld_HX8347D.c | 8 +- drivers/gdisp/ILI9225/gdisp_lld_ili9225.c | 8 +- .../gdisp/ILI9320/board_ILI9320_template.h | 2 +- drivers/gdisp/ILI9320/gdisp_lld_ILI9320.c | 8 +- .../gdisp/ILI9325/board_ILI9325_template.h | 2 +- drivers/gdisp/ILI9325/gdisp_lld_ILI9325.c | 8 +- .../gdisp/ILI9341/board_ILI9341_template.h | 2 +- drivers/gdisp/ILI9341/gdisp_lld_ILI9341.c | 8 +- drivers/gdisp/ILI9342/gdisp_lld_ILI9342.c | 8 +- .../gdisp/ILI93xx/board_ILI93xx_template.h | 2 +- drivers/gdisp/ILI93xx/gdisp_lld_ILI93xx.c | 10 +- .../gdisp/ILI9481/board_ILI9481_template.h | 2 +- drivers/gdisp/ILI9481/gdisp_lld_ILI9481.c | 8 +- .../gdisp/ILI9488/board_ILI9488_template.h | 2 +- drivers/gdisp/ILI9488/gdisp_lld_ILI9488.c | 10 +- drivers/gdisp/KS0108/board_KS0108_example.h | 2 +- drivers/gdisp/KS0108/gdisp_lld_KS0108.c | 8 +- .../gdisp/LGDP4532/board_LGDP4532_template.h | 2 +- drivers/gdisp/LGDP4532/gdisp_lld_LGDP4532.c | 8 +- .../board_Nokia6610GE12_template.h | 2 +- .../Nokia6610GE12/gdisp_lld_Nokia6610GE12.c | 8 +- .../board_Nokia6610GE8_template.h | 2 +- .../Nokia6610GE8/gdisp_lld_Nokia6610GE8.c | 8 +- .../gdisp/PCD8544/board_PCD8544_template.h | 2 +- drivers/gdisp/PCD8544/gdisp_lld_PCD8544.c | 8 +- .../gdisp/PCF8812/board_PCF8812_template.h | 2 +- drivers/gdisp/PCF8812/gdisp_lld_PCF8812.c | 8 +- drivers/gdisp/QImage/gdisp_lld_driver.c | 6 +- drivers/gdisp/QImage/gdisp_lld_qimage.cpp | 6 +- drivers/gdisp/QImage/gdisp_lld_qimage.h | 3 +- .../gdisp/R61505U/board_R61505U_template.h | 2 +- drivers/gdisp/R61505U/gdisp_lld_R61505U.c | 8 +- drivers/gdisp/RA6963/board_RA6963.h | 4 +- drivers/gdisp/RA6963/gdisp_lld_RA6963.c | 8 +- drivers/gdisp/RA8875/board_RA8875_template.h | 2 +- drivers/gdisp/RA8875/gdisp_lld_RA8875.c | 8 +- .../gdisp/S6D1121/board_S6D1121_template.h | 2 +- drivers/gdisp/S6D1121/gdisp_lld_S6D1121.c | 8 +- .../SPFD54124B/board_SPFD54124B_template.h | 2 +- .../gdisp/SPFD54124B/gdisp_lld_SPFD54124B.c | 8 +- .../gdisp/SSD1289/board_SSD1289_template.h | 2 +- drivers/gdisp/SSD1289/gdisp_lld_SSD1289.c | 8 +- .../gdisp/SSD1306/board_SSD1306_template.h | 2 +- drivers/gdisp/SSD1306/gdisp_lld_SSD1306.c | 8 +- .../gdisp/SSD1322/board_SSD1322_template.h | 2 +- drivers/gdisp/SSD1322/gdisp_lld_SSD1322.c | 8 +- .../gdisp/SSD1331/board_SSD1331_template.h | 2 +- drivers/gdisp/SSD1331/gdisp_lld_SSD1331.c | 8 +- .../gdisp/SSD1351/board_SSD1351_template.h | 2 +- drivers/gdisp/SSD1351/gdisp_lld_SSD1351.c | 8 +- .../gdisp/SSD1848/board_ssd1848_template.h | 2 +- drivers/gdisp/SSD1848/gdisp_lld_SSD1848.c | 12 +- .../gdisp/SSD1963/board_SSD1963_template.h | 6 +- drivers/gdisp/SSD1963/gdisp_lld_SSD1963.c | 12 +- .../gdisp/SSD2119/board_SSD2119_template.h | 2 +- drivers/gdisp/SSD2119/gdisp_lld_SSD2119.c | 8 +- drivers/gdisp/ST7565/board_ST7565_template.h | 2 +- drivers/gdisp/ST7565/gdisp_lld_ST7565.c | 10 +- drivers/gdisp/ST7735/gdisp_lld_ST7735.c | 8 +- drivers/gdisp/STM32LTDC/gdisp_lld_STM32LTDC.c | 10 +- .../gdisp/TLS8204/board_TLS8204_template.h | 2 +- drivers/gdisp/TLS8204/gdisp_lld_TLS8204.c | 8 +- drivers/gdisp/TestStub/gdisp_lld_TestStub.c | 4 +- .../gdisp/UC1601s/board_UC1601s_template.h | 2 +- drivers/gdisp/UC1601s/gdisp_lld_UC1601s.c | 8 +- drivers/gdisp/UC1610/board_UC1610_template.h | 2 +- drivers/gdisp/UC1610/gdisp_lld_UC1610.c | 4 +- drivers/gdisp/UC8173/board_UC8173_template.h | 18 +- drivers/gdisp/UC8173/gdisp_lld_UC8173.c | 14 +- .../gdisp/framebuffer/gdisp_lld_framebuffer.c | 4 +- .../ginput/touch/ADS7843/gmouse_lld_ADS7843.c | 4 +- .../gmouse_lld_ADS7843_board_template.h | 4 +- .../ginput/touch/EXC7200/gmouse_lld_EXC7200.c | 12 +- .../gmouse_lld_EXC7200_board_template.h | 2 +- .../ginput/touch/FT5336/gmouse_lld_FT5336.c | 12 +- .../FT5336/gmouse_lld_FT5336_board_template.h | 4 +- .../ginput/touch/FT5x06/gmouse_lld_FT5x06.c | 10 +- .../FT5x06/gmouse_lld_FT5x06_board_template.h | 2 +- .../ginput/touch/FT6x06/gmouse_lld_FT6x06.c | 10 +- .../FT6x06/gmouse_lld_FT6x06_board_template.h | 2 +- .../Linux-Event/gmouse_lld_linux_event.c | 10 +- .../touch/MAX11802/gmouse_lld_MAX11802.c | 16 +- .../gmouse_lld_MAX11802_board_template.h | 4 +- .../touch/MCU/gmouse_lld_MCU_board_template.h | 4 +- .../ginput/touch/QWidget/gmouse_lld_QWidget.c | 8 +- .../touch/STMPE610/gmouse_lld_STMPE610.c | 18 +- .../gmouse_lld_STMPE610_board_template.h | 4 +- .../touch/STMPE811/gmouse_lld_STMPE811.c | 18 +- .../gmouse_lld_STMPE811_board_template.h | 4 +- drivers/multiple/SDL/gdisp_lld_SDL.c | 24 +- drivers/multiple/Win32/gdisp_lld_Win32.c | 36 +- drivers/multiple/Win32/gdisp_lld_config.h | 2 +- drivers/multiple/X/gdisp_lld_X.c | 30 +- drivers/multiple/uGFXnet/gdisp_lld_uGFXnet.c | 42 +- .../gdisp_lld_uGFXnetESP8266.cpp | 32 +- gfx.h | 306 +-- src/gadc/gadc.c | 10 +- src/gadc/gadc.h | 14 +- src/gaudio/gaudio.c | 22 +- src/gaudio/gaudio.h | 28 +- src/gaudio/gaudio_driver_play.h | 10 +- src/gaudio/gaudio_driver_record.h | 4 +- src/gdisp/gdisp.c | 22 +- src/gdisp/gdisp.h | 16 +- src/gdisp/gdisp_driver.h | 8 +- src/gdisp/gdisp_fonts.c | 12 +- src/gdisp/gdisp_image.c | 12 +- src/gdisp/gdisp_image.h | 402 ++-- src/gdisp/gdisp_image_bmp.c | 10 +- src/gdisp/gdisp_image_png.c | 90 +- src/gdisp/gdisp_image_support.h | 16 +- src/gdisp/gdisp_pixmap.c | 6 +- src/gdisp/gdisp_pixmap.h | 96 +- src/gdriver/gdriver.h | 2 +- src/gevent/gevent.c | 8 +- src/gevent/gevent.h | 16 +- src/gfile/gfile.c | 66 +- src/gfile/gfile.h | 770 ++++--- src/gfile/gfile_fatfs_wrapper.c | 4 +- src/gfile/gfile_fs.h | 22 +- src/gfile/gfile_fs_chibios.c | 10 +- src/gfile/gfile_fs_fatfs.c | 88 +- src/gfile/gfile_fs_mem.c | 6 +- src/gfile/gfile_fs_native.c | 42 +- src/gfile/gfile_fs_petitfs.c | 32 +- src/gfile/gfile_fs_rom.c | 24 +- src/gfile/gfile_printg.c | 10 +- src/gfile/gfile_scang.c | 10 +- src/gfx.c | 6 +- src/gfx.h | 238 +++ src/gfx_options.h | 145 ++ src/gfx_types.h | 165 ++ src/ginput/ginput_dial.c | 10 +- src/ginput/ginput_dial.h | 106 +- src/ginput/ginput_driver_keyboard.h | 6 +- src/ginput/ginput_driver_mouse.h | 10 +- src/ginput/ginput_keyboard.c | 20 +- src/ginput/ginput_keyboard.h | 52 +- src/ginput/ginput_mouse.c | 18 +- src/ginput/ginput_mouse.h | 188 +- src/ginput/ginput_toggle.c | 18 +- src/ginput/ginput_toggle.h | 58 +- src/gmisc/gmisc.h | 12 +- src/gmisc/gmisc_hittest.c | 10 +- src/gos/gos.h | 45 +- src/gos/gos_arduino.h | 25 +- src/gos/gos_chibios.c | 14 +- src/gos/gos_chibios.h | 24 +- src/gos/gos_cmsis.c | 8 +- src/gos/gos_cmsis.h | 15 +- src/gos/gos_cmsis2.c | 6 +- src/gos/gos_cmsis2.h | 13 +- src/gos/gos_ecos.c | 4 +- src/gos/gos_ecos.h | 21 +- src/gos/gos_freertos.c | 12 +- src/gos/gos_freertos.h | 33 +- src/gos/gos_linux.c | 18 +- src/gos/gos_linux.h | 14 +- src/gos/gos_nios.h | 13 - src/gos/gos_osx.c | 10 +- src/gos/gos_osx.h | 14 +- src/gos/gos_qt.cpp | 4 +- src/gos/gos_qt.h | 17 +- src/gos/gos_raw32.h | 38 +- src/gos/gos_rawrtos.c | 12 +- src/gos/gos_rawrtos.h | 9 +- src/gos/gos_win32.c | 2 +- src/gos/gos_win32.h | 25 +- src/gos/gos_x_heap.h | 38 +- src/gos/gos_x_threads.c | 24 +- src/gos/gos_x_threads.h | 72 +- src/gos/gos_zephyr.h | 130 +- src/gqueue/gqueue.c | 46 +- src/gqueue/gqueue.h | 45 +- src/gtimer/gtimer.c | 6 +- src/gtimer/gtimer.h | 16 +- src/gtrans/gtrans.h | 8 - src/gwin/gwin.c | 12 +- src/gwin/gwin.h | 1832 ++++++++--------- src/gwin/gwin_button.c | 6 +- src/gwin/gwin_button.h | 12 +- src/gwin/gwin_checkbox.c | 14 +- src/gwin/gwin_checkbox.h | 18 +- src/gwin/gwin_class.h | 24 +- src/gwin/gwin_console.c | 38 +- src/gwin/gwin_console.h | 16 +- src/gwin/gwin_container.h | 8 - src/gwin/gwin_frame.h | 8 - src/gwin/gwin_gl3d.c | 6 +- src/gwin/gwin_gl3d.h | 8 - src/gwin/gwin_graph.h | 8 - src/gwin/gwin_image.c | 10 +- src/gwin/gwin_image.h | 18 +- src/gwin/gwin_keyboard.h | 8 - src/gwin/gwin_label.c | 2 +- src/gwin/gwin_label.h | 10 +- src/gwin/gwin_list.c | 20 +- src/gwin/gwin_list.h | 33 +- src/gwin/gwin_progressbar.c | 2 +- src/gwin/gwin_progressbar.h | 8 - src/gwin/gwin_radio.c | 10 +- src/gwin/gwin_radio.h | 12 +- src/gwin/gwin_slider.c | 2 +- src/gwin/gwin_slider.h | 12 +- src/gwin/gwin_tabset.c | 4 +- src/gwin/gwin_tabset.h | 16 +- src/gwin/gwin_textedit.c | 8 +- src/gwin/gwin_textedit.h | 8 - src/gwin/gwin_widget.c | 58 +- src/gwin/gwin_widget.h | 52 +- src/gwin/gwin_wm.c | 72 +- 343 files changed, 4152 insertions(+), 4551 deletions(-) delete mode 100644 boards/addons/gdisp/board_SSD1331_tinyscreen_arduino.cpp delete mode 100644 boards/addons/gdisp/board_SSD1331_tinyscreen_arduino.h create mode 100644 src/gfx.h create mode 100644 src/gfx_options.h create mode 100644 src/gfx_types.h diff --git a/boards/addons/gdisp/board_ED060SC4_example.h b/boards/addons/gdisp/board_ED060SC4_example.h index 4c25ba55..58d7ed3e 100644 --- a/boards/addons/gdisp/board_ED060SC4_example.h +++ b/boards/addons/gdisp/board_ED060SC4_example.h @@ -76,44 +76,44 @@ static void eink_delay(int us) { } /* Turn the E-ink panel Vdd supply (+3.3V) on or off. */ -static GFXINLINE void setpower_vdd(GDisplay *g, bool_t on) { +static GFXINLINE void setpower_vdd(GDisplay *g, gBool on) { (void) g; palWritePad(GPIOB, GPIOB_SMPS_CTRL, !on); palWritePad(GPIOA, GPIOA_EINK_VDD, on); } /* Turn the E-ink panel negative supplies (-15V, -20V) on or off. */ -static GFXINLINE void setpower_vneg(GDisplay *g, bool_t on) { +static GFXINLINE void setpower_vneg(GDisplay *g, gBool on) { (void) g; palWritePad(GPIOA, GPIOA_VNEG_CTRL, on); } /* Turn the E-ink panel positive supplies (-15V, -20V) on or off. */ -static GFXINLINE void setpower_vpos(GDisplay *g, bool_t on) { +static GFXINLINE void setpower_vpos(GDisplay *g, gBool on) { (void) g; palWritePad(GPIOA, GPIOA_VPOS_CTRL, on); } /* Set the state of the LE (source driver Latch Enable) pin. */ -static GFXINLINE void setpin_le(GDisplay *g, bool_t on) { +static GFXINLINE void setpin_le(GDisplay *g, gBool on) { (void) g; palWritePad(GPIOB, GPIOB_EINK_LE, on); } /* Set the state of the OE (source driver Output Enable) pin. */ -static GFXINLINE void setpin_oe(GDisplay *g, bool_t on) { +static GFXINLINE void setpin_oe(GDisplay *g, gBool on) { (void) g; palWritePad(GPIOB, GPIOB_EINK_OE, on); } /* Set the state of the CL (source driver Clock) pin. */ -static GFXINLINE void setpin_cl(GDisplay *g, bool_t on) { +static GFXINLINE void setpin_cl(GDisplay *g, gBool on) { (void) g; palWritePad(GPIOB, GPIOB_EINK_CL, on); } /* Set the state of the SPH (source driver Start Pulse Horizontal) pin. */ -static GFXINLINE void setpin_sph(GDisplay *g, bool_t on) { +static GFXINLINE void setpin_sph(GDisplay *g, gBool on) { (void) g; palWritePad(GPIOB, GPIOB_EINK_SPH, on); } @@ -125,19 +125,19 @@ static GFXINLINE void setpins_data(GDisplay *g, uint8_t value) { } /* Set the state of the CKV (gate driver Clock Vertical) pin. */ -static GFXINLINE void setpin_ckv(GDisplay *g, bool_t on) { +static GFXINLINE void setpin_ckv(GDisplay *g, gBool on) { (void) g; palWritePad(GPIOB, GPIOB_EINK_CKV, on); } /* Set the state of the GMODE (gate driver Gate Mode) pin. */ -static GFXINLINE void setpin_gmode(GDisplay *g, bool_t on) { +static GFXINLINE void setpin_gmode(GDisplay *g, gBool on) { (void) g; palWritePad(GPIOC, GPIOC_EINK_GMODE, on); } /* Set the state of the SPV (gate driver Start Pulse Vertical) pin. */ -static GFXINLINE void setpin_spv(GDisplay *g, bool_t on) { +static GFXINLINE void setpin_spv(GDisplay *g, gBool on) { (void) g; palWritePad(GPIOB, GPIOB_EINK_SPV, on); } diff --git a/boards/addons/gdisp/board_HX8347D_stm32f4discovery.h b/boards/addons/gdisp/board_HX8347D_stm32f4discovery.h index bece729d..f727614d 100644 --- a/boards/addons/gdisp/board_HX8347D_stm32f4discovery.h +++ b/boards/addons/gdisp/board_HX8347D_stm32f4discovery.h @@ -103,7 +103,7 @@ static GFXINLINE void post_init_board(GDisplay *g) { (void) g; } -static GFXINLINE void setpin_reset(GDisplay *g, bool_t state) { +static GFXINLINE void setpin_reset(GDisplay *g, gBool state) { (void) g; if (state) { CLR_RST; diff --git a/boards/addons/gdisp/board_ILI9320_olimex_pic32mx_lcd.h b/boards/addons/gdisp/board_ILI9320_olimex_pic32mx_lcd.h index 8ae7715f..aaafdf81 100644 --- a/boards/addons/gdisp/board_ILI9320_olimex_pic32mx_lcd.h +++ b/boards/addons/gdisp/board_ILI9320_olimex_pic32mx_lcd.h @@ -68,7 +68,7 @@ static GFXINLINE void post_init_board(GDisplay *g) { (void) g; } -static noinline void setpin_reset(GDisplay *g, bool_t state) { +static noinline void setpin_reset(GDisplay *g, gBool state) { (void) g; if (state) palClearPad(IOPORTA, 7); diff --git a/boards/addons/gdisp/board_ILI9325_hy_stm32_100p.h b/boards/addons/gdisp/board_ILI9325_hy_stm32_100p.h index 51090f5d..afe5a887 100644 --- a/boards/addons/gdisp/board_ILI9325_hy_stm32_100p.h +++ b/boards/addons/gdisp/board_ILI9325_hy_stm32_100p.h @@ -68,7 +68,7 @@ static GFXINLINE void post_init_board(GDisplay *g) { (void) g; } -static GFXINLINE void setpin_reset(GDisplay *g, bool_t state) { +static GFXINLINE void setpin_reset(GDisplay *g, gBool state) { (void) g; if(state) palClearPad(GPIOE, GPIOE_TFT_RST); diff --git a/boards/addons/gdisp/board_ILI9341_spi.h b/boards/addons/gdisp/board_ILI9341_spi.h index fbb710b0..c6bb2e56 100644 --- a/boards/addons/gdisp/board_ILI9341_spi.h +++ b/boards/addons/gdisp/board_ILI9341_spi.h @@ -83,14 +83,14 @@ static GFXINLINE void post_init_board(GDisplay *g) { * @brief Set or clear the lcd reset pin. * * @param[in] g The GDisplay structure - * @param[in] state TRUE = lcd in reset, FALSE = normal operation + * @param[in] state gTrue = lcd in reset, gFalse = normal operation * * @notapi */ -static GFXINLINE void setpin_reset(GDisplay *g, bool_t state) { +static GFXINLINE void setpin_reset(GDisplay *g, gBool state) { (void) g; - if (state == TRUE) { + if (state) { palClearPad(LCD_PORT, LCD_RES); } else { palSetPad(LCD_PORT, LCD_RES); diff --git a/boards/addons/gdisp/board_ILI9481_firebullstm32f103.h b/boards/addons/gdisp/board_ILI9481_firebullstm32f103.h index fb57fb62..8169bbfc 100644 --- a/boards/addons/gdisp/board_ILI9481_firebullstm32f103.h +++ b/boards/addons/gdisp/board_ILI9481_firebullstm32f103.h @@ -53,7 +53,7 @@ static GFXINLINE void post_init_board(GDisplay *g) { (void) g; } -static GFXINLINE void setpin_reset(GDisplay *g, bool_t state) { +static GFXINLINE void setpin_reset(GDisplay *g, gBool state) { (void) g; (void) state; } diff --git a/boards/addons/gdisp/board_ILI9488_stm32f4cube_hal.h b/boards/addons/gdisp/board_ILI9488_stm32f4cube_hal.h index d8379488..f1099c9b 100644 --- a/boards/addons/gdisp/board_ILI9488_stm32f4cube_hal.h +++ b/boards/addons/gdisp/board_ILI9488_stm32f4cube_hal.h @@ -97,7 +97,7 @@ static GFXINLINE void post_init_board(GDisplay* g) (void) g; } -static GFXINLINE void setpin_reset(GDisplay* g, bool_t state) +static GFXINLINE void setpin_reset(GDisplay *g, gBool state) { (void) g; diff --git a/boards/addons/gdisp/board_S6D1121_olimex_e407.h b/boards/addons/gdisp/board_S6D1121_olimex_e407.h index fd924e7f..063495c6 100644 --- a/boards/addons/gdisp/board_S6D1121_olimex_e407.h +++ b/boards/addons/gdisp/board_S6D1121_olimex_e407.h @@ -50,7 +50,7 @@ static GFXINLINE void init_board(GDisplay *g) { } } -static GFXINLINE void setpin_reset(GDisplay *g, bool_t state) { +static GFXINLINE void setpin_reset(GDisplay *g, gBool state) { (void) g; (void) state; } diff --git a/boards/addons/gdisp/board_SPFD54124B_stm32f3.h b/boards/addons/gdisp/board_SPFD54124B_stm32f3.h index 9bc40367..f5413ce7 100644 --- a/boards/addons/gdisp/board_SPFD54124B_stm32f3.h +++ b/boards/addons/gdisp/board_SPFD54124B_stm32f3.h @@ -81,7 +81,7 @@ static GFXINLINE void soft_spi_write_9bit(uint16_t data){ } #endif -static GFXINLINE void setpin_reset(GDisplay *g, bool_t state) { +static GFXINLINE void setpin_reset(GDisplay *g, gBool state) { (void) g; if(state) { CLR_RST; @@ -100,7 +100,7 @@ static GFXINLINE void init_board(GDisplay *g) { * SPI1 I/O pins setup. */ palSetPadMode(SPFD54124B_PIN_PORT, SPFD54124B_PIN_RST, PAL_MODE_OUTPUT_PUSHPULL); /* RESET */ - setpin_reset(g, TRUE); + setpin_reset(g, gTrue); #if USE_HARD_SPI palSetPadMode(SPFD54124B_SPI_PORT, SPFD54124B_SPI_SCK, PAL_MODE_ALTERNATE(5) | PAL_STM32_OSPEED_HIGHEST); /* SCK. */ diff --git a/boards/addons/gdisp/board_SSD1289_stm32f4discovery.h b/boards/addons/gdisp/board_SSD1289_stm32f4discovery.h index 834cbcac..d7767d30 100644 --- a/boards/addons/gdisp/board_SSD1289_stm32f4discovery.h +++ b/boards/addons/gdisp/board_SSD1289_stm32f4discovery.h @@ -109,7 +109,7 @@ static GFXINLINE void post_init_board(GDisplay *g) { (void) g; } -static GFXINLINE void setpin_reset(GDisplay *g, bool_t state) { +static GFXINLINE void setpin_reset(GDisplay *g, gBool state) { (void) g; (void) state; } diff --git a/boards/addons/gdisp/board_SSD1306_chibios_16.1.3_stm32f4.h b/boards/addons/gdisp/board_SSD1306_chibios_16.1.3_stm32f4.h index 361562fa..c13878fc 100644 --- a/boards/addons/gdisp/board_SSD1306_chibios_16.1.3_stm32f4.h +++ b/boards/addons/gdisp/board_SSD1306_chibios_16.1.3_stm32f4.h @@ -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; diff --git a/boards/addons/gdisp/board_SSD1306_i2c.h b/boards/addons/gdisp/board_SSD1306_i2c.h index ee92ded6..768e4572 100644 --- a/boards/addons/gdisp/board_SSD1306_i2c.h +++ b/boards/addons/gdisp/board_SSD1306_i2c.h @@ -82,7 +82,7 @@ static GFXINLINE void post_init_board(GDisplay *g) { (void) g; } -static GFXINLINE void setpin_reset(GDisplay *g, bool_t state) { +static GFXINLINE void setpin_reset(GDisplay *g, gBool state) { (void) g; if(state) CLR_RST diff --git a/boards/addons/gdisp/board_SSD1331_tinyscreen_arduino.cpp b/boards/addons/gdisp/board_SSD1331_tinyscreen_arduino.cpp deleted file mode 100644 index 5065c34d..00000000 --- a/boards/addons/gdisp/board_SSD1331_tinyscreen_arduino.cpp +++ /dev/null @@ -1,88 +0,0 @@ -#include -#include -#include - -#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); -} diff --git a/boards/addons/gdisp/board_SSD1331_tinyscreen_arduino.h b/boards/addons/gdisp/board_SSD1331_tinyscreen_arduino.h deleted file mode 100644 index 17b125c8..00000000 --- a/boards/addons/gdisp/board_SSD1331_tinyscreen_arduino.h +++ /dev/null @@ -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 */ diff --git a/boards/addons/gdisp/board_SSD1351_teensy.h b/boards/addons/gdisp/board_SSD1351_teensy.h index 92a8ba4f..3273effb 100644 --- a/boards/addons/gdisp/board_SSD1351_teensy.h +++ b/boards/addons/gdisp/board_SSD1351_teensy.h @@ -8,17 +8,6 @@ #ifndef _GDISP_LLD_BOARD_H #define _GDISP_LLD_BOARD_H -#ifdef __cplusplus -extern "C" { -#endif // __cplusplus - -extern void ssd1351_init_board(void); -extern void ssd1351_setpin_reset(int state); -extern void ssd1351_acquire_bus(void); -extern void ssd1351_release_bus(void); -extern void ssd1351_write_cmd(unsigned char index); -extern void ssd1351_write_data(unsigned char data); - #define init_board(g) ssd1351_init_board() #define post_init_board(g) #define setpin_reset(g, s) ssd1351_setpin_reset(s) @@ -28,8 +17,20 @@ extern void ssd1351_write_data(unsigned char data); #define write_cmd(g, i) ssd1351_write_cmd(i) #define write_data(g, d) ssd1351_write_cmd(d) +/* This test is needed as this file is also included in the .cpp file providing the below functions */ +#ifdef __cplusplus +extern "C" { +#endif + +void ssd1351_init_board(void); +void ssd1351_setpin_reset(int state); +void ssd1351_acquire_bus(void); +void ssd1351_release_bus(void); +void ssd1351_write_cmd(unsigned char index); +void ssd1351_write_data(unsigned char data); + #ifdef __cplusplus } -#endif // __cplusplus +#endif #endif /* _GDISP_LLD_BOARD_H */ diff --git a/boards/addons/gdisp/board_SSD1963_fsmc.h b/boards/addons/gdisp/board_SSD1963_fsmc.h index 1bccac71..06fb2c9a 100644 --- a/boards/addons/gdisp/board_SSD1963_fsmc.h +++ b/boards/addons/gdisp/board_SSD1963_fsmc.h @@ -81,7 +81,7 @@ static GFXINLINE void post_init_board(GDisplay *g) { FSMC_Bank1->BTCR[0] = FSMC_BCR1_MWID_0 | FSMC_BCR1_WREN | FSMC_BCR1_MBKEN; } -static GFXINLINE void setpin_reset(GDisplay *g, bool_t state) { +static GFXINLINE void setpin_reset(GDisplay *g, gBool state) { (void) g; (void) state; } diff --git a/boards/addons/gdisp/board_SSD1963_gpio.h b/boards/addons/gdisp/board_SSD1963_gpio.h index e3b80917..20e5787e 100644 --- a/boards/addons/gdisp/board_SSD1963_gpio.h +++ b/boards/addons/gdisp/board_SSD1963_gpio.h @@ -72,7 +72,7 @@ static GFXINLINE void post_init_board(GDisplay *g) { (void) g; } -static GFXINLINE void setpin_reset(GDisplay *g, bool_t state) { +static GFXINLINE void setpin_reset(GDisplay *g, gBool state) { (void) g; (void) state; } diff --git a/boards/addons/gdisp/board_UC8173_nordic_nrf52_sdk11.h b/boards/addons/gdisp/board_UC8173_nordic_nrf52_sdk11.h index a487ef20..7a4fb8ce 100644 --- a/boards/addons/gdisp/board_UC8173_nordic_nrf52_sdk11.h +++ b/boards/addons/gdisp/board_UC8173_nordic_nrf52_sdk11.h @@ -16,7 +16,7 @@ static const nrf_drv_spi_t spi = NRF_DRV_SPI_INSTANCE(SPI_INSTANCE); -static GFXINLINE bool_t init_board(GDisplay* g) +static GFXINLINE gBool init_board(GDisplay* g) { nrf_drv_spi_config_t spi_config; ret_code_t err = NRF_SUCCESS; @@ -47,10 +47,10 @@ static GFXINLINE bool_t init_board(GDisplay* g) spi_config.bit_order = NRF_DRV_SPI_BIT_ORDER_MSB_FIRST; err = nrf_drv_spi_init(&spi, &spi_config, 0); if (err != NRF_SUCCESS) { - return FALSE; + return gFalse; } - return TRUE; + return gTrue; } static GFXINLINE void post_init_board(GDisplay* g) @@ -58,7 +58,7 @@ static GFXINLINE void post_init_board(GDisplay* g) (void)g; } -static GFXINLINE void setpin_reset(GDisplay* g, bool_t state) +static GFXINLINE void setpin_reset(GDisplay *g, gBool state) { (void)g; @@ -69,14 +69,14 @@ static GFXINLINE void setpin_reset(GDisplay* g, bool_t state) } } -static GFXINLINE bool_t getpin_busy(GDisplay* g) +static GFXINLINE gBool getpin_busy(GDisplay* g) { (void)g; if (nrf_gpio_pin_read(PIN_BUSY) == 1) { - return TRUE; + return gTrue; } else { - return FALSE; + return gFalse; } } diff --git a/boards/addons/ginput/touch/ADS7843/ginput_lld_mouse_board_olimex_stm32_e407.h b/boards/addons/ginput/touch/ADS7843/ginput_lld_mouse_board_olimex_stm32_e407.h index 94f393b5..6611d5bc 100644 --- a/boards/addons/ginput/touch/ADS7843/ginput_lld_mouse_board_olimex_stm32_e407.h +++ b/boards/addons/ginput/touch/ADS7843/ginput_lld_mouse_board_olimex_stm32_e407.h @@ -34,17 +34,17 @@ static const SPIConfig spicfg = { // How much extra data to allocate at the end of the GMouse structure for the board's use #define GMOUSE_ADS7843_BOARD_DATA_SIZE 0 -static bool_t init_board(GMouse* m, unsigned driverinstance) { +static gBool init_board(GMouse* m, unsigned driverinstance) { (void) m; if (driverinstance) - return FALSE; + return gFalse; spiStart(&SPID2, &spicfg); - return TRUE; + return gTrue; } -static GFXINLINE bool_t getpin_pressed(GMouse* m) { +static GFXINLINE gBool getpin_pressed(GMouse* m) { (void) m; return (!palReadPad(GPIOG, 0)); diff --git a/boards/addons/ginput/touch/ADS7843/ginput_lld_mouse_board_st_stm32f4_discovery.h b/boards/addons/ginput/touch/ADS7843/ginput_lld_mouse_board_st_stm32f4_discovery.h index 83fb04fb..7916cc6f 100644 --- a/boards/addons/ginput/touch/ADS7843/ginput_lld_mouse_board_st_stm32f4_discovery.h +++ b/boards/addons/ginput/touch/ADS7843/ginput_lld_mouse_board_st_stm32f4_discovery.h @@ -45,11 +45,11 @@ static const SPIConfig spicfg = { // How much extra data to allocate at the end of the GMouse structure for the board's use #define GMOUSE_ADS7843_BOARD_DATA_SIZE 0 -static bool_t init_board(GMouse* m, unsigned driverinstance) { +static gBool init_board(GMouse* m, unsigned driverinstance) { (void) m; if (driverinstance) - return FALSE; + return gFalse; palSetPadMode(GPIOB, 13, PAL_MODE_ALTERNATE(5) ); /* SCK */ palSetPadMode(GPIOB, 14, PAL_MODE_ALTERNATE(5) ); /* MISO */ @@ -57,10 +57,10 @@ static bool_t init_board(GMouse* m, unsigned driverinstance) { palSetPadMode(GPIOC, 4, PAL_MODE_OUTPUT_PUSHPULL); /* CS */ spiStart(&SPID2, &spicfg); - return TRUE; + return gTrue; } -static GFXINLINE bool_t getpin_pressed(GMouse* m) { +static GFXINLINE gBool getpin_pressed(GMouse* m) { (void) m; return (!palReadPad(GPIOC, 5)); diff --git a/boards/addons/ginput/touch/ADS7843/stm32f4cube_hal.h b/boards/addons/ginput/touch/ADS7843/stm32f4cube_hal.h index 6bce29e6..e34dee84 100644 --- a/boards/addons/ginput/touch/ADS7843/stm32f4cube_hal.h +++ b/boards/addons/ginput/touch/ADS7843/stm32f4cube_hal.h @@ -16,7 +16,7 @@ static SPI_HandleTypeDef _hspi; -static bool_t init_board(GMouse* m, unsigned driverinstance) +static gBool init_board(GMouse* m, unsigned driverinstance) { GPIO_InitTypeDef GPIO_InitStruct; @@ -93,20 +93,20 @@ static bool_t init_board(GMouse* m, unsigned driverinstance) _hspi.Init.CRCCalculation = SPI_CRCCALCULATION_DISABLE; _hspi.Init.CRCPolynomial = 10; if (HAL_SPI_Init(&_hspi) != HAL_OK) { - return FALSE; + return gFalse; } - return TRUE; + return gTrue; } -static GFXINLINE bool_t getpin_pressed(GMouse* m) +static GFXINLINE gBool getpin_pressed(GMouse* m) { (void)m; if (HAL_GPIO_ReadPin(GPIOC, GPIO_PIN_4) == GPIO_PIN_RESET) - return TRUE; + return gTrue; - return FALSE; + return gFalse; } static GFXINLINE void aquire_bus(GMouse* m) diff --git a/boards/addons/ginput/touch/MCU/ginput_lld_mouse_board_olimex_pic32mx_lcd.h b/boards/addons/ginput/touch/MCU/ginput_lld_mouse_board_olimex_pic32mx_lcd.h index 391eba9c..1b535473 100644 --- a/boards/addons/ginput/touch/MCU/ginput_lld_mouse_board_olimex_pic32mx_lcd.h +++ b/boards/addons/ginput/touch/MCU/ginput_lld_mouse_board_olimex_pic32mx_lcd.h @@ -59,18 +59,18 @@ static const ADCConversionGroup ADC_Y_CG = { .channels = 1 << YPOS, }; -static bool_t init_board(GMouse *m, unsigned driverinstance) { +static gBool init_board(GMouse *m, unsigned driverinstance) { (void) m; if (driverinstance) - return FALSE; + return gFalse; adcObjectInit(&ADCD); adcStart(&ADCD, &ADCC); - return TRUE; + return gTrue; } -static bool_t read_xyz(GMouse *m, GMouseReading *prd) { +static gBool read_xyz(GMouse *m, GMouseReading *prd) { adcsample_t samples[2]; prd->buttons = 0; @@ -89,7 +89,7 @@ static bool_t read_xyz(GMouse *m, GMouseReading *prd) { // Shortcut - no need to read X or Y if the touch is off. if (pdr->z < GMOUSE_MCU_Z_TOUCHON) - return TRUE; + return gTrue; // Read X palSetPadMode(IOPORTB, XPOS, PAL_MODE_OUTPUT); @@ -111,7 +111,7 @@ static bool_t read_xyz(GMouse *m, GMouseReading *prd) { adcConvert(&ADCD, &ADC_X_CG, &samples[0], 1); pdr->y = ADC_MAX - samples[0]; - return TRUE; + return gTrue; } #endif /* _GINPUT_LLD_MOUSE_BOARD_H */ diff --git a/boards/base/Altera-MAX10-Neek/gmouse_lld_FT5316_board.h b/boards/base/Altera-MAX10-Neek/gmouse_lld_FT5316_board.h index c0d9354b..2c3288d8 100644 --- a/boards/base/Altera-MAX10-Neek/gmouse_lld_FT5316_board.h +++ b/boards/base/Altera-MAX10-Neek/gmouse_lld_FT5316_board.h @@ -66,14 +66,14 @@ static unsigned int device_read_16(unsigned char device_address, unsigned char s return (0xFFFF & ((rdata_h << 8) | rdata_l)); } -static bool_t init_board(GMouse* m, unsigned instance) +static gBool init_board(GMouse* m, unsigned instance) { (void)m; (void)instance; I2C_init(I2C_OPENCORES_0_BASE, 50000000, 400000); - return TRUE; + return gTrue; } static void write_reg(GMouse* m, uint8_t reg, uint8_t val) diff --git a/boards/base/ArduinoTinyScreen/gfx/board_SSD1331.h b/boards/base/ArduinoTinyScreen/gfx/board_SSD1331.h index 17b125c8..7efd3050 100644 --- a/boards/base/ArduinoTinyScreen/gfx/board_SSD1331.h +++ b/boards/base/ArduinoTinyScreen/gfx/board_SSD1331.h @@ -16,6 +16,7 @@ #define write_cmd(g, cmd) SSD1331_write_cmd(cmd) #define write_data(g, data) SSD1331_write_data(data) +/* This test is needed as this file is also included in the .cpp file providing the below functions */ #ifdef __cplusplus extern "C" { #endif diff --git a/boards/base/Embest-STM32-DMSTF4BB/board_SSD2119.h b/boards/base/Embest-STM32-DMSTF4BB/board_SSD2119.h index 67cebb11..fe59ba26 100644 --- a/boards/base/Embest-STM32-DMSTF4BB/board_SSD2119.h +++ b/boards/base/Embest-STM32-DMSTF4BB/board_SSD2119.h @@ -99,7 +99,7 @@ static GFXINLINE void post_init_board(GDisplay *g) { (void) g; } -static GFXINLINE void setpin_reset(GDisplay *g, bool_t state) { +static GFXINLINE void setpin_reset(GDisplay *g, gBool state) { (void) g; if (state) { CLR_RST; diff --git a/boards/base/Embest-STM32-DMSTF4BB/gmouse_lld_STMPE811_board.h b/boards/base/Embest-STM32-DMSTF4BB/gmouse_lld_STMPE811_board.h index 853c13a8..61304a62 100644 --- a/boards/base/Embest-STM32-DMSTF4BB/gmouse_lld_STMPE811_board.h +++ b/boards/base/Embest-STM32-DMSTF4BB/gmouse_lld_STMPE811_board.h @@ -43,12 +43,12 @@ static const I2CConfig i2ccfg = { FAST_DUTY_CYCLE_2, }; -static bool_t init_board(GMouse* m, unsigned driverinstance) { +static gBool init_board(GMouse* m, unsigned driverinstance) { (void) m; // This board only supports one touch panel if (driverinstance) - return FALSE; + return gFalse; palSetPadMode(GPIOC, 13, PAL_MODE_INPUT | PAL_STM32_PUDR_FLOATING); /* TP IRQ */ palSetPadMode(GPIOB, 8, PAL_MODE_ALTERNATE(4) | PAL_STM32_OTYPE_OPENDRAIN); /* SCL */ @@ -56,11 +56,11 @@ static bool_t init_board(GMouse* m, unsigned driverinstance) { i2cStart(&I2CD1, &i2ccfg); - return TRUE; + return gTrue; } #if GMOUSE_STMPE811_GPIO_IRQPIN - static bool_t getpin_irq(GMouse* m) { + static gBool getpin_irq(GMouse* m) { (void) m; return !palReadPad(GPIOC, 13); diff --git a/boards/base/FireBull-STM32F103-FB/board_SSD1289.h b/boards/base/FireBull-STM32F103-FB/board_SSD1289.h index 98e323de..15170acc 100644 --- a/boards/base/FireBull-STM32F103-FB/board_SSD1289.h +++ b/boards/base/FireBull-STM32F103-FB/board_SSD1289.h @@ -48,7 +48,7 @@ static GFXINLINE void post_init_board(GDisplay *g) (void) g; } -static GFXINLINE void setpin_reset(GDisplay *g, bool_t state) +static GFXINLINE void setpin_reset(GDisplay *g, gBool state) { (void) g; (void) state; diff --git a/boards/base/FireBull-STM32F103-FB/gmouse_lld_ADS7843_board.h b/boards/base/FireBull-STM32F103-FB/gmouse_lld_ADS7843_board.h index a49394ad..1bc18f39 100644 --- a/boards/base/FireBull-STM32F103-FB/gmouse_lld_ADS7843_board.h +++ b/boards/base/FireBull-STM32F103-FB/gmouse_lld_ADS7843_board.h @@ -26,13 +26,13 @@ static const SPIConfig spicfg = { /* SPI_CR1_BR_2 |*/ SPI_CR1_BR_1 | SPI_CR1_BR_0, }; -static bool_t init_board(GMouse* m, unsigned driverinstance) +static gBool init_board(GMouse* m, unsigned driverinstance) { (void)m; // Only one touch interface on this board if (driverinstance) - return FALSE; + return gFalse; // Set the GPIO modes palSetPadMode(GPIOC, 4, PAL_MODE_INPUT_PULLUP); @@ -40,10 +40,10 @@ static bool_t init_board(GMouse* m, unsigned driverinstance) // Start the SPI peripheral spiStart(&SPID1, &spicfg); - return TRUE; + return gTrue; } -static GFXINLINE bool_t getpin_pressed(GMouse* m) +static GFXINLINE gBool getpin_pressed(GMouse* m) { (void) m; diff --git a/boards/base/HY-MiniSTM32V/board_SSD1289.h b/boards/base/HY-MiniSTM32V/board_SSD1289.h index c6c45e2b..7193e466 100644 --- a/boards/base/HY-MiniSTM32V/board_SSD1289.h +++ b/boards/base/HY-MiniSTM32V/board_SSD1289.h @@ -124,7 +124,7 @@ static GFXINLINE void post_init_board(GDisplay *g) { (void) g; } -static GFXINLINE void setpin_reset(GDisplay *g, bool_t state) { +static GFXINLINE void setpin_reset(GDisplay *g, gBool state) { (void) g; if(state) {} diff --git a/boards/base/HY-MiniSTM32V/gmouse_lld_ADS7843_board.h b/boards/base/HY-MiniSTM32V/gmouse_lld_ADS7843_board.h index 9ef33f3f..5283201c 100644 --- a/boards/base/HY-MiniSTM32V/gmouse_lld_ADS7843_board.h +++ b/boards/base/HY-MiniSTM32V/gmouse_lld_ADS7843_board.h @@ -46,7 +46,7 @@ static const SPIConfig spicfg = { * TP_IRQ PB6 */ -static bool_t init_board(GMouse* m, unsigned driverinstance) { +static gBool init_board(GMouse* m, unsigned driverinstance) { (void) m; (void) driverinstance; @@ -63,7 +63,7 @@ static bool_t init_board(GMouse* m, unsigned driverinstance) { /* * PB6 is connected to TP_IRQ (low active). */ -static GFXINLINE bool_t getpin_pressed(GMouse* m) { +static GFXINLINE gBool getpin_pressed(GMouse* m) { (void)m; return (!palReadPad(GPIOB, 6)); } diff --git a/boards/base/Marlin/board_RA8875.h b/boards/base/Marlin/board_RA8875.h index 4288c8ab..5e9a5456 100644 --- a/boards/base/Marlin/board_RA8875.h +++ b/boards/base/Marlin/board_RA8875.h @@ -70,7 +70,7 @@ static GFXINLINE void post_init_board(GDisplay *g) { FSMC_Bank1->BTCR[2] = FSMC_BCR1_MWID_0 | FSMC_BCR1_WREN | FSMC_BCR1_MBKEN; } -static GFXINLINE void setpin_reset(GDisplay *g, bool_t state) { +static GFXINLINE void setpin_reset(GDisplay *g, gBool state) { (void) g; (void) state; } diff --git a/boards/base/Marlin/gmouse_lld_FT5x06_board.h b/boards/base/Marlin/gmouse_lld_FT5x06_board.h index 872dd208..b8301881 100644 --- a/boards/base/Marlin/gmouse_lld_FT5x06_board.h +++ b/boards/base/Marlin/gmouse_lld_FT5x06_board.h @@ -32,13 +32,13 @@ static const I2CConfig i2ccfg2 = { FAST_DUTY_CYCLE_2, }; -static bool_t init_board(GMouse* m, unsigned driverinstance) { +static gBool init_board(GMouse* m, unsigned driverinstance) { (void) m; // We only support one of these on this board if (driverinstance) - return FALSE; - return TRUE; + return gFalse; + return gTrue; } static GFXINLINE void aquire_bus(GMouse* m) { diff --git a/boards/base/Mikromedia-Plus-STM32-M4/board_SSD1963.h b/boards/base/Mikromedia-Plus-STM32-M4/board_SSD1963.h index 62672105..5f3da306 100644 --- a/boards/base/Mikromedia-Plus-STM32-M4/board_SSD1963.h +++ b/boards/base/Mikromedia-Plus-STM32-M4/board_SSD1963.h @@ -68,7 +68,7 @@ static GFXINLINE void post_init_board(GDisplay *g) { (void) g; } -static GFXINLINE void setpin_reset(GDisplay *g, bool_t state) { +static GFXINLINE void setpin_reset(GDisplay *g, gBool state) { (void) g; if (state) { CLR_RST; diff --git a/boards/base/Mikromedia-Plus-STM32-M4/gmouse_lld_STMPE610_board.h b/boards/base/Mikromedia-Plus-STM32-M4/gmouse_lld_STMPE610_board.h index c18e7450..629afd0d 100644 --- a/boards/base/Mikromedia-Plus-STM32-M4/gmouse_lld_STMPE610_board.h +++ b/boards/base/Mikromedia-Plus-STM32-M4/gmouse_lld_STMPE610_board.h @@ -43,12 +43,12 @@ static const I2CConfig i2ccfg = { FAST_DUTY_CYCLE_2, }; -static bool_t init_board(GMouse* m, unsigned driverinstance) { +static gBool init_board(GMouse* m, unsigned driverinstance) { (void) m; // This board only supports one touch panel if (driverinstance) - return FALSE; + return gFalse; palSetPadMode(GPIOA, 0, PAL_MODE_INPUT | PAL_STM32_PUDR_FLOATING); /* TP IRQ */ palSetPadMode(GPIOB, 6, PAL_MODE_ALTERNATE(4) | PAL_STM32_OTYPE_OPENDRAIN); /* SCL */ @@ -56,11 +56,11 @@ static bool_t init_board(GMouse* m, unsigned driverinstance) { i2cStart(&I2CD1, &i2ccfg); - return TRUE; + return gTrue; } #if GMOUSE_STMPE610_GPIO_IRQPIN - static bool_t getpin_irq(GMouse* m) { + static gBool getpin_irq(GMouse* m) { (void) m; return !palReadPad(GPIOA, 0); diff --git a/boards/base/Mikromedia-STM32-M4-ILI9341/board_ILI9341.h b/boards/base/Mikromedia-STM32-M4-ILI9341/board_ILI9341.h index 43d5eb20..4908bc2d 100644 --- a/boards/base/Mikromedia-STM32-M4-ILI9341/board_ILI9341.h +++ b/boards/base/Mikromedia-STM32-M4-ILI9341/board_ILI9341.h @@ -39,7 +39,7 @@ static GFXINLINE void post_init_board(GDisplay *g) { (void) g; } -static GFXINLINE void setpin_reset(GDisplay *g, bool_t state) { +static GFXINLINE void setpin_reset(GDisplay *g, gBool state) { (void) g; if(state) { // reset lcd diff --git a/boards/base/Mikromedia-STM32-M4-ILI9341/gmouse_lld_MCU_board.h b/boards/base/Mikromedia-STM32-M4-ILI9341/gmouse_lld_MCU_board.h index bad8b9ab..ba0907fe 100644 --- a/boards/base/Mikromedia-STM32-M4-ILI9341/gmouse_lld_MCU_board.h +++ b/boards/base/Mikromedia-STM32-M4-ILI9341/gmouse_lld_MCU_board.h @@ -41,12 +41,12 @@ static const ADCConversionGroup adcgrpcfg = { ADC_SQR3_SQ2_N(ADC_CHANNEL_IN8) | ADC_SQR3_SQ1_N(ADC_CHANNEL_IN9) }; -static bool_t init_board(GMouse *m, unsigned driverinstance) { +static gBool init_board(GMouse *m, unsigned driverinstance) { (void) m; // Only one touch interface on this board if (driverinstance) - return FALSE; + return gFalse; adcStart(&ADCD1, 0); @@ -54,10 +54,10 @@ static bool_t init_board(GMouse *m, unsigned driverinstance) { palClearPad(GPIOB, GPIOB_DRIVEA); palClearPad(GPIOB, GPIOB_DRIVEB); chThdSleepMilliseconds(1); // Settling time - return TRUE; + return gTrue; } -static bool_t read_xyz(GMouse *m, GMouseReading *prd) { +static gBool read_xyz(GMouse *m, GMouseReading *prd) { adcsample_t samples[ADC_NUM_CHANNELS * ADC_BUF_DEPTH]; (void) m; @@ -89,7 +89,7 @@ static bool_t read_xyz(GMouse *m, GMouseReading *prd) { palClearPad(GPIOB, GPIOB_DRIVEA); palClearPad(GPIOB, GPIOB_DRIVEB); } - return TRUE; + return gTrue; } #endif /* _LLD_GMOUSE_MCU_BOARD_H */ diff --git a/boards/base/Olimex-SAM7EX256-GE12/board_Nokia6610GE12.h b/boards/base/Olimex-SAM7EX256-GE12/board_Nokia6610GE12.h index 6da500be..1dd8d803 100644 --- a/boards/base/Olimex-SAM7EX256-GE12/board_Nokia6610GE12.h +++ b/boards/base/Olimex-SAM7EX256-GE12/board_Nokia6610GE12.h @@ -57,7 +57,7 @@ static const PWMConfig pwmcfg = { }, }; -static bool_t pwmRunning = FALSE; +static gBool pwmRunning = gFalse; /** * @brief Initialise the board for the display. @@ -123,7 +123,7 @@ static GFXINLINE void init_board(GDisplay *g) { pSPI->SPI_CSR[0] = 0x01010311; //9bit, CPOL=1, ClockPhase=0, SCLK = 48Mhz/3 = 16MHz /* Display backlight control at 100% */ - pwmRunning = FALSE; + pwmRunning = gFalse; palSetPad(IOPORT2, PIOB_LCD_BL); break; } @@ -133,7 +133,7 @@ static GFXINLINE void post_init_board(GDisplay *g) { (void) g; } -static GFXINLINE void setpin_reset(GDisplay *g, bool_t state) { +static GFXINLINE void setpin_reset(GDisplay *g, gBool state) { (void) g; if (state) palClearPad(IOPORT1, PIOA_LCD_RESET); @@ -147,21 +147,21 @@ static GFXINLINE void set_backlight(GDisplay *g, uint8_t percent) { /* Turn the pin on - No PWM */ if (pwmRunning) { pwmStop(&PWMD2); - pwmRunning = FALSE; + pwmRunning = gFalse; } palSetPad(IOPORT2, PIOB_LCD_BL); } else if (percent == 0) { /* Turn the pin off - No PWM */ if (pwmRunning) { pwmStop(&PWMD2); - pwmRunning = FALSE; + pwmRunning = gFalse; } palClearPad(IOPORT2, PIOB_LCD_BL); } else { /* Use the PWM */ if (!pwmRunning) { pwmStart(&PWMD2, &pwmcfg); - pwmRunning = TRUE; + pwmRunning = gTrue; } pwmEnableChannel(&PWMD2, 0, PWM_VALUE(percent)); } diff --git a/boards/base/Olimex-SAM7EX256-GE8/board_Nokia6610GE8.h b/boards/base/Olimex-SAM7EX256-GE8/board_Nokia6610GE8.h index a11766e4..193652eb 100644 --- a/boards/base/Olimex-SAM7EX256-GE8/board_Nokia6610GE8.h +++ b/boards/base/Olimex-SAM7EX256-GE8/board_Nokia6610GE8.h @@ -56,7 +56,7 @@ static const PWMConfig pwmcfg = { }, }; -static bool_t pwmRunning = FALSE; +static gBool pwmRunning = gFalse; /** * @brief Initialise the board for the display. @@ -121,7 +121,7 @@ static GFXINLINE void init_board(GDisplay *g) { pSPI->SPI_CSR[0] = 0x00000311; //9bit, CPOL=1, ClockPhase=0, SCLK = 48Mhz/3 = 16MHz /* Display backlight control at 100% */ - pwmRunning = FALSE; + pwmRunning = gFalse; palSetPad(IOPORT2, PIOB_LCD_BL); break; } @@ -131,7 +131,7 @@ static GFXINLINE void post_init_board(GDisplay *g) { (void) g; } -static GFXINLINE void setpin_reset(GDisplay *g, bool_t state) { +static GFXINLINE void setpin_reset(GDisplay *g, gBool state) { (void) g; if (state) palClearPad(IOPORT1, PIOA_LCD_RESET); @@ -145,21 +145,21 @@ static GFXINLINE void set_backlight(GDisplay *g, uint8_t percent) { /* Turn the pin on - No PWM */ if (pwmRunning) { pwmStop(&PWMD2); - pwmRunning = FALSE; + pwmRunning = gFalse; } palSetPad(IOPORT2, PIOB_LCD_BL); } else if (percent == 0) { /* Turn the pin off - No PWM */ if (pwmRunning) { pwmStop(&PWMD2); - pwmRunning = FALSE; + pwmRunning = gFalse; } palClearPad(IOPORT2, PIOB_LCD_BL); } else { /* Use the PWM */ if (!pwmRunning) { pwmStart(&PWMD2, &pwmcfg); - pwmRunning = TRUE; + pwmRunning = gTrue; } pwmEnableChannel(&PWMD2, 0, PWM_VALUE(percent)); } diff --git a/boards/base/Olimex-SAM7EX256-GE8/board_SSD1306_i2c.h b/boards/base/Olimex-SAM7EX256-GE8/board_SSD1306_i2c.h index aee3aa82..7a9ef46a 100644 --- a/boards/base/Olimex-SAM7EX256-GE8/board_SSD1306_i2c.h +++ b/boards/base/Olimex-SAM7EX256-GE8/board_SSD1306_i2c.h @@ -102,7 +102,7 @@ static GFXINLINE void post_init_board(GDisplay *g) { (void) g; } -static GFXINLINE void setpin_reset(GDisplay *g, bool_t state) { +static GFXINLINE void setpin_reset(GDisplay *g, gBool state) { (void) g; (void) state; } diff --git a/boards/base/Olimex-SAM7EX256-GE8/board_SSD1306_spi.h b/boards/base/Olimex-SAM7EX256-GE8/board_SSD1306_spi.h index ce2696dd..8caf3e8c 100644 --- a/boards/base/Olimex-SAM7EX256-GE8/board_SSD1306_spi.h +++ b/boards/base/Olimex-SAM7EX256-GE8/board_SSD1306_spi.h @@ -175,7 +175,7 @@ static GFXINLINE void post_init_board(GDisplay *g) { (void) g; } -static GFXINLINE void setpin_reset(GDisplay *g, bool_t state) { +static GFXINLINE void setpin_reset(GDisplay *g, gBool state) { (void) g; (void) state; diff --git a/boards/base/Olimex-SAM7EX256-GE8/board_SSD1331.h b/boards/base/Olimex-SAM7EX256-GE8/board_SSD1331.h index e7fc2242..7eb9e619 100644 --- a/boards/base/Olimex-SAM7EX256-GE8/board_SSD1331.h +++ b/boards/base/Olimex-SAM7EX256-GE8/board_SSD1331.h @@ -172,7 +172,7 @@ static GFXINLINE void post_init_board(GDisplay *g) { (void) g; } -static GFXINLINE void setpin_reset(GDisplay *g, bool_t state) { +static GFXINLINE void setpin_reset(GDisplay *g, gBool state) { (void) g; (void) state; diff --git a/boards/base/Olimex-SAM7EX256-GE8/board_TLS8204.h b/boards/base/Olimex-SAM7EX256-GE8/board_TLS8204.h index b4381e99..f41724ab 100644 --- a/boards/base/Olimex-SAM7EX256-GE8/board_TLS8204.h +++ b/boards/base/Olimex-SAM7EX256-GE8/board_TLS8204.h @@ -161,7 +161,7 @@ static GFXINLINE void post_init_board(GDisplay *g) { (void) g; } -static GFXINLINE void setpin_reset(GDisplay *g, bool_t state) { +static GFXINLINE void setpin_reset(GDisplay *g, gBool state) { (void) g; (void) state; diff --git a/boards/base/Olimex-SAM7EX256-GE8/gaudio_play_board.h b/boards/base/Olimex-SAM7EX256-GE8/gaudio_play_board.h index bbbc48c6..192badd0 100644 --- a/boards/base/Olimex-SAM7EX256-GE8/gaudio_play_board.h +++ b/boards/base/Olimex-SAM7EX256-GE8/gaudio_play_board.h @@ -35,15 +35,15 @@ static GPTConfig gptcfg = { static uint16_t lastvalue; -static bool gaudio_play_pwm_setup(uint32_t frequency, ArrayDataFormat format) { +static gBool gaudio_play_pwm_setup(uint32_t frequency, ArrayDataFormat format) { if (format == ARRAY_DATA_10BITUNSIGNED) pwmcfg.period = 1024; else if (format == ARRAY_DATA_8BITUNSIGNED) pwmcfg.period = 256; else - return FALSE; + return gFalse; gptcfg.frequency = frequency; - return TRUE; + return gTrue; } static void gaudio_play_pwm_start(void) { diff --git a/boards/base/Olimex-STM32-LCD/board_ILI9320.h b/boards/base/Olimex-STM32-LCD/board_ILI9320.h index 1f3a8c82..a58e7d69 100644 --- a/boards/base/Olimex-STM32-LCD/board_ILI9320.h +++ b/boards/base/Olimex-STM32-LCD/board_ILI9320.h @@ -45,7 +45,7 @@ static GFXINLINE void post_init_board(GDisplay *g) { (void) g; } -static GFXINLINE void setpin_reset(GDisplay *g, bool_t state) { +static GFXINLINE void setpin_reset(GDisplay *g, gBool state) { (void) g; if(state) diff --git a/boards/base/Olimex-STM32-LCD/gmouse_lld_MCU_board.h b/boards/base/Olimex-STM32-LCD/gmouse_lld_MCU_board.h index 071ef081..7a6487e6 100644 --- a/boards/base/Olimex-STM32-LCD/gmouse_lld_MCU_board.h +++ b/boards/base/Olimex-STM32-LCD/gmouse_lld_MCU_board.h @@ -58,22 +58,22 @@ static GFXINLINE void setup_z(void) { palSetPad(GPIOC, 3); } -static bool_t init_board(GMouse *m, unsigned driverinstance) { +static gBool init_board(GMouse *m, unsigned driverinstance) { (void) m; // Only one touch interface on this board if (driverinstance) - return FALSE; + return gFalse; adcStart(&ADCD1, 0); // Set up for reading Z setup_z(); chThdSleepMilliseconds(1); // Settling time - return TRUE; + return gTrue; } -static bool_t read_xyz(GMouse *m, GMouseReading *prd) { +static gBool read_xyz(GMouse *m, GMouseReading *prd) { adcsample_t samples[ADC_NUM_CHANNELS * ADC_BUF_DEPTH]; uint16_t val1, val2; (void) m; @@ -130,7 +130,7 @@ static bool_t read_xyz(GMouse *m, GMouseReading *prd) { // Set up for reading z again. We know it will be 20ms before we get called again so don't worry about settling time setup_z(); } - return TRUE; + return gTrue; } #endif /* _LLD_GMOUSE_MCU_BOARD_H */ diff --git a/boards/base/STM32F429i-Discovery/chibios/gmouse_lld_STMPE811_board.h b/boards/base/STM32F429i-Discovery/chibios/gmouse_lld_STMPE811_board.h index 02abc43d..eb8487a1 100644 --- a/boards/base/STM32F429i-Discovery/chibios/gmouse_lld_STMPE811_board.h +++ b/boards/base/STM32F429i-Discovery/chibios/gmouse_lld_STMPE811_board.h @@ -42,12 +42,12 @@ static const I2CConfig i2ccfg = { FAST_DUTY_CYCLE_2, }; -static bool_t init_board(GMouse* m, unsigned driverinstance) { +static gBool init_board(GMouse* m, unsigned driverinstance) { (void) m; // This board only supports one touch panel if (driverinstance) - return FALSE; + return gFalse; // Set pin modes #if CH_KERNEL_MAJOR == 2 @@ -63,11 +63,11 @@ static bool_t init_board(GMouse* m, unsigned driverinstance) { // Start the I2C i2cStart(&I2CD3, &i2ccfg); - return TRUE; + return gTrue; } #if GMOUSE_STMPE811_GPIO_IRQPIN - static bool_t getpin_irq(GMouse* m) { + static gBool getpin_irq(GMouse* m) { (void) m; return !palReadPad(GPIOA, 15); diff --git a/boards/base/STM32F439i-Eval/CubeHal/gmouse_lld_EXC7200_board.h b/boards/base/STM32F439i-Eval/CubeHal/gmouse_lld_EXC7200_board.h index cd558d69..56dbe599 100644 --- a/boards/base/STM32F439i-Eval/CubeHal/gmouse_lld_EXC7200_board.h +++ b/boards/base/STM32F439i-Eval/CubeHal/gmouse_lld_EXC7200_board.h @@ -40,7 +40,7 @@ static I2C_HandleTypeDef _i2cHandle; -static bool_t init_board(GMouse* m, unsigned driverinstance) +static gBool init_board(GMouse* m, unsigned driverinstance) { GPIO_InitTypeDef GPIO_InitStruct; @@ -79,17 +79,17 @@ static bool_t init_board(GMouse* m, unsigned driverinstance) _i2cHandle.Init.NoStretchMode = I2C_NOSTRETCH_DISABLED; HAL_I2C_Init(&_i2cHandle); - return TRUE; + return gTrue; } -static bool_t read_bytes(GMouse* m, uint8_t reg, uint8_t* buffer, uint8_t nbrBytes) +static gBool read_bytes(GMouse* m, uint8_t reg, uint8_t* buffer, uint8_t nbrBytes) { (void)m; HAL_I2C_Master_Transmit(&_i2cHandle, (uint16_t)EXC7200_SLAVE_ADDR, (uint8_t*)®, 1, 10000); HAL_I2C_Master_Receive(&_i2cHandle, (uint16_t)EXC7200_SLAVE_ADDR, buffer, nbrBytes, 10000); - return TRUE; + return gTrue; } #endif /* _GINPUT_LLD_MOUSE_BOARD_H */ diff --git a/boards/base/STM32F469i-Discovery/CubeHAL/gmouse_lld_FT6x06_board.h b/boards/base/STM32F469i-Discovery/CubeHAL/gmouse_lld_FT6x06_board.h index 04f72a72..79b59ced 100644 --- a/boards/base/STM32F469i-Discovery/CubeHAL/gmouse_lld_FT6x06_board.h +++ b/boards/base/STM32F469i-Discovery/CubeHAL/gmouse_lld_FT6x06_board.h @@ -30,7 +30,7 @@ I2C_HandleTypeDef i2cHandle; /* Maximum speed (400kHz) */ #define CLOCKSPEED 400000; -static bool_t init_board(GMouse* m, unsigned instance) { +static gBool init_board(GMouse* m, unsigned instance) { (void)m; (void)instance; @@ -69,9 +69,9 @@ static bool_t init_board(GMouse* m, unsigned instance) { __HAL_RCC_I2C1_CLK_ENABLE(); if(HAL_I2C_Init(&i2cHandle) == HAL_OK) - return TRUE; + return gTrue; - return FALSE; + return gFalse; } static GFXINLINE void aquire_bus(GMouse* m) { diff --git a/boards/base/STM32F746-Discovery/gmouse_lld_FT5336_board.h b/boards/base/STM32F746-Discovery/gmouse_lld_FT5336_board.h index 7d61bb25..d8c4c2e1 100644 --- a/boards/base/STM32F746-Discovery/gmouse_lld_FT5336_board.h +++ b/boards/base/STM32F746-Discovery/gmouse_lld_FT5336_board.h @@ -30,7 +30,7 @@ #define AFRH AFR[1] #endif -static bool_t init_board(GMouse* m, unsigned instance) +static gBool init_board(GMouse* m, unsigned instance) { (void)m; (void)instance; @@ -51,10 +51,10 @@ static bool_t init_board(GMouse* m, unsigned instance) // Initialize the I2C3 peripheral if (!(i2cInit(I2C3))) { - return FALSE; + return gFalse; } - return TRUE; + return gTrue; } static void write_reg(GMouse* m, uint8_t reg, uint8_t val) diff --git a/boards/base/STM32F746-Discovery/stm32f7_i2c.c b/boards/base/STM32F746-Discovery/stm32f7_i2c.c index 90bb9635..75af9de7 100644 --- a/boards/base/STM32F746-Discovery/stm32f7_i2c.c +++ b/boards/base/STM32F746-Discovery/stm32f7_i2c.c @@ -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)); } -bool_t i2cInit(I2C_TypeDef* i2c) +gBool i2cInit(I2C_TypeDef* i2c) { // Enable I2Cx peripheral clock. // Select APB1 as clock source @@ -51,7 +51,7 @@ bool_t i2cInit(I2C_TypeDef* i2c) RCC->DCKCFGR2 &= ~RCC_DCKCFGR2_I2C4SEL; RCC->APB1ENR |= RCC_APB1ENR_I2C4EN; } else { - return FALSE; + return gFalse; } // Disable the I2Cx peripheral @@ -76,7 +76,7 @@ bool_t i2cInit(I2C_TypeDef* i2c) // Enable the I2Cx peripheral i2c->CR1 |= I2C_CR1_PE; - return TRUE; + return gTrue; } void i2cSend(I2C_TypeDef* i2c, uint8_t slaveAddr, uint8_t* data, uint16_t length) diff --git a/boards/base/STM32F746-Discovery/stm32f7_i2c.h b/boards/base/STM32F746-Discovery/stm32f7_i2c.h index 625aeed8..4d481903 100644 --- a/boards/base/STM32F746-Discovery/stm32f7_i2c.h +++ b/boards/base/STM32F746-Discovery/stm32f7_i2c.h @@ -3,7 +3,7 @@ #include "stm32f7xx.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 i2cSendByte(I2C_TypeDef* i2c, uint8_t slaveAddr, uint8_t data); diff --git a/changelog.txt b/changelog.txt index 7793206b..4ec4d020 100644 --- a/changelog.txt +++ b/changelog.txt @@ -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. 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 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: 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 *** diff --git a/demos/3rdparty/notepad-2/main.c b/demos/3rdparty/notepad-2/main.c index 05481b18..ec9acd0c 100644 --- a/demos/3rdparty/notepad-2/main.c +++ b/demos/3rdparty/notepad-2/main.c @@ -81,13 +81,13 @@ int main(void) { gfxInit(); /* Calibrate the touchscreen */ - ginputSetMouseCalibrationRoutines(0, NULL, tsCalibRead, FALSE); + ginputSetMouseCalibrationRoutines(0, NULL, tsCalibRead, gFalse); ginputGetMouse(0); // Set the color scheme nSetColorScheme(schemeDefault); - while (TRUE) { + while (1) { gfxThreadWait(nLaunchNotepadApp()); gdispSetClip(0, 0, gdispGetWidth(), gdispGetHeight()); diff --git a/demos/3rdparty/notepad-2/notepadApp.c b/demos/3rdparty/notepad-2/notepadApp.c index 9f61aaa4..0540da2c 100644 --- a/demos/3rdparty/notepad-2/notepadApp.c +++ b/demos/3rdparty/notepad-2/notepadApp.c @@ -73,7 +73,7 @@ static NColorScheme nCurColorScheme; static DECLARE_THREAD_FUNCTION(notepadThread, param); // 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 int i, j, k; @@ -152,7 +152,7 @@ static void nbtnColorBarDraw(GHandle gh, bool_t enabled, bool_t isdown, const ch #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 int i, j = 0, k; @@ -215,7 +215,7 @@ static void nbtnColorBarSelDraw(GHandle gh, bool_t enabled, bool_t isdown, const #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; 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); } -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) isdown; (void) txt; @@ -401,7 +401,7 @@ static DECLARE_THREAD_FUNCTION(notepadThread, param) { ncoreSpawnDrawThread(nDrawingArea, gstatusConsole); - while(TRUE) { + while(1) { pem = (GEventMouse *) geventEventWait(&gl, TIME_INFINITE); /* button pressed... */ diff --git a/demos/3rdparty/notepad-2/notepadCore.c b/demos/3rdparty/notepad-2/notepadCore.c index 931ec331..65afc988 100644 --- a/demos/3rdparty/notepad-2/notepadCore.c +++ b/demos/3rdparty/notepad-2/notepadCore.c @@ -53,7 +53,7 @@ static gfxThreadHandle nThd; static GHandle ncoreDrawingArea = NULL; static GHandle nStatusConsole = NULL; -static volatile bool_t doExit; +static volatile gBool doExit; static void draw_point(coord_t x, coord_t y) { color_t c = ncoreDrawingArea->color; @@ -204,7 +204,7 @@ void ncoreSpawnDrawThread(GHandle drawingArea, GHandle statusConsole) { ncoreDrawingArea = drawingArea; nStatusConsole = statusConsole; - doExit = FALSE; + doExit = gFalse; nThd = gfxThreadCreate(waDrawThread, sizeof(waDrawThread), @@ -216,7 +216,7 @@ void ncoreSpawnDrawThread(GHandle drawingArea, GHandle statusConsole) { /* Terminate the core thread, wait for control release */ void ncoreTerminateDrawThread(void) { - doExit = TRUE; + doExit = gTrue; gfxThreadWait(nThd); nThd = 0; } diff --git a/demos/applications/combo/bounce.c b/demos/applications/combo/bounce.c index c669eff2..d3709056 100644 --- a/demos/applications/combo/bounce.c +++ b/demos/applications/combo/bounce.c @@ -33,7 +33,7 @@ #include "tasks.h" -static volatile bool_t run; +static volatile gBool run; static GHandle gh; static gfxThreadHandle thread; @@ -149,13 +149,13 @@ static DECLARE_THREAD_FUNCTION(task, param) { return 0; } -void doBounce(GHandle parent, bool_t start) { +void doBounce(GHandle parent, gBool start) { if (start) { - run = TRUE; + run = gTrue; gh = parent; thread = gfxThreadCreate(0, 0x200, LOW_PRIORITY, task, 0); } else if (run) { - run = FALSE; + run = gFalse; gfxThreadWait(thread); gfxYield(); } diff --git a/demos/applications/combo/main.c b/demos/applications/combo/main.c index 4585a74e..05cdb643 100644 --- a/demos/applications/combo/main.c +++ b/demos/applications/combo/main.c @@ -146,18 +146,18 @@ static void createWidgets(void) { border = ScrWidth < 450 ? 1 : 5; // Create the Tabs - wi.g.show = TRUE; + wi.g.show = gTrue; wi.g.x = border; wi.g.y = 0; wi.g.width = ScrWidth - 2*border; wi.g.height = ScrHeight-wi.g.y-border; ghTabset = gwinTabsetCreate(0, &wi, GWIN_TABSET_BORDER); - ghPgControls = gwinTabsetAddTab(ghTabset, "Controls", FALSE); - ghPgSliders = gwinTabsetAddTab(ghTabset, "Sliders", FALSE); - ghPgRadios = gwinTabsetAddTab(ghTabset, "Radios", FALSE); - ghPgLists = gwinTabsetAddTab(ghTabset, "Lists", FALSE); - ghPgLabels = gwinTabsetAddTab(ghTabset, "Labels", FALSE); - ghPgImages = gwinTabsetAddTab(ghTabset, "Images", FALSE); - ghPgBounce = gwinTabsetAddTab(ghTabset, "Bounce", FALSE); - ghPgMandelbrot = gwinTabsetAddTab(ghTabset, "Mandelbrot", FALSE); + ghPgControls = gwinTabsetAddTab(ghTabset, "Controls", gFalse); + ghPgSliders = gwinTabsetAddTab(ghTabset, "Sliders", gFalse); + ghPgRadios = gwinTabsetAddTab(ghTabset, "Radios", gFalse); + ghPgLists = gwinTabsetAddTab(ghTabset, "Lists", gFalse); + ghPgLabels = gwinTabsetAddTab(ghTabset, "Labels", gFalse); + ghPgImages = gwinTabsetAddTab(ghTabset, "Images", gFalse); + ghPgBounce = gwinTabsetAddTab(ghTabset, "Bounce", gFalse); + ghPgMandelbrot = gwinTabsetAddTab(ghTabset, "Mandelbrot", gFalse); pagewidth = gwinGetInnerWidth(ghTabset)/2; @@ -266,62 +266,62 @@ static void createWidgets(void) { wi.g.parent = ghPgLists; wi.g.width = LIST_WIDTH; wi.g.height = LIST_HEIGHT; wi.g.y = border; wi.g.x = border; wi.text = "L1"; - ghList1 = gwinListCreate(0, &wi, FALSE); - gwinListAddItem(ghList1, "Item 0", FALSE); - gwinListAddItem(ghList1, "Item 1", FALSE); - gwinListAddItem(ghList1, "Item 2", FALSE); - gwinListAddItem(ghList1, "Item 3", FALSE); - gwinListAddItem(ghList1, "Item 4", FALSE); - gwinListAddItem(ghList1, "Item 5", FALSE); - gwinListAddItem(ghList1, "Item 6", FALSE); - gwinListAddItem(ghList1, "Item 7", FALSE); - gwinListAddItem(ghList1, "Item 8", FALSE); - gwinListAddItem(ghList1, "Item 9", FALSE); - gwinListAddItem(ghList1, "Item 10", FALSE); - gwinListAddItem(ghList1, "Item 11", FALSE); - gwinListAddItem(ghList1, "Item 12", FALSE); - gwinListAddItem(ghList1, "Item 13", FALSE); + ghList1 = gwinListCreate(0, &wi, gFalse); + gwinListAddItem(ghList1, "Item 0", gFalse); + gwinListAddItem(ghList1, "Item 1", gFalse); + gwinListAddItem(ghList1, "Item 2", gFalse); + gwinListAddItem(ghList1, "Item 3", gFalse); + gwinListAddItem(ghList1, "Item 4", gFalse); + gwinListAddItem(ghList1, "Item 5", gFalse); + gwinListAddItem(ghList1, "Item 6", gFalse); + gwinListAddItem(ghList1, "Item 7", gFalse); + gwinListAddItem(ghList1, "Item 8", gFalse); + gwinListAddItem(ghList1, "Item 9", gFalse); + gwinListAddItem(ghList1, "Item 10", gFalse); + gwinListAddItem(ghList1, "Item 11", gFalse); + gwinListAddItem(ghList1, "Item 12", gFalse); + 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; } - ghList2 = gwinListCreate(0, &wi, TRUE); - gwinListAddItem(ghList2, "Item 0", FALSE); - gwinListAddItem(ghList2, "Item 1", FALSE); - gwinListAddItem(ghList2, "Item 2", FALSE); - gwinListAddItem(ghList2, "Item 3", FALSE); - gwinListAddItem(ghList2, "Item 4", FALSE); - gwinListAddItem(ghList2, "Item 5", FALSE); - gwinListAddItem(ghList2, "Item 6", FALSE); - gwinListAddItem(ghList2, "Item 7", FALSE); - gwinListAddItem(ghList2, "Item 8", FALSE); - gwinListAddItem(ghList2, "Item 9", FALSE); - gwinListAddItem(ghList2, "Item 10", FALSE); - gwinListAddItem(ghList2, "Item 11", FALSE); - gwinListAddItem(ghList2, "Item 12", FALSE); - gwinListAddItem(ghList2, "Item 13", FALSE); + ghList2 = gwinListCreate(0, &wi, gTrue); + gwinListAddItem(ghList2, "Item 0", gFalse); + gwinListAddItem(ghList2, "Item 1", gFalse); + gwinListAddItem(ghList2, "Item 2", gFalse); + gwinListAddItem(ghList2, "Item 3", gFalse); + gwinListAddItem(ghList2, "Item 4", gFalse); + gwinListAddItem(ghList2, "Item 5", gFalse); + gwinListAddItem(ghList2, "Item 6", gFalse); + gwinListAddItem(ghList2, "Item 7", gFalse); + gwinListAddItem(ghList2, "Item 8", gFalse); + gwinListAddItem(ghList2, "Item 9", gFalse); + gwinListAddItem(ghList2, "Item 10", gFalse); + gwinListAddItem(ghList2, "Item 11", gFalse); + gwinListAddItem(ghList2, "Item 12", gFalse); + 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; } - ghList3 = gwinListCreate(0, &wi, TRUE); - gwinListAddItem(ghList3, "Item 0", FALSE); - gwinListAddItem(ghList3, "Item 1", FALSE); - gwinListAddItem(ghList3, "Item 2", FALSE); - gwinListAddItem(ghList3, "Item 3", FALSE); + ghList3 = gwinListCreate(0, &wi, gTrue); + gwinListAddItem(ghList3, "Item 0", gFalse); + gwinListAddItem(ghList3, "Item 1", gFalse); + gwinListAddItem(ghList3, "Item 2", gFalse); + gwinListAddItem(ghList3, "Item 3", gFalse); gdispImageOpenFile(&imgYesNo, "image_yesno.gif"); gwinListItemSetImage(ghList3, 1, &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; } - ghList4 = gwinListCreate(0, &wi, TRUE); - gwinListAddItem(ghList4, "Item 0", FALSE); - gwinListAddItem(ghList4, "Item 1", FALSE); - gwinListAddItem(ghList4, "Item 2", FALSE); - gwinListAddItem(ghList4, "Item 3", FALSE); - gwinListAddItem(ghList4, "Item 4", FALSE); - gwinListAddItem(ghList4, "Item 5", FALSE); - gwinListAddItem(ghList4, "Item 6", FALSE); - gwinListAddItem(ghList4, "Item 7", FALSE); - gwinListAddItem(ghList4, "Item 8", FALSE); - gwinListAddItem(ghList4, "Item 9", FALSE); - gwinListAddItem(ghList4, "Item 10", FALSE); - gwinListAddItem(ghList4, "Item 11", FALSE); - gwinListAddItem(ghList4, "Item 12", FALSE); - gwinListAddItem(ghList4, "Item 13", FALSE); + ghList4 = gwinListCreate(0, &wi, gTrue); + gwinListAddItem(ghList4, "Item 0", gFalse); + gwinListAddItem(ghList4, "Item 1", gFalse); + gwinListAddItem(ghList4, "Item 2", gFalse); + gwinListAddItem(ghList4, "Item 3", gFalse); + gwinListAddItem(ghList4, "Item 4", gFalse); + gwinListAddItem(ghList4, "Item 5", gFalse); + gwinListAddItem(ghList4, "Item 6", gFalse); + gwinListAddItem(ghList4, "Item 7", gFalse); + gwinListAddItem(ghList4, "Item 8", gFalse); + gwinListAddItem(ghList4, "Item 9", gFalse); + gwinListAddItem(ghList4, "Item 10", gFalse); + gwinListAddItem(ghList4, "Item 11", gFalse); + gwinListAddItem(ghList4, "Item 12", gFalse); + gwinListAddItem(ghList4, "Item 13", gFalse); gwinListSetScroll(ghList4, scrollSmooth); // Image @@ -339,25 +339,25 @@ static void setLabels(void) { // The sliders snprintg(tmp, sizeof(tmp), "%d%%", gwinSliderGetPosition(ghSlider1)); - gwinSetText(ghLabelSlider1, tmp, TRUE); + gwinSetText(ghLabelSlider1, tmp, gTrue); snprintg(tmp, sizeof(tmp), "%d%%", gwinSliderGetPosition(ghSlider2)); - gwinSetText(ghLabelSlider2, tmp, TRUE); + gwinSetText(ghLabelSlider2, tmp, gTrue); snprintg(tmp, sizeof(tmp), "%d%%", gwinSliderGetPosition(ghSlider3)); - gwinSetText(ghLabelSlider3, tmp, TRUE); + gwinSetText(ghLabelSlider3, tmp, gTrue); snprintg(tmp, sizeof(tmp), "%d%%", gwinSliderGetPosition(ghSlider4)); - gwinSetText(ghLabelSlider4, tmp, TRUE); + gwinSetText(ghLabelSlider4, tmp, gTrue); // The radio buttons if (gwinRadioIsPressed(ghRadio1)) - gwinSetText(ghLabelRadio1, "Yes", TRUE); + gwinSetText(ghLabelRadio1, "Yes", gTrue); else if (gwinRadioIsPressed(ghRadio2)) - gwinSetText(ghLabelRadio1, "No", TRUE); + gwinSetText(ghLabelRadio1, "No", gTrue); } /** * Control the progress bar auto-increment */ -static void setProgressbar(bool_t onoff) { +static void setProgressbar(gBool onoff) { if (onoff) gwinProgressbarStart(ghProgressbar1, 500); else { @@ -369,7 +369,7 @@ static void setProgressbar(bool_t onoff) { /** * 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(ghPgSliders, ena); gwinSetEnabled(ghPgLabels, ena); @@ -386,7 +386,7 @@ static void setEnabled(bool_t ena) { gwinSetEnabled(ghCheckbox1, ena); gwinSetEnabled(ghCheckbox2, ena); gwinSetEnabled(ghCheckbox3, ena); - //gwinSetEnabled(ghCheckDisableAll, TRUE); + //gwinSetEnabled(ghCheckDisableAll, gTrue); } static void FlashOffFn(void *param) { @@ -404,7 +404,7 @@ int main(void) { // Set the widget defaults font = gdispOpenFont("*"); // Get the first defined font. gwinSetDefaultFont(font); - gwinSetDefaultStyle(&WhiteWidgetStyle, FALSE); + gwinSetDefaultStyle(&WhiteWidgetStyle, gFalse); gdispClear(GFX_WHITE); // Create the gwin windows/widgets @@ -458,7 +458,7 @@ int main(void) { // If it is the toggle button checkbox start the flash. } else if (((GEventGWinCheckbox *)pe)->gwin == ghCheckbox3) { gwinFlash(ghCheckbox3); - gtimerStart(&FlashTimer, FlashOffFn, 0, FALSE, 3000); + gtimerStart(&FlashTimer, FlashOffFn, 0, gFalse, 3000); } break; @@ -501,7 +501,7 @@ int main(void) { gdispClear(pstyle->background); // Update the style on all controls - gwinSetDefaultStyle(pstyle, TRUE); + gwinSetDefaultStyle(pstyle, gTrue); } break; } diff --git a/demos/applications/combo/mandelbrot.c b/demos/applications/combo/mandelbrot.c index 68ee1fae..8033957c 100644 --- a/demos/applications/combo/mandelbrot.c +++ b/demos/applications/combo/mandelbrot.c @@ -30,7 +30,7 @@ #include "gfx.h" #include "tasks.h" -static volatile bool_t run; +static volatile gBool run; static GHandle gh; static gfxThreadHandle thread; @@ -85,13 +85,13 @@ static DECLARE_THREAD_FUNCTION(task, param) { return 0; } -void doMandlebrot(GHandle parent, bool_t start) { +void doMandlebrot(GHandle parent, gBool start) { if (start) { - run = TRUE; + run = gTrue; gh = parent; thread = gfxThreadCreate(0, 0x400, LOW_PRIORITY, task, 0); } else if (run) { - run = FALSE; + run = gFalse; gfxThreadWait(thread); } } diff --git a/demos/applications/combo/tasks.h b/demos/applications/combo/tasks.h index 68a32e09..c7a2b7fc 100644 --- a/demos/applications/combo/tasks.h +++ b/demos/applications/combo/tasks.h @@ -1,7 +1,7 @@ #ifndef _TASKS_INCLUDED #define _TASKS_INCLUDED -void doMandlebrot(GHandle parent, bool_t start); -void doBounce(GHandle parent, bool_t start); +void doMandlebrot(GHandle parent, gBool start); +void doBounce(GHandle parent, gBool start); #endif diff --git a/demos/applications/mandelbrot/main.c b/demos/applications/mandelbrot/main.c index 37e0ac5f..808ef1c2 100644 --- a/demos/applications/mandelbrot/main.c +++ b/demos/applications/mandelbrot/main.c @@ -72,7 +72,7 @@ int main(void) { cx = -0.086f; cy = 0.85f; - while(TRUE) { + while(1) { mandelbrot(-2.0f*zoom+cx, -1.5f*zoom+cy, 2.0f*zoom+cx, 1.5f*zoom+cy); zoom *= 0.7f; diff --git a/demos/applications/notepad/main.c b/demos/applications/notepad/main.c index de24f227..72fb23e2 100644 --- a/demos/applications/notepad/main.c +++ b/demos/applications/notepad/main.c @@ -82,7 +82,7 @@ int main(void) { drawScreen(); - while (TRUE) { + while (1) { ginputGetMouseStatus(0, &ev); if (!(ev.buttons & GINPUT_MOUSE_BTN_LEFT)) continue; diff --git a/demos/benchmarks/main.c b/demos/benchmarks/main.c index 12d719ca..d14f3cc6 100644 --- a/demos/benchmarks/main.c +++ b/demos/benchmarks/main.c @@ -141,7 +141,7 @@ int main(void) { benchmark(); - while(TRUE) { + while(1) { gfxSleepMilliseconds(500); } diff --git a/demos/games/justget10/jg10.c b/demos/games/justget10/jg10.c index f9974fe1..7d5f8a46 100644 --- a/demos/games/justget10/jg10.c +++ b/demos/games/justget10/jg10.c @@ -17,12 +17,12 @@ GHandle jg10SelectionWidgetGCreate(GDisplay* g, jg10WidgetObject* wo, GWidgetIni typedef struct { // Node properties uint8_t num; // Node number - bool_t check; // Node needs to be checked or not - bool_t sel; // Node selected or not + gBool check; // Node needs to be checked or not + gBool sel; // Node selected or not } nodeProps; 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) gdispImage jg10Image[JG10_MAX_COUNT]; #define JG10_ANIM_IMAGES 5 @@ -33,7 +33,7 @@ uint8_t jg10MaxVal=4; // Max v font_t font; #if JG10_SHOW_SPLASH GTimer jg10SplashBlink; -bool_t jg10SplashTxtVisible = FALSE; +gBool jg10SplashTxtVisible = gFalse; gdispImage jg10SplashImage; #endif @@ -86,16 +86,16 @@ static int uitoa(unsigned int value, char * buf, int max) { return n; } -static bool_t 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; +static gBool inRange(int16_t x, int16_t y) { + if ((x >= 0) && (x < JG10_FIELD_WIDTH) && (y >= 0) && (y < JG10_FIELD_HEIGHT)) return gTrue; else return gFalse; } static void clean_SelCheck(void) { uint16_t i ,j; for (i = 0; i < JG10_FIELD_WIDTH; i++) { for (j = 0; j < JG10_FIELD_HEIGHT; j++) { - jg10Field[i][j].check = FALSE; - jg10Field[i][j].sel = FALSE; + jg10Field[i][j].check = gFalse; + jg10Field[i][j].sel = gFalse; } } } @@ -121,7 +121,7 @@ static void remove_Selected(void) { for (i = 0; i < JG10_FIELD_WIDTH; i++) { for (j = 0; j < JG10_FIELD_HEIGHT; j++) { if (jg10Field[i][j].sel) { - jg10Field[i][j].sel = FALSE; + jg10Field[i][j].sel = gFalse; jg10Field[i][j].num = 0; } } @@ -148,9 +148,9 @@ static uint8_t jg10_randomer(uint8_t max, uint8_t th) { static void movePiecesDown(void) { uint8_t tmp = 0; - bool_t needToCheck = TRUE; + gBool needToCheck = gTrue; while (needToCheck) { - needToCheck = FALSE; + needToCheck = gFalse; for (int8_t y = (JG10_FIELD_HEIGHT-1); y >= 0; y--) { for (uint8_t x = 0; x < JG10_FIELD_WIDTH; x++) { 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][0].num = 0; - needToCheck = TRUE; + needToCheck = gTrue; } } } @@ -172,9 +172,9 @@ static void movePiecesDown(void) { } gwinRedraw(mainWin); // Add new pieces - needToCheck = TRUE; + needToCheck = gTrue; while (needToCheck) { - needToCheck = FALSE; + needToCheck = gFalse; for (int8_t y = (JG10_FIELD_HEIGHT-1); y >= 0; y--) { for (uint8_t x = 0; x < JG10_FIELD_WIDTH; x++) { 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][0].num = jg10_randomer(jg10MaxVal, 3); - needToCheck = TRUE; + needToCheck = gTrue; } } } @@ -191,8 +191,8 @@ static void movePiecesDown(void) { } } -static bool_t checkForPossibleMove(void) { - bool_t canMove = FALSE; +static gBool checkForPossibleMove(void) { + gBool canMove = gFalse; uint16_t i ,j; for (i = 0; i < JG10_FIELD_WIDTH; i++) { 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,j+1) && jg10Field[i][j+1].num == jg10Field[i][j].num) || (inRange(i+1,j) && jg10Field[i+1][j].num == jg10Field[i][j].num)) { - canMove = TRUE; + canMove = gTrue; 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,y+1) && jg10Field[x][y+1].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(); - jg10Field[x][y].check = TRUE; - gwinSetVisible(Jg10SelectWidget, TRUE); + jg10Field[x][y].check = gTrue; + gwinSetVisible(Jg10SelectWidget, gTrue); } } else { // already selected section clicked... @@ -254,19 +254,19 @@ static DECLARE_THREAD_FUNCTION(thdJg10, msg) { jg10MaxVal = jg10Field[x][y].num; if (jg10MaxVal >= 10) printCongrats(); if (jg10MaxVal == 20) { // Just in case someone got so far :D I cannot imaginge though - jg10GameOver = TRUE; + jg10GameOver = gTrue; printGameOver(); } } - jg10Field[x][y].sel = FALSE; - gwinSetVisible(Jg10SelectWidget, FALSE); + jg10Field[x][y].sel = gFalse; + gwinSetVisible(Jg10SelectWidget, gFalse); remove_Selected(); movePiecesDown(); if (checkForPossibleMove()) { clean_SelCheck(); //gwinRedraw(mainWin); } else { - jg10GameOver = TRUE; + jg10GameOver = gTrue; printGameOver(); } } @@ -284,11 +284,11 @@ static void initField(void) { //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+y+5; // good demo to check out pieces :D - jg10Field[x][y].check = FALSE; - jg10Field[x][y].sel = FALSE; + jg10Field[x][y].check = gFalse; + jg10Field[x][y].sel = gFalse; } } - jg10GameOver = FALSE; + jg10GameOver = gFalse; printGameOver(); } @@ -304,21 +304,21 @@ static void mainWinDraw(GWidgetObject* gw, void* param) { static void jg10SelectionWidget_Draw(GWidgetObject* gw, void* param) { int16_t x, y; - bool_t needToCheck = TRUE; + gBool needToCheck = gTrue; (void)param; while (needToCheck) { - needToCheck = FALSE; + needToCheck = gFalse; for (x = 0; x < JG10_FIELD_WIDTH; x++) { for (y = 0; y < JG10_FIELD_HEIGHT; y++) { if (jg10Field[x][y].check && !jg10Field[x][y].sel) { - jg10Field[x][y].sel = TRUE; - jg10Field[x][y].check = FALSE; + jg10Field[x][y].sel = gTrue; + jg10Field[x][y].check = gFalse; // Up 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; - needToCheck = TRUE; + jg10Field[x][y-1].check = gTrue; + needToCheck = gTrue; } 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 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 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; - needToCheck = TRUE; + jg10Field[x][y+1].check = gTrue; + needToCheck = gTrue; } 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 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 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; - needToCheck = TRUE; + jg10Field[x-1][y].check = gTrue; + needToCheck = gTrue; } 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 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 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; - needToCheck = TRUE; + jg10Field[x+1][y].check = gTrue; + needToCheck = gTrue; } 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 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; gwinWidgetClearInit(&wi); // Container - mainWin - wi.g.show = FALSE; + wi.g.show = gFalse; wi.g.x = 0; wi.g.y = 0; wi.g.width = gdispGetWidth(); @@ -435,7 +435,7 @@ static void createMainWin(void) { mainWin = gwinContainerCreate(0, &wi, 0); // create selection widget - wi.g.show = FALSE; + wi.g.show = gFalse; wi.g.x = 0; wi.g.y = 0; wi.g.width = 272; @@ -496,6 +496,6 @@ void jg10ShowSplash(void) { gdispImageOpenFile(&jg10SplashImage, "splash.bmp"); gdispImageDraw(&jg10SplashImage, (gdispGetWidth()/2)-150, (gdispGetHeight()/2)-100, 300, 200, 0, 0); gdispImageClose(&jg10SplashImage); - gtimerStart(&jg10SplashBlink, jg10SplashBlinker, 0, TRUE, 400); + gtimerStart(&jg10SplashBlink, jg10SplashBlinker, 0, gTrue, 400); } #endif \ No newline at end of file diff --git a/demos/games/justget10/main.c b/demos/games/justget10/main.c index 29749686..d4238fed 100644 --- a/demos/games/justget10/main.c +++ b/demos/games/justget10/main.c @@ -21,7 +21,7 @@ int main(void) gdispCloseFont(font); #endif - while (TRUE) { + while (1) { ginputGetMouseStatus(0, &ev); if (ev.buttons & GINPUT_MOUSE_BTN_LEFT) { while (ev.buttons & GINPUT_MOUSE_BTN_LEFT) { // Wait until release diff --git a/demos/games/minesweeper/main.c b/demos/games/minesweeper/main.c index e7a105bf..54b79743 100644 --- a/demos/games/minesweeper/main.c +++ b/demos/games/minesweeper/main.c @@ -55,7 +55,7 @@ int main(void) gdispCloseFont(font); #endif - while (TRUE) { + while (1) { ginputGetMouseStatus(0, &ev); if (ev.buttons & GINPUT_MOUSE_BTN_LEFT) { while (ev.buttons & GINPUT_MOUSE_BTN_LEFT) { // Wait until release diff --git a/demos/games/minesweeper/mines.c b/demos/games/minesweeper/mines.c index 8b0cd292..1b58fc6b 100644 --- a/demos/games/minesweeper/mines.c +++ b/demos/games/minesweeper/mines.c @@ -4,16 +4,16 @@ typedef struct { // Node properties uint8_t num; // Node number, how many mines around - bool_t open; // Node shown or hidden - bool_t 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 open; // Node shown or hidden + gBool check; // Node needs to be checked or not, used for opening up empty nodes + gBool flag; // Node is marked with flag by player uint16_t fieldNum; // Node number, used to randomize gamestart "animation" } nodeProps; static GEventMouse ev; static nodeProps minesField[MINES_FIELD_WIDTH][MINES_FIELD_HEIGHT]; // Mines field array -static bool_t minesGameOver = FALSE; -static bool_t minesGameWinner = FALSE; +static gBool minesGameOver = gFalse; +static gBool minesGameWinner = gFalse; static int16_t minesEmptyNodes; // Empty node counter static int16_t minesFlags; // Flag 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 uint8_t minesStatusIconWidth = 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 bool_t minesSplashTxtVisible = FALSE; +static gBool minesFirstGame = gTrue; // Just don't clear field for the first time, as we have black screen already... :/ +static gBool minesSplashTxtVisible = gFalse; #if MINES_SHOW_SPLASH static GTimer minesSplashBlink; #endif @@ -125,19 +125,19 @@ static void minesTimeCounter(void* arg) 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)) - return TRUE; + return gTrue; else - return FALSE; + return gFalse; } static void showOne(int16_t x, int16_t y) { - minesField[x][y].open = TRUE; + minesField[x][y].open = gTrue; if (minesField[x][y].flag) { - minesField[x][y].flag = FALSE; + minesField[x][y].flag = gFalse; minesFlags--; } @@ -149,8 +149,8 @@ static void showOne(int16_t x, int16_t y) gdispImageClose(&minesImage); minesEmptyNodes--; } else if (minesField[x][y].num == 9) { - minesGameOver = TRUE; - minesGameWinner = FALSE; + minesGameOver = gTrue; + minesGameWinner = gFalse; gdispImageOpenFile(&minesImage, minesGraph[10]); gdispImageDraw(&minesImage, (x*MINES_CELL_HEIGHT)+1, (y*MINES_CELL_WIDTH)+1, MINES_CELL_WIDTH, MINES_CELL_HEIGHT, 0, 0); gdispImageClose(&minesImage); @@ -160,7 +160,7 @@ static void showOne(int16_t x, int16_t y) gdispImageOpenFile(&minesImage, minesGraph[9]); gdispImageDraw(&minesImage, (x*MINES_CELL_HEIGHT)+1, (y*MINES_CELL_WIDTH)+1, MINES_CELL_WIDTH, MINES_CELL_HEIGHT, 0, 0); gdispImageClose(&minesImage); - minesField[x][y].check = TRUE; + minesField[x][y].check = gTrue; minesEmptyNodes--; } } @@ -168,10 +168,10 @@ static void showOne(int16_t x, int16_t y) static void openEmptyNodes(void) { int16_t x, y, i, j; - bool_t needToCheck = TRUE; + gBool needToCheck = gTrue; while (needToCheck) { - needToCheck = FALSE; + needToCheck = gFalse; for (x = 0; x < MINES_FIELD_WIDTH; x++) { for (y = 0; y < MINES_FIELD_HEIGHT; y++) { 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 (inRange(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; uint16_t x,y, delay; - bool_t delayed = FALSE; + gBool delayed = gFalse; while (!minesGameOver) { if (minesEmptyNodes == 0) { - minesGameOver = TRUE; - minesGameWinner = TRUE; + minesGameOver = gTrue; + minesGameWinner = gTrue; } initRng(); ginputGetMouseStatus(0, &ev); - delayed = FALSE; + delayed = gFalse; if (ev.buttons & GINPUT_MOUSE_BTN_LEFT) { x = ev.x/MINES_CELL_WIDTH; y = ev.y/MINES_CELL_WIDTH; @@ -220,18 +220,18 @@ static DECLARE_THREAD_FUNCTION(thdMines, msg) 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); gdispImageClose(&minesImage); - minesField[x][y].flag = FALSE; + minesField[x][y].flag = gFalse; minesFlags--; printStats(); } else { gdispImageOpenFile(&minesImage, minesGraph[11]); gdispImageDraw(&minesImage, (x*MINES_CELL_HEIGHT)+1, (y*MINES_CELL_WIDTH)+1, MINES_CELL_WIDTH, MINES_CELL_HEIGHT, 0, 0); gdispImageClose(&minesImage); - minesField[x][y].flag = TRUE; + minesField[x][y].flag = gTrue; minesFlags++; printStats(); } - delayed = TRUE; + delayed = gTrue; } } } @@ -268,7 +268,7 @@ static void initField(void) int16_t x, y, mines, i, j; minesFlags = 0; - minesGameOver = FALSE; + minesGameOver = gFalse; printGameOver(); font_t font = gdispOpenFont("fixed_5x8"); @@ -291,9 +291,9 @@ static void initField(void) for (x = 0; x < MINES_FIELD_WIDTH; x++) { for (y = 0; y < MINES_FIELD_HEIGHT; y++) { minesField[x][y].num = 0; - minesField[x][y].open = FALSE; - minesField[x][y].check = FALSE; - minesField[x][y].flag = FALSE; + minesField[x][y].open = gFalse; + minesField[x][y].check = gFalse; + minesField[x][y].flag = gFalse; minesField[x][y].fieldNum = i; i++; } @@ -322,7 +322,7 @@ static void initField(void) } } } else { - minesFirstGame = FALSE; + minesFirstGame = gFalse; } // Drawing closed nodes randomly @@ -369,7 +369,7 @@ static void initField(void) minesTime = 0; minesUpdateTime(); - gtimerStart(&minesTimeCounterTimer, minesTimeCounter, 0, TRUE, 1000); + gtimerStart(&minesTimeCounterTimer, minesTimeCounter, 0, gTrue, 1000); } void minesStart(void) @@ -434,7 +434,7 @@ void minesStart(void) gdispImageDraw(&minesImage, (gdispGetWidth()/2)-150, (gdispGetHeight()/2)-100, 300, 200, 0, 0); gdispImageClose(&minesImage); - gtimerStart(&minesSplashBlink, minesSplashBlinker, 0, TRUE, 400); + gtimerStart(&minesSplashBlink, minesSplashBlinker, 0, gTrue, 400); } #endif diff --git a/demos/games/tetris/Example_Makefiles/stm32f4/board_SSD1289.h b/demos/games/tetris/Example_Makefiles/stm32f4/board_SSD1289.h index 833ebdb4..dc3580e6 100644 --- a/demos/games/tetris/Example_Makefiles/stm32f4/board_SSD1289.h +++ b/demos/games/tetris/Example_Makefiles/stm32f4/board_SSD1289.h @@ -111,7 +111,7 @@ static GFXINLINE void post_init_board(GDisplay *g) { (void) g; } -static GFXINLINE void setpin_reset(GDisplay *g, bool_t state) { +static GFXINLINE void setpin_reset(GDisplay *g, gBool state) { (void) g; (void) state; } diff --git a/demos/games/tetris/Example_Makefiles/stm32f4/ginput_lld_mouse_board.h b/demos/games/tetris/Example_Makefiles/stm32f4/ginput_lld_mouse_board.h index 39538747..0568d4e5 100644 --- a/demos/games/tetris/Example_Makefiles/stm32f4/ginput_lld_mouse_board.h +++ b/demos/games/tetris/Example_Makefiles/stm32f4/ginput_lld_mouse_board.h @@ -26,7 +26,7 @@ static GFXINLINE void init_board(void) spiStart(&SPID1, &spicfg); } -static GFXINLINE bool_t getpin_pressed(void) +static GFXINLINE gBool getpin_pressed(void) { return (!palReadPad(GPIOC, 4)); } diff --git a/demos/games/tetris/Example_Makefiles/stm32f4/gmouse_lld_ADS7843_board.h b/demos/games/tetris/Example_Makefiles/stm32f4/gmouse_lld_ADS7843_board.h index dc8e979e..1af92bb2 100644 --- a/demos/games/tetris/Example_Makefiles/stm32f4/gmouse_lld_ADS7843_board.h +++ b/demos/games/tetris/Example_Makefiles/stm32f4/gmouse_lld_ADS7843_board.h @@ -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 #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; // Only one touch interface on this board if (driverinstance) - return FALSE; + return gFalse; // Set the GPIO modes palSetPadMode(GPIOC, 6, PAL_MODE_OUTPUT_PUSHPULL); @@ -62,10 +62,10 @@ static bool_t init_board(GMouse* m, unsigned driverinstance) { // Start the SPI peripheral spiStart(&SPID1, &spicfg); - return TRUE; + return gTrue; } -static GFXINLINE bool_t getpin_pressed(GMouse* m) { +static GFXINLINE gBool getpin_pressed(GMouse* m) { (void) m; return (!palReadPad(GPIOC, 4)); diff --git a/demos/games/tetris/Example_Makefiles/stm32f4/gmouse_lld_ADS7843_board.h.old b/demos/games/tetris/Example_Makefiles/stm32f4/gmouse_lld_ADS7843_board.h.old index 77d82bf8..70a22ee3 100644 --- a/demos/games/tetris/Example_Makefiles/stm32f4/gmouse_lld_ADS7843_board.h.old +++ b/demos/games/tetris/Example_Makefiles/stm32f4/gmouse_lld_ADS7843_board.h.old @@ -22,13 +22,13 @@ static const SPIConfig spicfg = { /* SPI_CR1_BR_2 |*/ SPI_CR1_BR_1 | SPI_CR1_BR_0, }; -static bool_t init_board(GMouse* m, unsigned driverinstance) +static gBool init_board(GMouse* m, unsigned driverinstance) { (void)m; // Only one touch interface on this board if (driverinstance) - return FALSE; + return gFalse; // Set the GPIO modes palSetPadMode(GPIOC, 6, PAL_MODE_OUTPUT_PUSHPULL); @@ -40,10 +40,10 @@ static bool_t init_board(GMouse* m, unsigned driverinstance) // Start the SPI peripheral spiStart(&SPID1, &spicfg); - return TRUE; + return gTrue; } -GFXINLINE bool_t getpin_pressed(void) { +GFXINLINE gBool getpin_pressed(void) { return (!palReadPad(GPIOC, 4)); } diff --git a/demos/games/tetris/Example_Makefiles/stm32f4_chibios_3.x/board_SSD1289.h b/demos/games/tetris/Example_Makefiles/stm32f4_chibios_3.x/board_SSD1289.h index a74507e5..7e2bb05d 100644 --- a/demos/games/tetris/Example_Makefiles/stm32f4_chibios_3.x/board_SSD1289.h +++ b/demos/games/tetris/Example_Makefiles/stm32f4_chibios_3.x/board_SSD1289.h @@ -109,7 +109,7 @@ static GFXINLINE void post_init_board(GDisplay *g) { (void) g; } -static GFXINLINE void setpin_reset(GDisplay *g, bool_t state) { +static GFXINLINE void setpin_reset(GDisplay *g, gBool state) { (void) g; (void) state; } diff --git a/demos/games/tetris/Example_Makefiles/stm32f4_chibios_3.x/ginput_lld_mouse_board.h b/demos/games/tetris/Example_Makefiles/stm32f4_chibios_3.x/ginput_lld_mouse_board.h index 39538747..0568d4e5 100644 --- a/demos/games/tetris/Example_Makefiles/stm32f4_chibios_3.x/ginput_lld_mouse_board.h +++ b/demos/games/tetris/Example_Makefiles/stm32f4_chibios_3.x/ginput_lld_mouse_board.h @@ -26,7 +26,7 @@ static GFXINLINE void init_board(void) spiStart(&SPID1, &spicfg); } -static GFXINLINE bool_t getpin_pressed(void) +static GFXINLINE gBool getpin_pressed(void) { return (!palReadPad(GPIOC, 4)); } diff --git a/demos/games/tetris/Example_Makefiles/stm32f4_chibios_3.x/gmouse_lld_ADS7843_board.h b/demos/games/tetris/Example_Makefiles/stm32f4_chibios_3.x/gmouse_lld_ADS7843_board.h index 77d82bf8..70a22ee3 100644 --- a/demos/games/tetris/Example_Makefiles/stm32f4_chibios_3.x/gmouse_lld_ADS7843_board.h +++ b/demos/games/tetris/Example_Makefiles/stm32f4_chibios_3.x/gmouse_lld_ADS7843_board.h @@ -22,13 +22,13 @@ static const SPIConfig spicfg = { /* SPI_CR1_BR_2 |*/ SPI_CR1_BR_1 | SPI_CR1_BR_0, }; -static bool_t init_board(GMouse* m, unsigned driverinstance) +static gBool init_board(GMouse* m, unsigned driverinstance) { (void)m; // Only one touch interface on this board if (driverinstance) - return FALSE; + return gFalse; // Set the GPIO modes palSetPadMode(GPIOC, 6, PAL_MODE_OUTPUT_PUSHPULL); @@ -40,10 +40,10 @@ static bool_t init_board(GMouse* m, unsigned driverinstance) // Start the SPI peripheral spiStart(&SPID1, &spicfg); - return TRUE; + return gTrue; } -GFXINLINE bool_t getpin_pressed(void) { +GFXINLINE gBool getpin_pressed(void) { return (!palReadPad(GPIOC, 4)); } diff --git a/demos/games/tetris/main.c b/demos/games/tetris/main.c index ffbccf6c..705813ab 100644 --- a/demos/games/tetris/main.c +++ b/demos/games/tetris/main.c @@ -43,7 +43,7 @@ int main(void) tetrisInit(); - while (TRUE) { + while (1) { // Start a new game // Will return when game is over tetrisStart(); diff --git a/demos/games/tetris/tetris.c b/demos/games/tetris/tetris.c index ed924781..cf73c978 100644 --- a/demos/games/tetris/tetris.c +++ b/demos/games/tetris/tetris.c @@ -86,9 +86,9 @@ int tetrisOldShape[4][2]; int tetrisNextShapeNum, tetrisOldShapeNum; unsigned long tetrisLines = 0; unsigned long tetrisScore = 0; -bool_t tetrisKeysPressed[5] = {FALSE, FALSE, FALSE, FALSE, FALSE}; // left/down/right/up/pause -bool_t tetrisPaused = FALSE; -bool_t tetrisGameOver = FALSE; +gBool tetrisKeysPressed[5] = {gFalse, gFalse, gFalse, gFalse, gFalse}; // left/down/right/up/pause +gBool tetrisPaused = gFalse; +gBool tetrisGameOver = gFalse; font_t font16; 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); } -static bool_t stay(bool_t down) { +static gBool stay(gBool down) { int sk, k; - bool_t stay; - if (down == TRUE) sk = 1; else sk = 0; - stay = FALSE; + gBool stay; + if (down) sk = 1; else sk = 0; + stay = gFalse; for (k = 0; k <= 3; k++) { if (tetrisCurrentShape[k][1] == 0) { - return TRUE; + return gTrue; } } 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 (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; } static void clearCompleteLines(void) { - bool_t t; + gBool t; uint8_t reiz = 0; int l,k,j; l = 0; while (l <= 16) { - t = TRUE; + t = gTrue; for (j = 0; j <= 9; j++) - if (tetrisField[l][j] == 0) t = FALSE; - if (t == TRUE) { + if (tetrisField[l][j] == 0) t = gFalse; + if (t) { for (j = 4; j >= 0; j--) { // cheap & dirty line removal animation :D drawCell(j,l, 0); drawCell(9-j,l, 0); @@ -331,7 +331,7 @@ static void clearCompleteLines(void) { static void goDown(void) { int i; - if (stay(TRUE) == FALSE) { + if (!stay(gTrue)) { drawShape(0); for (i = 0; i <= 3; i++) { tetrisCurrentShape[i][1]--; @@ -340,7 +340,7 @@ static void goDown(void) { } else { for (i = 0; i <= 3; i++) { if (tetrisCurrentShape[i][1] >=17) { - tetrisGameOver = TRUE; + tetrisGameOver = gTrue; return; } else { tetrisField[tetrisCurrentShape[i][1]][tetrisCurrentShape[i][0]] = tetrisOldShapeNum+1; @@ -348,8 +348,8 @@ static void goDown(void) { } clearCompleteLines(); createShape(); - if (stay(FALSE) == TRUE) { - tetrisGameOver = TRUE; + if (stay(gFalse)) { + tetrisGameOver = gTrue; return; } 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][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(tetrisCurrentShape, tetrisOldShape, sizeof(tetrisCurrentShape)); // tetrisCurrentShape = tetrisOldShape; 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; - if (left == TRUE) sk = 1; else sk = -1; + if (left) sk = 1; else sk = -1; 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 (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) { int i; - if (checkSides(TRUE) == FALSE) { + if (!checkSides(gTrue)) { drawShape(0); for (i = 0; i <= 3; i++) { tetrisCurrentShape[i][0]++; @@ -418,7 +418,7 @@ static void goRight(void) { static void goLeft(void) { int i; - if (checkSides(FALSE) == FALSE) { + if (!checkSides(gFalse)) { drawShape(0); for (i = 0; i <= 3; i++) { tetrisCurrentShape[i][0]--; @@ -434,8 +434,8 @@ static DECLARE_THREAD_FUNCTION(thdTetris, arg) { // key handling if (gfxSystemTicks() - tetrisPreviousKeyTime >= gfxMillisecondsToTicks(tetrisKeySpeed) || gfxSystemTicks() <= gfxMillisecondsToTicks(tetrisKeySpeed)) { for (i = 0; i < sizeof(tetrisKeysPressed); i++) { - if (tetrisKeysPressed[i] == TRUE) { - tetrisKeysPressed[i] = FALSE; + if (tetrisKeysPressed[i]) { + tetrisKeysPressed[i] = gFalse; } } tetrisPreviousKeyTime = gfxSystemTicks(); @@ -447,28 +447,28 @@ static DECLARE_THREAD_FUNCTION(thdTetris, arg) { tetrisPreviousGameTime = gfxSystemTicks(); } 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(); - tetrisKeysPressed[0] = TRUE; + tetrisKeysPressed[0] = gTrue; 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(); - tetrisKeysPressed[2] = TRUE; + tetrisKeysPressed[2] = gTrue; 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(); - tetrisKeysPressed[3] = TRUE; + tetrisKeysPressed[3] = gTrue; 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(); - tetrisKeysPressed[1] = TRUE; + tetrisKeysPressed[1] = gTrue; tetrisPreviousKeyTime = gfxSystemTicks(); } - if (ev.y <= gdispGetHeight()/4 && tetrisKeysPressed[4] == FALSE) { - tetrisKeysPressed[4] = TRUE; + if (ev.y <= gdispGetHeight()/4 && !tetrisKeysPressed[4]) { + tetrisKeysPressed[4] = gTrue; tetrisPaused = !tetrisPaused; printPaused(); tetrisPreviousKeyTime = gfxSystemTicks(); @@ -495,8 +495,8 @@ void tetrisStart(void) { // Away we go initField(); - tetrisGameOver = FALSE; - printGameOver(); // removes "Game Over!" if tetrisGameOver == FALSE + tetrisGameOver = gFalse; + printGameOver(); // removes "Game Over!" if tetrisGameOver == gFalse tetrisPreviousGameTime = gfxSystemTicks(); gfxThreadCreate(0, 1024, NORMAL_PRIORITY, thdTetris, 0); while (!tetrisGameOver) { diff --git a/demos/modules/gadc/gwinosc.c b/demos/modules/gadc/gwinosc.c index f29107bc..e82cd7d8 100644 --- a/demos/modules/gadc/gwinosc.c +++ b/demos/modules/gadc/gwinosc.c @@ -89,10 +89,10 @@ void gwinScopeWaitForTrace(GHandle gh) { GDataBuffer *pd; uint8_t shr; #if TRIGGER_METHOD == TRIGGER_POSITIVERAMP - bool_t rdytrigger; + gBool rdytrigger; int flsamples; #elif TRIGGER_METHOD == TRIGGER_MINVALUE - bool_t rdytrigger; + gBool rdytrigger; int flsamples; coord_t scopemin; #endif @@ -116,10 +116,10 @@ void gwinScopeWaitForTrace(GHandle gh) { pc = gs->lastscopetrace+x; pa = (adcsample_t *)(pd+1); #if TRIGGER_METHOD == TRIGGER_POSITIVERAMP - rdytrigger = FALSE; + rdytrigger = gFalse; flsamples = 0; #elif TRIGGER_METHOD == TRIGGER_MINVALUE - rdytrigger = FALSE; + rdytrigger = gFalse; flsamples = 0; scopemin = 0; #endif @@ -144,7 +144,7 @@ void gwinScopeWaitForTrace(GHandle gh) { #if TRIGGER_METHOD == TRIGGER_MINVALUE /* Arm when we reach the sample minimum (y value maximum) of the previous trace */ if (!rdytrigger && y >= gs->scopemin) - rdytrigger = TRUE; + rdytrigger = gTrue; #endif if (y == gs->lasty) { @@ -157,7 +157,7 @@ void gwinScopeWaitForTrace(GHandle gh) { flsamples = 0; #if TRIGGER_METHOD == TRIGGER_POSITIVERAMP /* Arm the trigger when samples fall (y increases) ie. negative slope */ - rdytrigger = TRUE; + rdytrigger = gTrue; #endif continue; } else { @@ -169,7 +169,7 @@ void gwinScopeWaitForTrace(GHandle gh) { } /* Ready for a the next trigger cycle */ - rdytrigger = FALSE; + rdytrigger = gFalse; #endif /* Prepare for a scope trace */ diff --git a/demos/modules/gadc/main.c b/demos/modules/gadc/main.c index ee54a118..5d07f8eb 100644 --- a/demos/modules/gadc/main.c +++ b/demos/modules/gadc/main.c @@ -154,7 +154,7 @@ int main(void) { GWindowInit wi; gwinClearInit(&wi); - wi.show = TRUE; + wi.show = gTrue; wi.x = wi.y = 0; wi.width = swidth-SCOPE_CX; wi.height = sheight; @@ -166,7 +166,7 @@ int main(void) { /* Start our timer for reading the dial */ gtimerInit(&lsTimer); - gtimerStart(&lsTimer, LowSpeedTimer, ghText, TRUE, MY_LS_DELAY); + gtimerStart(&lsTimer, LowSpeedTimer, ghText, gTrue, MY_LS_DELAY); #endif /** @@ -188,7 +188,7 @@ int main(void) { GWindowInit wi; gwinClearInit(&wi); - wi.show = TRUE; + wi.show = gTrue; wi.x = swidth-SCOPE_CX; wi.y = 0; wi.width = SCOPE_CX; @@ -200,7 +200,7 @@ int main(void) { gwinClear(ghScope); /* Just keep displaying the scope traces */ - while (TRUE) { + while (1) { /** * The function below internally performs a wait thus giving the timer thread a * chance to run. diff --git a/demos/modules/gaudio/oscilloscope/gwinosc.c b/demos/modules/gaudio/oscilloscope/gwinosc.c index fcad648f..38edb35e 100644 --- a/demos/modules/gaudio/oscilloscope/gwinosc.c +++ b/demos/modules/gaudio/oscilloscope/gwinosc.c @@ -106,10 +106,10 @@ void gwinScopeWaitForTrace(GHandle gh) { uint8_t shr; #if TRIGGER_METHOD == TRIGGER_POSITIVERAMP - bool_t rdytrigger; + gBool rdytrigger; int flsamples; #elif TRIGGER_METHOD == TRIGGER_MINVALUE - bool_t rdytrigger; + gBool rdytrigger; int flsamples; coord_t scopemin; #endif @@ -136,10 +136,10 @@ void gwinScopeWaitForTrace(GHandle gh) { pa16 = (uint16_t *)(paud+1); #if TRIGGER_METHOD == TRIGGER_POSITIVERAMP - rdytrigger = FALSE; + rdytrigger = gFalse; flsamples = 0; #elif TRIGGER_METHOD == TRIGGER_MINVALUE - rdytrigger = FALSE; + rdytrigger = gFalse; flsamples = 0; scopemin = 0; #endif @@ -167,7 +167,7 @@ void gwinScopeWaitForTrace(GHandle gh) { #if TRIGGER_METHOD == TRIGGER_MINVALUE /* Arm when we reach the sample minimum (y value maximum) of the previous trace */ if (!rdytrigger && y >= gs->scopemin) - rdytrigger = TRUE; + rdytrigger = gTrue; #endif if (y == gs->lasty) { @@ -180,7 +180,7 @@ void gwinScopeWaitForTrace(GHandle gh) { flsamples = 0; #if TRIGGER_METHOD == TRIGGER_POSITIVERAMP /* Arm the trigger when samples fall (y increases) ie. negative slope */ - rdytrigger = TRUE; + rdytrigger = gTrue; #endif continue; } else { @@ -192,7 +192,7 @@ void gwinScopeWaitForTrace(GHandle gh) { } /* Ready for a the next trigger cycle */ - rdytrigger = FALSE; + rdytrigger = gFalse; #endif /* Prepare for a scope trace */ diff --git a/demos/modules/gaudio/oscilloscope/main.c b/demos/modules/gaudio/oscilloscope/main.c index 335b2cee..cd62e1f1 100644 --- a/demos/modules/gaudio/oscilloscope/main.c +++ b/demos/modules/gaudio/oscilloscope/main.c @@ -74,7 +74,7 @@ int main(void) { GWindowInit wi; gwinClearInit(&wi); - wi.show = TRUE; + wi.show = gTrue; wi.x = wi.y = 0; wi.width = swidth; wi.height = sheight; ghScope = gwinScopeCreate(&gScopeWindow, &wi, MY_AUDIO_CHANNEL, MY_AUDIO_FREQUENCY, MY_AUDIO_FORMAT); @@ -84,7 +84,7 @@ int main(void) { gwinClear(ghScope); /* Just keep displaying the scope traces */ - while (TRUE) { + while (1) { gwinScopeWaitForTrace(ghScope); } } diff --git a/demos/modules/gaudio/play-vs1053/main.c b/demos/modules/gaudio/play-vs1053/main.c index 66ac5f8d..21e28c98 100644 --- a/demos/modules/gaudio/play-vs1053/main.c +++ b/demos/modules/gaudio/play-vs1053/main.c @@ -114,6 +114,6 @@ theend: if (errmsg) gdispDrawString(0, gdispGetHeight()/2, errmsg, font, GFX_RED); - while(TRUE) + while(1) gfxSleepMilliseconds(1000); } diff --git a/demos/modules/gaudio/play-wave/main.c b/demos/modules/gaudio/play-wave/main.c index af3df7d1..4c863fcf 100644 --- a/demos/modules/gaudio/play-wave/main.c +++ b/demos/modules/gaudio/play-wave/main.c @@ -139,7 +139,7 @@ repeatplay: len += 20; // Read RIFF blocks until we get to the data RIFF block (contains the audio) - while(TRUE) { + while(1) { if (gfileRead(f, whdr, 8) != 8) { errmsg = "Err: Read block"; goto theend; @@ -196,6 +196,6 @@ theend: if (errmsg) gdispDrawString(0, gdispGetHeight()/2, errmsg, font, GFX_RED); - while(TRUE) + while(1) gfxSleepMilliseconds(1000); } diff --git a/demos/modules/gdisp/basics/main.c b/demos/modules/gdisp/basics/main.c index ccf98d22..9517e0a6 100644 --- a/demos/modules/gdisp/basics/main.c +++ b/demos/modules/gdisp/basics/main.c @@ -48,7 +48,7 @@ int main(void) { for(i = 5, j = 0; i < width && j < height; i += 7, j += i/20) gdispDrawPixel(i, j, GFX_WHITE); - while(TRUE) { + while(1) { gfxSleepMilliseconds(500); } } diff --git a/demos/modules/gdisp/circles/main.c b/demos/modules/gdisp/circles/main.c index 4efb896a..e631da1a 100644 --- a/demos/modules/gdisp/circles/main.c +++ b/demos/modules/gdisp/circles/main.c @@ -47,7 +47,7 @@ int main(void) { 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); - while(TRUE) { + while(1) { gfxSleepMilliseconds(500); } } diff --git a/demos/modules/gdisp/fonts/main.c b/demos/modules/gdisp/fonts/main.c index 73d7c54e..a0d888dc 100644 --- a/demos/modules/gdisp/fonts/main.c +++ b/demos/modules/gdisp/fonts/main.c @@ -88,7 +88,7 @@ int main(void) { gdispFillStringBox(0, y, width, fheight1, buf, font1, GFX_RED, GFX_WHITE, justifyCenter); // Wait forever - while(TRUE) { + while(1) { gfxSleepMilliseconds(500); } } diff --git a/demos/modules/gdisp/fonts_cyrillic/main.c b/demos/modules/gdisp/fonts_cyrillic/main.c index b65801a1..1f6a30a9 100644 --- a/demos/modules/gdisp/fonts_cyrillic/main.c +++ b/demos/modules/gdisp/fonts_cyrillic/main.c @@ -42,7 +42,7 @@ int main(void) { gdispDrawString(10, 10, "привет мир", font1, GFX_YELLOW); // Wait forever - while(TRUE) { + while(1) { gfxSleepMilliseconds(500); } } diff --git a/demos/modules/gdisp/multiple_displays/main.c b/demos/modules/gdisp/multiple_displays/main.c index 8b38a22a..ea05507b 100644 --- a/demos/modules/gdisp/multiple_displays/main.c +++ b/demos/modules/gdisp/multiple_displays/main.c @@ -83,7 +83,7 @@ gdispGDrawPixel(g, i, j, GFX_WHITE); } - while(TRUE) { + while(1) { gfxSleepMilliseconds(500); } } @@ -126,7 +126,7 @@ gdispDrawPixel(i, j, GFX_WHITE); } - while(TRUE) { + while(1) { gfxSleepMilliseconds(500); } } diff --git a/demos/modules/gdisp/pixmap/main.c b/demos/modules/gdisp/pixmap/main.c index a6791ec9..975611c8 100644 --- a/demos/modules/gdisp/pixmap/main.c +++ b/demos/modules/gdisp/pixmap/main.c @@ -62,7 +62,7 @@ int main(void) { gdispGDrawLine(pixmap, 0, 0, gdispGGetWidth(pixmap)-1, gdispGGetHeight(pixmap)-1, GFX_WHITE); i = j = 0; - while(TRUE) { + while(1) { // Clear the old position gdispFillArea(i, j, PIXMAP_WIDTH, PIXMAP_HEIGHT, GFX_BLACK); diff --git a/demos/modules/gdisp/polygons/main.c b/demos/modules/gdisp/polygons/main.c index 8a4f7df3..277fd0bf 100644 --- a/demos/modules/gdisp/polygons/main.c +++ b/demos/modules/gdisp/polygons/main.c @@ -103,7 +103,7 @@ int main(void) { transmaxy = INT2MTYPE(height - 15); transminy = INT2MTYPE(15); - while(TRUE) { + while(1) { // Move to the new location, rotation and scale scalex += scaleincx; diff --git a/demos/modules/gdisp/thickarcs/main.c b/demos/modules/gdisp/thickarcs/main.c index adf42810..c190d43c 100644 --- a/demos/modules/gdisp/thickarcs/main.c +++ b/demos/modules/gdisp/thickarcs/main.c @@ -43,7 +43,7 @@ int main(void) // Initialize the uGFX library gfxInit(); - while(TRUE) { + while(1) { // Clear the entire screen gdispClear(GFX_BLACK); diff --git a/demos/modules/ginput/keyboard/main.c b/demos/modules/ginput/keyboard/main.c index dec93125..e521207f 100644 --- a/demos/modules/ginput/keyboard/main.c +++ b/demos/modules/ginput/keyboard/main.c @@ -54,7 +54,7 @@ int main(void) { GWindowInit wi; gwinClearInit(&wi); - wi.show = TRUE; + wi.show = gTrue; wi.x = 0; wi.y = 0; wi.width = gdispGetWidth(); wi.height = gdispGetHeight(); GW = gwinConsoleCreate(0, &wi); diff --git a/demos/modules/gos/threads/main.c b/demos/modules/gos/threads/main.c index 97b1c7e4..56ea4bb9 100644 --- a/demos/modules/gos/threads/main.c +++ b/demos/modules/gos/threads/main.c @@ -26,7 +26,7 @@ threadreturn_t heartbeat1(void* param) { (void)param; - while (TRUE) { + while (1) { DEBUGWRITE("thread 1\n"); gfxSleepMilliseconds(500); } @@ -38,7 +38,7 @@ threadreturn_t heartbeat2(void* param) { (void)param; - while (TRUE) { + while (1) { DEBUGWRITE("thread 2\n"); gfxSleepMilliseconds(900); } @@ -54,7 +54,7 @@ int main(void) gfxThreadCreate(0, 2048, NORMAL_PRIORITY, heartbeat1, 0); gfxThreadCreate(0, 2048, NORMAL_PRIORITY, heartbeat2, 0); - while (TRUE) { + while (1) { DEBUGWRITE("thread main\n"); gfxSleepMilliseconds(1400); } diff --git a/demos/modules/gos/threads_advanced/main.c b/demos/modules/gos/threads_advanced/main.c index 89cada9f..8527194e 100644 --- a/demos/modules/gos/threads_advanced/main.c +++ b/demos/modules/gos/threads_advanced/main.c @@ -65,11 +65,11 @@ gfxThreadHandle thd; */ threadreturn_t Thread_function(void* param) { - /* Cast the paramter into a bool pointer so we can use it */ - bool_t* doExit = (bool_t*)param; + /* Cast the paramter into a gBool pointer so we can use it */ + gBool* doExit = (gBool*)param; /* Execute this until we shall be terminated */ - while (*doExit == FALSE) { + while (!*doExit) { DEBUGWRITE("Message from Thread\n"); gfxSleepMilliseconds(500); } @@ -84,12 +84,12 @@ threadreturn_t Thread_function(void* param) */ void timerCallback(void* param) { - /* Cast the paramter into a bool pointer so we can use it */ - bool_t* threadExit = (bool_t*)param; + /* Cast the paramter into a gBool pointer so we can use it */ + gBool* threadExit = (gBool*)param; /* Ask the Thread to fall over the end */ DEBUGWRITE("Closing thread!\n"); - *threadExit = TRUE; + *threadExit = gTrue; } /* @@ -97,7 +97,7 @@ void timerCallback(void* param) */ int main(void) { - bool_t exitThread = FALSE; + gBool exitThread = gFalse; gfxInit(); @@ -112,9 +112,9 @@ int main(void) /* 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 */ - gtimerStart(>, timerCallback, (void*)&exitThread, FALSE, 2000); + gtimerStart(>, timerCallback, (void*)&exitThread, gFalse, 2000); - while(TRUE) { + while(1) { DEBUGWRITE("Message from main!\n"); gfxSleepMilliseconds(500); } diff --git a/demos/modules/gtimer/main.c b/demos/modules/gtimer/main.c index 89a6bab7..7612772c 100644 --- a/demos/modules/gtimer/main.c +++ b/demos/modules/gtimer/main.c @@ -51,12 +51,12 @@ int main(void) { gtimerInit(>2); /* continious mode - callback1() called without any argument every 250ms */ - gtimerStart(>1, callback1, 0, TRUE, 250); + gtimerStart(>1, callback1, 0, gTrue, 250); /* single shot mode - callback2() called without any argument once after 1s */ - gtimerStart(>2, callback2, 0, FALSE, 1000); + gtimerStart(>2, callback2, 0, gFalse, 1000); - while(TRUE) { + while(1) { gfxSleepMilliseconds(500); } diff --git a/demos/modules/gtrans/basic/main.c b/demos/modules/gtrans/basic/main.c index 77430a46..da42aa46 100644 --- a/demos/modules/gtrans/basic/main.c +++ b/demos/modules/gtrans/basic/main.c @@ -91,7 +91,7 @@ int main(void) gtransSetBaseLanguage(&EnglishTranslation); // Loop through the languages - while (TRUE) { + while (1) { // English gtransSetLanguage(&EnglishTranslation); updateText(); diff --git a/demos/modules/gwin/basic/main.c b/demos/modules/gwin/basic/main.c index e5b66f17..901f9e6d 100644 --- a/demos/modules/gwin/basic/main.c +++ b/demos/modules/gwin/basic/main.c @@ -44,9 +44,9 @@ int main(void) { GWindowInit 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); - 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); } @@ -72,7 +72,7 @@ int main(void) { gwinFillCircle(GW1, 20, 20, 15); gwinFillCircle(GW2, 20, 20, 15); - while(TRUE) { + while(1) { gfxSleepMilliseconds(500); } } diff --git a/demos/modules/gwin/button/main.c b/demos/modules/gwin/button/main.c index 29a5641f..6e766e74 100644 --- a/demos/modules/gwin/button/main.c +++ b/demos/modules/gwin/button/main.c @@ -37,7 +37,7 @@ static void createWidgets(void) { // Apply some default values for GWIN gwinWidgetClearInit(&wi); - wi.g.show = TRUE; + wi.g.show = gTrue; // Apply the button parameters wi.g.width = 100; @@ -64,7 +64,7 @@ int main(void) { // Set the widget defaults gwinSetDefaultFont(gdispOpenFont("UI2")); - gwinSetDefaultStyle(&WhiteWidgetStyle, FALSE); + gwinSetDefaultStyle(&WhiteWidgetStyle, gFalse); gdispClear(GFX_WHITE); // create the widget @@ -90,7 +90,7 @@ int main(void) { // corner which should translate safely into any orientation. gdispSetOrientation(orients[which]); gdispClear(GFX_WHITE); - gwinRedrawDisplay(GDISP, FALSE); + gwinRedrawDisplay(GDISP, gFalse); } break; diff --git a/demos/modules/gwin/checkbox/main.c b/demos/modules/gwin/checkbox/main.c index 00f3ebdb..486c4057 100644 --- a/demos/modules/gwin/checkbox/main.c +++ b/demos/modules/gwin/checkbox/main.c @@ -37,7 +37,7 @@ static void createWidgets(void) { // Apply some default values for GWIN gwinWidgetClearInit(&wi); - wi.g.show = TRUE; + wi.g.show = gTrue; // Apply the checkbox parameters wi.g.width = 100; // includes text @@ -58,7 +58,7 @@ int main(void) { // Set the widget defaults gwinSetDefaultFont(gdispOpenFont("UI2")); - gwinSetDefaultStyle(&WhiteWidgetStyle, FALSE); + gwinSetDefaultStyle(&WhiteWidgetStyle, gFalse); gdispClear(GFX_WHITE); // create the widget diff --git a/demos/modules/gwin/console/main.c b/demos/modules/gwin/console/main.c index 248aeedf..53b80fcb 100644 --- a/demos/modules/gwin/console/main.c +++ b/demos/modules/gwin/console/main.c @@ -49,7 +49,7 @@ int main(void) { GWindowInit wi; gwinClearInit(&wi); - wi.show = TRUE; + wi.show = gTrue; wi.x = 0; wi.y = 0; wi.width = gdispGetWidth(); wi.height = gdispGetHeight()/2; GW1 = gwinConsoleCreate(0, &wi); 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 */ gwinPrintf(GW2, "Making red window \033uinvisible\033U\n"); - gwinSetVisible(GW3, FALSE); + gwinSetVisible(GW3, gFalse); gfxSleepMilliseconds(1000); gwinPrintf(GW2, "Making red window \033uvisible\033U\n"); - gwinSetVisible(GW3, TRUE); + gwinSetVisible(GW3, gTrue); gwinPrintf(GW3, "\033bI'm back!!!\033B\n", i+1); - while(TRUE) { + while(1) { gfxSleepMilliseconds(500); } } diff --git a/demos/modules/gwin/container/main.c b/demos/modules/gwin/container/main.c index af2e8b1f..d43eca93 100644 --- a/demos/modules/gwin/container/main.c +++ b/demos/modules/gwin/container/main.c @@ -10,14 +10,14 @@ static void createWidgets(void) { gwinWidgetClearInit(&wi); // Apply the container parameters - wi.g.show = FALSE; + wi.g.show = gFalse; wi.g.width = 200; wi.g.height = 150; wi.g.y = 10; wi.g.x = 10; wi.text = "Container"; ghContainer = gwinContainerCreate(0, &wi, GWIN_CONTAINER_BORDER); - wi.g.show = TRUE; + wi.g.show = gTrue; // Apply the button parameters wi.g.width = 120; @@ -39,7 +39,7 @@ int main(void) { // Set the widget defaults gwinSetDefaultFont(gdispOpenFont("*")); - gwinSetDefaultStyle(&WhiteWidgetStyle, FALSE); + gwinSetDefaultStyle(&WhiteWidgetStyle, gFalse); gdispClear(GFX_WHITE); // Create the widget diff --git a/demos/modules/gwin/container_nested/main.c b/demos/modules/gwin/container_nested/main.c index 0e5a2634..6d86704e 100644 --- a/demos/modules/gwin/container_nested/main.c +++ b/demos/modules/gwin/container_nested/main.c @@ -10,7 +10,7 @@ static void createWidgets(void) { // Apply some default values for GWIN gwinWidgetClearInit(&wi); - wi.g.show = FALSE; + wi.g.show = gFalse; // Container 1 wi.g.width = 300; @@ -20,7 +20,7 @@ static void createWidgets(void) { wi.text = "Container 1"; ghContainer1 = gwinContainerCreate(0, &wi, GWIN_CONTAINER_BORDER); - wi.g.show = TRUE; + wi.g.show = gTrue; // Container 2 wi.g.width = 100; @@ -117,7 +117,7 @@ int main(void) { // Set the widget defaults gwinSetDefaultFont(gdispOpenFont("*")); - gwinSetDefaultStyle(&WhiteWidgetStyle, FALSE); + gwinSetDefaultStyle(&WhiteWidgetStyle, gFalse); gdispClear(GFX_WHITE); // Create the widget @@ -128,9 +128,9 @@ int main(void) { gwinAttachListener(&gl); // Set the initial state of the checkboxes - gwinCheckboxCheck(ghCheckbox1, TRUE); - gwinCheckboxCheck(ghCheckbox2, TRUE); - gwinCheckboxCheck(ghCheckbox3, TRUE); + gwinCheckboxCheck(ghCheckbox1, gTrue); + gwinCheckboxCheck(ghCheckbox2, gTrue); + gwinCheckboxCheck(ghCheckbox3, gTrue); while(1) { // Get an Event diff --git a/demos/modules/gwin/frame/main.c b/demos/modules/gwin/frame/main.c index aae4cfac..3ee330df 100644 --- a/demos/modules/gwin/frame/main.c +++ b/demos/modules/gwin/frame/main.c @@ -23,7 +23,7 @@ static void _createWidgets(void) { // Apply some default values for GWIN gwinWidgetClearInit(&wi); - wi.g.show = TRUE; + wi.g.show = gTrue; // Create a surprise label behind the frame window wi.g.width = 100; @@ -119,7 +119,7 @@ int main(void) { // Set the widget defaults gwinSetDefaultFont(gdispOpenFont("*")); - gwinSetDefaultStyle(&WhiteWidgetStyle, FALSE); + gwinSetDefaultStyle(&WhiteWidgetStyle, gFalse); gdispClear(GFX_WHITE); // create the widget diff --git a/demos/modules/gwin/gl3d-gears/main.c b/demos/modules/gwin/gl3d-gears/main.c index 2b450799..882b4253 100644 --- a/demos/modules/gwin/gl3d-gears/main.c +++ b/demos/modules/gwin/gl3d-gears/main.c @@ -270,7 +270,7 @@ int main(void) { GWindowInit wi; gwinClearInit(&wi); - wi.show = TRUE; wi.x = (gdispGetWidth()-GL3D_WINDOW_SIZE)/2; wi.y = (gdispGetHeight()-GL3D_WINDOW_SIZE)/2; wi.width = GL3D_WINDOW_SIZE; wi.height = GL3D_WINDOW_SIZE; + wi.show = gTrue; wi.x = (gdispGetWidth()-GL3D_WINDOW_SIZE)/2; wi.y = (gdispGetHeight()-GL3D_WINDOW_SIZE)/2; wi.width = GL3D_WINDOW_SIZE; wi.height = GL3D_WINDOW_SIZE; gh = gwinGL3DCreate(0, &wi); } @@ -278,7 +278,7 @@ int main(void) { setup(); init(); - while(TRUE) { + while(1) { // rate control gfxSleepMilliseconds(FRAME_DELAY); diff --git a/demos/modules/gwin/gl3d-spin/main.c b/demos/modules/gwin/gl3d-spin/main.c index 4da6b053..0f4b397c 100644 --- a/demos/modules/gwin/gl3d-spin/main.c +++ b/demos/modules/gwin/gl3d-spin/main.c @@ -141,7 +141,7 @@ int main(void) { GWindowInit wi; gwinClearInit(&wi); - wi.show = TRUE; wi.x = (gdispGetWidth()-GL3D_WINDOW_SIZE)/2; wi.y = (gdispGetHeight()-GL3D_WINDOW_SIZE)/2; wi.width = GL3D_WINDOW_SIZE; wi.height = GL3D_WINDOW_SIZE; + wi.show = gTrue; wi.x = (gdispGetWidth()-GL3D_WINDOW_SIZE)/2; wi.y = (gdispGetHeight()-GL3D_WINDOW_SIZE)/2; wi.width = GL3D_WINDOW_SIZE; wi.height = GL3D_WINDOW_SIZE; gh = gwinGL3DCreate(0, &wi); } @@ -162,7 +162,7 @@ int main(void) { Ystep = Zstep = 0.0; - while(TRUE) { + while(1) { // rate control gfxSleepMilliseconds(FRAME_DELAY); diff --git a/demos/modules/gwin/graph/main.c b/demos/modules/gwin/graph/main.c index 2ca4d1a6..c184a939 100644 --- a/demos/modules/gwin/graph/main.c +++ b/demos/modules/gwin/graph/main.c @@ -71,7 +71,7 @@ int main(void) { { GWindowInit wi; - wi.show = TRUE; + wi.show = gTrue; wi.x = wi.y = 0; wi.width = gdispGetWidth(); wi.height = gdispGetHeight(); @@ -105,7 +105,7 @@ int main(void) { // Draw a set of points gwinGraphDrawPoints(gh, data, sizeof(data)/sizeof(data[0])); - while(TRUE) { + while(1) { gfxSleepMilliseconds(100); } } diff --git a/demos/modules/gwin/imagebox/main.c b/demos/modules/gwin/imagebox/main.c index c4f70df2..64156669 100644 --- a/demos/modules/gwin/imagebox/main.c +++ b/demos/modules/gwin/imagebox/main.c @@ -38,7 +38,7 @@ static void createWidgets(void) { // Apply some default values for GWIN gwinWidgetClearInit(&wi); - wi.g.show = TRUE; + wi.g.show = gTrue; // create the first image widget wi.g.x = 10; wi.g.y = 10; wi.g.width = 200; wi.g.height = 100; @@ -52,7 +52,7 @@ int main(void) { // Set the widget defaults gwinSetDefaultFont(gdispOpenFont("UI2")); - gwinSetDefaultStyle(&WhiteWidgetStyle, FALSE); + gwinSetDefaultStyle(&WhiteWidgetStyle, gFalse); gdispClear(GFX_WHITE); // create the widget diff --git a/demos/modules/gwin/keyboard/main.c b/demos/modules/gwin/keyboard/main.c index d81ac6a3..b43e72d1 100644 --- a/demos/modules/gwin/keyboard/main.c +++ b/demos/modules/gwin/keyboard/main.c @@ -43,7 +43,7 @@ static void createWidgets(void) { gwinWidgetClearInit(&wi); // Create the console - set colors before making it visible - wi.g.show = FALSE; + wi.g.show = gFalse; wi.g.x = 0; wi.g.y = 0; wi.g.width = gdispGetWidth(); wi.g.height = gdispGetHeight()/2; ghConsole = gwinConsoleCreate(0, &wi.g); @@ -53,7 +53,7 @@ static void createWidgets(void) { gwinClear(ghConsole); // Create the keyboard - wi.g.show = TRUE; + wi.g.show = gTrue; wi.g.x = 0; wi.g.y = gdispGetHeight()/2; wi.g.width = gdispGetWidth(); wi.g.height = gdispGetHeight()/2; ghKeyboard = gwinKeyboardCreate(0, &wi); @@ -70,7 +70,7 @@ int main(void) { // Set the widget defaults font = gdispOpenFont("*"); // Get the first defined font. gwinSetDefaultFont(font); - gwinSetDefaultStyle(&WhiteWidgetStyle, FALSE); + gwinSetDefaultStyle(&WhiteWidgetStyle, gFalse); gdispClear(GFX_WHITE); // Create the gwin windows/widgets diff --git a/demos/modules/gwin/label/main.c b/demos/modules/gwin/label/main.c index f1fb6b92..6a2429a4 100644 --- a/demos/modules/gwin/label/main.c +++ b/demos/modules/gwin/label/main.c @@ -37,7 +37,7 @@ static void createWidgets(void) { // Apply some default values for GWIN gwinWidgetClearInit(&wi); - wi.g.show = TRUE; + wi.g.show = gTrue; // Create the IP label wi.g.width = 200; wi.g.height = 20; wi.g.x = 10, wi.g.y = 80; @@ -60,7 +60,7 @@ int main(void) { // Set the widget defaults gwinSetDefaultFont(gdispOpenFont("*")); - gwinSetDefaultStyle(&WhiteWidgetStyle, FALSE); + gwinSetDefaultStyle(&WhiteWidgetStyle, gFalse); gdispClear(GFX_WHITE); // create the widget diff --git a/demos/modules/gwin/list/main.c b/demos/modules/gwin/list/main.c index 22a2074e..86e50e9a 100644 --- a/demos/modules/gwin/list/main.c +++ b/demos/modules/gwin/list/main.c @@ -38,7 +38,7 @@ static void createWidgets(void) { // Apply some default values for GWIN gwinWidgetClearInit(&wi); - wi.g.show = TRUE; + wi.g.show = gTrue; // Create the label for the first list wi.g.width = 150; wi.g.height = 20; wi.g.x = 10, wi.g.y = 80; @@ -56,7 +56,7 @@ static void createWidgets(void) { wi.g.y = 100; wi.g.x = 10; wi.text = "Name of list 1"; - ghList1 = gwinListCreate(0, &wi, FALSE); + ghList1 = gwinListCreate(0, &wi, gFalse); // The second list widget wi.g.width = 150; @@ -64,7 +64,7 @@ static void createWidgets(void) { wi.g.y = 100; wi.g.x = 165; wi.text = "Name of list 2"; - ghList2 = gwinListCreate(0, &wi, FALSE); + ghList2 = gwinListCreate(0, &wi, gFalse); gwinListSetScroll(ghList2, scrollSmooth); } @@ -76,7 +76,7 @@ int main(void) { // Set the widget defaults gwinSetDefaultFont(gdispOpenFont("UI2")); - gwinSetDefaultStyle(&WhiteWidgetStyle, FALSE); + gwinSetDefaultStyle(&WhiteWidgetStyle, gFalse); gdispClear(GFX_WHITE); // create the widget @@ -87,40 +87,40 @@ int main(void) { gwinAttachListener(&gl); // Add some items to the first list widget - gwinListAddItem(ghList1, "Item 0", FALSE); - gwinListAddItem(ghList1, "Item 1", FALSE); - gwinListAddItem(ghList1, "Item 2", FALSE); - gwinListAddItem(ghList1, "Item 3", FALSE); - gwinListAddItem(ghList1, "Item 4", FALSE); - gwinListAddItem(ghList1, "Item 5", FALSE); - gwinListAddItem(ghList1, "Item 6", FALSE); - gwinListAddItem(ghList1, "Item 7", FALSE); - gwinListAddItem(ghList1, "Item 8", FALSE); - gwinListAddItem(ghList1, "Item 9", FALSE); - gwinListAddItem(ghList1, "Item 10", FALSE); - gwinListAddItem(ghList1, "Item 11", FALSE); - gwinListAddItem(ghList1, "Item 12", FALSE); - gwinListAddItem(ghList1, "Item 13", FALSE); + gwinListAddItem(ghList1, "Item 0", gFalse); + gwinListAddItem(ghList1, "Item 1", gFalse); + gwinListAddItem(ghList1, "Item 2", gFalse); + gwinListAddItem(ghList1, "Item 3", gFalse); + gwinListAddItem(ghList1, "Item 4", gFalse); + gwinListAddItem(ghList1, "Item 5", gFalse); + gwinListAddItem(ghList1, "Item 6", gFalse); + gwinListAddItem(ghList1, "Item 7", gFalse); + gwinListAddItem(ghList1, "Item 8", gFalse); + gwinListAddItem(ghList1, "Item 9", gFalse); + gwinListAddItem(ghList1, "Item 10", gFalse); + gwinListAddItem(ghList1, "Item 11", gFalse); + gwinListAddItem(ghList1, "Item 12", gFalse); + gwinListAddItem(ghList1, "Item 13", gFalse); // Add some items to the second list widget // This time we will disable the render until // all the items have been added - gwinListEnableRender(ghList2, FALSE); - gwinListAddItem(ghList2, "Item 0", FALSE); - gwinListAddItem(ghList2, "Item 1", FALSE); - gwinListAddItem(ghList2, "Item 2", FALSE); - gwinListAddItem(ghList2, "Item 3", FALSE); - gwinListAddItem(ghList2, "Item 4", FALSE); - gwinListAddItem(ghList2, "Item 5", FALSE); - gwinListAddItem(ghList2, "Item 6", FALSE); - gwinListAddItem(ghList2, "Item 7", FALSE); - gwinListAddItem(ghList2, "Item 8", FALSE); - gwinListAddItem(ghList2, "Item 9", FALSE); - gwinListAddItem(ghList2, "Item 10", FALSE); - gwinListAddItem(ghList2, "Item 11", FALSE); - gwinListAddItem(ghList2, "Item 12", FALSE); - gwinListAddItem(ghList2, "Item 13", FALSE); - gwinListEnableRender(ghList2, TRUE); + gwinListEnableRender(ghList2, gFalse); + gwinListAddItem(ghList2, "Item 0", gFalse); + gwinListAddItem(ghList2, "Item 1", gFalse); + gwinListAddItem(ghList2, "Item 2", gFalse); + gwinListAddItem(ghList2, "Item 3", gFalse); + gwinListAddItem(ghList2, "Item 4", gFalse); + gwinListAddItem(ghList2, "Item 5", gFalse); + gwinListAddItem(ghList2, "Item 6", gFalse); + gwinListAddItem(ghList2, "Item 7", gFalse); + gwinListAddItem(ghList2, "Item 8", gFalse); + gwinListAddItem(ghList2, "Item 9", gFalse); + gwinListAddItem(ghList2, "Item 10", gFalse); + gwinListAddItem(ghList2, "Item 11", gFalse); + gwinListAddItem(ghList2, "Item 12", gFalse); + gwinListAddItem(ghList2, "Item 13", gFalse); + gwinListEnableRender(ghList2, gTrue); while(1) { // Get an Event diff --git a/demos/modules/gwin/progressbar/main.c b/demos/modules/gwin/progressbar/main.c index 374728cf..cf285014 100644 --- a/demos/modules/gwin/progressbar/main.c +++ b/demos/modules/gwin/progressbar/main.c @@ -6,7 +6,7 @@ static void _createWidget(void) { GWidgetInit wi; gwinWidgetClearInit(&wi); - wi.g.show = TRUE; + wi.g.show = gTrue; wi.g.y = 10; wi.g.x = 10; wi.g.width = 200; wi.g.height = 20; wi.text = "Progress 1"; ghProgressbar = gwinProgressbarCreate(0, &wi); @@ -16,7 +16,7 @@ int main(void) { gfxInit(); gwinSetDefaultFont(gdispOpenFont("UI2")); - gwinSetDefaultStyle(&WhiteWidgetStyle, FALSE); + gwinSetDefaultStyle(&WhiteWidgetStyle, gFalse); gdispClear(GFX_WHITE); _createWidget(); diff --git a/demos/modules/gwin/radio/main.c b/demos/modules/gwin/radio/main.c index 18c34e4c..f6cc5b4d 100644 --- a/demos/modules/gwin/radio/main.c +++ b/demos/modules/gwin/radio/main.c @@ -41,7 +41,7 @@ static void createWidgets(void) { // Apply some default values for GWIN gwinWidgetClearInit(&wi); - wi.g.show = TRUE; + wi.g.show = gTrue; // create Radio11 wi.g.y = 10; wi.g.x = 10; wi.g.width = 80; wi.g.height = 20; wi.text = "Radio 1"; @@ -80,7 +80,7 @@ int main(void) { // Set the widget defaults gwinSetDefaultFont(gdispOpenFont("UI2")); - gwinSetDefaultStyle(&WhiteWidgetStyle, FALSE); + gwinSetDefaultStyle(&WhiteWidgetStyle, gFalse); gdispClear(GFX_WHITE); // create the widget diff --git a/demos/modules/gwin/slider/main.c b/demos/modules/gwin/slider/main.c index 5e90c554..b813a393 100644 --- a/demos/modules/gwin/slider/main.c +++ b/demos/modules/gwin/slider/main.c @@ -37,7 +37,7 @@ static void createWidgets(void) { // Apply some default values for GWIN gwinWidgetClearInit(&wi); - wi.g.show = TRUE; + wi.g.show = gTrue; // create Slider1 wi.g.y = 10; wi.g.x = 10; wi.g.width = gdispGetWidth()-20; wi.g.height = 20; wi.text = "S1"; @@ -48,7 +48,7 @@ static void createWidgets(void) { ghSlider2 = gwinSliderCreate(0, &wi); // Set slider 2 to return extended events - gwinSliderSendExtendedEvents(ghSlider2, TRUE); + gwinSliderSendExtendedEvents(ghSlider2, gTrue); // Some options to try //gwinSliderSetRange(ghSlider1, 0, 70000); @@ -69,7 +69,7 @@ int main(void) { // Set the widget defaults gwinSetDefaultFont(gdispOpenFont("UI2")); - gwinSetDefaultStyle(&WhiteWidgetStyle, FALSE); + gwinSetDefaultStyle(&WhiteWidgetStyle, gFalse); gdispClear(GFX_WHITE); // create the widget diff --git a/demos/modules/gwin/tabset/main.c b/demos/modules/gwin/tabset/main.c index c4472c39..bedd7ed8 100644 --- a/demos/modules/gwin/tabset/main.c +++ b/demos/modules/gwin/tabset/main.c @@ -39,14 +39,14 @@ static void createWidgets(void) { // Apply some default values for GWIN gwinWidgetClearInit(&wi); - wi.g.show = TRUE; + wi.g.show = gTrue; // Create the Tabset wi.g.width = 200; wi.g.height = 200; wi.g.x = 10, wi.g.y = 10; ghTabset = gwinTabsetCreate(0, &wi, GWIN_TABSET_BORDER); - ghPage1 = gwinTabsetAddTab(ghTabset, "Page 1", FALSE); - ghPage2 = gwinTabsetAddTab(ghTabset, "Page 2", FALSE); - ghPage3 = gwinTabsetAddTab(ghTabset, "Page 3", FALSE); + ghPage1 = gwinTabsetAddTab(ghTabset, "Page 1", gFalse); + ghPage2 = gwinTabsetAddTab(ghTabset, "Page 2", gFalse); + ghPage3 = gwinTabsetAddTab(ghTabset, "Page 3", gFalse); // Add some widgets to Page 1 wi.g.width = 120; wi.g.height = 20; wi.g.x = 10; wi.g.y = 10; @@ -75,7 +75,7 @@ int main(void) { // Set the widget defaults gwinSetDefaultFont(gdispOpenFont("UI2")); - gwinSetDefaultStyle(&WhiteWidgetStyle, FALSE); + gwinSetDefaultStyle(&WhiteWidgetStyle, gFalse); gdispClear(GFX_WHITE); // create the widget diff --git a/demos/modules/gwin/textedit/main.c b/demos/modules/gwin/textedit/main.c index b3fafcf0..490a949c 100644 --- a/demos/modules/gwin/textedit/main.c +++ b/demos/modules/gwin/textedit/main.c @@ -44,7 +44,7 @@ static void guiCreate(void) gwinWidgetClearInit(&wi); // Console - wi.g.show = TRUE; + wi.g.show = gTrue; wi.g.x = 0; wi.g.y = 0; wi.g.width = gdispGetWidth()/2; @@ -56,7 +56,7 @@ static void guiCreate(void) gwinClear(ghConsole); // TextEdit1 - wi.g.show = TRUE; + wi.g.show = gTrue; wi.g.x = gdispGetWidth()/2 + 10; wi.g.y = 20; wi.g.width = 200; @@ -65,28 +65,28 @@ static void guiCreate(void) ghTextedit1 = gwinTexteditCreate(0, &wi, 100); // TextEdit2 - wi.g.show = TRUE; + wi.g.show = gTrue; wi.g.x = gdispGetWidth()/2 + 10; wi.g.y = 100; wi.g.width = 200; wi.g.height = 35; wi.text = "to switch between"; ghTextedit2 = gwinTexteditCreate(0, &wi, 20); - //gwinTexteditSetBorder(ghTextedit2, FALSE); + //gwinTexteditSetBorder(ghTextedit2, gFalse); // TextEdit3 - wi.g.show = TRUE; + wi.g.show = gTrue; wi.g.x = gdispGetWidth()/2 + 10; wi.g.y = 180; wi.g.width = 200; wi.g.height = 35; wi.text = "the different widgets"; ghTextedit3 = gwinTexteditCreate(0, &wi, 100); - //gwinTexteditSetBorder(ghTextedit3, TRUE); + //gwinTexteditSetBorder(ghTextedit3, gTrue); // Virtual keyboard #if GWIN_NEED_KEYBOARD - wi.g.show = TRUE; + wi.g.show = gTrue; wi.g.x = 0; wi.g.y = gdispGetHeight()*3/4; wi.g.width = gdispGetWidth(); @@ -104,7 +104,7 @@ int main(void) { gdispClear(GFX_SILVER); gwinSetDefaultFont(gdispOpenFont("DejaVuSans16")); - gwinSetDefaultStyle(&WhiteWidgetStyle, FALSE); + gwinSetDefaultStyle(&WhiteWidgetStyle, gFalse); gwinSetDefaultColor(GFX_BLACK); gwinSetDefaultBgColor(GFX_WHITE); diff --git a/demos/modules/gwin/textedit_virtual_keyboard/main.c b/demos/modules/gwin/textedit_virtual_keyboard/main.c index 6bc29a57..a7af1e08 100644 --- a/demos/modules/gwin/textedit_virtual_keyboard/main.c +++ b/demos/modules/gwin/textedit_virtual_keyboard/main.c @@ -41,7 +41,7 @@ static void guiCreate(void) gwinWidgetClearInit(&wi); // TextEdit1 - wi.g.show = TRUE; + wi.g.show = gTrue; wi.g.x = 10; wi.g.y = 20; wi.g.width = 200; @@ -50,7 +50,7 @@ static void guiCreate(void) ghTextedit1 = gwinTexteditCreate(0, &wi, 100); // TextEdit2 - wi.g.show = TRUE; + wi.g.show = gTrue; wi.g.x = 10; wi.g.y = 100; wi.g.width = 200; @@ -59,7 +59,7 @@ static void guiCreate(void) ghTextedit2 = gwinTexteditCreate(0, &wi, 20); // TextEdit3 - wi.g.show = TRUE; + wi.g.show = gTrue; wi.g.x = 10; wi.g.y = 180; wi.g.width = 200; @@ -68,7 +68,7 @@ static void guiCreate(void) ghTextedit3 = gwinTexteditCreate(0, &wi, 100); // Virtual keyboard - wi.g.show = TRUE; + wi.g.show = gTrue; wi.g.x = 0; wi.g.y = (gdispGetHeight()/2); wi.g.width = gdispGetWidth(); @@ -82,7 +82,7 @@ int main(void) gdispClear(GFX_SILVER); gwinSetDefaultFont(gdispOpenFont("DejaVuSans16")); - gwinSetDefaultStyle(&WhiteWidgetStyle, FALSE); + gwinSetDefaultStyle(&WhiteWidgetStyle, gFalse); gwinSetDefaultColor(GFX_BLACK); gwinSetDefaultBgColor(GFX_WHITE); diff --git a/demos/modules/gwin/widgets/main.c b/demos/modules/gwin/widgets/main.c index 5f98387e..8e56af90 100644 --- a/demos/modules/gwin/widgets/main.c +++ b/demos/modules/gwin/widgets/main.c @@ -203,18 +203,18 @@ static void createWidgets(void) { // Create the Tabs #if GWIN_NEED_TABSET - wi.g.show = TRUE; + wi.g.show = gTrue; wi.g.x = border; wi.g.y = 0; wi.g.width = ScrWidth - 2*border; wi.g.height = ScrHeight-wi.g.y-border; ghTabset = gwinTabsetCreate(0, &wi, GWIN_TABSET_BORDER); - ghPgButtons = gwinTabsetAddTab(ghTabset, "Buttons", FALSE); - ghPgSliders = gwinTabsetAddTab(ghTabset, "Sliders", FALSE); - ghPgCheckboxes = gwinTabsetAddTab(ghTabset, "Checkbox", FALSE); - ghPgRadios = gwinTabsetAddTab(ghTabset, "Radios", FALSE); - ghPgLists = gwinTabsetAddTab(ghTabset, "Lists", FALSE); - ghPgLabels = gwinTabsetAddTab(ghTabset, "Labels", FALSE); - ghPgImages = gwinTabsetAddTab(ghTabset, "Images", FALSE); - ghPgProgressbars = gwinTabsetAddTab(ghTabset, "Progressbar", FALSE); + ghPgButtons = gwinTabsetAddTab(ghTabset, "Buttons", gFalse); + ghPgSliders = gwinTabsetAddTab(ghTabset, "Sliders", gFalse); + ghPgCheckboxes = gwinTabsetAddTab(ghTabset, "Checkbox", gFalse); + ghPgRadios = gwinTabsetAddTab(ghTabset, "Radios", gFalse); + ghPgLists = gwinTabsetAddTab(ghTabset, "Lists", gFalse); + ghPgLabels = gwinTabsetAddTab(ghTabset, "Labels", gFalse); + ghPgImages = gwinTabsetAddTab(ghTabset, "Images", gFalse); + ghPgProgressbars = gwinTabsetAddTab(ghTabset, "Progressbar", gFalse); pagewidth = gwinGetInnerWidth(ghTabset)/2; @@ -229,7 +229,7 @@ static void createWidgets(void) { gwinSetBgColor(ghConsole, HTML2COLOR(0xF0F0F0)); #else - wi.g.show = TRUE; wi.customDraw = gwinRadioDraw_Tab; + wi.g.show = gTrue; wi.customDraw = gwinRadioDraw_Tab; wi.g.height = TAB_HEIGHT; wi.g.y = 0; wi.g.x = 0; setbtntext(&wi, ScrWidth, "Buttons"); ghTabButtons = gwinRadioCreate(0, &wi, GROUP_TABS); @@ -251,7 +251,7 @@ static void createWidgets(void) { wi.customDraw = 0; // Create the Pages - wi.g.show = FALSE; + wi.g.show = gFalse; wi.g.x = border; wi.g.y += border; wi.g.width = ScrWidth/2 - border; wi.g.height = ScrHeight-wi.g.y-border; ghPgButtons = gwinContainerCreate(0, &wi, GWIN_CONTAINER_BORDER); @@ -262,7 +262,7 @@ static void createWidgets(void) { ghPgLabels = gwinContainerCreate(0, &wi, GWIN_CONTAINER_BORDER); ghPgImages = gwinContainerCreate(0, &wi, GWIN_CONTAINER_BORDER); ghPgProgressbars = gwinContainerCreate(0, &wi, GWIN_CONTAINER_BORDER); - wi.g.show = TRUE; + wi.g.show = gTrue; // Console - we apply some special colors before making it visible wi.g.x = ScrWidth/2+border; @@ -363,62 +363,62 @@ static void createWidgets(void) { wi.g.parent = ghPgLists; wi.g.width = LIST_WIDTH; wi.g.height = LIST_HEIGHT; wi.g.y = border; wi.g.x = border; wi.text = "L1"; - ghList1 = gwinListCreate(0, &wi, FALSE); - gwinListAddItem(ghList1, "Item 0", FALSE); - gwinListAddItem(ghList1, "Item 1", FALSE); - gwinListAddItem(ghList1, "Item 2", FALSE); - gwinListAddItem(ghList1, "Item 3", FALSE); - gwinListAddItem(ghList1, "Item 4", FALSE); - gwinListAddItem(ghList1, "Item 5", FALSE); - gwinListAddItem(ghList1, "Item 6", FALSE); - gwinListAddItem(ghList1, "Item 7", FALSE); - gwinListAddItem(ghList1, "Item 8", FALSE); - gwinListAddItem(ghList1, "Item 9", FALSE); - gwinListAddItem(ghList1, "Item 10", FALSE); - gwinListAddItem(ghList1, "Item 11", FALSE); - gwinListAddItem(ghList1, "Item 12", FALSE); - gwinListAddItem(ghList1, "Item 13", FALSE); + ghList1 = gwinListCreate(0, &wi, gFalse); + gwinListAddItem(ghList1, "Item 0", gFalse); + gwinListAddItem(ghList1, "Item 1", gFalse); + gwinListAddItem(ghList1, "Item 2", gFalse); + gwinListAddItem(ghList1, "Item 3", gFalse); + gwinListAddItem(ghList1, "Item 4", gFalse); + gwinListAddItem(ghList1, "Item 5", gFalse); + gwinListAddItem(ghList1, "Item 6", gFalse); + gwinListAddItem(ghList1, "Item 7", gFalse); + gwinListAddItem(ghList1, "Item 8", gFalse); + gwinListAddItem(ghList1, "Item 9", gFalse); + gwinListAddItem(ghList1, "Item 10", gFalse); + gwinListAddItem(ghList1, "Item 11", gFalse); + gwinListAddItem(ghList1, "Item 12", gFalse); + 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; } - ghList2 = gwinListCreate(0, &wi, TRUE); - gwinListAddItem(ghList2, "Item 0", FALSE); - gwinListAddItem(ghList2, "Item 1", FALSE); - gwinListAddItem(ghList2, "Item 2", FALSE); - gwinListAddItem(ghList2, "Item 3", FALSE); - gwinListAddItem(ghList2, "Item 4", FALSE); - gwinListAddItem(ghList2, "Item 5", FALSE); - gwinListAddItem(ghList2, "Item 6", FALSE); - gwinListAddItem(ghList2, "Item 7", FALSE); - gwinListAddItem(ghList2, "Item 8", FALSE); - gwinListAddItem(ghList2, "Item 9", FALSE); - gwinListAddItem(ghList2, "Item 10", FALSE); - gwinListAddItem(ghList2, "Item 11", FALSE); - gwinListAddItem(ghList2, "Item 12", FALSE); - gwinListAddItem(ghList2, "Item 13", FALSE); + ghList2 = gwinListCreate(0, &wi, gTrue); + gwinListAddItem(ghList2, "Item 0", gFalse); + gwinListAddItem(ghList2, "Item 1", gFalse); + gwinListAddItem(ghList2, "Item 2", gFalse); + gwinListAddItem(ghList2, "Item 3", gFalse); + gwinListAddItem(ghList2, "Item 4", gFalse); + gwinListAddItem(ghList2, "Item 5", gFalse); + gwinListAddItem(ghList2, "Item 6", gFalse); + gwinListAddItem(ghList2, "Item 7", gFalse); + gwinListAddItem(ghList2, "Item 8", gFalse); + gwinListAddItem(ghList2, "Item 9", gFalse); + gwinListAddItem(ghList2, "Item 10", gFalse); + gwinListAddItem(ghList2, "Item 11", gFalse); + gwinListAddItem(ghList2, "Item 12", gFalse); + 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; } - ghList3 = gwinListCreate(0, &wi, TRUE); - gwinListAddItem(ghList3, "Item 0", FALSE); - gwinListAddItem(ghList3, "Item 1", FALSE); - gwinListAddItem(ghList3, "Item 2", FALSE); - gwinListAddItem(ghList3, "Item 3", FALSE); + ghList3 = gwinListCreate(0, &wi, gTrue); + gwinListAddItem(ghList3, "Item 0", gFalse); + gwinListAddItem(ghList3, "Item 1", gFalse); + gwinListAddItem(ghList3, "Item 2", gFalse); + gwinListAddItem(ghList3, "Item 3", gFalse); gdispImageOpenFile(&imgYesNo, "image_yesno.gif"); gwinListItemSetImage(ghList3, 1, &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; } - ghList4 = gwinListCreate(0, &wi, TRUE); - gwinListAddItem(ghList4, "Item 0", FALSE); - gwinListAddItem(ghList4, "Item 1", FALSE); - gwinListAddItem(ghList4, "Item 2", FALSE); - gwinListAddItem(ghList4, "Item 3", FALSE); - gwinListAddItem(ghList4, "Item 4", FALSE); - gwinListAddItem(ghList4, "Item 5", FALSE); - gwinListAddItem(ghList4, "Item 6", FALSE); - gwinListAddItem(ghList4, "Item 7", FALSE); - gwinListAddItem(ghList4, "Item 8", FALSE); - gwinListAddItem(ghList4, "Item 9", FALSE); - gwinListAddItem(ghList4, "Item 10", FALSE); - gwinListAddItem(ghList4, "Item 11", FALSE); - gwinListAddItem(ghList4, "Item 12", FALSE); - gwinListAddItem(ghList4, "Item 13", FALSE); + ghList4 = gwinListCreate(0, &wi, gTrue); + gwinListAddItem(ghList4, "Item 0", gFalse); + gwinListAddItem(ghList4, "Item 1", gFalse); + gwinListAddItem(ghList4, "Item 2", gFalse); + gwinListAddItem(ghList4, "Item 3", gFalse); + gwinListAddItem(ghList4, "Item 4", gFalse); + gwinListAddItem(ghList4, "Item 5", gFalse); + gwinListAddItem(ghList4, "Item 6", gFalse); + gwinListAddItem(ghList4, "Item 7", gFalse); + gwinListAddItem(ghList4, "Item 8", gFalse); + gwinListAddItem(ghList4, "Item 9", gFalse); + gwinListAddItem(ghList4, "Item 10", gFalse); + gwinListAddItem(ghList4, "Item 11", gFalse); + gwinListAddItem(ghList4, "Item 12", gFalse); + gwinListAddItem(ghList4, "Item 13", gFalse); gwinListSetScroll(ghList4, scrollSmooth); // Image @@ -443,25 +443,25 @@ static void setLabels(void) { // The sliders snprintg(tmp, sizeof(tmp), "%d%%", gwinSliderGetPosition(ghSlider1)); - gwinSetText(ghLabelSlider1, tmp, TRUE); + gwinSetText(ghLabelSlider1, tmp, gTrue); snprintg(tmp, sizeof(tmp), "%d%%", gwinSliderGetPosition(ghSlider2)); - gwinSetText(ghLabelSlider2, tmp, TRUE); + gwinSetText(ghLabelSlider2, tmp, gTrue); snprintg(tmp, sizeof(tmp), "%d%%", gwinSliderGetPosition(ghSlider3)); - gwinSetText(ghLabelSlider3, tmp, TRUE); + gwinSetText(ghLabelSlider3, tmp, gTrue); snprintg(tmp, sizeof(tmp), "%d%%", gwinSliderGetPosition(ghSlider4)); - gwinSetText(ghLabelSlider4, tmp, TRUE); + gwinSetText(ghLabelSlider4, tmp, gTrue); // The radio buttons if (gwinRadioIsPressed(ghRadio1)) - gwinSetText(ghLabelRadio1, "Yes", TRUE); + gwinSetText(ghLabelRadio1, "Yes", gTrue); else if (gwinRadioIsPressed(ghRadio2)) - gwinSetText(ghLabelRadio1, "No", TRUE); + gwinSetText(ghLabelRadio1, "No", gTrue); } /** * Control the progress bar auto-increment */ -static void setProgressbar(bool_t onoff) { +static void setProgressbar(gBool onoff) { if (onoff) gwinProgressbarStart(ghProgressbar1, 500); else { @@ -473,7 +473,7 @@ static void setProgressbar(bool_t onoff) { /** * Set the enabled state of every widget (except the tabs etc) */ -static void setEnabled(bool_t ena) { +static void setEnabled(gBool ena) { gwinSetEnabled(ghPgButtons, ena); gwinSetEnabled(ghPgSliders, ena); gwinSetEnabled(ghPgLabels, ena); @@ -485,7 +485,7 @@ static void setEnabled(bool_t ena) { gwinSetEnabled(ghCheckbox1, ena); gwinSetEnabled(ghCheckbox2, ena); gwinSetEnabled(ghCheckbox3, ena); - //gwinSetEnabled(ghCheckDisableAll, TRUE); + //gwinSetEnabled(ghCheckDisableAll, gTrue); } static void FlashOffFn(void *param) { @@ -503,7 +503,7 @@ int main(void) { // Set the widget defaults font = gdispOpenFont("*"); // Get the first defined font. gwinSetDefaultFont(font); - gwinSetDefaultStyle(&WhiteWidgetStyle, FALSE); + gwinSetDefaultStyle(&WhiteWidgetStyle, gFalse); gdispClear(GFX_WHITE); // Create the gwin windows/widgets @@ -557,7 +557,7 @@ int main(void) { // If it is the toggle button checkbox start the flash. } else if (((GEventGWinCheckbox *)pe)->gwin == ghCheckbox3) { gwinFlash(ghCheckbox3); - gtimerStart(&FlashTimer, FlashOffFn, 0, FALSE, 3000); + gtimerStart(&FlashTimer, FlashOffFn, 0, gFalse, 3000); } break; @@ -600,7 +600,7 @@ int main(void) { gdispClear(pstyle->background); // Update the style on all controls - gwinSetDefaultStyle(pstyle, TRUE); + gwinSetDefaultStyle(pstyle, gTrue); } break; } diff --git a/demos/tools/touch_calibration_grabber/main.c b/demos/tools/touch_calibration_grabber/main.c index 9f16bb90..e6017030 100644 --- a/demos/tools/touch_calibration_grabber/main.c +++ b/demos/tools/touch_calibration_grabber/main.c @@ -63,7 +63,7 @@ int main(void) { GWindowInit wi; gwinClearInit(&wi); - wi.show = TRUE; wi.x = 0; wi.y = bHeight; wi.width = swidth; wi.height = sheight-bHeight; + wi.show = gTrue; wi.x = 0; wi.y = bHeight; wi.width = swidth; wi.height = sheight-bHeight; ghc = gwinConsoleCreate(&gc, &wi); } diff --git a/demos/tools/touch_driver_test/main.c b/demos/tools/touch_driver_test/main.c index 5182056a..8a4e5304 100644 --- a/demos/tools/touch_driver_test/main.c +++ b/demos/tools/touch_driver_test/main.c @@ -42,7 +42,7 @@ static coord_t bWidth, bWidth2, bHeight; static GHandle ghc; static coord_t swidth, sheight; -static void DrawHeader(const char *title, bool_t btnNext, bool_t btnPrev, bool_t btnPlusMinus) { +static void DrawHeader(const char *title, gBool btnNext, gBool btnPrev, gBool btnPlusMinus) { #if GDISP_NEED_CLIP gdispSetClip(0, 0, swidth, sheight); #endif @@ -87,10 +87,10 @@ static int CheckButtons(GEventMouse *pem) { int main(void) { GSourceHandle gs; GEventMouse *pem; - bool_t isFirstTime; - bool_t isCalibrated; - bool_t isTouch; - bool_t isFinger; + gBool isFirstTime; + gBool isCalibrated; + gBool isTouch; + gBool isFinger; const char * isFingerText; const char * deviceText; GMouse * m; @@ -122,7 +122,7 @@ int main(void) { GWindowInit wi; gwinClearInit(&wi); - wi.show = TRUE; wi.x = 0; wi.y = bHeight; wi.width = swidth; wi.height = sheight-bHeight; + wi.show = gTrue; wi.x = 0; wi.y = bHeight; wi.width = swidth; wi.height = sheight-bHeight; ghc = gwinConsoleCreate(&gc, &wi); } @@ -144,8 +144,8 @@ int main(void) { geventAttachSource(&gl, gs, GLISTEN_MOUSEDOWNMOVES|GLISTEN_MOUSEMETA); // Get initial display settings for buttons - isFirstTime = TRUE; - isCalibrated = (vmt->d.flags & GMOUSE_VFLG_CALIBRATE) ? FALSE : TRUE; + isFirstTime = gTrue; + isCalibrated = (vmt->d.flags & GMOUSE_VFLG_CALIBRATE) ? gFalse : gTrue; calerr = 0; /* @@ -156,8 +156,8 @@ StepDeviceType: DrawHeader("1. Device Type", isCalibrated, isCalibrated && !isFirstTime, isCalibrated); // Get the type of device and the current mode - isTouch = (vmt->d.flags & GMOUSE_VFLG_TOUCH) ? TRUE : FALSE; - isFinger = (m->flags & GMOUSE_FLG_FINGERMODE) ? TRUE : FALSE; + isTouch = (vmt->d.flags & GMOUSE_VFLG_TOUCH) ? gTrue : gFalse; + isFinger = (m->flags & GMOUSE_FLG_FINGERMODE) ? gTrue : gFalse; pjit = isFinger ? &vmt->finger_jitter : &vmt->pen_jitter; isFingerText = isFinger ? "finger" : "pen"; deviceText = isTouch ? isFingerText : "mouse"; @@ -205,7 +205,7 @@ StepDeviceType: */ StepRawReading: - DrawHeader("2. Raw Mouse Output", FALSE, FALSE, FALSE); + DrawHeader("2. Raw Mouse Output", gFalse, gFalse, gFalse); if (isTouch) gwinPrintf(ghc, "Press and hold on the surface.\n\n"); else @@ -292,7 +292,7 @@ StepCalibrate: calerr = ginputCalibrateMouse(0); if (calerr) goto StepCalibrate; - isCalibrated = TRUE; + isCalibrated = gTrue; } /* @@ -300,7 +300,7 @@ StepCalibrate: */ StepMouseCoords: - DrawHeader("4. Show Mouse Coordinates", TRUE, TRUE, TRUE); + DrawHeader("4. Show Mouse Coordinates", gTrue, gTrue, gTrue); if (isTouch) gwinPrintf(ghc, "Press and hold on the surface.\n\n"); else @@ -345,7 +345,7 @@ StepMouseCoords: */ StepMovementJitter: - DrawHeader("5. Movement Jitter", TRUE, TRUE, TRUE); + DrawHeader("5. Movement Jitter", gTrue, gTrue, gTrue); if (isTouch) gwinPrintf(ghc, "Press firmly on the surface and move around as if to draw.\n\n"); else @@ -456,6 +456,6 @@ StepDrawing: } // Can't let this really exit - isFirstTime = FALSE; + isFirstTime = gFalse; goto StepDeviceType; } diff --git a/demos/tools/touch_raw_readings/main.c b/demos/tools/touch_raw_readings/main.c index 27c799f7..1e19f69f 100644 --- a/demos/tools/touch_raw_readings/main.c +++ b/demos/tools/touch_raw_readings/main.c @@ -68,7 +68,7 @@ int main(void) { GWindowInit wi; gwinClearInit(&wi); - wi.show = TRUE; wi.x = 0; wi.y = bHeight; wi.width = swidth; wi.height = sheight-bHeight; + wi.show = gTrue; wi.x = 0; wi.y = bHeight; wi.width = swidth; wi.height = sheight-bHeight; ghc = gwinConsoleCreate(&gc, &wi); } diff --git a/demos/tools/uGFXnetDisplay/main.c b/demos/tools/uGFXnetDisplay/main.c index 6f4ad4b6..9bf61b47 100644 --- a/demos/tools/uGFXnetDisplay/main.c +++ b/demos/tools/uGFXnetDisplay/main.c @@ -135,9 +135,9 @@ static font_t font; /** * Get a whole packet of data. * Len is specified in the number of uint16_t's we want as our protocol only talks uint16_t's. - * If the connection closes before we get all the data - the call returns FALSE. + * If the connection closes before we get all the data - the call returns gFalse. */ -static bool_t getpkt(uint16_t *pkt, int len) { +static gBool getpkt(uint16_t *pkt, int len) { int got; int have; @@ -149,22 +149,22 @@ static bool_t getpkt(uint16_t *pkt, int len) { len -= got; } if (len) - return FALSE; + return gFalse; // Convert each uint16_t to host order for(got = 0, have /= 2; got < have; got++) pkt[got] = ntohs(pkt[got]); - return TRUE; + return gTrue; } /** * Send a whole packet of data. * Len is specified in the number of uint16_t's we want to send as our protocol only talks uint16_t's. * Note that contents of the packet are modified to ensure it will cross the wire in the correct format. - * If the connection closes before we send all the data - the call returns FALSE. + * If the connection closes before we send all the data - the call returns gFalse. */ -static bool_t sendpkt(uint16_t *pkt, int len) { +static gBool sendpkt(uint16_t *pkt, int len) { int i; // Convert each uint16_t to network order diff --git a/drivers/gaudio/Win32/gaudio_play_Win32.c b/drivers/gaudio/Win32/gaudio_play_Win32.c index 7bca6e04..33342151 100644 --- a/drivers/gaudio/Win32/gaudio_play_Win32.c +++ b/drivers/gaudio/Win32/gaudio_play_Win32.c @@ -31,7 +31,7 @@ static HWAVEOUT ah = 0; static volatile int nQueuedBuffers; -static bool_t isRunning; +static gBool isRunning; static WAVEHDR WaveHdrs[MAX_WAVE_HEADERS]; static HANDLE waveThread; static DWORD threadID; @@ -46,7 +46,7 @@ static DWORD threadID; * anyway, so instead just use CALLBACK_THREAD here instead. *************************************************************************/ -static bool_t senddata(WAVEHDR *pwh) { +static gBool senddata(WAVEHDR *pwh) { GDataBuffer *paud; // Get the next data block to send @@ -56,7 +56,7 @@ static bool_t senddata(WAVEHDR *pwh) { gaudioPlayDoneI(); gfxSystemUnlock(); if (!paud) - return FALSE; + return gFalse; // Prepare the wave header for Windows pwh->dwUser = (DWORD_PTR)paud; @@ -76,7 +76,7 @@ static bool_t senddata(WAVEHDR *pwh) { } nQueuedBuffers++; - return TRUE; + return gTrue; } static DWORD WINAPI waveProc(LPVOID arg) { @@ -122,11 +122,11 @@ static DWORD WINAPI waveProc(LPVOID arg) { /* External declarations. */ /*===========================================================================*/ -bool_t gaudio_play_lld_init(uint16_t channel, uint32_t frequency, ArrayDataFormat format) { +gBool gaudio_play_lld_init(uint16_t channel, uint32_t frequency, ArrayDataFormat format) { WAVEFORMATEX wfx; if (format != ARRAY_DATA_8BITUNSIGNED && format != ARRAY_DATA_16BITSIGNED) - return FALSE; + return gFalse; if (!waveThread) { if (!(waveThread = CreateThread(0, 0, (LPTHREAD_START_ROUTINE)waveProc, 0, 0, &threadID))) { @@ -153,19 +153,19 @@ bool_t gaudio_play_lld_init(uint16_t channel, uint32_t frequency, ArrayDataForma exit(-1); } - return TRUE; + return gTrue; } -bool_t gaudio_play_lld_set_volume(uint8_t vol) { +gBool gaudio_play_lld_set_volume(uint8_t vol) { if (!ah) - return FALSE; + return gFalse; return waveOutSetVolume(ah, (((uint16_t)vol)<<8)|vol) != 0; } void gaudio_play_lld_start(void) { WAVEHDR *pwh; - isRunning = TRUE; + isRunning = gTrue; while (nQueuedBuffers < MAX_WAVE_HEADERS) { // Find the empty one - there will always be at least one. for(pwh = WaveHdrs; pwh->lpData; pwh++); @@ -177,7 +177,7 @@ void gaudio_play_lld_start(void) { } void gaudio_play_lld_stop(void) { - isRunning = FALSE; + isRunning = gFalse; waveOutReset(ah); while(nQueuedBuffers) Sleep(1); } diff --git a/drivers/gaudio/Win32/gaudio_record_Win32.c b/drivers/gaudio/Win32/gaudio_record_Win32.c index 1c86c37f..065c2e5f 100644 --- a/drivers/gaudio/Win32/gaudio_record_Win32.c +++ b/drivers/gaudio/Win32/gaudio_record_Win32.c @@ -31,7 +31,7 @@ static HWAVEIN ah = 0; static volatile int nQueuedBuffers; -static bool_t isRunning; +static gBool isRunning; static WAVEHDR WaveHdrs[MAX_WAVE_HEADERS]; static HANDLE waveThread; static DWORD threadID; @@ -46,7 +46,7 @@ static DWORD threadID; * anyway, so instead just use CALLBACK_THREAD here instead. *************************************************************************/ -static bool_t getbuffer(WAVEHDR *pwh) { +static gBool getbuffer(WAVEHDR *pwh) { GDataBuffer *paud; // Get the next data block to send @@ -56,7 +56,7 @@ static bool_t getbuffer(WAVEHDR *pwh) { gaudioRecordDoneI(); gfxSystemUnlock(); if (!paud) - return FALSE; + return gFalse; // Prepare the wave header for Windows pwh->dwUser = (DWORD_PTR)paud; @@ -75,7 +75,7 @@ static bool_t getbuffer(WAVEHDR *pwh) { } nQueuedBuffers++; - return TRUE; + return gTrue; } static DWORD WINAPI waveProc(LPVOID arg) { @@ -124,11 +124,11 @@ static DWORD WINAPI waveProc(LPVOID arg) { /* External declarations. */ /*===========================================================================*/ -bool_t gaudio_record_lld_init(uint16_t channel, uint32_t frequency, ArrayDataFormat format) { +gBool gaudio_record_lld_init(uint16_t channel, uint32_t frequency, ArrayDataFormat format) { WAVEFORMATEX wfx; if (format != ARRAY_DATA_8BITUNSIGNED && format != ARRAY_DATA_16BITSIGNED) - return FALSE; + return gFalse; if (!waveThread) { if (!(waveThread = CreateThread(0, 0, (LPTHREAD_START_ROUTINE)waveProc, 0, 0, &threadID))) { @@ -155,7 +155,7 @@ bool_t gaudio_record_lld_init(uint16_t channel, uint32_t frequency, ArrayDataFor exit(-1); } - return TRUE; + return gTrue; } void gaudio_record_lld_start(void) { @@ -173,13 +173,13 @@ void gaudio_record_lld_start(void) { break; } if (!isRunning) { - isRunning = TRUE; + isRunning = gTrue; waveInStart(ah); } } void gaudio_record_lld_stop(void) { - isRunning = FALSE; + isRunning = gFalse; waveInReset(ah); while(nQueuedBuffers) Sleep(1); } diff --git a/drivers/gaudio/gadc/gaudio_record_gadc.c b/drivers/gaudio/gadc/gaudio_record_gadc.c index c894c84b..01eebd7e 100644 --- a/drivers/gaudio/gadc/gaudio_record_gadc.c +++ b/drivers/gaudio/gadc/gaudio_record_gadc.c @@ -30,10 +30,10 @@ static void gadcCallbackI(void) { /* External declarations. */ /*===========================================================================*/ -bool_t gaudio_record_lld_init(uint16_t channel, uint32_t frequency, ArrayDataFormat format) { +gBool gaudio_record_lld_init(uint16_t channel, uint32_t frequency, ArrayDataFormat format) { /* Check the parameters */ if (channel >= GAUDIO_RECORD_NUM_CHANNELS || frequency > GAUDIO_RECORD_MAX_SAMPLE_FREQUENCY || format != GAUDIO_RECORD_FORMAT1) - return FALSE; + return gFalse; /* Setup the high speed GADC */ gadcHighSpeedInit(gaudio_gadc_physdevs[channel], frequency); @@ -41,7 +41,7 @@ bool_t gaudio_record_lld_init(uint16_t channel, uint32_t frequency, ArrayDataFor /* Register ourselves for ISR callbacks */ gadcHighSpeedSetISRCallback(gadcCallbackI); - return TRUE; + return gTrue; } void gaudio_record_lld_start(void) { diff --git a/drivers/gaudio/pwm/gaudio_play_board_template.h b/drivers/gaudio/pwm/gaudio_play_board_template.h index 24039d17..c2a91fe1 100644 --- a/drivers/gaudio/pwm/gaudio_play_board_template.h +++ b/drivers/gaudio/pwm/gaudio_play_board_template.h @@ -15,10 +15,10 @@ * */ -static bool gaudio_play_pwm_setup(uint32_t frequency, ArrayDataFormat format) { +static gBool gaudio_play_pwm_setup(uint32_t frequency, ArrayDataFormat format) { /* Initialise the PWM - use a midpoint value for the initial PWM value */ /* Initialise the timer interrupt @ frequency */ - /* Return FALSE if any parameter invalid */ + /* Return gFalse if any parameter invalid */ } static void gaudio_play_pwm_start(void) { diff --git a/drivers/gaudio/pwm/gaudio_play_pwm.c b/drivers/gaudio/pwm/gaudio_play_pwm.c index 91d7a835..ab83852d 100644 --- a/drivers/gaudio/pwm/gaudio_play_pwm.c +++ b/drivers/gaudio/pwm/gaudio_play_pwm.c @@ -65,19 +65,19 @@ static void gaudio_play_pwm_timer_callbackI(void) { /* External declarations. */ /*===========================================================================*/ -bool_t gaudio_play_lld_init(uint16_t channel, uint32_t frequency, ArrayDataFormat format) { +gBool gaudio_play_lld_init(uint16_t channel, uint32_t frequency, ArrayDataFormat format) { (void) channel; if (format != ARRAY_DATA_8BITUNSIGNED && format != ARRAY_DATA_10BITUNSIGNED) - return FALSE; + return gFalse; playfmt = format; return gaudio_play_pwm_setup(frequency, format); } -bool_t gaudio_play_lld_set_volume(uint8_t vol) { +gBool gaudio_play_lld_set_volume(uint8_t vol) { (void) vol; - return FALSE; + return gFalse; } void gaudio_play_lld_start(void) { diff --git a/drivers/gaudio/vs1053/gaudio_play_board_template.h b/drivers/gaudio/vs1053/gaudio_play_board_template.h index d6125bbc..273bd7ed 100644 --- a/drivers/gaudio/vs1053/gaudio_play_board_template.h +++ b/drivers/gaudio/vs1053/gaudio_play_board_template.h @@ -24,7 +24,7 @@ static void board_reset(void) { } // Returns the state of the dreq pin -static bool board_dreq(void) { +static gBool board_dreq(void) { } diff --git a/drivers/gaudio/vs1053/gaudio_play_vs1053.c b/drivers/gaudio/vs1053/gaudio_play_vs1053.c index c96ec036..8b333741 100644 --- a/drivers/gaudio/vs1053/gaudio_play_vs1053.c +++ b/drivers/gaudio/vs1053/gaudio_play_vs1053.c @@ -61,7 +61,7 @@ #endif // Our static variables -static bool_t vs1053_isinit; +static gBool vs1053_isinit; static GTimer playTimer; // Some common macro's @@ -228,7 +228,7 @@ static void FeedData(void *param) { /* External declarations. */ /*===========================================================================*/ -bool_t gaudio_play_lld_init(uint16_t channel, uint32_t frequency, ArrayDataFormat format) { +gBool gaudio_play_lld_init(uint16_t channel, uint32_t frequency, ArrayDataFormat format) { uint32_t brate; uint32_t bps; uint8_t buf[4]; @@ -246,14 +246,14 @@ bool_t gaudio_play_lld_init(uint16_t channel, uint32_t frequency, ArrayDataForma }; if (format != ARRAY_DATA_8BITUNSIGNED && format != ARRAY_DATA_16BITSIGNED && format != ARRAY_DATA_UNKNOWN) - return FALSE; + return gFalse; if (frequency > VS1053_MAX_SAMPLE_RATE) - return FALSE; + return gFalse; // Reset the chip if needed if (!vs1053_isinit) { vs1053_hard_reset(); - vs1053_isinit = TRUE; + vs1053_isinit = gTrue; } // Setup @@ -274,10 +274,10 @@ bool_t gaudio_play_lld_init(uint16_t channel, uint32_t frequency, ArrayDataForma buf[0] = gfxSampleFormatBits(format); buf[1] = 0; data_write(buf, 2); data_write(hdr2, sizeof(hdr2)); } - return TRUE; + return gTrue; } -bool_t gaudio_play_lld_set_volume(uint8_t vol) { +gBool gaudio_play_lld_set_volume(uint8_t vol) { uint16_t tmp; // Volume is 0xFE -> 0x00. Adjust vol to match @@ -291,7 +291,7 @@ bool_t gaudio_play_lld_set_volume(uint8_t vol) { cmd_write(SCI_VOL, tmp); - return TRUE; + return gTrue; } void gaudio_play_lld_start(void) { @@ -310,7 +310,7 @@ void gaudio_play_lld_start(void) { // Start the playing by starting the timer and executing FeedData immediately just to get things started // We really should set the timer to be equivalent to half the available data but that is just too hard to calculate. - gtimerStart(&playTimer, FeedData, 0, TRUE, VS1053_POLL_RATE); + gtimerStart(&playTimer, FeedData, 0, gTrue, VS1053_POLL_RATE); FeedData(0); } diff --git a/drivers/gdisp/AlteraFramereader/gdisp_lld_alteraframereader.c b/drivers/gdisp/AlteraFramereader/gdisp_lld_alteraframereader.c index 50160f9b..1fb34378 100644 --- a/drivers/gdisp/AlteraFramereader/gdisp_lld_alteraframereader.c +++ b/drivers/gdisp/AlteraFramereader/gdisp_lld_alteraframereader.c @@ -46,7 +46,7 @@ typedef struct fbPriv { /* Driver exported functions. */ /*===========================================================================*/ -LLDSPEC bool_t gdisp_lld_init(GDisplay* g) +LLDSPEC gBool gdisp_lld_init(GDisplay* g) { // Allocate the frame buffers PRIV(g)->frame0 = gfxAlloc(SCREEN_WIDTH * SCREEN_HEIGHT * sizeof(LLDCOLOR_TYPE)); @@ -94,7 +94,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay* g) // Start the framebuffer reader IOWR(ALT_VIP_VFR_0_BASE, 0x00, 0x01); - return TRUE; + return gTrue; } LLDSPEC void gdisp_lld_draw_pixel(GDisplay* g) diff --git a/drivers/gdisp/ED060SC4/board_ED060SC4_example.h b/drivers/gdisp/ED060SC4/board_ED060SC4_example.h index 6cda606b..95823edc 100644 --- a/drivers/gdisp/ED060SC4/board_ED060SC4_example.h +++ b/drivers/gdisp/ED060SC4/board_ED060SC4_example.h @@ -69,38 +69,38 @@ static void eink_delay(int us) } /* Turn the E-ink panel Vdd supply (+3.3V) on or off. */ -static GFXINLINE void setpower_vdd(bool_t on) { +static GFXINLINE void setpower_vdd(gBool on) { palWritePad(GPIOB, GPIOB_SMPS_CTRL, !on); palWritePad(GPIOA, GPIOA_EINK_VDD, on); } /* Turn the E-ink panel negative supplies (-15V, -20V) on or off. */ -static GFXINLINE void setpower_vneg(bool_t on) { +static GFXINLINE void setpower_vneg(gBool on) { palWritePad(GPIOA, GPIOA_VNEG_CTRL, on); } /* Turn the E-ink panel positive supplies (-15V, -20V) on or off. */ -static GFXINLINE void setpower_vpos(bool_t on) { +static GFXINLINE void setpower_vpos(gBool on) { palWritePad(GPIOA, GPIOA_VPOS_CTRL, on); } /* Set the state of the LE (source driver Latch Enable) pin. */ -static GFXINLINE void setpin_le(bool_t on) { +static GFXINLINE void setpin_le(gBool on) { palWritePad(GPIOB, GPIOB_EINK_LE, on); } /* Set the state of the OE (source driver Output Enable) pin. */ -static GFXINLINE void setpin_oe(bool_t on) { +static GFXINLINE void setpin_oe(gBool on) { palWritePad(GPIOB, GPIOB_EINK_OE, on); } /* Set the state of the CL (source driver Clock) pin. */ -static GFXINLINE void setpin_cl(bool_t on) { +static GFXINLINE void setpin_cl(gBool on) { palWritePad(GPIOB, GPIOB_EINK_CL, on); } /* Set the state of the SPH (source driver Start Pulse Horizontal) pin. */ -static GFXINLINE void setpin_sph(bool_t on) { +static GFXINLINE void setpin_sph(gBool on) { palWritePad(GPIOB, GPIOB_EINK_SPH, on); } @@ -110,17 +110,17 @@ static GFXINLINE void setpins_data(uint8_t value) { } /* Set the state of the CKV (gate driver Clock Vertical) pin. */ -static GFXINLINE void setpin_ckv(bool_t on) { +static GFXINLINE void setpin_ckv(gBool on) { palWritePad(GPIOB, GPIOB_EINK_CKV, on); } /* Set the state of the GMODE (gate driver Gate Mode) pin. */ -static GFXINLINE void setpin_gmode(bool_t on) { +static GFXINLINE void setpin_gmode(gBool on) { palWritePad(GPIOC, GPIOC_EINK_GMODE, on); } /* Set the state of the SPV (gate driver Start Pulse Vertical) pin. */ -static GFXINLINE void setpin_spv(bool_t on) { +static GFXINLINE void setpin_spv(gBool on) { palWritePad(GPIOB, GPIOB_EINK_SPV, on); } diff --git a/drivers/gdisp/ED060SC4/board_ED060SC4_template.h b/drivers/gdisp/ED060SC4/board_ED060SC4_template.h index ad261b44..71c9caae 100644 --- a/drivers/gdisp/ED060SC4/board_ED060SC4_template.h +++ b/drivers/gdisp/ED060SC4/board_ED060SC4_template.h @@ -54,37 +54,37 @@ static void eink_delay(int us) { (void) us; } -static GFXINLINE void setpower_vdd(GDisplay *g, bool_t on) { +static GFXINLINE void setpower_vdd(GDisplay *g, gBool on) { (void) g; (void) on; } -static GFXINLINE void setpower_vneg(GDisplay *g, bool_t on) { +static GFXINLINE void setpower_vneg(GDisplay *g, gBool on) { (void) g; (void) on; } -static GFXINLINE void setpower_vpos(GDisplay *g, bool_t on) { +static GFXINLINE void setpower_vpos(GDisplay *g, gBool on) { (void) g; (void) on; } -static GFXINLINE void setpin_le(GDisplay *g, bool_t on) { +static GFXINLINE void setpin_le(GDisplay *g, gBool on) { (void) g; (void) on; } -static GFXINLINE void setpin_oe(GDisplay *g, bool_t on) { +static GFXINLINE void setpin_oe(GDisplay *g, gBool on) { (void) g; (void) on; } -static GFXINLINE void setpin_cl(GDisplay *g, bool_t on) { +static GFXINLINE void setpin_cl(GDisplay *g, gBool on) { (void) g; (void) on; } -static GFXINLINE void setpin_sph(GDisplay *g, bool_t on) { +static GFXINLINE void setpin_sph(GDisplay *g, gBool on) { (void) g; (void) on; } @@ -94,17 +94,17 @@ static GFXINLINE void setpins_data(GDisplay *g, uint8_t value) { (void) value; } -static GFXINLINE void setpin_ckv(GDisplay *g, bool_t on) { +static GFXINLINE void setpin_ckv(GDisplay *g, gBool on) { (void) g; (void) on; } -static GFXINLINE void setpin_gmode(GDisplay *g, bool_t on) { +static GFXINLINE void setpin_gmode(GDisplay *g, gBool on) { (void) g; (void) on; } -static GFXINLINE void setpin_spv(GDisplay *g, bool_t on) { +static GFXINLINE void setpin_spv(GDisplay *g, gBool on) { (void) g; (void) on; } diff --git a/drivers/gdisp/ED060SC4/gdisp_lld_ED060SC4.c b/drivers/gdisp/ED060SC4/gdisp_lld_ED060SC4.c index 3272ca0a..a745ab86 100644 --- a/drivers/gdisp/ED060SC4/gdisp_lld_ED060SC4.c +++ b/drivers/gdisp/ED060SC4/gdisp_lld_ED060SC4.c @@ -109,9 +109,9 @@ static GFXINLINE void clockdelay(void) /* Fast vertical clock pulse for gate driver, used during initializations */ static void vclock_quick(GDisplay *g) { - setpin_ckv(g, TRUE); + setpin_ckv(g, gTrue); eink_delay(1); - setpin_ckv(g, FALSE); + setpin_ckv(g, gFalse); eink_delay(4); } @@ -119,9 +119,9 @@ static void vclock_quick(GDisplay *g) static void hclock(GDisplay *g) { clockdelay(); - setpin_cl(g, TRUE); + setpin_cl(g, gTrue); clockdelay(); - setpin_cl(g, FALSE); + setpin_cl(g, gFalse); } /* Start a new vertical gate driver scan from top. @@ -131,11 +131,11 @@ static void hclock(GDisplay *g) */ static void vscan_start(GDisplay *g) { - setpin_gmode(g, TRUE); + setpin_gmode(g, gTrue); vclock_quick(g); - setpin_spv(g, FALSE); + setpin_spv(g, gFalse); vclock_quick(g); - setpin_spv(g, TRUE); + setpin_spv(g, gTrue); vclock_quick(g); } @@ -145,11 +145,11 @@ static void vscan_start(GDisplay *g) */ static void vscan_write(GDisplay *g) { - setpin_ckv(g, TRUE); - setpin_oe(g, TRUE); + setpin_ckv(g, gTrue); + setpin_oe(g, gTrue); eink_delay(5); - setpin_oe(g, FALSE); - setpin_ckv(g, FALSE); + setpin_oe(g, gFalse); + setpin_ckv(g, gFalse); eink_delay(200); } @@ -158,9 +158,9 @@ static void vscan_write(GDisplay *g) */ static void vscan_bulkwrite(GDisplay *g) { - setpin_ckv(g, TRUE); + setpin_ckv(g, gTrue); eink_delay(20); - setpin_ckv(g, FALSE); + setpin_ckv(g, gFalse); eink_delay(200); } @@ -169,9 +169,9 @@ static void vscan_bulkwrite(GDisplay *g) */ static void vscan_skip(GDisplay *g) { - setpin_ckv(g, TRUE); + setpin_ckv(g, gTrue); eink_delay(1); - setpin_ckv(g, FALSE); + setpin_ckv(g, gFalse); eink_delay(100); } @@ -180,7 +180,7 @@ static void vscan_skip(GDisplay *g) */ static void vscan_stop(GDisplay *g) { - setpin_gmode(g, FALSE); + setpin_gmode(g, gFalse); vclock_quick(g); vclock_quick(g); vclock_quick(g); @@ -192,11 +192,11 @@ static void vscan_stop(GDisplay *g) static void hscan_start(GDisplay *g) { /* Disable latching and output enable while we are modifying the row. */ - setpin_le(g, FALSE); - setpin_oe(g, FALSE); + setpin_le(g, gFalse); + setpin_oe(g, gFalse); /* The start pulse should remain low for the duration of the row. */ - setpin_sph(g, FALSE); + setpin_sph(g, gFalse); } /* Write data to the horizontal row. */ @@ -217,13 +217,13 @@ static void hscan_write(GDisplay *g, const uint8_t *data, int count) static void hscan_stop(GDisplay *g) { /* End the scan */ - setpin_sph(g, TRUE); + setpin_sph(g, gTrue); hclock(g); /* Latch the new data */ - setpin_le(g, TRUE); + setpin_le(g, gTrue); clockdelay(); - setpin_le(g, FALSE); + setpin_le(g, gFalse); } /* Turn on the power to the E-Ink panel, observing proper power sequencing. */ @@ -232,25 +232,25 @@ static void power_on(GDisplay *g) unsigned i; /* First the digital power supply and signal levels. */ - setpower_vdd(g, TRUE); - setpin_le(g, FALSE); - setpin_oe(g, FALSE); - setpin_cl(g, FALSE); - setpin_sph(g, TRUE); + setpower_vdd(g, gTrue); + setpin_le(g, gFalse); + setpin_oe(g, gFalse); + setpin_cl(g, gFalse); + setpin_sph(g, gTrue); setpins_data(g, 0); - setpin_ckv(g, FALSE); - setpin_gmode(g, FALSE); - setpin_spv(g, TRUE); + setpin_ckv(g, gFalse); + setpin_gmode(g, gFalse); + setpin_spv(g, gTrue); /* Min. 100 microsecond delay after digital supply */ gfxSleepMicroseconds(100); /* Then negative voltages and min. 1000 microsecond delay. */ - setpower_vneg(g, TRUE); + setpower_vneg(g, gTrue); gfxSleepMicroseconds(1000); /* Finally the positive voltages. */ - setpower_vpos(g, TRUE); + setpower_vpos(g, gTrue); /* Clear the vscan shift register */ vscan_start(g); @@ -263,22 +263,22 @@ static void power_on(GDisplay *g) static void power_off(GDisplay *g) { /* First the high voltages */ - setpower_vpos(g, FALSE); - setpower_vneg(g, FALSE); + setpower_vpos(g, gFalse); + setpower_vneg(g, gFalse); /* Wait for any capacitors to drain */ gfxSleepMilliseconds(100); /* Then put all signals and digital supply to ground. */ - setpin_le(g, FALSE); - setpin_oe(g, FALSE); - setpin_cl(g, FALSE); - setpin_sph(g, FALSE); + setpin_le(g, gFalse); + setpin_oe(g, gFalse); + setpin_cl(g, gFalse); + setpin_sph(g, gFalse); setpins_data(g, 0); - setpin_ckv(g, FALSE); - setpin_gmode(g, FALSE); - setpin_spv(g, FALSE); - setpower_vdd(g, FALSE); + setpin_ckv(g, gFalse); + setpin_gmode(g, gFalse); + setpin_spv(g, gFalse); + setpower_vdd(g, gFalse); } /* ==================================== @@ -332,17 +332,17 @@ typedef struct drvPriv { } drvPriv; /* Check if the row contains any allocated blocks. */ -static bool_t blocks_on_row(GDisplay *g, unsigned by) +static gBool blocks_on_row(GDisplay *g, unsigned by) { unsigned bx; for (bx = 0; bx < BLOCKS_X; bx++) { if (PRIV(g)->g_blockmap[by][bx] != 0) { - return TRUE; + return gTrue; } } - return FALSE; + return gFalse; } /* Write out a block row. */ @@ -432,7 +432,7 @@ static block_t *alloc_buffer(GDisplay *g, unsigned bx, unsigned by) /* Driver exported functions. */ /*===========================================================================*/ -LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { +LLDSPEC gBool gdisp_lld_init(GDisplay *g) { g->priv = gfxAlloc(sizeof(drvPriv)); init_board(g); @@ -452,7 +452,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { g->g.Powermode = powerOn; g->g.Backlight = 100; g->g.Contrast = 100; - return TRUE; + return gTrue; } #if GDISP_HARDWARE_FLUSH @@ -593,12 +593,12 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { } hscan_stop(g); - setpin_oe(g, TRUE); + setpin_oe(g, gTrue); vscan_start(g); for (y = 0; y < GDISP_SCREEN_HEIGHT; y++) vscan_bulkwrite(g); vscan_stop(g); - setpin_oe(g, FALSE); + setpin_oe(g, gFalse); } void gdisp_lld_clear(GDisplay *g) { diff --git a/drivers/gdisp/Fb24bpp/gdisp_lld_fb24bpp.c b/drivers/gdisp/Fb24bpp/gdisp_lld_fb24bpp.c index 4d981ce4..61f7b500 100644 --- a/drivers/gdisp/Fb24bpp/gdisp_lld_fb24bpp.c +++ b/drivers/gdisp/Fb24bpp/gdisp_lld_fb24bpp.c @@ -39,7 +39,7 @@ typedef struct fbPriv { /* Driver exported functions. */ /*===========================================================================*/ -LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { +LLDSPEC gBool gdisp_lld_init(GDisplay *g) { // Initialize the private structure if (!(g->priv = gfxAlloc(sizeof(fbPriv)))) @@ -53,7 +53,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { g->board = 0; // preinitialize board_init(g, &((fbPriv *)g->priv)->fbi); - return TRUE; + return gTrue; } #if GDISP_HARDWARE_FLUSH diff --git a/drivers/gdisp/HX8347D/board_HX8347D_template.h b/drivers/gdisp/HX8347D/board_HX8347D_template.h index 3e412e99..5112d648 100644 --- a/drivers/gdisp/HX8347D/board_HX8347D_template.h +++ b/drivers/gdisp/HX8347D/board_HX8347D_template.h @@ -16,7 +16,7 @@ static GFXINLINE void post_init_board(GDisplay *g) { (void) g; } -static GFXINLINE void setpin_reset(GDisplay *g, bool_t state) { +static GFXINLINE void setpin_reset(GDisplay *g, gBool state) { (void) g; (void) state; } diff --git a/drivers/gdisp/HX8347D/gdisp_lld_HX8347D.c b/drivers/gdisp/HX8347D/gdisp_lld_HX8347D.c index 6adead64..792db343 100644 --- a/drivers/gdisp/HX8347D/gdisp_lld_HX8347D.c +++ b/drivers/gdisp/HX8347D/gdisp_lld_HX8347D.c @@ -56,7 +56,7 @@ static GFXINLINE void set_viewport(GDisplay* g) { /* Driver exported functions. */ /*===========================================================================*/ -LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { +LLDSPEC gBool gdisp_lld_init(GDisplay *g) { // No private area for this controller g->priv = 0; @@ -64,9 +64,9 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { init_board(g); // Hardware reset - setpin_reset(g, TRUE); + setpin_reset(g, gTrue); gfxSleepMilliseconds(1); - setpin_reset(g, FALSE); + setpin_reset(g, gFalse); gfxSleepMilliseconds(5); // Get the bus for the following initialisation commands @@ -152,7 +152,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { g->g.Powermode = powerOn; g->g.Backlight = GDISP_INITIAL_BACKLIGHT; g->g.Contrast = GDISP_INITIAL_CONTRAST; - return TRUE; + return gTrue; } #if GDISP_HARDWARE_STREAM_WRITE diff --git a/drivers/gdisp/ILI9225/gdisp_lld_ili9225.c b/drivers/gdisp/ILI9225/gdisp_lld_ili9225.c index 9014ebe3..cb5a1356 100644 --- a/drivers/gdisp/ILI9225/gdisp_lld_ili9225.c +++ b/drivers/gdisp/ILI9225/gdisp_lld_ili9225.c @@ -51,7 +51,7 @@ #define write_data_repeat(g, data, count) { int i; for (i = 0; i < count; ++i) write_data (g, data) } #endif -LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { +LLDSPEC gBool gdisp_lld_init(GDisplay *g) { // No private area for this controller g->priv = 0; @@ -59,9 +59,9 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { init_board(g); // Hardware reset - setpin_reset(g, TRUE); + setpin_reset(g, gTrue); gfxSleepMilliseconds(20); - setpin_reset(g, FALSE); + setpin_reset(g, gFalse); gfxSleepMilliseconds(20); // Get the bus for the following initialisation commands @@ -136,7 +136,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { g->g.Powermode = powerOn; g->g.Backlight = GDISP_INITIAL_BACKLIGHT; g->g.Contrast = GDISP_INITIAL_CONTRAST; - return TRUE; + return gTrue; } static void set_cursor(GDisplay *g) { diff --git a/drivers/gdisp/ILI9320/board_ILI9320_template.h b/drivers/gdisp/ILI9320/board_ILI9320_template.h index a26ffe94..f99b59ea 100644 --- a/drivers/gdisp/ILI9320/board_ILI9320_template.h +++ b/drivers/gdisp/ILI9320/board_ILI9320_template.h @@ -16,7 +16,7 @@ static GFXINLINE void post_init_board(GDisplay *g) { (void) g; } -static GFXINLINE void setpin_reset(GDisplay *g, bool_t state) { +static GFXINLINE void setpin_reset(GDisplay *g, gBool state) { (void) g; (void) state; } diff --git a/drivers/gdisp/ILI9320/gdisp_lld_ILI9320.c b/drivers/gdisp/ILI9320/gdisp_lld_ILI9320.c index a77e016c..7de1490a 100644 --- a/drivers/gdisp/ILI9320/gdisp_lld_ILI9320.c +++ b/drivers/gdisp/ILI9320/gdisp_lld_ILI9320.c @@ -93,7 +93,7 @@ static void set_viewport(GDisplay *g) { } } -LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { +LLDSPEC gBool gdisp_lld_init(GDisplay *g) { uint16_t cver; // No private area for this controller @@ -103,9 +103,9 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { init_board(g); /* Hardware reset */ - setpin_reset(g, TRUE); + setpin_reset(g, gTrue); gfxSleepMicroseconds(1000); - setpin_reset(g, FALSE); + setpin_reset(g, gFalse); gfxSleepMicroseconds(1000); acquire_bus(g); @@ -190,7 +190,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { g->g.Powermode = powerOn; g->g.Backlight = GDISP_INITIAL_BACKLIGHT; g->g.Contrast = GDISP_INITIAL_CONTRAST; - return TRUE; + return gTrue; } #if GDISP_HARDWARE_STREAM_WRITE diff --git a/drivers/gdisp/ILI9325/board_ILI9325_template.h b/drivers/gdisp/ILI9325/board_ILI9325_template.h index a26ffe94..f99b59ea 100644 --- a/drivers/gdisp/ILI9325/board_ILI9325_template.h +++ b/drivers/gdisp/ILI9325/board_ILI9325_template.h @@ -16,7 +16,7 @@ static GFXINLINE void post_init_board(GDisplay *g) { (void) g; } -static GFXINLINE void setpin_reset(GDisplay *g, bool_t state) { +static GFXINLINE void setpin_reset(GDisplay *g, gBool state) { (void) g; (void) state; } diff --git a/drivers/gdisp/ILI9325/gdisp_lld_ILI9325.c b/drivers/gdisp/ILI9325/gdisp_lld_ILI9325.c index d0bb43d1..6582693d 100644 --- a/drivers/gdisp/ILI9325/gdisp_lld_ILI9325.c +++ b/drivers/gdisp/ILI9325/gdisp_lld_ILI9325.c @@ -94,7 +94,7 @@ static void set_viewport(GDisplay* g) { } } -LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { +LLDSPEC gBool gdisp_lld_init(GDisplay *g) { uint16_t cver; // No private area for this controller @@ -104,9 +104,9 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { init_board(g); /* Hardware reset */ - setpin_reset(g, TRUE); + setpin_reset(g, gTrue); gfxSleepMicroseconds(1000); - setpin_reset(g, FALSE); + setpin_reset(g, gFalse); gfxSleepMicroseconds(1000); acquire_bus(g); @@ -189,7 +189,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { g->g.Backlight = GDISP_INITIAL_BACKLIGHT; g->g.Contrast = GDISP_INITIAL_CONTRAST; - return TRUE; + return gTrue; } #if GDISP_HARDWARE_STREAM_WRITE diff --git a/drivers/gdisp/ILI9341/board_ILI9341_template.h b/drivers/gdisp/ILI9341/board_ILI9341_template.h index aac744f9..8b1dc07c 100644 --- a/drivers/gdisp/ILI9341/board_ILI9341_template.h +++ b/drivers/gdisp/ILI9341/board_ILI9341_template.h @@ -16,7 +16,7 @@ static GFXINLINE void post_init_board(GDisplay *g) { (void) g; } -static GFXINLINE void setpin_reset(GDisplay *g, bool_t state) { +static GFXINLINE void setpin_reset(GDisplay *g, gBool state) { (void) g; (void) state; } diff --git a/drivers/gdisp/ILI9341/gdisp_lld_ILI9341.c b/drivers/gdisp/ILI9341/gdisp_lld_ILI9341.c index c757806f..87c47114 100644 --- a/drivers/gdisp/ILI9341/gdisp_lld_ILI9341.c +++ b/drivers/gdisp/ILI9341/gdisp_lld_ILI9341.c @@ -73,7 +73,7 @@ static void set_viewport(GDisplay *g) { /* Driver exported functions. */ /*===========================================================================*/ -LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { +LLDSPEC gBool gdisp_lld_init(GDisplay *g) { // No private area for this controller g->priv = 0; @@ -81,9 +81,9 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { init_board(g); // Hardware reset - setpin_reset(g, TRUE); + setpin_reset(g, gTrue); gfxSleepMilliseconds(20); - setpin_reset(g, FALSE); + setpin_reset(g, gFalse); gfxSleepMilliseconds(20); // Get the bus for the following initialisation commands @@ -231,7 +231,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { g->g.Powermode = powerOn; g->g.Backlight = GDISP_INITIAL_BACKLIGHT; g->g.Contrast = GDISP_INITIAL_CONTRAST; - return TRUE; + return gTrue; } #if GDISP_HARDWARE_STREAM_WRITE diff --git a/drivers/gdisp/ILI9342/gdisp_lld_ILI9342.c b/drivers/gdisp/ILI9342/gdisp_lld_ILI9342.c index 33c6712f..1d645443 100644 --- a/drivers/gdisp/ILI9342/gdisp_lld_ILI9342.c +++ b/drivers/gdisp/ILI9342/gdisp_lld_ILI9342.c @@ -70,7 +70,7 @@ static void set_viewport(GDisplay *g) { /* Driver exported functions. */ /*===========================================================================*/ -LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { +LLDSPEC gBool gdisp_lld_init(GDisplay *g) { // No private area for this controller g->priv = 0; @@ -78,9 +78,9 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { init_board(g); // Hardware reset - setpin_reset(g, TRUE); + setpin_reset(g, gTrue); gfxSleepMilliseconds(20); - setpin_reset(g, FALSE); + setpin_reset(g, gFalse); gfxSleepMilliseconds(20); // Get the bus for the following initialisation commands @@ -235,7 +235,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { g->g.Powermode = powerOn; g->g.Backlight = GDISP_INITIAL_BACKLIGHT; g->g.Contrast = GDISP_INITIAL_CONTRAST; - return TRUE; + return gTrue; } #if GDISP_HARDWARE_STREAM_WRITE diff --git a/drivers/gdisp/ILI93xx/board_ILI93xx_template.h b/drivers/gdisp/ILI93xx/board_ILI93xx_template.h index a5ac23ec..059dc1a5 100644 --- a/drivers/gdisp/ILI93xx/board_ILI93xx_template.h +++ b/drivers/gdisp/ILI93xx/board_ILI93xx_template.h @@ -18,7 +18,7 @@ static GFXINLINE void post_init_board(GDisplay *g) (void) g; } -static GFXINLINE void setpin_reset(GDisplay *g, bool_t state) +static GFXINLINE void setpin_reset(GDisplay *g, gBool state) { (void) g; (void) state; diff --git a/drivers/gdisp/ILI93xx/gdisp_lld_ILI93xx.c b/drivers/gdisp/ILI93xx/gdisp_lld_ILI93xx.c index 72f6bac0..e340dc18 100644 --- a/drivers/gdisp/ILI93xx/gdisp_lld_ILI93xx.c +++ b/drivers/gdisp/ILI93xx/gdisp_lld_ILI93xx.c @@ -100,7 +100,7 @@ static void set_viewport(GDisplay* g) { } -LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { +LLDSPEC gBool gdisp_lld_init(GDisplay *g) { unsigned short DeviceCode; @@ -111,11 +111,11 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { init_board(g); /* Hardware reset */ - setpin_reset(g, TRUE); + setpin_reset(g, gTrue); gfxSleepMilliseconds(1); - setpin_reset(g, FALSE); + setpin_reset(g, gFalse); gfxSleepMilliseconds(10); - setpin_reset(g, TRUE); + setpin_reset(g, gTrue); gfxSleepMilliseconds(50); acquire_bus(g); @@ -261,7 +261,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { g->g.Backlight = GDISP_INITIAL_BACKLIGHT; g->g.Contrast = GDISP_INITIAL_CONTRAST; - return TRUE; + return gTrue; } #if GDISP_HARDWARE_STREAM_WRITE diff --git a/drivers/gdisp/ILI9481/board_ILI9481_template.h b/drivers/gdisp/ILI9481/board_ILI9481_template.h index aac744f9..8b1dc07c 100644 --- a/drivers/gdisp/ILI9481/board_ILI9481_template.h +++ b/drivers/gdisp/ILI9481/board_ILI9481_template.h @@ -16,7 +16,7 @@ static GFXINLINE void post_init_board(GDisplay *g) { (void) g; } -static GFXINLINE void setpin_reset(GDisplay *g, bool_t state) { +static GFXINLINE void setpin_reset(GDisplay *g, gBool state) { (void) g; (void) state; } diff --git a/drivers/gdisp/ILI9481/gdisp_lld_ILI9481.c b/drivers/gdisp/ILI9481/gdisp_lld_ILI9481.c index afd1b3e7..2201cdbc 100644 --- a/drivers/gdisp/ILI9481/gdisp_lld_ILI9481.c +++ b/drivers/gdisp/ILI9481/gdisp_lld_ILI9481.c @@ -65,7 +65,7 @@ static void set_viewport(GDisplay* g) { /* Driver exported functions. */ /*===========================================================================*/ -LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { +LLDSPEC gBool gdisp_lld_init(GDisplay *g) { // No private area for this controller g->priv = 0; @@ -73,9 +73,9 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { init_board(g); /* Hardware reset */ - setpin_reset(g, TRUE); + setpin_reset(g, gTrue); gfxSleepMilliseconds(20); - setpin_reset(g, FALSE); + setpin_reset(g, gFalse); gfxSleepMilliseconds(20); /* Get the bus for the following initialisation commands */ @@ -197,7 +197,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { g->g.Powermode = powerOn; g->g.Backlight = GDISP_INITIAL_BACKLIGHT; g->g.Contrast = GDISP_INITIAL_CONTRAST; - return TRUE; + return gTrue; } #if GDISP_HARDWARE_STREAM_WRITE diff --git a/drivers/gdisp/ILI9488/board_ILI9488_template.h b/drivers/gdisp/ILI9488/board_ILI9488_template.h index aac744f9..8b1dc07c 100644 --- a/drivers/gdisp/ILI9488/board_ILI9488_template.h +++ b/drivers/gdisp/ILI9488/board_ILI9488_template.h @@ -16,7 +16,7 @@ static GFXINLINE void post_init_board(GDisplay *g) { (void) g; } -static GFXINLINE void setpin_reset(GDisplay *g, bool_t state) { +static GFXINLINE void setpin_reset(GDisplay *g, gBool state) { (void) g; (void) state; } diff --git a/drivers/gdisp/ILI9488/gdisp_lld_ILI9488.c b/drivers/gdisp/ILI9488/gdisp_lld_ILI9488.c index 84e5c222..c83695d2 100644 --- a/drivers/gdisp/ILI9488/gdisp_lld_ILI9488.c +++ b/drivers/gdisp/ILI9488/gdisp_lld_ILI9488.c @@ -75,7 +75,7 @@ static void set_viewport(GDisplay* g) { /* Driver exported functions. */ /*===========================================================================*/ -LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { +LLDSPEC gBool gdisp_lld_init(GDisplay *g) { // No private area for this controller g->priv = 0; @@ -83,11 +83,11 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { init_board(g); /* Hardware reset */ - setpin_reset(g, TRUE); + setpin_reset(g, gTrue); gfxSleepMilliseconds(2); - setpin_reset(g, FALSE); + setpin_reset(g, gFalse); gfxSleepMilliseconds(10); - setpin_reset(g, TRUE); + setpin_reset(g, gTrue); gfxSleepMilliseconds(120); /* Get the bus for the following initialisation commands */ @@ -194,7 +194,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { g->g.Backlight = GDISP_INITIAL_BACKLIGHT; g->g.Contrast = GDISP_INITIAL_CONTRAST; - return TRUE; + return gTrue; } #if GDISP_HARDWARE_STREAM_WRITE diff --git a/drivers/gdisp/KS0108/board_KS0108_example.h b/drivers/gdisp/KS0108/board_KS0108_example.h index ffc6e9c2..73912be2 100644 --- a/drivers/gdisp/KS0108/board_KS0108_example.h +++ b/drivers/gdisp/KS0108/board_KS0108_example.h @@ -158,7 +158,7 @@ static GFXINLINE void post_init_board(GDisplay *g) { (void) g; } -static GFXINLINE void setpin_reset(GDisplay *g, bool_t state) { +static GFXINLINE void setpin_reset(GDisplay *g, gBool state) { (void) g; (void) state; diff --git a/drivers/gdisp/KS0108/gdisp_lld_KS0108.c b/drivers/gdisp/KS0108/gdisp_lld_KS0108.c index 20b3a5c9..40712485 100644 --- a/drivers/gdisp/KS0108/gdisp_lld_KS0108.c +++ b/drivers/gdisp/KS0108/gdisp_lld_KS0108.c @@ -94,7 +94,7 @@ /* Driver exported functions. */ /*===========================================================================*/ -LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { +LLDSPEC gBool gdisp_lld_init(GDisplay *g) { #if !KS0108_NEED_READ // The private area is the display surface. g->priv = gfxAlloc(BUFFSZ); @@ -105,9 +105,9 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { init_board(g); #if KS0108_HAS_RESET //Make Hardware Reset - setpin_reset(g, TRUE); + setpin_reset(g, gTrue); gfxSleepMilliseconds(120); - setpin_reset(g, FALSE); + setpin_reset(g, gFalse); #endif gfxSleepMilliseconds(120); write_cmd(g, KS0108_DISP1OFF); @@ -139,7 +139,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { g->g.Backlight = GDISP_INITIAL_BACKLIGHT; g->g.Contrast = GDISP_INITIAL_CONTRAST; - return TRUE; + return gTrue; } GFXINLINE void KS0108_goto(GDisplay* g, ) { diff --git a/drivers/gdisp/LGDP4532/board_LGDP4532_template.h b/drivers/gdisp/LGDP4532/board_LGDP4532_template.h index ef8e7a3a..f6fe8c4a 100644 --- a/drivers/gdisp/LGDP4532/board_LGDP4532_template.h +++ b/drivers/gdisp/LGDP4532/board_LGDP4532_template.h @@ -18,7 +18,7 @@ static GFXINLINE void post_init_board(GDisplay *g) (void) g; } -static GFXINLINE void setpin_reset(GDisplay *g, bool_t state) +static GFXINLINE void setpin_reset(GDisplay *g, gBool state) { (void) g; (void) state; diff --git a/drivers/gdisp/LGDP4532/gdisp_lld_LGDP4532.c b/drivers/gdisp/LGDP4532/gdisp_lld_LGDP4532.c index 4be8aca8..65ea6d8b 100644 --- a/drivers/gdisp/LGDP4532/gdisp_lld_LGDP4532.c +++ b/drivers/gdisp/LGDP4532/gdisp_lld_LGDP4532.c @@ -94,7 +94,7 @@ static void set_viewport(GDisplay* g) { } } -LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { +LLDSPEC gBool gdisp_lld_init(GDisplay *g) { // No private area for this controller g->priv = 0; @@ -102,9 +102,9 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { init_board(g); /* Hardware reset */ - setpin_reset(g, TRUE); + setpin_reset(g, gTrue); gfxSleepMilliseconds(1); - setpin_reset(g, FALSE); + setpin_reset(g, gFalse); gfxSleepMilliseconds(2); acquire_bus(g); @@ -183,7 +183,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { g->g.Backlight = GDISP_INITIAL_BACKLIGHT; g->g.Contrast = GDISP_INITIAL_CONTRAST; - return TRUE; + return gTrue; } #if GDISP_HARDWARE_STREAM_WRITE diff --git a/drivers/gdisp/Nokia6610GE12/board_Nokia6610GE12_template.h b/drivers/gdisp/Nokia6610GE12/board_Nokia6610GE12_template.h index 00762436..dd5828ca 100644 --- a/drivers/gdisp/Nokia6610GE12/board_Nokia6610GE12_template.h +++ b/drivers/gdisp/Nokia6610GE12/board_Nokia6610GE12_template.h @@ -28,7 +28,7 @@ static GFXINLINE void post_init_board(GDisplay *g) { (void) g; } -static GFXINLINE void setpin_reset(GDisplay *g, bool_t state) { +static GFXINLINE void setpin_reset(GDisplay *g, gBool state) { (void) g; (void) state; } diff --git a/drivers/gdisp/Nokia6610GE12/gdisp_lld_Nokia6610GE12.c b/drivers/gdisp/Nokia6610GE12/gdisp_lld_Nokia6610GE12.c index 05b00dd4..a718a707 100644 --- a/drivers/gdisp/Nokia6610GE12/gdisp_lld_Nokia6610GE12.c +++ b/drivers/gdisp/Nokia6610GE12/gdisp_lld_Nokia6610GE12.c @@ -93,7 +93,7 @@ static GFXINLINE void set_viewport(GDisplay* g) { /* Driver exported functions. */ /*===========================================================================*/ -LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { +LLDSPEC gBool gdisp_lld_init(GDisplay *g) { // No private area for this controller g->priv = 0; @@ -101,9 +101,9 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { init_board(g); // Hardware reset - setpin_reset(g, TRUE); + setpin_reset(g, gTrue); delayms(20); - setpin_reset(g, FALSE); + setpin_reset(g, gFalse); delayms(20); acquire_bus(g); @@ -129,7 +129,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { g->g.Powermode = powerOn; g->g.Backlight = GDISP_INITIAL_BACKLIGHT; g->g.Contrast = GDISP_INITIAL_CONTRAST; - return TRUE; + return gTrue; } #if GDISP_HARDWARE_STREAM_WRITE diff --git a/drivers/gdisp/Nokia6610GE8/board_Nokia6610GE8_template.h b/drivers/gdisp/Nokia6610GE8/board_Nokia6610GE8_template.h index 00762436..dd5828ca 100644 --- a/drivers/gdisp/Nokia6610GE8/board_Nokia6610GE8_template.h +++ b/drivers/gdisp/Nokia6610GE8/board_Nokia6610GE8_template.h @@ -28,7 +28,7 @@ static GFXINLINE void post_init_board(GDisplay *g) { (void) g; } -static GFXINLINE void setpin_reset(GDisplay *g, bool_t state) { +static GFXINLINE void setpin_reset(GDisplay *g, gBool state) { (void) g; (void) state; } diff --git a/drivers/gdisp/Nokia6610GE8/gdisp_lld_Nokia6610GE8.c b/drivers/gdisp/Nokia6610GE8/gdisp_lld_Nokia6610GE8.c index 1eea9e58..86f4a94f 100644 --- a/drivers/gdisp/Nokia6610GE8/gdisp_lld_Nokia6610GE8.c +++ b/drivers/gdisp/Nokia6610GE8/gdisp_lld_Nokia6610GE8.c @@ -190,7 +190,7 @@ static GFXINLINE void set_viewport(GDisplay* g) { /* Driver exported functions. */ /*===========================================================================*/ -LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { +LLDSPEC gBool gdisp_lld_init(GDisplay *g) { #if GDISP_HARDWARE_STREAM_WRITE g->priv = gfxAlloc(sizeof(dvrPriv)); #else @@ -201,9 +201,9 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { init_board(g); // Hardware reset - setpin_reset(g, TRUE); + setpin_reset(g, gTrue); delayms(20); - setpin_reset(g, FALSE); + setpin_reset(g, gFalse); delayms(20); // Get the bus for the following initialisation commands @@ -245,7 +245,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { g->g.Contrast = GDISP_INITIAL_CONTRAST; g->g.Width = GDISP_SCREEN_WIDTH; g->g.Height = GDISP_SCREEN_HEIGHT; - return TRUE; + return gTrue; } #if GDISP_HARDWARE_STREAM_WRITE diff --git a/drivers/gdisp/PCD8544/board_PCD8544_template.h b/drivers/gdisp/PCD8544/board_PCD8544_template.h index 01cafefa..0781238f 100644 --- a/drivers/gdisp/PCD8544/board_PCD8544_template.h +++ b/drivers/gdisp/PCD8544/board_PCD8544_template.h @@ -16,7 +16,7 @@ static GFXINLINE void post_init_board(GDisplay *g) { (void) g; } -static GFXINLINE void setpin_reset(GDisplay *g, bool_t state) { +static GFXINLINE void setpin_reset(GDisplay *g, gBool state) { (void) g; (void) state; } diff --git a/drivers/gdisp/PCD8544/gdisp_lld_PCD8544.c b/drivers/gdisp/PCD8544/gdisp_lld_PCD8544.c index fae87409..568860e0 100644 --- a/drivers/gdisp/PCD8544/gdisp_lld_PCD8544.c +++ b/drivers/gdisp/PCD8544/gdisp_lld_PCD8544.c @@ -51,7 +51,7 @@ #define GDISP_SCREEN_BYTES ((GDISP_SCREEN_WIDTH * GDISP_SCREEN_HEIGHT) / 8) -LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { +LLDSPEC gBool gdisp_lld_init(GDisplay *g) { // The private area is the display surface. if (!(g->priv = gfxAlloc(GDISP_SCREEN_BYTES))) gfxHalt("GDISP PCD8544: Failed to allocate private memory"); @@ -60,9 +60,9 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { init_board(g); // Hardware reset - setpin_reset(g, TRUE); + setpin_reset(g, gTrue); gfxSleepMilliseconds(100); - setpin_reset(g, FALSE); + setpin_reset(g, gFalse); gfxSleepMilliseconds(100); acquire_bus(g); @@ -91,7 +91,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { g->g.Backlight = GDISP_INITIAL_BACKLIGHT; g->g.Contrast = GDISP_INITIAL_CONTRAST; - return TRUE; + return gTrue; } #if GDISP_HARDWARE_FLUSH diff --git a/drivers/gdisp/PCF8812/board_PCF8812_template.h b/drivers/gdisp/PCF8812/board_PCF8812_template.h index fef65b55..66327b8e 100644 --- a/drivers/gdisp/PCF8812/board_PCF8812_template.h +++ b/drivers/gdisp/PCF8812/board_PCF8812_template.h @@ -16,7 +16,7 @@ static GFXINLINE void post_init_board(GDisplay *g) { (void) g; } -static GFXINLINE void setpin_reset(GDisplay *g, bool_t state) { +static GFXINLINE void setpin_reset(GDisplay *g, gBool state) { (void) g; (void) state; } diff --git a/drivers/gdisp/PCF8812/gdisp_lld_PCF8812.c b/drivers/gdisp/PCF8812/gdisp_lld_PCF8812.c index 5d96c4b1..e7e621cc 100644 --- a/drivers/gdisp/PCF8812/gdisp_lld_PCF8812.c +++ b/drivers/gdisp/PCF8812/gdisp_lld_PCF8812.c @@ -56,7 +56,7 @@ //#define GDISP_SCREEN_BYTES ((GDISP_SCREEN_WIDTH * GDISP_SCREEN_HEIGHT) / 8) #define GDISP_MATRIX_BYTES ((GDISP_MATRIX_WIDTH * GDISP_MATRIX_HEIGHT) / 8) // real height 65 pixels, this fix 65 / 8 != 9 -LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { +LLDSPEC gBool gdisp_lld_init(GDisplay *g) { // The private area is the display surface. if (!(g->priv = gfxAlloc(GDISP_MATRIX_BYTES))) gfxHalt("GDISP PCF8812: Failed to allocate private memory"); @@ -65,9 +65,9 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { init_board(g); // Hardware reset - setpin_reset(g, TRUE); + setpin_reset(g, gTrue); gfxSleepMilliseconds(100); - setpin_reset(g, FALSE); + setpin_reset(g, gFalse); gfxSleepMilliseconds(100); acquire_bus(g); @@ -101,7 +101,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { g->g.Backlight = GDISP_INITIAL_BACKLIGHT; g->g.Contrast = GDISP_INITIAL_CONTRAST; - return TRUE; + return gTrue; } #if GDISP_HARDWARE_FLUSH diff --git a/drivers/gdisp/QImage/gdisp_lld_driver.c b/drivers/gdisp/QImage/gdisp_lld_driver.c index dbd7c279..a93d1761 100644 --- a/drivers/gdisp/QImage/gdisp_lld_driver.c +++ b/drivers/gdisp/QImage/gdisp_lld_driver.c @@ -27,13 +27,13 @@ #define GDISP_INITIAL_BACKLIGHT 100 #endif -LLDSPEC bool_t gdisp_lld_init(GDisplay *g) +LLDSPEC gBool gdisp_lld_init(GDisplay *g) { /* No board interface and no private driver area */ g->priv = g->board = 0; if (!qimage_init(g, GDISP_SCREEN_WIDTH, GDISP_SCREEN_HEIGHT)) { - return FALSE; + return gFalse; } /* Initialise the GDISP structure */ @@ -44,7 +44,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) g->g.Backlight = GDISP_INITIAL_BACKLIGHT; g->g.Contrast = GDISP_INITIAL_CONTRAST; - return TRUE; + return gTrue; } #if GDISP_HARDWARE_DRAWPIXEL diff --git a/drivers/gdisp/QImage/gdisp_lld_qimage.cpp b/drivers/gdisp/QImage/gdisp_lld_qimage.cpp index a133dfb4..ba7cf44d 100644 --- a/drivers/gdisp/QImage/gdisp_lld_qimage.cpp +++ b/drivers/gdisp/QImage/gdisp_lld_qimage.cpp @@ -3,17 +3,17 @@ #include "../../../src/gdisp/gdisp_driver.h" #include "gdisp_lld_qimage.h" -bool_t qimage_init(GDisplay* g, coord_t width, coord_t height) +gBool qimage_init(GDisplay* g, coord_t width, coord_t height) { QImage* qimage = new QImage(width, height, QImage::Format_RGB888); if (!qimage) { - return FALSE; + return gFalse; } qimage->fill(Qt::gray); g->priv = qimage; - return TRUE; + return gTrue; } void qimage_setPixel(GDisplay* g) diff --git a/drivers/gdisp/QImage/gdisp_lld_qimage.h b/drivers/gdisp/QImage/gdisp_lld_qimage.h index 9e855f08..512fdf53 100644 --- a/drivers/gdisp/QImage/gdisp_lld_qimage.h +++ b/drivers/gdisp/QImage/gdisp_lld_qimage.h @@ -2,11 +2,12 @@ #include "../../../gfx.h" +/* This test is needed as this file is also included in the .cpp file providing the below functions */ #ifdef __cplusplus extern "C" { #endif -bool_t qimage_init(GDisplay* g, coord_t width, coord_t height); +gBool qimage_init(GDisplay* g, coord_t width, coord_t height); void qimage_setPixel(GDisplay* g); color_t qimage_getPixel(GDisplay* g); diff --git a/drivers/gdisp/R61505U/board_R61505U_template.h b/drivers/gdisp/R61505U/board_R61505U_template.h index a26ffe94..f99b59ea 100644 --- a/drivers/gdisp/R61505U/board_R61505U_template.h +++ b/drivers/gdisp/R61505U/board_R61505U_template.h @@ -16,7 +16,7 @@ static GFXINLINE void post_init_board(GDisplay *g) { (void) g; } -static GFXINLINE void setpin_reset(GDisplay *g, bool_t state) { +static GFXINLINE void setpin_reset(GDisplay *g, gBool state) { (void) g; (void) state; } diff --git a/drivers/gdisp/R61505U/gdisp_lld_R61505U.c b/drivers/gdisp/R61505U/gdisp_lld_R61505U.c index 4346d3da..8b48eee2 100644 --- a/drivers/gdisp/R61505U/gdisp_lld_R61505U.c +++ b/drivers/gdisp/R61505U/gdisp_lld_R61505U.c @@ -93,7 +93,7 @@ static void set_viewport(GDisplay *g) { } } -LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { +LLDSPEC gBool gdisp_lld_init(GDisplay *g) { uint16_t cver; // No private area for this controller @@ -103,9 +103,9 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { init_board(g); /* Hardware reset */ - setpin_reset(g, TRUE); + setpin_reset(g, gTrue); gfxSleepMicroseconds(1000); - setpin_reset(g, FALSE); + setpin_reset(g, gFalse); gfxSleepMicroseconds(1000); acquire_bus(g); @@ -198,7 +198,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { g->g.Powermode = powerOn; g->g.Backlight = GDISP_INITIAL_BACKLIGHT; g->g.Contrast = GDISP_INITIAL_CONTRAST; - return TRUE; + return gTrue; } #if GDISP_HARDWARE_STREAM_WRITE diff --git a/drivers/gdisp/RA6963/board_RA6963.h b/drivers/gdisp/RA6963/board_RA6963.h index 6d959775..1e4559e5 100755 --- a/drivers/gdisp/RA6963/board_RA6963.h +++ b/drivers/gdisp/RA6963/board_RA6963.h @@ -165,7 +165,7 @@ static GFXINLINE void post_init_board(GDisplay *g) { (void) g; } -static GFXINLINE void setpin_reset(GDisplay *g, bool_t state) { +static GFXINLINE void setpin_reset(GDisplay *g, gBool state) { (void) g; #if RA6963_HAS_RESET //Make Hardware Reset if (state) @@ -199,7 +199,7 @@ static GFXINLINE void release_bus(GDisplay *g) { #if RA6963_NEED_READ -static GFXINLINE uint8_t RA6963_busy_wait(uint8_t pattern, bool_t lh){ +static GFXINLINE uint8_t RA6963_busy_wait(uint8_t pattern, gBool lh){ uint8_t data; int ii; diff --git a/drivers/gdisp/RA6963/gdisp_lld_RA6963.c b/drivers/gdisp/RA6963/gdisp_lld_RA6963.c index 97090d5e..42298656 100755 --- a/drivers/gdisp/RA6963/gdisp_lld_RA6963.c +++ b/drivers/gdisp/RA6963/gdisp_lld_RA6963.c @@ -141,7 +141,7 @@ /* Driver exported functions. */ /*===========================================================================*/ -LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { +LLDSPEC gBool gdisp_lld_init(GDisplay *g) { #if RA6963_NEED_READ g->priv = 0; #else @@ -152,9 +152,9 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { init_board(g); #if RA6963_HAS_RESET //Make Hardware Reset - setpin_reset(g, TRUE); + setpin_reset(g, gTrue); gfxSleepMilliseconds(100); - setpin_reset(g, FALSE); + setpin_reset(g, gFalse); #endif gfxSleepMilliseconds(50); //RA6963 needs Data first THEN command! @@ -207,7 +207,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { g->g.Backlight = GDISP_INITIAL_BACKLIGHT; g->g.Contrast = GDISP_INITIAL_CONTRAST; - return TRUE; + return gTrue; } static void set_viewport(GDisplay *g) { diff --git a/drivers/gdisp/RA8875/board_RA8875_template.h b/drivers/gdisp/RA8875/board_RA8875_template.h index 19793bc4..c5e8346f 100644 --- a/drivers/gdisp/RA8875/board_RA8875_template.h +++ b/drivers/gdisp/RA8875/board_RA8875_template.h @@ -16,7 +16,7 @@ static GFXINLINE void post_init_board(GDisplay *g) { (void) g; } -static GFXINLINE void setpin_reset(GDisplay *g, bool_t state) { +static GFXINLINE void setpin_reset(GDisplay *g, gBool state) { (void) g; (void) state; } diff --git a/drivers/gdisp/RA8875/gdisp_lld_RA8875.c b/drivers/gdisp/RA8875/gdisp_lld_RA8875.c index 4026237a..75702d09 100644 --- a/drivers/gdisp/RA8875/gdisp_lld_RA8875.c +++ b/drivers/gdisp/RA8875/gdisp_lld_RA8875.c @@ -101,7 +101,7 @@ static GFXINLINE void set_backlight(GDisplay* g, uint8_t percent) { /* Driver exported functions. */ /*===========================================================================*/ -LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { +LLDSPEC gBool gdisp_lld_init(GDisplay *g) { // No private area for this controller g->priv = 0; @@ -109,9 +109,9 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { init_board(g); // Hardware reset - setpin_reset(g, TRUE); + setpin_reset(g, gTrue); gfxSleepMilliseconds(20); - setpin_reset(g, FALSE); + setpin_reset(g, gFalse); gfxSleepMilliseconds(20); // Get the bus for the following initialisation commands @@ -170,7 +170,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { g->g.Powermode = powerOn; g->g.Backlight = GDISP_INITIAL_BACKLIGHT; g->g.Contrast = GDISP_INITIAL_CONTRAST; - return TRUE; + return gTrue; } #if GDISP_HARDWARE_STREAM_WRITE diff --git a/drivers/gdisp/S6D1121/board_S6D1121_template.h b/drivers/gdisp/S6D1121/board_S6D1121_template.h index aac744f9..8b1dc07c 100644 --- a/drivers/gdisp/S6D1121/board_S6D1121_template.h +++ b/drivers/gdisp/S6D1121/board_S6D1121_template.h @@ -16,7 +16,7 @@ static GFXINLINE void post_init_board(GDisplay *g) { (void) g; } -static GFXINLINE void setpin_reset(GDisplay *g, bool_t state) { +static GFXINLINE void setpin_reset(GDisplay *g, gBool state) { (void) g; (void) state; } diff --git a/drivers/gdisp/S6D1121/gdisp_lld_S6D1121.c b/drivers/gdisp/S6D1121/gdisp_lld_S6D1121.c index 0d9a0d7c..526426b2 100644 --- a/drivers/gdisp/S6D1121/gdisp_lld_S6D1121.c +++ b/drivers/gdisp/S6D1121/gdisp_lld_S6D1121.c @@ -111,7 +111,7 @@ static GFXINLINE void set_viewport(GDisplay *g) { } } -LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { +LLDSPEC gBool gdisp_lld_init(GDisplay *g) { // No private area for this controller g->priv = 0; @@ -119,9 +119,9 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { init_board(g); /* Hardware reset */ - setpin_reset(g, TRUE); + setpin_reset(g, gTrue); delayms(20); - setpin_reset(g, TRUE); + setpin_reset(g, gFalse); delayms(20); /* Get the bus for the following initialisation commands */ @@ -207,7 +207,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { g->g.Powermode = powerOn; g->g.Backlight = GDISP_INITIAL_BACKLIGHT; g->g.Contrast = GDISP_INITIAL_CONTRAST; - return TRUE; + return gTrue; } #if GDISP_HARDWARE_STREAM_WRITE diff --git a/drivers/gdisp/SPFD54124B/board_SPFD54124B_template.h b/drivers/gdisp/SPFD54124B/board_SPFD54124B_template.h index 345a1a8b..509c50c3 100644 --- a/drivers/gdisp/SPFD54124B/board_SPFD54124B_template.h +++ b/drivers/gdisp/SPFD54124B/board_SPFD54124B_template.h @@ -18,7 +18,7 @@ static GFXINLINE void post_init_board(GDisplay *g) (void) g; } -static GFXINLINE void setpin_reset(GDisplay *g, bool_t state) +static GFXINLINE void setpin_reset(GDisplay *g, gBool state) { (void) g; (void) state; diff --git a/drivers/gdisp/SPFD54124B/gdisp_lld_SPFD54124B.c b/drivers/gdisp/SPFD54124B/gdisp_lld_SPFD54124B.c index 6a3457d9..35ad43cb 100644 --- a/drivers/gdisp/SPFD54124B/gdisp_lld_SPFD54124B.c +++ b/drivers/gdisp/SPFD54124B/gdisp_lld_SPFD54124B.c @@ -102,7 +102,7 @@ const uint16_t lcd_init_list[] = { SPFD54124B_CMD_NORON }; -LLDSPEC bool_t gdisp_lld_init(GDisplay *g) +LLDSPEC gBool gdisp_lld_init(GDisplay *g) { // No private area for this controller g->priv = 0; @@ -111,9 +111,9 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) init_board(g); // Hardware reset - setpin_reset(g, TRUE); + setpin_reset(g, gTrue); delayms(100); - setpin_reset(g, FALSE); + setpin_reset(g, gFalse); delayms(100); acquire_bus(g); @@ -141,7 +141,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) g->g.Backlight = GDISP_INITIAL_BACKLIGHT; g->g.Contrast = GDISP_INITIAL_CONTRAST; - return TRUE; + return gTrue; } #if GDISP_HARDWARE_STREAM_WRITE diff --git a/drivers/gdisp/SSD1289/board_SSD1289_template.h b/drivers/gdisp/SSD1289/board_SSD1289_template.h index bbf8147a..5d9442e9 100644 --- a/drivers/gdisp/SSD1289/board_SSD1289_template.h +++ b/drivers/gdisp/SSD1289/board_SSD1289_template.h @@ -16,7 +16,7 @@ static GFXINLINE void post_init_board(GDisplay *g) { (void) g; } -static GFXINLINE void setpin_reset(GDisplay *g, bool_t state) { +static GFXINLINE void setpin_reset(GDisplay *g, gBool state) { (void) g; (void) state; } diff --git a/drivers/gdisp/SSD1289/gdisp_lld_SSD1289.c b/drivers/gdisp/SSD1289/gdisp_lld_SSD1289.c index e88798aa..c4e0a941 100644 --- a/drivers/gdisp/SSD1289/gdisp_lld_SSD1289.c +++ b/drivers/gdisp/SSD1289/gdisp_lld_SSD1289.c @@ -117,7 +117,7 @@ static void set_viewport(GDisplay* g) { /* Driver exported functions. */ /*===========================================================================*/ -LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { +LLDSPEC gBool gdisp_lld_init(GDisplay *g) { // No private area for this controller g->priv = 0; @@ -125,9 +125,9 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { init_board(g); // Hardware reset - setpin_reset(g, TRUE); + setpin_reset(g, gTrue); gfxSleepMilliseconds(20); - setpin_reset(g, FALSE); + setpin_reset(g, gFalse); gfxSleepMilliseconds(20); // Get the bus for the following initialisation commands @@ -191,7 +191,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { g->g.Powermode = powerOn; g->g.Backlight = GDISP_INITIAL_BACKLIGHT; g->g.Contrast = GDISP_INITIAL_CONTRAST; - return TRUE; + return gTrue; } #if GDISP_HARDWARE_STREAM_WRITE diff --git a/drivers/gdisp/SSD1306/board_SSD1306_template.h b/drivers/gdisp/SSD1306/board_SSD1306_template.h index 9ab8fd30..a7efa52e 100644 --- a/drivers/gdisp/SSD1306/board_SSD1306_template.h +++ b/drivers/gdisp/SSD1306/board_SSD1306_template.h @@ -18,7 +18,7 @@ static GFXINLINE void post_init_board(GDisplay *g) { (void) g; } -static GFXINLINE void setpin_reset(GDisplay *g, bool_t state) { +static GFXINLINE void setpin_reset(GDisplay *g, gBool state) { (void) g; (void) state; } diff --git a/drivers/gdisp/SSD1306/gdisp_lld_SSD1306.c b/drivers/gdisp/SSD1306/gdisp_lld_SSD1306.c index 39d48317..9658cc26 100644 --- a/drivers/gdisp/SSD1306/gdisp_lld_SSD1306.c +++ b/drivers/gdisp/SSD1306/gdisp_lld_SSD1306.c @@ -71,7 +71,7 @@ * 64 * 128 / 8 = 1024 bytes. */ -LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { +LLDSPEC gBool gdisp_lld_init(GDisplay *g) { // The private area is the display surface. g->priv = gfxAlloc(GDISP_SCREEN_HEIGHT/8 * SSD1306_PAGE_WIDTH); @@ -90,9 +90,9 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { init_board(g); // Hardware reset - setpin_reset(g, TRUE); + setpin_reset(g, gTrue); gfxSleepMilliseconds(20); - setpin_reset(g, FALSE); + setpin_reset(g, gFalse); gfxSleepMilliseconds(20); acquire_bus(g); @@ -134,7 +134,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { g->g.Powermode = powerOn; g->g.Backlight = GDISP_INITIAL_BACKLIGHT; g->g.Contrast = GDISP_INITIAL_CONTRAST; - return TRUE; + return gTrue; } #if GDISP_HARDWARE_FLUSH diff --git a/drivers/gdisp/SSD1322/board_SSD1322_template.h b/drivers/gdisp/SSD1322/board_SSD1322_template.h index cb3a4740..883c798d 100644 --- a/drivers/gdisp/SSD1322/board_SSD1322_template.h +++ b/drivers/gdisp/SSD1322/board_SSD1322_template.h @@ -23,7 +23,7 @@ static GFXINLINE void post_init_board(GDisplay *g) { (void) g; } -static GFXINLINE void setpin_reset(GDisplay *g, bool_t state) { +static GFXINLINE void setpin_reset(GDisplay *g, gBool state) { (void) g; (void) state; } diff --git a/drivers/gdisp/SSD1322/gdisp_lld_SSD1322.c b/drivers/gdisp/SSD1322/gdisp_lld_SSD1322.c index 961c22f0..6793b461 100644 --- a/drivers/gdisp/SSD1322/gdisp_lld_SSD1322.c +++ b/drivers/gdisp/SSD1322/gdisp_lld_SSD1322.c @@ -64,7 +64,7 @@ * 64 * 128 / 2 = 4096 bytes. */ -LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { +LLDSPEC gBool gdisp_lld_init(GDisplay *g) { // The private area is the display surface. g->priv = gfxAlloc(GDISP_SCREEN_HEIGHT * SSD1322_ROW_WIDTH); @@ -73,9 +73,9 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { post_init_board(g); // Hardware reset - setpin_reset(g, TRUE); + setpin_reset(g, gTrue); gfxSleepMilliseconds(20); - setpin_reset(g, FALSE); + setpin_reset(g, gFalse); gfxSleepMilliseconds(200); @@ -152,7 +152,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { g->g.Powermode = powerOn; g->g.Backlight = GDISP_INITIAL_BACKLIGHT; g->g.Contrast = GDISP_INITIAL_CONTRAST; - return TRUE; + return gTrue; } #if GDISP_HARDWARE_FLUSH diff --git a/drivers/gdisp/SSD1331/board_SSD1331_template.h b/drivers/gdisp/SSD1331/board_SSD1331_template.h index db4a8aa2..b3641fb5 100644 --- a/drivers/gdisp/SSD1331/board_SSD1331_template.h +++ b/drivers/gdisp/SSD1331/board_SSD1331_template.h @@ -16,7 +16,7 @@ static GFXINLINE void post_init_board(GDisplay *g) { (void) g; } -static GFXINLINE void setpin_reset(GDisplay *g, bool_t state) { +static GFXINLINE void setpin_reset(GDisplay *g, gBool state) { (void) g; (void) state; } diff --git a/drivers/gdisp/SSD1331/gdisp_lld_SSD1331.c b/drivers/gdisp/SSD1331/gdisp_lld_SSD1331.c index a36320d7..6dcca875 100644 --- a/drivers/gdisp/SSD1331/gdisp_lld_SSD1331.c +++ b/drivers/gdisp/SSD1331/gdisp_lld_SSD1331.c @@ -88,7 +88,7 @@ static const uint8_t initdata[] = { SSD1331_DRAW_MODE, SSD1331_DRAW_FILLRECT, }; -LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { +LLDSPEC gBool gdisp_lld_init(GDisplay *g) { unsigned i; // No private area for this controller @@ -98,9 +98,9 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { init_board(g); // Hardware reset - setpin_reset(g, TRUE); + setpin_reset(g, gTrue); gfxSleepMilliseconds(20); - setpin_reset(g, FALSE); + setpin_reset(g, gFalse); gfxSleepMilliseconds(20); // Get the bus for the following initialisation commands @@ -124,7 +124,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { g->g.Powermode = powerOn; g->g.Backlight = GDISP_INITIAL_BACKLIGHT; g->g.Contrast = GDISP_INITIAL_CONTRAST; - return TRUE; + return gTrue; } #if GDISP_HARDWARE_STREAM_WRITE diff --git a/drivers/gdisp/SSD1351/board_SSD1351_template.h b/drivers/gdisp/SSD1351/board_SSD1351_template.h index dc086977..78d9bd18 100644 --- a/drivers/gdisp/SSD1351/board_SSD1351_template.h +++ b/drivers/gdisp/SSD1351/board_SSD1351_template.h @@ -16,7 +16,7 @@ static GFXINLINE void post_init_board(GDisplay *g) { (void) g; } -static GFXINLINE void setpin_reset(GDisplay *g, bool_t state) { +static GFXINLINE void setpin_reset(GDisplay *g, gBool state) { (void) g; (void) state; } diff --git a/drivers/gdisp/SSD1351/gdisp_lld_SSD1351.c b/drivers/gdisp/SSD1351/gdisp_lld_SSD1351.c index ebb3e29f..871aa218 100644 --- a/drivers/gdisp/SSD1351/gdisp_lld_SSD1351.c +++ b/drivers/gdisp/SSD1351/gdisp_lld_SSD1351.c @@ -56,7 +56,7 @@ /* Driver exported functions. */ /*===========================================================================*/ -LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { +LLDSPEC gBool gdisp_lld_init(GDisplay *g) { // No private area for this controller g->priv = 0; @@ -64,9 +64,9 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { init_board(g); // Hardware reset - setpin_reset(g, TRUE); + setpin_reset(g, gTrue); gfxSleepMilliseconds(20); - setpin_reset(g, FALSE); + setpin_reset(g, gFalse); gfxSleepMilliseconds(20); // Get the bus for the following initialisation commands @@ -135,7 +135,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { g->g.Powermode = powerOn; g->g.Backlight = GDISP_INITIAL_BACKLIGHT; g->g.Contrast = GDISP_INITIAL_CONTRAST; - return TRUE; + return gTrue; } #if GDISP_HARDWARE_STREAM_WRITE diff --git a/drivers/gdisp/SSD1848/board_ssd1848_template.h b/drivers/gdisp/SSD1848/board_ssd1848_template.h index f8081c19..66c85547 100644 --- a/drivers/gdisp/SSD1848/board_ssd1848_template.h +++ b/drivers/gdisp/SSD1848/board_ssd1848_template.h @@ -16,7 +16,7 @@ static void post_init_board(GDisplay *g) { (void) g; } -static void setpin_reset(GDisplay *g, bool_t state) { +static void setpin_reset(GDisplay *g, gBool state) { (void) g; (void) state; } diff --git a/drivers/gdisp/SSD1848/gdisp_lld_SSD1848.c b/drivers/gdisp/SSD1848/gdisp_lld_SSD1848.c index a1247315..412ba042 100644 --- a/drivers/gdisp/SSD1848/gdisp_lld_SSD1848.c +++ b/drivers/gdisp/SSD1848/gdisp_lld_SSD1848.c @@ -116,14 +116,14 @@ static void set_viewport (GDisplay* g) * 128 * 128 / 8 = 2048 bytes. */ -LLDSPEC bool_t gdisp_lld_init (GDisplay *g) +LLDSPEC gBool gdisp_lld_init (GDisplay *g) { uint8_t temp [5] = { 0 }; /* The private area is the display surface. */ g->priv = gfxAlloc (sizeof(DisplayData) + GDISP_SCREEN_WIDTH / 8 * GDISP_SCREEN_HEIGHT); if (!g->priv) - return FALSE; + return gFalse; memset (g->priv, 0, sizeof(DisplayData) + GDISP_SCREEN_WIDTH / 8 * GDISP_SCREEN_HEIGHT); /* Initialise the board interface */ @@ -131,11 +131,11 @@ LLDSPEC bool_t gdisp_lld_init (GDisplay *g) /* Init LCD */ /* Hardware reset */ - setpin_reset (g, FALSE); + setpin_reset (g, gFalse); gfxSleepMilliseconds (50); - setpin_reset (g, TRUE); + setpin_reset (g, gTrue); gfxSleepMilliseconds (50); - setpin_reset (g, FALSE); + setpin_reset (g, gFalse); acquire_bus (g); @@ -217,7 +217,7 @@ LLDSPEC bool_t gdisp_lld_init (GDisplay *g) g->g.Powermode = powerOn; g->g.Backlight = GDISP_INITIAL_BACKLIGHT; g->g.Contrast = GDISP_INITIAL_CONTRAST; - return TRUE; + return gTrue; } #if GDISP_HARDWARE_STREAM_WRITE diff --git a/drivers/gdisp/SSD1963/board_SSD1963_template.h b/drivers/gdisp/SSD1963/board_SSD1963_template.h index 4c615438..7d5fbfb1 100644 --- a/drivers/gdisp/SSD1963/board_SSD1963_template.h +++ b/drivers/gdisp/SSD1963/board_SSD1963_template.h @@ -17,8 +17,8 @@ static const LCD_Parameters DisplayTimings[] = { 2, 2, 10, // Vertical Timings (back porch, front porch, pulse) CALC_PERIOD(272,2,2,10), // Total Vertical Period (calculated from above line) CALC_FPR(480,272,2,2,41,2,2,10,60ULL), // FPR - the 60ULL is the frames per second. Note the ULL! - FALSE, // Flip horizontally - FALSE // Flip vertically + gFalse, // Flip horizontally + gFalse // Flip vertically }, }; @@ -30,7 +30,7 @@ static GFXINLINE void post_init_board(GDisplay *g) { (void) g; } -static GFXINLINE void setpin_reset(GDisplay *g, bool_t state) { +static GFXINLINE void setpin_reset(GDisplay *g, gBool state) { (void) g; (void) state; } diff --git a/drivers/gdisp/SSD1963/gdisp_lld_SSD1963.c b/drivers/gdisp/SSD1963/gdisp_lld_SSD1963.c index 35df624f..f5d9fd63 100644 --- a/drivers/gdisp/SSD1963/gdisp_lld_SSD1963.c +++ b/drivers/gdisp/SSD1963/gdisp_lld_SSD1963.c @@ -45,8 +45,8 @@ typedef struct LCD_Parameters { #define LCD_PANEL_TYPE_SERIAL_RGB_MODE ((1<<6) << 8) // Serial RGB mode #define LCD_PANEL_TYPE_SERIAL_RGB_DUMMY_MODE (((1<<5) | (1<<6)) << 8) // Serial RGB+dummy mode - bool_t flipHorz; // Flipping the display horizontally - bool_t flipVert; // Flipping the display vertically + gBool flipHorz; // Flipping the display horizontally + gBool flipVert; // Flipping the display vertically } LCD_Parameters; #include "board_SSD1963.h" @@ -149,7 +149,7 @@ static GFXINLINE void set_backlight(GDisplay *g, uint8_t percent) { /* Driver exported functions. */ /*===========================================================================*/ -LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { +LLDSPEC gBool gdisp_lld_init(GDisplay *g) { LCD_Parameters * lcdp; /* @@ -168,9 +168,9 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { #if !GDISP_SSD1963_NO_INIT // Hardware reset - setpin_reset(g, TRUE); + setpin_reset(g, gTrue); gfxSleepMilliseconds(200); - setpin_reset(g, FALSE); + setpin_reset(g, gFalse); gfxSleepMilliseconds(200); #endif @@ -271,7 +271,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { g->g.Powermode = powerOn; g->g.Backlight = GDISP_INITIAL_BACKLIGHT; g->g.Contrast = GDISP_INITIAL_CONTRAST; - return TRUE; + return gTrue; } #if GDISP_HARDWARE_STREAM_WRITE diff --git a/drivers/gdisp/SSD2119/board_SSD2119_template.h b/drivers/gdisp/SSD2119/board_SSD2119_template.h index bbf8147a..5d9442e9 100644 --- a/drivers/gdisp/SSD2119/board_SSD2119_template.h +++ b/drivers/gdisp/SSD2119/board_SSD2119_template.h @@ -16,7 +16,7 @@ static GFXINLINE void post_init_board(GDisplay *g) { (void) g; } -static GFXINLINE void setpin_reset(GDisplay *g, bool_t state) { +static GFXINLINE void setpin_reset(GDisplay *g, gBool state) { (void) g; (void) state; } diff --git a/drivers/gdisp/SSD2119/gdisp_lld_SSD2119.c b/drivers/gdisp/SSD2119/gdisp_lld_SSD2119.c index 6426f508..75bea819 100644 --- a/drivers/gdisp/SSD2119/gdisp_lld_SSD2119.c +++ b/drivers/gdisp/SSD2119/gdisp_lld_SSD2119.c @@ -117,7 +117,7 @@ static void set_viewport(GDisplay* g) { /* Driver exported functions. */ /*===========================================================================*/ -LLDSPEC bool_t gdisp_lld_init(GDisplay* g) { +LLDSPEC gBool gdisp_lld_init(GDisplay* g) { // no private area for this controller g->priv = 0; @@ -125,9 +125,9 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay* g) { init_board(g); // Hardware reset - setpin_reset(g, TRUE); + setpin_reset(g, gTrue); gfxSleepMilliseconds(20); - setpin_reset(g, FALSE); + setpin_reset(g, gFalse); gfxSleepMilliseconds(20); // Get the bus for the following initialisation commands @@ -232,7 +232,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay* g) { g->g.Powermode = powerOn; g->g.Backlight = GDISP_INITIAL_BACKLIGHT; g->g.Contrast = GDISP_INITIAL_CONTRAST; - return TRUE; + return gTrue; } #if GDISP_HARDWARE_STREAM_WRITE diff --git a/drivers/gdisp/ST7565/board_ST7565_template.h b/drivers/gdisp/ST7565/board_ST7565_template.h index a73aae89..24de601c 100644 --- a/drivers/gdisp/ST7565/board_ST7565_template.h +++ b/drivers/gdisp/ST7565/board_ST7565_template.h @@ -25,7 +25,7 @@ static GFXINLINE void post_init_board(GDisplay *g) { (void) g; } -static GFXINLINE void setpin_reset(GDisplay *g, bool_t state) { +static GFXINLINE void setpin_reset(GDisplay *g, gBool state) { (void) g; (void) state; } diff --git a/drivers/gdisp/ST7565/gdisp_lld_ST7565.c b/drivers/gdisp/ST7565/gdisp_lld_ST7565.c index ed98a6fa..2639e268 100644 --- a/drivers/gdisp/ST7565/gdisp_lld_ST7565.c +++ b/drivers/gdisp/ST7565/gdisp_lld_ST7565.c @@ -79,20 +79,20 @@ * 64 * 128 / 8 = 1024 bytes. */ -LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { +LLDSPEC gBool gdisp_lld_init(GDisplay *g) { // The private area is the display surface. g->priv = gfxAlloc(GDISP_SCREEN_HEIGHT * GDISP_SCREEN_WIDTH / 8); if (!g->priv) { - return FALSE; + return gFalse; } // Initialise the board interface init_board(g); // Hardware reset - setpin_reset(g, TRUE); + setpin_reset(g, gTrue); gfxSleepMilliseconds(20); - setpin_reset(g, FALSE); + setpin_reset(g, gFalse); gfxSleepMilliseconds(20); acquire_bus(g); @@ -138,7 +138,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { g->g.Backlight = GDISP_INITIAL_BACKLIGHT; g->g.Contrast = GDISP_INITIAL_CONTRAST; - return TRUE; + return gTrue; } #if GDISP_HARDWARE_FLUSH diff --git a/drivers/gdisp/ST7735/gdisp_lld_ST7735.c b/drivers/gdisp/ST7735/gdisp_lld_ST7735.c index db91f82d..983cfa1d 100644 --- a/drivers/gdisp/ST7735/gdisp_lld_ST7735.c +++ b/drivers/gdisp/ST7735/gdisp_lld_ST7735.c @@ -233,7 +233,7 @@ static void execute_cmds(GDisplay *g, const uint8_t *addr) { } -LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { +LLDSPEC gBool gdisp_lld_init(GDisplay *g) { // No private area for this controller g->priv = 0; @@ -241,9 +241,9 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { init_board(g); // Hardware reset - setpin_reset(g, TRUE); + setpin_reset(g, gTrue); gfxSleepMilliseconds(20); - setpin_reset(g, FALSE); + setpin_reset(g, gFalse); gfxSleepMilliseconds(20); // Get the bus for the following initialisation commands @@ -264,7 +264,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { g->g.Powermode = powerOn; g->g.Backlight = GDISP_INITIAL_BACKLIGHT; g->g.Contrast = GDISP_INITIAL_CONTRAST; - return TRUE; + return gTrue; } static void set_viewport(GDisplay *g) { diff --git a/drivers/gdisp/STM32LTDC/gdisp_lld_STM32LTDC.c b/drivers/gdisp/STM32LTDC/gdisp_lld_STM32LTDC.c index 4bc231d9..57253b0d 100644 --- a/drivers/gdisp/STM32LTDC/gdisp_lld_STM32LTDC.c +++ b/drivers/gdisp/STM32LTDC/gdisp_lld_STM32LTDC.c @@ -233,7 +233,7 @@ static void _ltdc_init(void) { _ltdc_reload(); } -LLDSPEC bool_t gdisp_lld_init(GDisplay* g) { +LLDSPEC gBool gdisp_lld_init(GDisplay* g) { // Initialize the private structure g->priv = 0; g->board = 0; @@ -252,7 +252,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay* g) { #endif if (!(driverCfg.bglayer.layerflags & LTDC_LEF_ENABLE)) - return FALSE; + return gFalse; g->priv = (void *)&driverCfg.bglayer; @@ -267,7 +267,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay* g) { case 1: // Display 1 is the foreground layer if (!(driverCfg.fglayer.layerflags & LTDC_LEF_ENABLE)) - return FALSE; + return gFalse; // Load the foreground layer _ltdc_layer_init(LTDC_Layer2, &driverCfg.fglayer); @@ -281,7 +281,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay* g) { break; default: // There is only 1 LTDC in the CPU and only the 2 layers in the LTDC. - return FALSE; + return gFalse; } // Initialise the GDISP structure @@ -292,7 +292,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay* g) { g->g.Backlight = GDISP_INITIAL_BACKLIGHT; g->g.Contrast = GDISP_INITIAL_CONTRAST; - return TRUE; + return gTrue; } LLDSPEC void gdisp_lld_draw_pixel(GDisplay* g) { diff --git a/drivers/gdisp/TLS8204/board_TLS8204_template.h b/drivers/gdisp/TLS8204/board_TLS8204_template.h index 01cafefa..0781238f 100644 --- a/drivers/gdisp/TLS8204/board_TLS8204_template.h +++ b/drivers/gdisp/TLS8204/board_TLS8204_template.h @@ -16,7 +16,7 @@ static GFXINLINE void post_init_board(GDisplay *g) { (void) g; } -static GFXINLINE void setpin_reset(GDisplay *g, bool_t state) { +static GFXINLINE void setpin_reset(GDisplay *g, gBool state) { (void) g; (void) state; } diff --git a/drivers/gdisp/TLS8204/gdisp_lld_TLS8204.c b/drivers/gdisp/TLS8204/gdisp_lld_TLS8204.c index 3157eb73..be5bf3c7 100644 --- a/drivers/gdisp/TLS8204/gdisp_lld_TLS8204.c +++ b/drivers/gdisp/TLS8204/gdisp_lld_TLS8204.c @@ -53,7 +53,7 @@ #define GDISP_SCREEN_BYTES ((GDISP_TLS8204_WIDTH * GDISP_TLS8204_HEIGHT) / 8) -LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { +LLDSPEC gBool gdisp_lld_init(GDisplay *g) { // The private area is the display surface. if (!(g->priv = gfxAlloc(GDISP_SCREEN_BYTES))) gfxHalt("GDISP TLS8204: Failed to allocate private memory"); @@ -62,9 +62,9 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { init_board(g); // Hardware reset - setpin_reset(g, TRUE); + setpin_reset(g, gTrue); gfxSleepMilliseconds(100); - setpin_reset(g, FALSE); + setpin_reset(g, gFalse); gfxSleepMilliseconds(100); acquire_bus(g); @@ -105,7 +105,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { g->g.Backlight = GDISP_INITIAL_BACKLIGHT; g->g.Contrast = GDISP_INITIAL_CONTRAST; - return TRUE; + return gTrue; } #if GDISP_HARDWARE_FLUSH diff --git a/drivers/gdisp/TestStub/gdisp_lld_TestStub.c b/drivers/gdisp/TestStub/gdisp_lld_TestStub.c index a7d39fd8..f87b273b 100644 --- a/drivers/gdisp/TestStub/gdisp_lld_TestStub.c +++ b/drivers/gdisp/TestStub/gdisp_lld_TestStub.c @@ -26,7 +26,7 @@ #define GDISP_INITIAL_BACKLIGHT 100 #endif -LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { +LLDSPEC gBool gdisp_lld_init(GDisplay *g) { /* No board interface and no private driver area */ g->priv = g->board = 0; @@ -37,7 +37,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { g->g.Powermode = powerOn; g->g.Backlight = GDISP_INITIAL_BACKLIGHT; g->g.Contrast = GDISP_INITIAL_CONTRAST; - return TRUE; + return gTrue; } #if GDISP_HARDWARE_DRAWPIXEL diff --git a/drivers/gdisp/UC1601s/board_UC1601s_template.h b/drivers/gdisp/UC1601s/board_UC1601s_template.h index 9ab8fd30..a7efa52e 100644 --- a/drivers/gdisp/UC1601s/board_UC1601s_template.h +++ b/drivers/gdisp/UC1601s/board_UC1601s_template.h @@ -18,7 +18,7 @@ static GFXINLINE void post_init_board(GDisplay *g) { (void) g; } -static GFXINLINE void setpin_reset(GDisplay *g, bool_t state) { +static GFXINLINE void setpin_reset(GDisplay *g, gBool state) { (void) g; (void) state; } diff --git a/drivers/gdisp/UC1601s/gdisp_lld_UC1601s.c b/drivers/gdisp/UC1601s/gdisp_lld_UC1601s.c index a6d15c26..479e49e9 100644 --- a/drivers/gdisp/UC1601s/gdisp_lld_UC1601s.c +++ b/drivers/gdisp/UC1601s/gdisp_lld_UC1601s.c @@ -71,7 +71,7 @@ /* Driver exported functions. */ /*===========================================================================*/ -LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { +LLDSPEC gBool gdisp_lld_init(GDisplay *g) { // The private area is the display surface. if (!(g->priv = gfxAlloc(GDISP_SCREEN_BYTES))) @@ -85,9 +85,9 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { init_board(g); // Hardware reset - setpin_reset(g, TRUE); + setpin_reset(g, gTrue); gfxSleepMilliseconds(5); - setpin_reset(g, FALSE); + setpin_reset(g, gFalse); acquire_bus(g); @@ -111,7 +111,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { g->g.Powermode = powerOn; g->g.Backlight = GDISP_INITIAL_BACKLIGHT; g->g.Contrast = GDISP_INITIAL_CONTRAST; - return TRUE; + return gTrue; } #if GDISP_HARDWARE_FLUSH diff --git a/drivers/gdisp/UC1610/board_UC1610_template.h b/drivers/gdisp/UC1610/board_UC1610_template.h index 206e7c88..4a20c3a2 100644 --- a/drivers/gdisp/UC1610/board_UC1610_template.h +++ b/drivers/gdisp/UC1610/board_UC1610_template.h @@ -17,7 +17,7 @@ static GFXINLINE void post_init_board(GDisplay *g) { (void) g; } -static GFXINLINE void setpin_reset(GDisplay *g, bool_t state) { +static GFXINLINE void setpin_reset(GDisplay *g, gBool state) { (void) g; (void) state; } diff --git a/drivers/gdisp/UC1610/gdisp_lld_UC1610.c b/drivers/gdisp/UC1610/gdisp_lld_UC1610.c index 67b74d90..b0d4660b 100644 --- a/drivers/gdisp/UC1610/gdisp_lld_UC1610.c +++ b/drivers/gdisp/UC1610/gdisp_lld_UC1610.c @@ -92,7 +92,7 @@ static void GFXINLINE flush_screen(GDisplay* g) { /* Driver exported functions. */ /*===========================================================================*/ -LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { +LLDSPEC gBool gdisp_lld_init(GDisplay *g) { // The private area is the display surface + flush window structure. g->priv = gfxAlloc(sizeof(UC1610_Window) + GDISP_SCREEN_WIDTH * GDISP_SCREEN_HEIGHT / UC1610_PAGE_HEIGHT); @@ -128,7 +128,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { g->g.Powermode = powerOn; g->g.Backlight = GDISP_INITIAL_BACKLIGHT; g->g.Contrast = GDISP_INITIAL_CONTRAST; - return TRUE; + return gTrue; } #if GDISP_HARDWARE_DRAWPIXEL diff --git a/drivers/gdisp/UC8173/board_UC8173_template.h b/drivers/gdisp/UC8173/board_UC8173_template.h index 4a164e3a..2a344e02 100644 --- a/drivers/gdisp/UC8173/board_UC8173_template.h +++ b/drivers/gdisp/UC8173/board_UC8173_template.h @@ -21,17 +21,17 @@ #include "UC8173_waveform_examples.h" static UC8173Lut UC8173_ModeTable[] = { // 32 bytes, 512 bytes, 128 bytes, regal - { _lut_KWvcom_DC_A2_240ms, _lut_kw_A2_240ms, _lut_ft, FALSE }, - { _lut_KWvcom_DC_A2_120ms, _lut_kw_A2_120ms, _lut_ft, FALSE }, - { _lut_KWvcom_DC_GU, _lut_kw_GU, _lut_ft, TRUE }, - { _lut_KWvcom_GC, _lut_kw_GC, _lut_ft, FALSE } + { _lut_KWvcom_DC_A2_240ms, _lut_kw_A2_240ms, _lut_ft, gFalse }, + { _lut_KWvcom_DC_A2_120ms, _lut_kw_A2_120ms, _lut_ft, gFalse }, + { _lut_KWvcom_DC_GU, _lut_kw_GU, _lut_ft, gTrue }, + { _lut_KWvcom_GC, _lut_kw_GC, _lut_ft, gFalse } // Add extra lines for other waveforms }; -static GFXINLINE bool_t init_board(GDisplay* g) +static GFXINLINE gBool init_board(GDisplay* g) { (void) g; - return TRUE; + return gTrue; } static GFXINLINE void post_init_board(GDisplay* g) @@ -39,16 +39,16 @@ static GFXINLINE void post_init_board(GDisplay* g) (void) g; } -static GFXINLINE void setpin_reset(GDisplay* g, bool_t state) +static GFXINLINE void setpin_reset(GDisplay *g, gBool state) { (void) g; (void) state; } -static GFXINLINE bool_t getpin_busy(GDisplay* g) +static GFXINLINE gBool getpin_busy(GDisplay* g) { (void)g; - return FALSE; + return gFalse; } static GFXINLINE void acquire_bus(GDisplay* g) diff --git a/drivers/gdisp/UC8173/gdisp_lld_UC8173.c b/drivers/gdisp/UC8173/gdisp_lld_UC8173.c index 6b227ccb..7cb79c7e 100644 --- a/drivers/gdisp/UC8173/gdisp_lld_UC8173.c +++ b/drivers/gdisp/UC8173/gdisp_lld_UC8173.c @@ -28,7 +28,7 @@ typedef struct UC8173Lut { uint8_t const *lutVCOM; // 32 bytes uint8_t const *lutFW; // 512 bytes uint8_t const *lutFT; // 128 bytes - bool_t regal; + gBool regal; } UC8173Lut; #include "board_UC8173.h" @@ -125,14 +125,14 @@ typedef struct UC8173_Private { }; #endif -LLDSPEC bool_t gdisp_lld_init(GDisplay* g) +LLDSPEC gBool gdisp_lld_init(GDisplay* g) { UC8173_Private *priv; // Allocate the private area g->priv = gfxAlloc(sizeof(UC8173_Private)); if (!g->priv) - return FALSE; + return gFalse; priv = (UC8173_Private *)g->priv; // Initialize the private area @@ -142,12 +142,12 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay* g) // Initialise the board interface if (!init_board(g)) - return FALSE; + return gFalse; // Hardware reset - setpin_reset(g, FALSE); + setpin_reset(g, gTrue); gfxSleepMilliseconds(100); - setpin_reset(g, TRUE); + setpin_reset(g, gFalse); gfxSleepMilliseconds(300); // Acquire the bus @@ -303,7 +303,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay* g) g->g.Backlight = 0; g->g.Contrast = 0; - return TRUE; + return gTrue; } #if GDISP_HARDWARE_FLUSH diff --git a/drivers/gdisp/framebuffer/gdisp_lld_framebuffer.c b/drivers/gdisp/framebuffer/gdisp_lld_framebuffer.c index 67c01b66..40f476b4 100644 --- a/drivers/gdisp/framebuffer/gdisp_lld_framebuffer.c +++ b/drivers/gdisp/framebuffer/gdisp_lld_framebuffer.c @@ -35,7 +35,7 @@ typedef struct fbPriv { /* Driver exported functions. */ /*===========================================================================*/ -LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { +LLDSPEC gBool gdisp_lld_init(GDisplay *g) { // Initialize the private structure if (!(g->priv = gfxAlloc(sizeof(fbPriv)))) @@ -49,7 +49,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { g->board = 0; // preinitialize board_init(g, &((fbPriv *)g->priv)->fbi); - return TRUE; + return gTrue; } #if GDISP_HARDWARE_FLUSH diff --git a/drivers/ginput/touch/ADS7843/gmouse_lld_ADS7843.c b/drivers/ginput/touch/ADS7843/gmouse_lld_ADS7843.c index d5412ad2..fb5e4aec 100644 --- a/drivers/ginput/touch/ADS7843/gmouse_lld_ADS7843.c +++ b/drivers/ginput/touch/ADS7843/gmouse_lld_ADS7843.c @@ -19,7 +19,7 @@ #define CMD_Y 0x91 #define CMD_ENABLE_IRQ 0x80 -static bool_t MouseXYZ(GMouse* m, GMouseReading* pdr) +static gBool MouseXYZ(GMouse* m, GMouseReading* pdr) { (void)m; @@ -42,7 +42,7 @@ static bool_t MouseXYZ(GMouse* m, GMouseReading* pdr) release_bus(m); } - return TRUE; + return gTrue; } const GMouseVMT const GMOUSE_DRIVER_VMT[1] = {{ diff --git a/drivers/ginput/touch/ADS7843/gmouse_lld_ADS7843_board_template.h b/drivers/ginput/touch/ADS7843/gmouse_lld_ADS7843_board_template.h index fcfb1f7a..533b5cb6 100644 --- a/drivers/ginput/touch/ADS7843/gmouse_lld_ADS7843_board_template.h +++ b/drivers/ginput/touch/ADS7843/gmouse_lld_ADS7843_board_template.h @@ -19,11 +19,11 @@ // How much extra data to allocate at the end of the GMouse structure for the board's use #define GMOUSE_ADS7843_BOARD_DATA_SIZE 0 -static bool_t init_board(GMouse* m, unsigned driverinstance) { +static gBool init_board(GMouse* m, unsigned driverinstance) { } -static GFXINLINE bool_t getpin_pressed(GMouse* m) { +static GFXINLINE gBool getpin_pressed(GMouse* m) { } diff --git a/drivers/ginput/touch/EXC7200/gmouse_lld_EXC7200.c b/drivers/ginput/touch/EXC7200/gmouse_lld_EXC7200.c index ebe1d9c8..7bd82e36 100644 --- a/drivers/ginput/touch/EXC7200/gmouse_lld_EXC7200.c +++ b/drivers/ginput/touch/EXC7200/gmouse_lld_EXC7200.c @@ -17,16 +17,16 @@ #define EXC7200_READ_CMD 0x09 -static bool_t MouseInit(GMouse* m, unsigned driverinstance) +static gBool MouseInit(GMouse* m, unsigned driverinstance) { if (!init_board(m, driverinstance)) { - return FALSE; + return gFalse; } - return TRUE; + return gTrue; } -static bool_t read_xyz(GMouse* m, GMouseReading* pdr) +static gBool read_xyz(GMouse* m, GMouseReading* pdr) { uint8_t rxbuf[10]; @@ -35,7 +35,7 @@ static bool_t read_xyz(GMouse* m, GMouseReading* pdr) // Read if (!read_bytes(m, EXC7200_READ_CMD, rxbuf, 10)) { - return FALSE; + return gFalse; } // Check if touched @@ -47,7 +47,7 @@ static bool_t read_xyz(GMouse* m, GMouseReading* pdr) pdr->z = 0; } - return TRUE; + return gTrue; } const GMouseVMT const GMOUSE_DRIVER_VMT[1] = {{ diff --git a/drivers/ginput/touch/EXC7200/gmouse_lld_EXC7200_board_template.h b/drivers/ginput/touch/EXC7200/gmouse_lld_EXC7200_board_template.h index 16588a8a..9a2556d3 100644 --- a/drivers/ginput/touch/EXC7200/gmouse_lld_EXC7200_board_template.h +++ b/drivers/ginput/touch/EXC7200/gmouse_lld_EXC7200_board_template.h @@ -19,7 +19,7 @@ // How much extra data to allocate at the end of the GMouse structure for the board's use #define GMOUSE_EXC7200_BOARD_DATA_SIZE 0 -static bool_t init_board(GMouse* m, unsigned driverinstance) +static gBool init_board(GMouse* m, unsigned driverinstance) { } diff --git a/drivers/ginput/touch/FT5336/gmouse_lld_FT5336.c b/drivers/ginput/touch/FT5336/gmouse_lld_FT5336.c index a55bef65..082c372a 100644 --- a/drivers/ginput/touch/FT5336/gmouse_lld_FT5336.c +++ b/drivers/ginput/touch/FT5336/gmouse_lld_FT5336.c @@ -18,11 +18,11 @@ // Hardware definitions #include "drivers/ginput/touch/FT5336/ft5336.h" -static bool_t ft5336Init(GMouse* m, unsigned driverinstance) +static gBool ft5336Init(GMouse* m, unsigned driverinstance) { // Initialize the board stuff if (!init_board(m, driverinstance)) { - return FALSE; + return gFalse; } // We need at least 200 ms worth of delay here... @@ -30,7 +30,7 @@ static bool_t ft5336Init(GMouse* m, unsigned driverinstance) // Check Chip ID if (read_byte(m, FT5336_CHIP_ID_REG) != FT5336_ID_VALUE) { - return FALSE; + return gFalse; } // Disable interrupts. We use this chip in polling mode @@ -53,10 +53,10 @@ static bool_t ft5336Init(GMouse* m, unsigned driverinstance) // Timer to enter 'idle' when in 'Monitor' (ms) write_reg(m, FT5336_PERIODMONITOR_REG, 0x28); */ - return TRUE; + return gTrue; } -static bool_t ft5336ReadXYZ(GMouse* m, GMouseReading* pdr) +static gBool ft5336ReadXYZ(GMouse* m, GMouseReading* pdr) { // Assume not touched. pdr->buttons = 0; @@ -70,7 +70,7 @@ static bool_t ft5336ReadXYZ(GMouse* m, GMouseReading* pdr) pdr->z = 1; } - return TRUE; + return gTrue; } const GMouseVMT const GMOUSE_DRIVER_VMT[1] = {{ diff --git a/drivers/ginput/touch/FT5336/gmouse_lld_FT5336_board_template.h b/drivers/ginput/touch/FT5336/gmouse_lld_FT5336_board_template.h index fb3a8b52..45331b25 100644 --- a/drivers/ginput/touch/FT5336/gmouse_lld_FT5336_board_template.h +++ b/drivers/ginput/touch/FT5336/gmouse_lld_FT5336_board_template.h @@ -25,12 +25,12 @@ // It requires the active area of the touch panel to exactly match the display size. #define GMOUSE_FT5336_SELF_CALIBRATE GFXOFF -static bool_t init_board(GMouse* m, unsigned instance) +static gBool init_board(GMouse* m, unsigned instance) { (void)m; (void)instance; - return TRUE; + return gTrue; } static void write_reg(GMouse* m, uint8_t reg, uint8_t val) diff --git a/drivers/ginput/touch/FT5x06/gmouse_lld_FT5x06.c b/drivers/ginput/touch/FT5x06/gmouse_lld_FT5x06.c index dbd5981c..50fa36a0 100644 --- a/drivers/ginput/touch/FT5x06/gmouse_lld_FT5x06.c +++ b/drivers/ginput/touch/FT5x06/gmouse_lld_FT5x06.c @@ -18,9 +18,9 @@ // Hardware definitions #include "ft5x06.h" -static bool_t MouseInit(GMouse* m, unsigned driverinstance) { +static gBool MouseInit(GMouse* m, unsigned driverinstance) { if (!init_board(m, driverinstance)) - return FALSE; + return gFalse; aquire_bus(m); @@ -53,10 +53,10 @@ static bool_t MouseInit(GMouse* m, unsigned driverinstance) { write_reg(m, FT5x06_ID_G_PERIODMONITOR, 0x28); release_bus(m); - return TRUE; + return gTrue; } -static bool_t read_xyz(GMouse* m, GMouseReading* pdr) +static gBool read_xyz(GMouse* m, GMouseReading* pdr) { // Assume not touched. pdr->buttons = 0; @@ -96,7 +96,7 @@ static bool_t read_xyz(GMouse* m, GMouseReading* pdr) } release_bus(m); - return TRUE; + return gTrue; } const GMouseVMT const GMOUSE_DRIVER_VMT[1] = {{ diff --git a/drivers/ginput/touch/FT5x06/gmouse_lld_FT5x06_board_template.h b/drivers/ginput/touch/FT5x06/gmouse_lld_FT5x06_board_template.h index 728fa695..ded7cfb9 100644 --- a/drivers/ginput/touch/FT5x06/gmouse_lld_FT5x06_board_template.h +++ b/drivers/ginput/touch/FT5x06/gmouse_lld_FT5x06_board_template.h @@ -25,7 +25,7 @@ // It requires the active area of the touch panel to exactly match the display size. #define GMOUSE_FT5x06_SELF_CALIBRATE GFXOFF -static bool_t init_board(GMouse* m, unsigned driverinstance) { +static gBool init_board(GMouse* m, unsigned driverinstance) { } static GFXINLINE void aquire_bus(GMouse* m) { diff --git a/drivers/ginput/touch/FT6x06/gmouse_lld_FT6x06.c b/drivers/ginput/touch/FT6x06/gmouse_lld_FT6x06.c index 0fc21d18..5f3902b3 100644 --- a/drivers/ginput/touch/FT6x06/gmouse_lld_FT6x06.c +++ b/drivers/ginput/touch/FT6x06/gmouse_lld_FT6x06.c @@ -18,9 +18,9 @@ // Hardware definitions #include "ft6x06.h" -static bool_t MouseInit(GMouse* m, unsigned driverinstance) { +static gBool MouseInit(GMouse* m, unsigned driverinstance) { if (!init_board(m, driverinstance)) - return FALSE; + return gFalse; aquire_bus(m); @@ -53,10 +53,10 @@ static bool_t MouseInit(GMouse* m, unsigned driverinstance) { write_reg(m, FT6x06_ID_G_PERIODMONITOR, 0x28); release_bus(m); - return TRUE; + return gTrue; } -static bool_t read_xyz(GMouse* m, GMouseReading* pdr) +static gBool read_xyz(GMouse* m, GMouseReading* pdr) { // Assume not touched. pdr->buttons = 0; @@ -96,7 +96,7 @@ static bool_t read_xyz(GMouse* m, GMouseReading* pdr) } release_bus(m); - return TRUE; + return gTrue; } const GMouseVMT const GMOUSE_DRIVER_VMT[1] = {{ diff --git a/drivers/ginput/touch/FT6x06/gmouse_lld_FT6x06_board_template.h b/drivers/ginput/touch/FT6x06/gmouse_lld_FT6x06_board_template.h index 85b54652..3f2c63d2 100644 --- a/drivers/ginput/touch/FT6x06/gmouse_lld_FT6x06_board_template.h +++ b/drivers/ginput/touch/FT6x06/gmouse_lld_FT6x06_board_template.h @@ -25,7 +25,7 @@ // It requires the active area of the touch panel to exactly match the display size. #define GMOUSE_FT6x06_SELF_CALIBRATE GFXOFF -static bool_t init_board(GMouse* m, unsigned driverinstance) { +static gBool init_board(GMouse* m, unsigned driverinstance) { } static GFXINLINE void aquire_bus(GMouse* m) { diff --git a/drivers/ginput/touch/Linux-Event/gmouse_lld_linux_event.c b/drivers/ginput/touch/Linux-Event/gmouse_lld_linux_event.c index e1989e03..d1aad3ba 100644 --- a/drivers/ginput/touch/Linux-Event/gmouse_lld_linux_event.c +++ b/drivers/ginput/touch/Linux-Event/gmouse_lld_linux_event.c @@ -31,7 +31,7 @@ typedef struct privStruct { GMouseReading lastReading; } privStruct; -static bool_t _init(GMouse* m, unsigned driverInstance) +static gBool _init(GMouse* m, unsigned driverInstance) { (void)driverInstance; @@ -42,7 +42,7 @@ static bool_t _init(GMouse* m, unsigned driverInstance) priv->fd = open(GMOUSE_LINUX_EVENT_DEVICE, O_RDONLY | O_NONBLOCK); if (priv->fd < 0) { fprintf(stderr, "GINPUT Mouse: Cannot open input device (%s)\n", GMOUSE_LINUX_EVENT_DEVICE); - return FALSE; + return gFalse; } // Initialize @@ -51,10 +51,10 @@ static bool_t _init(GMouse* m, unsigned driverInstance) priv->lastReading.y = 0; priv->lastReading.z = 0; - return TRUE; + return gTrue; } -static bool_t _read(GMouse* m, GMouseReading* pdr) +static gBool _read(GMouse* m, GMouseReading* pdr) { int i; int rb; @@ -97,7 +97,7 @@ static bool_t _read(GMouse* m, GMouseReading* pdr) priv->lastReading.z = pdr->z; priv->lastReading.buttons = pdr->buttons; - return TRUE; + return gTrue; } const GMouseVMT const GMOUSE_DRIVER_VMT[1] = {{ diff --git a/drivers/ginput/touch/MAX11802/gmouse_lld_MAX11802.c b/drivers/ginput/touch/MAX11802/gmouse_lld_MAX11802.c index 8976cceb..f2222898 100644 --- a/drivers/ginput/touch/MAX11802/gmouse_lld_MAX11802.c +++ b/drivers/ginput/touch/MAX11802/gmouse_lld_MAX11802.c @@ -27,7 +27,7 @@ #define Z_MIN 0 #define Z_MAX 1 -static bool_t MouseInit(GMouse* m, unsigned driverinstance) +static gBool MouseInit(GMouse* m, unsigned driverinstance) { const uint8_t *p; @@ -46,7 +46,7 @@ static bool_t MouseInit(GMouse* m, unsigned driverinstance) }; if (!init_board(m, driverinstance)) - return FALSE; + return gFalse; aquire_bus(m); for (p = commandList; p < commandList+sizeof(commandList); p += 2) @@ -60,15 +60,15 @@ static bool_t MouseInit(GMouse* m, unsigned driverinstance) aquire_bus(m); if (write_command(m, MAX11802_CMD_MODE_RD, 0) != MAX11802_MODE) { release_bus(m); - return FALSE; + return gFalse; } release_bus(m); - return TRUE; + return gTrue; } -static bool_t read_xyz(GMouse* m, GMouseReading* pdr) +static gBool read_xyz(GMouse* m, GMouseReading* pdr) { uint8_t readyCount; uint8_t notReadyCount; @@ -126,7 +126,7 @@ static bool_t read_xyz(GMouse* m, GMouseReading* pdr) // Has it been too long? If so give up if (++notReadyCount >= 5) { - return FALSE; + return gFalse; } // Give up the time slice to someone else and then try again @@ -149,7 +149,7 @@ static bool_t read_xyz(GMouse* m, GMouseReading* pdr) // Was there a valid touch? if (((pdr->x | pdr->y) & 0x03) != 0x0) { pdr->z = Z_MIN; - return TRUE; + return gTrue; } // Strip the tags (we need to take care because coord_t is signed - and sign bit gets extended on shift!) @@ -157,7 +157,7 @@ static bool_t read_xyz(GMouse* m, GMouseReading* pdr) pdr->y = (uint16_t)(pdr->y) >> 4; pdr->z = Z_MAX; - return TRUE; + return gTrue; } const GMouseVMT const GMOUSE_DRIVER_VMT[1] = {{ diff --git a/drivers/ginput/touch/MAX11802/gmouse_lld_MAX11802_board_template.h b/drivers/ginput/touch/MAX11802/gmouse_lld_MAX11802_board_template.h index e5339815..cf663cb0 100644 --- a/drivers/ginput/touch/MAX11802/gmouse_lld_MAX11802_board_template.h +++ b/drivers/ginput/touch/MAX11802/gmouse_lld_MAX11802_board_template.h @@ -22,9 +22,9 @@ /** * Init the board * - * Returns TRUE on success, FALSE on failure + * Returns gTrue on success, gFalse on failure */ -static GFXINLINE bool_t init_board(GMouse* m, unsigned driverinstance) { +static GFXINLINE gBool init_board(GMouse* m, unsigned driverinstance) { } diff --git a/drivers/ginput/touch/MCU/gmouse_lld_MCU_board_template.h b/drivers/ginput/touch/MCU/gmouse_lld_MCU_board_template.h index 440d81fe..bc2917ad 100644 --- a/drivers/ginput/touch/MCU/gmouse_lld_MCU_board_template.h +++ b/drivers/ginput/touch/MCU/gmouse_lld_MCU_board_template.h @@ -23,10 +23,10 @@ // How much extra data to allocate at the end of the GMouse structure for the board's use #define GMOUSE_MCU_BOARD_DATA_SIZE 0 -static bool_t init_board(GMouse *m, unsigned driverinstance) { +static gBool init_board(GMouse *m, unsigned driverinstance) { } -static bool_t read_xyz(GMouse *m, GMouseReading *prd) { +static gBool read_xyz(GMouse *m, GMouseReading *prd) { } #endif /* _LLD_GMOUSE_MCU_BOARD_H */ diff --git a/drivers/ginput/touch/QWidget/gmouse_lld_QWidget.c b/drivers/ginput/touch/QWidget/gmouse_lld_QWidget.c index d79da2a2..53b167bb 100644 --- a/drivers/ginput/touch/QWidget/gmouse_lld_QWidget.c +++ b/drivers/ginput/touch/QWidget/gmouse_lld_QWidget.c @@ -19,16 +19,16 @@ coord_t qwidgetMouseY; coord_t qwidgetMouseZ; uint16_t qwidgetMouseButtons; -static bool_t _init(GMouse* m, unsigned driverinstance) +static gBool _init(GMouse* m, unsigned driverinstance) { (void)driverinstance; qwidgetMouse = m; - return TRUE; + return gTrue; } -static bool_t _read(GMouse* m, GMouseReading* pdr) +static gBool _read(GMouse* m, GMouseReading* pdr) { (void)m; @@ -37,7 +37,7 @@ static bool_t _read(GMouse* m, GMouseReading* pdr) pdr->z = qwidgetMouseZ; pdr->buttons = qwidgetMouseButtons; - return TRUE; + return gTrue; } const GMouseVMT GMOUSE_DRIVER_VMT[1] = {{ diff --git a/drivers/ginput/touch/STMPE610/gmouse_lld_STMPE610.c b/drivers/ginput/touch/STMPE610/gmouse_lld_STMPE610.c index 896074b9..eab13de4 100644 --- a/drivers/ginput/touch/STMPE610/gmouse_lld_STMPE610.c +++ b/drivers/ginput/touch/STMPE610/gmouse_lld_STMPE610.c @@ -57,9 +57,9 @@ * The settling times. We have set these conservatively at 1ms. * The reading window. We set this to 16 just to reduce noise. High-res panels may need a lower value. */ -static bool_t MouseInit(GMouse* m, unsigned driverinstance) { +static gBool MouseInit(GMouse* m, unsigned driverinstance) { if (!init_board(m, driverinstance)) - return FALSE; + return gFalse; aquire_bus(m); @@ -95,10 +95,10 @@ static bool_t MouseInit(GMouse* m, unsigned driverinstance) { write_reg(m, STMPE610_REG_INT_CTRL, 0x01); // Level interrupt, enable interrupts release_bus(m); - return TRUE; + return gTrue; } -static bool_t read_xyz(GMouse* m, GMouseReading* pdr) +static gBool read_xyz(GMouse* m, GMouseReading* pdr) { #if GMOUSE_STMPE610_TEST_MODE static GMouseReading n; @@ -133,14 +133,14 @@ static bool_t read_xyz(GMouse* m, GMouseReading* pdr) write_reg(m, STMPE610_REG_INT_STA, 0xFF); #endif release_bus(m); - return TRUE; + return gTrue; } #else // Is there a new sample or a touch transition #if GMOUSE_STMPE610_GPIO_IRQPIN if(!getpin_irq(m)) - return FALSE; + return gFalse; #endif // Is there something in the fifo @@ -157,7 +157,7 @@ static bool_t read_xyz(GMouse* m, GMouseReading* pdr) write_reg(m, STMPE610_REG_INT_STA, 0xFF); #endif release_bus(m); - return TRUE; + return gTrue; } // No new result @@ -165,7 +165,7 @@ static bool_t read_xyz(GMouse* m, GMouseReading* pdr) write_reg(m, STMPE610_REG_INT_STA, 0xFF); #endif release_bus(m); - return FALSE; + return gFalse; } #endif @@ -229,7 +229,7 @@ static bool_t read_xyz(GMouse* m, GMouseReading* pdr) #endif #endif - return TRUE; + return gTrue; } const GMouseVMT const GMOUSE_DRIVER_VMT[1] = {{ diff --git a/drivers/ginput/touch/STMPE610/gmouse_lld_STMPE610_board_template.h b/drivers/ginput/touch/STMPE610/gmouse_lld_STMPE610_board_template.h index 14917e53..a821ee7c 100644 --- a/drivers/ginput/touch/STMPE610/gmouse_lld_STMPE610_board_template.h +++ b/drivers/ginput/touch/STMPE610/gmouse_lld_STMPE610_board_template.h @@ -33,11 +33,11 @@ // If GFXON this is a really slow CPU and we should always clear the FIFO between reads. #define GMOUSE_STMPE610_SLOW_CPU GFXOFF -static bool_t init_board(GMouse* m, unsigned driverinstance) { +static gBool init_board(GMouse* m, unsigned driverinstance) { } #if GMOUSE_STMPE610_GPIO_IRQPIN - static bool_t getpin_irq(GMouse* m) { + static gBool getpin_irq(GMouse* m) { } #endif diff --git a/drivers/ginput/touch/STMPE811/gmouse_lld_STMPE811.c b/drivers/ginput/touch/STMPE811/gmouse_lld_STMPE811.c index 90496b29..fe978828 100644 --- a/drivers/ginput/touch/STMPE811/gmouse_lld_STMPE811.c +++ b/drivers/ginput/touch/STMPE811/gmouse_lld_STMPE811.c @@ -57,9 +57,9 @@ * The settling times. We have set these conservatively at 1ms. * The reading window. We set this to 16 just to reduce noise. High-res panels may need a lower value. */ -static bool_t MouseInit(GMouse* m, unsigned driverinstance) { +static gBool MouseInit(GMouse* m, unsigned driverinstance) { if (!init_board(m, driverinstance)) - return FALSE; + return gFalse; aquire_bus(m); @@ -95,10 +95,10 @@ static bool_t MouseInit(GMouse* m, unsigned driverinstance) { write_reg(m, STMPE811_REG_INT_CTRL, 0x01); // Level interrupt, enable interrupts release_bus(m); - return TRUE; + return gTrue; } -static bool_t read_xyz(GMouse* m, GMouseReading* pdr) +static gBool read_xyz(GMouse* m, GMouseReading* pdr) { #if GMOUSE_STMPE811_TEST_MODE static GMouseReading n; @@ -133,14 +133,14 @@ static bool_t read_xyz(GMouse* m, GMouseReading* pdr) write_reg(m, STMPE811_REG_INT_STA, 0xFF); #endif release_bus(m); - return TRUE; + return gTrue; } #else // Is there a new sample or a touch transition #if GMOUSE_STMPE811_GPIO_IRQPIN if(!getpin_irq(m)) - return FALSE; + return gFalse; #endif // Is there something in the fifo @@ -157,7 +157,7 @@ static bool_t read_xyz(GMouse* m, GMouseReading* pdr) write_reg(m, STMPE811_REG_INT_STA, 0xFF); #endif release_bus(m); - return TRUE; + return gTrue; } // No new result @@ -165,7 +165,7 @@ static bool_t read_xyz(GMouse* m, GMouseReading* pdr) write_reg(m, STMPE811_REG_INT_STA, 0xFF); #endif release_bus(m); - return FALSE; + return gFalse; } #endif @@ -228,7 +228,7 @@ static bool_t read_xyz(GMouse* m, GMouseReading* pdr) #endif #endif - return TRUE; + return gTrue; } const GMouseVMT const GMOUSE_DRIVER_VMT[1] = {{ diff --git a/drivers/ginput/touch/STMPE811/gmouse_lld_STMPE811_board_template.h b/drivers/ginput/touch/STMPE811/gmouse_lld_STMPE811_board_template.h index fb979f8b..dfe44ed7 100644 --- a/drivers/ginput/touch/STMPE811/gmouse_lld_STMPE811_board_template.h +++ b/drivers/ginput/touch/STMPE811/gmouse_lld_STMPE811_board_template.h @@ -33,11 +33,11 @@ // If GFXON this is a really slow CPU and we should always clear the FIFO between reads. #define GMOUSE_STMPE811_SLOW_CPU GFXOFF -static bool_t init_board(GMouse* m, unsigned driverinstance) { +static gBool init_board(GMouse* m, unsigned driverinstance) { } #if GMOUSE_STMPE811_GPIO_IRQPIN - static bool_t getpin_irq(GMouse* m) { + static gBool getpin_irq(GMouse* m) { } #endif diff --git a/drivers/multiple/SDL/gdisp_lld_SDL.c b/drivers/multiple/SDL/gdisp_lld_SDL.c index 5e2661a3..3ea2168f 100644 --- a/drivers/multiple/SDL/gdisp_lld_SDL.c +++ b/drivers/multiple/SDL/gdisp_lld_SDL.c @@ -40,8 +40,8 @@ #include "../../../src/ginput/ginput_driver_mouse.h" // Forward definitions - static bool_t SDL_MouseInit(GMouse *m, unsigned driverinstance); - static bool_t SDL_MouseRead(GMouse *m, GMouseReading *prd); + static gBool SDL_MouseInit(GMouse *m, unsigned driverinstance); + static gBool SDL_MouseRead(GMouse *m, GMouseReading *prd); const GMouseVMT GMOUSE_DRIVER_VMT[1] = {{ { GDRIVER_TYPE_MOUSE, @@ -78,7 +78,7 @@ #include "../../../src/ginput/ginput_driver_keyboard.h" // Forward definitions - static bool_t SDL_KeyboardInit(GKeyboard *k, unsigned driverinstance); + static gBool SDL_KeyboardInit(GKeyboard *k, unsigned driverinstance); static int SDL_KeyboardGetData(GKeyboard *k, uint8_t *pch, int sz); const GKeyboardVMT GKEYBOARD_DRIVER_VMT[1] = {{ @@ -366,7 +366,7 @@ void sdl_driver_init (void) { } -LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { +LLDSPEC gBool gdisp_lld_init(GDisplay *g) { g->board = 0; // No board interface for this driver #if GINPUT_NEED_MOUSE @@ -380,7 +380,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { g->g.Width = GDISP_SCREEN_WIDTH; g->g.Height = GDISP_SCREEN_HEIGHT; - return TRUE; + return gTrue; } @@ -433,29 +433,29 @@ LLDSPEC void gdisp_lld_draw_pixel(GDisplay *g) #endif #if GINPUT_NEED_MOUSE - static bool_t SDL_MouseInit(GMouse *m, unsigned driverinstance) { + static gBool SDL_MouseInit(GMouse *m, unsigned driverinstance) { mouse = m; (void) driverinstance; - return TRUE; + return gTrue; } - static bool_t SDL_MouseRead(GMouse *m, GMouseReading *pt) { + static gBool SDL_MouseRead(GMouse *m, GMouseReading *pt) { (void) m; if (!context) - return FALSE; + return gFalse; pt->x = context->mousex; pt->y = context->mousey; pt->z = (context->buttons & GINPUT_MOUSE_BTN_LEFT) ? 1 : 0; pt->buttons = context->buttons; - return TRUE; + return gTrue; } #endif /* GINPUT_NEED_MOUSE */ #if GINPUT_NEED_KEYBOARD - static bool_t SDL_KeyboardInit(GKeyboard *k, unsigned driverinstance) { + static gBool SDL_KeyboardInit(GKeyboard *k, unsigned driverinstance) { keyboard = k; (void) driverinstance; - return TRUE; + return gTrue; } static int SDL_KeyboardGetData(GKeyboard *k, uint8_t *pch, int sz) { diff --git a/drivers/multiple/Win32/gdisp_lld_Win32.c b/drivers/multiple/Win32/gdisp_lld_Win32.c index 10818269..86af1d80 100644 --- a/drivers/multiple/Win32/gdisp_lld_Win32.c +++ b/drivers/multiple/Win32/gdisp_lld_Win32.c @@ -96,8 +96,8 @@ #include "../../../src/ginput/ginput_driver_mouse.h" // Forward definitions - static bool_t Win32MouseInit(GMouse *m, unsigned driverinstance); - static bool_t Win32MouseRead(GMouse *m, GMouseReading *prd); + static gBool Win32MouseInit(GMouse *m, unsigned driverinstance); + static gBool Win32MouseRead(GMouse *m, GMouseReading *prd); const GMouseVMT const GMOUSE_DRIVER_VMT[1] = {{ { @@ -390,7 +390,7 @@ #endif // Forward definitions - static bool_t Win32KeyboardInit(GKeyboard *k, unsigned driverinstance); + static gBool Win32KeyboardInit(GKeyboard *k, unsigned driverinstance); static int Win32KeyboardGetData(GKeyboard *k, uint8_t *pch, int sz); const GKeyboardVMT const GKEYBOARD_DRIVER_VMT[1] = {{ @@ -420,7 +420,7 @@ #endif static DWORD winThreadId; -static volatile bool_t QReady; +static volatile gBool QReady; static HANDLE drawMutex; static HWND hWndParent = 0; @@ -445,7 +445,7 @@ typedef struct winPriv { coord_t mousex, mousey; uint16_t mousebuttons; GMouse *mouse; - bool_t mouseenabled; + gBool mouseenabled; void (*capfn)(void * hWnd, GDisplay *g, uint16_t buttons, coord_t x, coord_t y); #endif #if GFX_USE_GINPUT && GINPUT_NEED_TOGGLE @@ -472,7 +472,7 @@ void gfxEmulatorSetParentWindow(void *hwnd) { if ((gmvmt(priv->mouse)->d.flags & GMOUSE_VFLG_NOPOLL)) // For normal setup this is always true _gmouseWakeup(priv->mouse); } - void gfxEmulatorMouseEnable(GDisplay *g, bool_t enabled) { + void gfxEmulatorMouseEnable(GDisplay *g, gBool enabled) { ((winPriv *)g->priv)->mouseenabled = enabled; } void gfxEmulatorMouseCapture(GDisplay *g, void (*capfn)(void * hWnd, GDisplay *g, uint16_t buttons, coord_t x, coord_t y)) { @@ -761,7 +761,7 @@ static DWORD WINAPI WindowThread(void *param) { // Establish this thread as a message queue thread winThreadId = GetCurrentThreadId(); PeekMessage(&msg, 0, WM_USER, WM_USER, PM_NOREMOVE); - QReady = TRUE; + QReady = gTrue; // Create the window class { @@ -825,7 +825,7 @@ static DWORD WINAPI WindowThread(void *param) { /* Driver exported functions. */ /*===========================================================================*/ -LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { +LLDSPEC gBool gdisp_lld_init(GDisplay *g) { winPriv * priv; char buf[132]; @@ -838,7 +838,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { // Create the thread if (!(hth = CreateThread(0, 0, WindowThread, 0, CREATE_SUSPENDED, 0))) - return FALSE; + return gFalse; SetThreadPriority(hth, THREAD_PRIORITY_ABOVE_NORMAL); ResumeThread(hth); CloseHandle(hth); @@ -884,7 +884,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { // Create the associated mouse #if GFX_USE_GINPUT && GINPUT_NEED_MOUSE - priv->mouseenabled = hWndParent ? FALSE : TRUE; + priv->mouseenabled = hWndParent ? gFalse : gTrue; priv->mouse = (GMouse *)gdriverRegister((const GDriverVMT const *)GMOUSE_DRIVER_VMT, g); #endif @@ -893,7 +893,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { ShowWindow(priv->hwnd, SW_SHOW); UpdateWindow(priv->hwnd); - return TRUE; + return gTrue; } #if GDISP_HARDWARE_FLUSH @@ -1551,12 +1551,12 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { #endif #if GFX_USE_GINPUT && GINPUT_NEED_MOUSE - static bool_t Win32MouseInit(GMouse *m, unsigned driverinstance) { + static gBool Win32MouseInit(GMouse *m, unsigned driverinstance) { (void) m; (void) driverinstance; - return TRUE; + return gTrue; } - static bool_t Win32MouseRead(GMouse *m, GMouseReading *pt) { + static gBool Win32MouseRead(GMouse *m, GMouseReading *pt) { GDisplay * g; winPriv * priv; @@ -1595,20 +1595,20 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { } #endif - return TRUE; + return gTrue; } #endif /* GINPUT_NEED_MOUSE */ #if GFX_USE_GINPUT && GINPUT_NEED_KEYBOARD - static bool_t Win32KeyboardInit(GKeyboard *k, unsigned driverinstance) { + static gBool Win32KeyboardInit(GKeyboard *k, unsigned driverinstance) { (void) driverinstance; // Only one please if (keyboard) - return FALSE; + return gFalse; keyboard = k; - return TRUE; + return gTrue; } static int Win32KeyboardGetData(GKeyboard *k, uint8_t *pch, int sz) { diff --git a/drivers/multiple/Win32/gdisp_lld_config.h b/drivers/multiple/Win32/gdisp_lld_config.h index 710cd3fb..c95b554a 100644 --- a/drivers/multiple/Win32/gdisp_lld_config.h +++ b/drivers/multiple/Win32/gdisp_lld_config.h @@ -58,7 +58,7 @@ void gfxEmulatorSetParentWindow(void *hwnd); void gfxEmulatorMouseInject(GDisplay *g, uint16_t buttons, coord_t x, coord_t y); // This function enables you to turn on/off normal mouse functions on a ugfx Win32 display window. - void gfxEmulatorMouseEnable(GDisplay *g, bool_t enabled); + void gfxEmulatorMouseEnable(GDisplay *g, gBool enabled); // This function enables you to capture mouse events on a ugfx Win32 display window. // Passing NULL turns off the capture diff --git a/drivers/multiple/X/gdisp_lld_X.c b/drivers/multiple/X/gdisp_lld_X.c index f27795a8..05e80614 100644 --- a/drivers/multiple/X/gdisp_lld_X.c +++ b/drivers/multiple/X/gdisp_lld_X.c @@ -59,8 +59,8 @@ #include "../../../src/ginput/ginput_driver_mouse.h" // Forward definitions - static bool_t XMouseInit(GMouse *m, unsigned driverinstance); - static bool_t XMouseRead(GMouse *m, GMouseReading *prd); + static gBool XMouseInit(GMouse *m, unsigned driverinstance); + static gBool XMouseRead(GMouse *m, GMouseReading *prd); const GMouseVMT const GMOUSE_DRIVER_VMT[1] = {{ { @@ -140,7 +140,7 @@ #endif // Forward definitions - static bool_t XKeyboardInit(GKeyboard *k, unsigned driverinstance); + static gBool XKeyboardInit(GKeyboard *k, unsigned driverinstance); static int XKeyboardGetData(GKeyboard *k, uint8_t *pch, int sz); const GKeyboardVMT const GKEYBOARD_DRIVER_VMT[1] = {{ @@ -167,7 +167,7 @@ static GKeyboard *keyboard; #endif -static bool_t initdone; +static gBool initdone; static Display *dis; static int scr; static XEvent evt; @@ -294,7 +294,7 @@ static int FatalXIOError(Display *d) { exit(0); } -LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { +LLDSPEC gBool gdisp_lld_init(GDisplay *g) { XSizeHints *pSH; XSetWindowAttributes xa; XTextProperty WindowTitle; @@ -304,7 +304,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { if (!initdone) { gfxThreadHandle hth; - initdone = TRUE; + initdone = gTrue; #if GFX_USE_OS_LINUX || GFX_USE_OS_OSX XInitThreads(); #endif @@ -319,7 +319,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { if (!XMatchVisualInfo(dis, scr, 24, TrueColor, &vis)) { fprintf(stderr, "Your display has no TrueColor mode\n"); XCloseDisplay(dis); - return FALSE; + return gFalse; } cmap = XCreateColormap(dis, RootWindow(dis, scr), vis.visual, AllocNone); @@ -404,7 +404,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { g->g.Width = GDISP_SCREEN_WIDTH; g->g.Height = GDISP_SCREEN_HEIGHT; - return TRUE; + return gTrue; } LLDSPEC void gdisp_lld_draw_pixel(GDisplay *g) @@ -480,12 +480,12 @@ LLDSPEC void gdisp_lld_draw_pixel(GDisplay *g) #endif #if GINPUT_NEED_MOUSE - static bool_t XMouseInit(GMouse *m, unsigned driverinstance) { + static gBool XMouseInit(GMouse *m, unsigned driverinstance) { (void) m; (void) driverinstance; - return TRUE; + return gTrue; } - static bool_t XMouseRead(GMouse *m, GMouseReading *pt) { + static gBool XMouseRead(GMouse *m, GMouseReading *pt) { xPriv * priv; priv = m->display->priv; @@ -493,20 +493,20 @@ LLDSPEC void gdisp_lld_draw_pixel(GDisplay *g) pt->y = priv->mousey; pt->z = (priv->buttons & GINPUT_MOUSE_BTN_LEFT) ? 1 : 0; pt->buttons = priv->buttons; - return TRUE; + return gTrue; } #endif /* GINPUT_NEED_MOUSE */ #if GINPUT_NEED_KEYBOARD - static bool_t XKeyboardInit(GKeyboard *k, unsigned driverinstance) { + static gBool XKeyboardInit(GKeyboard *k, unsigned driverinstance) { (void) driverinstance; // Only one please if (keyboard) - return FALSE; + return gFalse; keyboard = k; - return TRUE; + return gTrue; } static int XKeyboardGetData(GKeyboard *k, uint8_t *pch, int sz) { diff --git a/drivers/multiple/uGFXnet/gdisp_lld_uGFXnet.c b/drivers/multiple/uGFXnet/gdisp_lld_uGFXnet.c index bb8ffbe6..653b75c4 100644 --- a/drivers/multiple/uGFXnet/gdisp_lld_uGFXnet.c +++ b/drivers/multiple/uGFXnet/gdisp_lld_uGFXnet.c @@ -42,8 +42,8 @@ #include "../../../src/ginput/ginput_driver_mouse.h" // Forward definitions - static bool_t NMouseInit(GMouse *m, unsigned driverinstance); - static bool_t NMouseRead(GMouse *m, GMouseReading *prd); + static gBool NMouseInit(GMouse *m, unsigned driverinstance); + static gBool NMouseRead(GMouse *m, GMouseReading *prd); const GMouseVMT const GMOUSE_DRIVER_VMT[1] = {{ { @@ -182,9 +182,9 @@ static gfxThreadHandle hThread; * Send a whole packet of data. * Len is specified in the number of uint16_t's we want to send as our protocol only talks uint16_t's. * Note that contents of the packet are modified to ensure it will cross the wire in the correct format. - * If the connection closes before we send all the data - the call returns FALSE. + * If the connection closes before we send all the data - the call returns gFalse. */ -static bool_t sendpkt(SOCKET_TYPE netfd, uint16_t *pkt, int len) { +static gBool sendpkt(SOCKET_TYPE netfd, uint16_t *pkt, int len) { int i; // Convert each uint16_t to network order @@ -196,7 +196,7 @@ static bool_t sendpkt(SOCKET_TYPE netfd, uint16_t *pkt, int len) { return send(netfd, (const char *)pkt, len, 0) == len; } -static bool_t newconnection(SOCKET_TYPE clientfd) { +static gBool newconnection(SOCKET_TYPE clientfd) { GDisplay * g; netPriv * priv; @@ -213,7 +213,7 @@ static bool_t newconnection(SOCKET_TYPE clientfd) { // Was anything found? if (!g) - return FALSE; + return gFalse; // Reset the priv area priv = g->priv; @@ -240,13 +240,13 @@ static bool_t newconnection(SOCKET_TYPE clientfd) { // Send a redraw all #if GFX_USE_GWIN && GWIN_NEED_WINDOWMANAGER gdispGClear(g, gwinGetDefaultBgColor()); - gwinRedrawDisplay(g, FALSE); + gwinRedrawDisplay(g, gFalse); #endif - return TRUE; + return gTrue; } -static bool_t rxdata(SOCKET_TYPE fd) { +static gBool rxdata(SOCKET_TYPE fd) { GDisplay * g; netPriv * priv; int len; @@ -269,7 +269,7 @@ static bool_t rxdata(SOCKET_TYPE fd) { // The higher level is still processing the previous data. // Give it a chance to run by coming back to this data. gfxSleepMilliseconds(1); - return TRUE; + return gTrue; } /* handle data from a client */ @@ -278,14 +278,14 @@ static bool_t rxdata(SOCKET_TYPE fd) { // Socket closed or in error state MUTEX_EXIT; g->flags &= ~GDISP_FLG_CONNECTED; - return FALSE; + return gFalse; } MUTEX_EXIT; // Do we have a full reply yet priv->databytes += len; if (priv->databytes < sizeof(priv->data)) - return TRUE; + return gTrue; priv->databytes = 0; // Convert network byte or to host byte order @@ -315,7 +315,7 @@ static bool_t rxdata(SOCKET_TYPE fd) { // Just ignore unrecognised data break; } - return TRUE; + return gTrue; } static DECLARE_THREAD_STACK(waNetThread, 512); @@ -429,7 +429,7 @@ static DECLARE_THREAD_FUNCTION(NetThread, param) { /* Driver exported functions. */ /*===========================================================================*/ -LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { +LLDSPEC gBool gdisp_lld_init(GDisplay *g) { netPriv * priv; // Initialise the receiver thread (if it hasn't been done already) @@ -459,7 +459,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { g->g.Width = GDISP_SCREEN_WIDTH; g->g.Height = GDISP_SCREEN_HEIGHT; - return TRUE; + return gTrue; } #if GDISP_HARDWARE_FLUSH @@ -636,7 +636,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { LLDSPEC void gdisp_lld_control(GDisplay *g) { netPriv * priv; uint16_t buf[3]; - bool_t allgood; + gBool allgood; #if GDISP_DONT_WAIT_FOR_NET_DISPLAY if (!(g->flags & GDISP_FLG_CONNECTED)) @@ -680,7 +680,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { gfxSleepMilliseconds(1); // Extract the return status - allgood = priv->data[1] ? TRUE : FALSE; + allgood = priv->data[1] ? gTrue : gFalse; g->flags &= ~GDISP_FLG_HAVEDATA; // Do nothing more if the operation failed @@ -716,12 +716,12 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { #endif #if GINPUT_NEED_MOUSE - static bool_t NMouseInit(GMouse *m, unsigned driverinstance) { + static gBool NMouseInit(GMouse *m, unsigned driverinstance) { (void) m; (void) driverinstance; - return TRUE; + return gTrue; } - static bool_t NMouseRead(GMouse *m, GMouseReading *pt) { + static gBool NMouseRead(GMouse *m, GMouseReading *pt) { GDisplay * g; netPriv * priv; @@ -732,7 +732,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { pt->y = priv->mousey; pt->z = (priv->mousebuttons & GINPUT_MOUSE_BTN_LEFT) ? 1 : 0; pt->buttons = priv->mousebuttons; - return TRUE; + return gTrue; } #endif /* GINPUT_NEED_MOUSE */ diff --git a/drivers/multiple/uGFXnetESP8266/gdisp_lld_uGFXnetESP8266.cpp b/drivers/multiple/uGFXnetESP8266/gdisp_lld_uGFXnetESP8266.cpp index dc208cbe..8df5e08d 100644 --- a/drivers/multiple/uGFXnetESP8266/gdisp_lld_uGFXnetESP8266.cpp +++ b/drivers/multiple/uGFXnetESP8266/gdisp_lld_uGFXnetESP8266.cpp @@ -34,7 +34,7 @@ static WiFiServer server(GDISP_GFXNET_PORT); static GTimer poller; -static bool_t uGFXInitDone; +static gBool uGFXInitDone; #ifndef GDISP_GFXNET_WIFI_INIT_FUNCTION #define GDISP_GFXNET_WIFI_INIT_FUNCTION uGFXnetArduinoWifiInit @@ -62,8 +62,8 @@ static bool_t uGFXInitDone; #include "../../../src/ginput/ginput_driver_mouse.h" // Forward definitions - static bool_t NMouseInit(GMouse *m, unsigned driverinstance); - static bool_t NMouseRead(GMouse *m, GMouseReading *prd); + static gBool NMouseInit(GMouse *m, unsigned driverinstance); + static gBool NMouseRead(GMouse *m, GMouseReading *prd); const GMouseVMT const GMOUSE_DRIVER_VMT[1] = {{ { @@ -150,9 +150,9 @@ static void endcon(GDisplay *g) { * Send a whole packet of data. * Len is specified in the number of uint16_t's we want to send as our protocol only talks uint16_t's. * Note that contents of the packet are modified to ensure it will cross the wire in the correct format. - * If the connection closes before we send all the data - the call returns FALSE. + * If the connection closes before we send all the data - the call returns gFalse. */ -static bool_t sendpkt(CLIENTFD fd, uint16_t *pkt, int len) { +static gBool sendpkt(CLIENTFD fd, uint16_t *pkt, int len) { // Convert each uint16_t to network order #if GFX_CPU_ENDIAN == GFX_CPU_ENDIAN_LITTLE { @@ -284,7 +284,7 @@ void uGFXnetClientPoller(void *param) { // Send a redraw all #if GFX_USE_GWIN && GWIN_NEED_WINDOWMANAGER gdispGClear(g, gwinGetDefaultBgColor()); - gwinRedrawDisplay(g, FALSE); + gwinRedrawDisplay(g, gFalse); #endif break; } @@ -307,7 +307,7 @@ void uGFXnetClientPoller(void *param) { /* Driver exported functions. */ /*===========================================================================*/ -LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { +LLDSPEC gBool gdisp_lld_init(GDisplay *g) { netPriv * priv; // Initialise the receiver thread (if it hasn't been done already) @@ -318,8 +318,8 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { // Initialise the poller gtimerInit(&poller); - gtimerStart(&poller, uGFXnetClientPoller, 0, TRUE, 50); - uGFXInitDone = TRUE; + gtimerStart(&poller, uGFXnetClientPoller, 0, gTrue, 50); + uGFXInitDone = gTrue; } // Create a private area for this window @@ -342,7 +342,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { g->g.Width = GDISP_SCREEN_WIDTH; g->g.Height = GDISP_SCREEN_HEIGHT; - return TRUE; + return gTrue; } #if GDISP_HARDWARE_FLUSH @@ -519,7 +519,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { LLDSPEC void gdisp_lld_control(GDisplay *g) { netPriv * priv; uint16_t buf[3]; - bool_t allgood; + gBool allgood; #if GDISP_DONT_WAIT_FOR_NET_DISPLAY if (!(g->flags & GDISP_FLG_CONNECTED)) @@ -563,7 +563,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { gfxSleepMilliseconds(1); // Extract the return status - allgood = priv->data[1] ? TRUE : FALSE; + allgood = priv->data[1] ? gTrue : gFalse; g->flags &= ~GDISP_FLG_HAVEDATA; // Do nothing more if the operation failed @@ -599,12 +599,12 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { #endif #if GINPUT_NEED_MOUSE - static bool_t NMouseInit(GMouse *m, unsigned driverinstance) { + static gBool NMouseInit(GMouse *m, unsigned driverinstance) { (void) m; (void) driverinstance; - return TRUE; + return gTrue; } - static bool_t NMouseRead(GMouse *m, GMouseReading *pt) { + static gBool NMouseRead(GMouse *m, GMouseReading *pt) { GDisplay * g; netPriv * priv; @@ -615,7 +615,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { pt->y = priv->mousey; pt->z = (priv->mousebuttons & GINPUT_MOUSE_BTN_LEFT) ? 1 : 0; pt->buttons = priv->mousebuttons; - return TRUE; + return gTrue; } #endif /* GINPUT_NEED_MOUSE */ diff --git a/gfx.h b/gfx.h index e248c701..2d665462 100644 --- a/gfx.h +++ b/gfx.h @@ -4,308 +4,4 @@ * * http://ugfx.org/license.html */ - -/** - * @file gfx.h - * @brief GFX system header file. - * - * @addtogroup GFX - * - * @brief Main module to glue all the others together - * - * @{ - */ - -#ifndef _GFX_H -#define _GFX_H - -// Everything here is C, not C++ -#ifdef __cplusplus -extern "C" { -#endif - -// ------------------------------ Initial preparation --------------------------------- - -// ------------------------------ Load the user configuration --------------------------------- - -// Definitions for option configuration -#define GFXOFF (0) -#define GFXON (-1) - -// gfxconf.h is the user's project configuration for the GFX system. -#include "gfxconf.h" - -// ------------------------------ Determine build environment info - COMPILER, CPU etc --------------------------------- - -/** - * @name GFX compatibility options - * @{ - */ - /** - * @brief Include the uGFX V2.x API - * @details Defaults to GFXON - */ - #ifndef GFX_COMPAT_V2 - #define GFX_COMPAT_V2 GFXON - #endif -/** @} */ - -#if GFX_COMPAT_V2 - // These need to be defined here for compatibility with V2.x user config files - #if !defined(FALSE) - #define FALSE 0 - #endif - #if !defined(TRUE) - #define TRUE -1 - #endif -#endif - -// Macro concatination and strify - not API documented -#define GFXCAT(a, b) a ## b -#define GFXCATX(a, b) GFXCAT(a, b) -#define GFXSTR(a) #a -#define GFXSTRX(a) GFXSTR(a) - -// Include Compiler and CPU support -#include "src/gfx_compilers.h" - -// ------------------------------ Enumerate all options --------------------------------- -/** - * @name GFX sub-systems that can be turned on - * @{ - */ - /** - * @brief GFX Driver API - * @details Defaults to GFXON - * @note Not much useful can be done without a driver - */ - #ifndef GFX_USE_GDRIVER - #define GFX_USE_GDRIVER GFXON - #endif - /** - * @brief GFX Graphics Display Basic API - * @details Defaults to GFXOFF - * @note Also add the specific hardware driver to your makefile. - * Eg. include $(GFXLIB)/drivers/gdisp/Nokia6610/driver.mk - */ - #ifndef GFX_USE_GDISP - #define GFX_USE_GDISP GFXOFF - #endif - /** - * @brief GFX Graphics Windowing API - * @details Defaults to GFXOFF - * @details Extends the GDISP API to add the concept of graphic windows. - * @note Also supports high-level "window" objects such as console windows, - * buttons, graphing etc - */ - #ifndef GFX_USE_GWIN - #define GFX_USE_GWIN GFXOFF - #endif - /** - * @brief GFX Event API - * @details Defaults to GFXOFF - * @details Defines the concept of a "Source" that can send "Events" to "Listeners". - */ - #ifndef GFX_USE_GEVENT - #define GFX_USE_GEVENT GFXOFF - #endif - /** - * @brief GFX Timer API - * @details Defaults to GFXOFF - * @details Provides thread context timers - both one-shot and periodic. - */ - #ifndef GFX_USE_GTIMER - #define GFX_USE_GTIMER GFXOFF - #endif - /** - * @brief GFX Queue API - * @details Defaults to GFXOFF - * @details Provides queue management. - */ - #ifndef GFX_USE_GQUEUE - #define GFX_USE_GQUEUE GFXOFF - #endif - /** - * @brief GFX Input Device API - * @details Defaults to GFXOFF - * @note Also add the specific hardware drivers to your makefile. - * Eg. - * include $(GFXLIB)/drivers/ginput/toggle/Pal/driver.mk - * and... - * include $(GFXLIB)/drivers/ginput/touch/MCU/driver.mk - */ - #ifndef GFX_USE_GINPUT - #define GFX_USE_GINPUT GFXOFF - #endif - /** - * @brief GFX Generic Periodic ADC API - * @details Defaults to GFXOFF - */ - #ifndef GFX_USE_GADC - #define GFX_USE_GADC GFXOFF - #endif - /** - * @brief GFX Audio API - * @details Defaults to GFXOFF - * @note Also add the specific hardware drivers to your makefile. - * Eg. - * include $(GFXLIB)/drivers/gaudio/GADC/driver.mk - */ - #ifndef GFX_USE_GAUDIO - #define GFX_USE_GAUDIO GFXOFF - #endif - /** - * @brief GFX Miscellaneous Routines API - * @details Defaults to GFXOFF - * @note Turning this on without turning on any GMISC_NEED_xxx macros will result - * in no extra code being compiled in. GMISC is made up from the sum of its - * parts. - */ - #ifndef GFX_USE_GMISC - #define GFX_USE_GMISC GFXOFF - #endif - /** - * @brief GFX File API - * @details Defaults to GFXOFF - */ - #ifndef GFX_USE_GFILE - #define GFX_USE_GFILE GFXOFF - #endif - /** - * @brief GFX Translation Support API - * @details Defaults to GFXOFF - */ - #ifndef GFX_USE_GTRANS - #define GFX_USE_GTRANS GFXOFF - #endif -/** @} */ - -/** - * @name GFX compatibility options - * @{ - */ - /** - * @brief Include the uGFX V2.x Old Colors - * @details Defaults to GFXON - * @pre Requires GFX_COMPAT_V2 to be GFXON - * @note The old color definitions (particularly Red, Green & Blue) can - * cause symbol conflicts with many platforms eg Win32, STM32 HAL etc. - * Although officially these symbols are part of the V2.x API, this - * option allows them to be turned off even when the rest of the V2.x - * API is turned on. - */ - #ifndef GFX_COMPAT_OLDCOLORS - #define GFX_COMPAT_OLDCOLORS GFXON - #endif -/** @} */ - -/** - * Get all the options for each sub-system. - * - */ -#include "src/gos/gos_options.h" -#include "src/gdriver/gdriver_options.h" -#include "src/gfile/gfile_options.h" -#include "src/gmisc/gmisc_options.h" -#include "src/gtrans/gtrans_options.h" -#include "src/gqueue/gqueue_options.h" -#include "src/gevent/gevent_options.h" -#include "src/gtimer/gtimer_options.h" -#include "src/gdisp/gdisp_options.h" -#include "src/gwin/gwin_options.h" -#include "src/ginput/ginput_options.h" -#include "src/gadc/gadc_options.h" -#include "src/gaudio/gaudio_options.h" - -// ------------------------------ Load driver configuration --------------------------------- - -// ------------------------------ Apply configuration rules --------------------------------- - -/** - * Interdependency safety checks on the sub-systems. - * These must be in dependency order. - * - */ -#ifndef GFX_DISPLAY_RULE_WARNINGS - #define GFX_DISPLAY_RULE_WARNINGS GFXOFF -#endif -#include "src/gwin/gwin_rules.h" -#include "src/ginput/ginput_rules.h" -#include "src/gdisp/gdisp_rules.h" -#include "src/gaudio/gaudio_rules.h" -#include "src/gadc/gadc_rules.h" -#include "src/gevent/gevent_rules.h" -#include "src/gtimer/gtimer_rules.h" -#include "src/gqueue/gqueue_rules.h" -#include "src/gmisc/gmisc_rules.h" -#include "src/gtrans/gtrans_rules.h" -#include "src/gfile/gfile_rules.h" -#include "src/gdriver/gdriver_rules.h" -#include "src/gos/gos_rules.h" - -// ------------------------------ Define API definitions --------------------------------- - -/** - * Include the sub-system header files - */ -#include "src/gos/gos.h" -//#include "src/gdriver/gdriver.h" // This module is only included by source that needs it. -#include "src/gfile/gfile.h" -#include "src/gmisc/gmisc.h" -#include "src/gtrans/gtrans.h" -#include "src/gqueue/gqueue.h" -#include "src/gevent/gevent.h" -#include "src/gtimer/gtimer.h" -#include "src/gdisp/gdisp.h" -#include "src/gwin/gwin.h" -#include "src/ginput/ginput.h" -#include "src/gadc/gadc.h" -#include "src/gaudio/gaudio.h" - -/** - * @brief The one call to start it all - * - * @note This will initialise each sub-system that has been turned on. - * For example, if GFX_USE_GDISP is defined then display will be initialised - * and cleared to black. - * @note If you define GFX_OS_NO_INIT as GFXON in your gfxconf.h file then ugfx doesn't try to - * initialise the operating system for you when you call @p gfxInit(). - * @note If you define GFX_OS_EXTRA_INIT_FUNCTION in your gfxconf.h file the macro is the - * name of a void function with no parameters that is called immediately after - * operating system initialisation (whether or not GFX_OS_NO_INIT is set). - * @note If you define GFX_OS_EXTRA_DEINIT_FUNCTION in your gfxconf.h file the macro is the - * name of a void function with no parameters that is called immediately before - * operating system de-initialisation (as ugfx is exiting). - * @note If GFX_OS_CALL_UGFXMAIN is set uGFXMain() is called after all initialisation is complete. - * - * @api - */ -void gfxInit(void); - -/** - * @brief The one call to end it all - * - * @note This will de-initialise each sub-system that has been turned on. - * - * @api - */ -void gfxDeinit(void); - -#if GFX_OS_CALL_UGFXMAIN || defined(__DOXYGEN__) - /** - * @brief The function containing all the user uGFX application code. - * - * @note This is called by gfxInit() and is expected to never return. - * It is defined by the user. - * - * @pre GFX_OS_CALL_UGFXMAIN is GFXON - */ - void uGFXMain(void); -#endif - -#ifdef __cplusplus -} -#endif -#endif /* _GFX_H */ -/** @} */ - +#include "src/gfx.h" diff --git a/src/gadc/gadc.c b/src/gadc/gadc.c index 32a30930..8e8553df 100644 --- a/src/gadc/gadc.c +++ b/src/gadc/gadc.c @@ -214,7 +214,7 @@ void gadcHighSpeedInit(uint32_t physdev, uint32_t frequency) #if GFX_USE_GEVENT GSourceHandle gadcHighSpeedGetSource(void) { if (!gtimerIsActive(&hsGTimer)) - gtimerStart(&hsGTimer, HighSpeedGTimerCallback, 0, TRUE, TIME_INFINITE); + gtimerStart(&hsGTimer, HighSpeedGTimerCallback, 0, gTrue, TIME_INFINITE); hsFlags |= GADC_HSADC_GTIMER; return (GSourceHandle)&hsGTimer; } @@ -319,16 +319,16 @@ void gadcLowSpeedGet(uint32_t physdev, adcsample_t *buffer) { gfxSemDestroy(&ndata.sigdone); } -bool_t gadcLowSpeedStart(uint32_t physdev, adcsample_t *buffer, GADCCallbackFunction fn, void *param) { +gBool gadcLowSpeedStart(uint32_t physdev, adcsample_t *buffer, GADCCallbackFunction fn, void *param) { NonTimerData *pdata; /* Start the Low Speed Timer */ if (!gtimerIsActive(&lsGTimer)) - gtimerStart(&lsGTimer, LowSpeedGTimerCallback, 0, TRUE, TIME_INFINITE); + gtimerStart(&lsGTimer, LowSpeedGTimerCallback, 0, gTrue, TIME_INFINITE); // Prepare the job if (!(pdata = gfxAlloc(sizeof(NonTimerData)))) - return FALSE; + return gFalse; pdata->job.physdev = physdev; pdata->job.buffer = buffer; pdata->callback = fn; @@ -347,7 +347,7 @@ bool_t gadcLowSpeedStart(uint32_t physdev, adcsample_t *buffer, GADCCallbackFunc gfxQueueGSyncPutI(&lsListToDo, (gfxQueueGSyncItem *)pdata); } gfxSystemUnlock(); - return TRUE; + return gTrue; } #endif /* GFX_USE_GADC */ diff --git a/src/gadc/gadc.h b/src/gadc/gadc.h index 94321192..3e995db6 100644 --- a/src/gadc/gadc.h +++ b/src/gadc/gadc.h @@ -94,10 +94,6 @@ typedef void (*GADCISRCallbackFunction)(void); /* External declarations. */ /*===========================================================================*/ -#ifdef __cplusplus -extern "C" { -#endif - /** * @brief Initialise the high speed ADC. * @details Initialises but does not start the conversions. @@ -219,14 +215,14 @@ void gadcLowSpeedGet(uint32_t physdev, adcsample_t *buffer); /** * @brief Perform a low speed ADC conversion with callback (in a thread context) - * @details Returns FALSE if internal memory allocation fails + * @details Returns gFalse if internal memory allocation fails * * @param[in] physdev A value passed to describe which physical ADC devices/channels to use. * @param[in] buffer The static buffer to put the ADC samples into. * @param[in] fn The callback function to call when the conversion is complete. * @param[in] param A parameter to pass to the callback function. * - * @return FALSE if no free low speed ADC slots. + * @return gFalse if no free low speed ADC slots. * * @note This may be safely called from within a GTimer callback. * @note The callback may take a while to occur if the high speed ADC is running as the @@ -240,11 +236,7 @@ void gadcLowSpeedGet(uint32_t physdev, adcsample_t *buffer); * * @api */ -bool_t gadcLowSpeedStart(uint32_t physdev, adcsample_t *buffer, GADCCallbackFunction fn, void *param); - -#ifdef __cplusplus -} -#endif +gBool gadcLowSpeedStart(uint32_t physdev, adcsample_t *buffer, GADCCallbackFunction fn, void *param); #endif /* GFX_USE_GADC */ diff --git a/src/gaudio/gaudio.c b/src/gaudio/gaudio.c index a9f20357..8311d8cb 100644 --- a/src/gaudio/gaudio.c +++ b/src/gaudio/gaudio.c @@ -76,13 +76,13 @@ void _gaudioDeinit(void) #if GAUDIO_NEED_PLAY - bool_t gaudioPlayInit(uint16_t channel, uint32_t frequency, ArrayDataFormat format) { + gBool gaudioPlayInit(uint16_t channel, uint32_t frequency, ArrayDataFormat format) { gaudioPlayStop(); playFlags &= ~PLAYFLG_ISINIT; if (!gaudio_play_lld_init(channel, frequency, format)) - return FALSE; + return gFalse; playFlags |= PLAYFLG_ISINIT; - return TRUE; + return gTrue; } void gaudioPlay(GDataBuffer *pd) { @@ -115,13 +115,13 @@ void _gaudioDeinit(void) gfxBufferRelease(pd); } - bool_t gaudioPlaySetVolume(uint8_t vol) { + gBool gaudioPlaySetVolume(uint8_t vol) { return gaudio_play_lld_set_volume(vol); } - bool_t gaudioPlayWait(delaytime_t ms) { + gBool gaudioPlayWait(delaytime_t ms) { if (!(playFlags & PLAYFLG_PLAYING)) - return TRUE; + return gTrue; return gfxSemWait(&playComplete, ms); } @@ -152,7 +152,7 @@ void _gaudioDeinit(void) GSourceHandle gaudioPlayGetSource(void) { if (!gtimerIsActive(&playTimer)) - gtimerStart(&playTimer, PlayTimerCallback, 0, TRUE, TIME_INFINITE); + gtimerStart(&playTimer, PlayTimerCallback, 0, gTrue, TIME_INFINITE); playFlags |= PLAYFLG_USEEVENTS; return (GSourceHandle)&playTimer; } @@ -185,13 +185,13 @@ void _gaudioDeinit(void) #endif #if GAUDIO_NEED_RECORD - bool_t gaudioRecordInit(uint16_t channel, uint32_t frequency, ArrayDataFormat format) { + gBool gaudioRecordInit(uint16_t channel, uint32_t frequency, ArrayDataFormat format) { gaudioRecordStop(); recordFlags &= ~RECORDFLG_ISINIT; if (!gaudio_record_lld_init(channel, frequency, format)) - return FALSE; + return gFalse; recordFlags |= RECORDFLG_ISINIT; - return TRUE; + return gTrue; } void gaudioRecordStart(void) { @@ -245,7 +245,7 @@ void _gaudioDeinit(void) GSourceHandle gaudioRecordGetSource(void) { if (!gtimerIsActive(&recordTimer)) - gtimerStart(&recordTimer, RecordTimerCallback, 0, TRUE, TIME_INFINITE); + gtimerStart(&recordTimer, RecordTimerCallback, 0, gTrue, TIME_INFINITE); recordFlags |= RECORDFLG_USEEVENTS; return (GSourceHandle)&recordTimer; } diff --git a/src/gaudio/gaudio.h b/src/gaudio/gaudio.h index 7473373c..a318bab5 100644 --- a/src/gaudio/gaudio.h +++ b/src/gaudio/gaudio.h @@ -93,15 +93,11 @@ /* External declarations. */ /*===========================================================================*/ -#ifdef __cplusplus -extern "C" { -#endif - #if GAUDIO_NEED_PLAY || defined(__DOXYGEN__) /** * @brief Set the audio device to play on the specified channel and with the specified * sample frequency. - * @return TRUE is successful, FALSE if the driver doesn't accept those parameters. + * @return gTrue is successful, gFalse if the driver doesn't accept those parameters. * * @param[in] channel The audio output channel to use. Can be set from 0 to GAUDIO_PLAY_NUM_CHANNELS - 1 * @param[in] frequency The audio sample rate in samples per second @@ -114,7 +110,7 @@ extern "C" { * * @api */ - bool_t gaudioPlayInit(uint16_t channel, uint32_t frequency, ArrayDataFormat format); + gBool gaudioPlayInit(uint16_t channel, uint32_t frequency, ArrayDataFormat format); /** * @brief Play the specified sample data. @@ -159,16 +155,16 @@ extern "C" { /** * @brief Set the output volume. - * @return TRUE if successful. + * @return gTrue if successful. * * @param[in] vol 0->255 (0 = muted) * - * @note Some drivers may not support this. They will return FALSE. + * @note Some drivers may not support this. They will return gFalse. * @note For stereo devices, both channels are set to the same volume. * * @api */ - bool_t gaudioPlaySetVolume(uint8_t vol); + gBool gaudioPlaySetVolume(uint8_t vol); #if GFX_USE_GEVENT || defined(__DOXYGEN__) /** @@ -191,19 +187,19 @@ extern "C" { /** * @brief Wait for any currently playing sounds to complete - * @return TRUE if there is now nothing playing or FALSE if the timeout is exceeded + * @return gTrue if there is now nothing playing or gFalse if the timeout is exceeded * * @param[in] ms The maximum amount of time in milliseconds to wait for playing to complete. * * @api */ - bool_t gaudioPlayWait(delaytime_t ms); + gBool gaudioPlayWait(delaytime_t ms); #endif #if GAUDIO_NEED_RECORD || defined(__DOXYGEN__) /** * @brief Initialise (but not start) the Audio Recording sub-system. - * @details Returns FALSE for an invalid channel or other invalid parameter. + * @details Returns gFalse for an invalid channel or other invalid parameter. * * @param[in] channel The channel to convert. Can be set from 0 to GAUDIO_RECORD_NUM_CHANNELS - 1 * @param[in] frequency The sample frequency @@ -225,11 +221,11 @@ extern "C" { * Make sure you allocate your buffers large enough. Each channel is then interleaved * into the provided buffer. * - * @return FALSE if invalid channel or parameter + * @return gFalse if invalid channel or parameter * * @api */ - bool_t gaudioRecordInit(uint16_t channel, uint32_t frequency, ArrayDataFormat format); + gBool gaudioRecordInit(uint16_t channel, uint32_t frequency, ArrayDataFormat format); /** * @brief Start the audio recording. @@ -286,10 +282,6 @@ extern "C" { #endif #endif -#ifdef __cplusplus -} -#endif - #endif /* GFX_USE_GAUDIO */ #endif /* _GAUDIO_H */ diff --git a/src/gaudio/gaudio_driver_play.h b/src/gaudio/gaudio_driver_play.h index 622769f1..69e194c7 100644 --- a/src/gaudio/gaudio_driver_play.h +++ b/src/gaudio/gaudio_driver_play.h @@ -71,7 +71,7 @@ void gaudioPlayDoneI(void); /** * @brief Initialise the play driver - * @return TRUE if the channel, frequency and format are valid. + * @return gTrue if the channel, frequency and format are valid. * * @param[in] channel The channel to use (see the driver for the available channels provided) * @param[in] frequency The sample frequency to use @@ -81,7 +81,7 @@ void gaudioPlayDoneI(void); * * @api */ -bool_t gaudio_play_lld_init(uint16_t channel, uint32_t frequency, ArrayDataFormat format); +gBool gaudio_play_lld_init(uint16_t channel, uint32_t frequency, ArrayDataFormat format); /** * @brief Start the audio output playing @@ -108,16 +108,16 @@ void gaudio_play_lld_stop(void); /** * @brief Set the output volume. - * @return TRUE if successful. + * @return gTrue if successful. * * @param[in] vol 0->255 (0 = muted) * - * @note Some drivers may not support this. They will return FALSE. + * @note Some drivers may not support this. They will return gFalse. * @note For stereo devices, both channels are set to the same volume. * * @api */ -bool_t gaudio_play_lld_set_volume(uint8_t vol); +gBool gaudio_play_lld_set_volume(uint8_t vol); #ifdef __cplusplus } diff --git a/src/gaudio/gaudio_driver_record.h b/src/gaudio/gaudio_driver_record.h index 5cbe4532..f7db3d14 100644 --- a/src/gaudio/gaudio_driver_record.h +++ b/src/gaudio/gaudio_driver_record.h @@ -71,7 +71,7 @@ extern "C" { /** * @brief Initialise the record driver - * @return TRUE if the channel, frequency and format are valid. + * @return gTrue if the channel, frequency and format are valid. * * @param[in] channel The channel to use (see the driver for the available channels provided) * @param[in] frequency The sample frequency to use @@ -81,7 +81,7 @@ extern "C" { * * @api */ -bool_t gaudio_record_lld_init(uint16_t channel, uint32_t frequency, ArrayDataFormat format); +gBool gaudio_record_lld_init(uint16_t channel, uint32_t frequency, ArrayDataFormat format); /** * @brief Start the audio recording diff --git a/src/gdisp/gdisp.c b/src/gdisp/gdisp.c index f1df787a..38edda9c 100644 --- a/src/gdisp/gdisp.c +++ b/src/gdisp/gdisp.c @@ -501,7 +501,7 @@ static void line_clip(GDisplay *g) { } #if GDISP_STARTUP_LOGO_TIMEOUT > 0 - static bool_t gdispInitDone; + static gBool gdispInitDone; static void StartupLogoDisplay(GDisplay *g) { coord_t x, y, w; const coord_t * p; @@ -604,14 +604,14 @@ void _gdispInit(void) #endif } - gdispInitDone = TRUE; + gdispInitDone = gTrue; } #endif // Start the automatic timer flush (if required) #if GDISP_NEED_TIMERFLUSH gtimerInit(&FlushTimer); - gtimerStart(&FlushTimer, FlushTimerFn, 0, TRUE, GDISP_NEED_TIMERFLUSH); + gtimerStart(&FlushTimer, FlushTimerFn, 0, gTrue, GDISP_NEED_TIMERFLUSH); #endif } @@ -620,9 +620,9 @@ void _gdispDeinit(void) /* ToDo */ } -bool_t _gdispInitDriver(GDriver *g, void *param, unsigned driverinstance, unsigned systeminstance) { +gBool _gdispInitDriver(GDriver *g, void *param, unsigned driverinstance, unsigned systeminstance) { #define gd ((GDisplay *)g) - bool_t ret; + gBool ret; // Intialise fields gd->systemdisplay = systeminstance; @@ -3150,7 +3150,7 @@ void gdispGDrawBox(GDisplay *g, coord_t x, coord_t y, coord_t cx, coord_t cy, co return; } - void gdispGDrawThickLine(GDisplay *g, coord_t x0, coord_t y0, coord_t x1, coord_t y1, color_t color, coord_t width, bool_t round) { + void gdispGDrawThickLine(GDisplay *g, coord_t x0, coord_t y0, coord_t x1, coord_t y1, color_t color, coord_t width, gBool round) { coord_t dx, dy, nx = 0, ny = 0; /* Compute the direction vector for the line */ @@ -3345,21 +3345,21 @@ void gdispGDrawBox(GDisplay *g, coord_t x, coord_t y, coord_t cx, coord_t cy, co (void) count; ((coord_t*)state)[0]++; - return TRUE; + return gTrue; } static bool mf_drawline_callback(mf_str line, uint16_t count, void *state) { #define GD ((GDisplay *)state) mf_render_aligned(GD->t.font, GD->t.wrapx, GD->t.wrapy, GD->t.lrj, line, count, drawcharglyph, state); GD->t.wrapy += GD->t.font->line_height; #undef GD - return TRUE; + return gTrue; } static bool mf_fillline_callback(mf_str line, uint16_t count, void *state) { #define GD ((GDisplay *)state) mf_render_aligned(GD->t.font, GD->t.wrapx, GD->t.wrapy, GD->t.lrj, line, count, fillcharglyph, state); GD->t.wrapy += GD->t.font->line_height; #undef GD - return TRUE; + return gTrue; } #endif @@ -3638,9 +3638,9 @@ void gdispGDrawBox(GDisplay *g, coord_t x, coord_t y, coord_t cx, coord_t cy, co // No mutex required as we only read static data #if GDISP_NEED_TEXT_KERNING - return mf_get_string_width(font, str, count, TRUE); + return mf_get_string_width(font, str, count, gTrue); #else - return mf_get_string_width(font, str, count, FALSE); + return mf_get_string_width(font, str, count, gFalse); #endif } diff --git a/src/gdisp/gdisp.h b/src/gdisp/gdisp.h index 5bf2b284..587c3115 100644 --- a/src/gdisp/gdisp.h +++ b/src/gdisp/gdisp.h @@ -225,10 +225,6 @@ extern GDisplay *GDISP; */ typedef color_t pixel_t; -#ifdef __cplusplus -extern "C" { -#endif - /* Color Utility Functions */ /** @@ -445,7 +441,7 @@ void gdispGFillArea(GDisplay *g, coord_t x, coord_t y, coord_t cx, coord_t cy, c * non-byte boundary (no end-of-line padding). * @note If GDISP_NEED_ASYNC is defined then the buffer must be static * or at least retained until this call has finished the blit. You can - * tell when all graphics drawing is finished by @p gdispIsBusy() going FALSE. + * tell when all graphics drawing is finished by @p gdispIsBusy() going gFalse. * * @param[in] g The display to use * @param[in] x,y The start position @@ -902,7 +898,7 @@ void gdispGDrawBox(GDisplay *g, coord_t x, coord_t y, coord_t cx, coord_t cy, co * * @api */ - void gdispGDrawThickLine(GDisplay *g, coord_t x0, coord_t y0, coord_t x1, coord_t y1, color_t color, coord_t width, bool_t round); + void gdispGDrawThickLine(GDisplay *g, coord_t x0, coord_t y0, coord_t x1, coord_t y1, color_t color, coord_t width, gBool round); #define gdispDrawThickLine(x0,y0,x1,y1,c,w,r) gdispGDrawThickLine(GDISP,x0,y0,x1,y1,c,w,r) #endif @@ -1109,14 +1105,14 @@ void gdispGDrawBox(GDisplay *g, coord_t x, coord_t y, coord_t cx, coord_t cy, co /** * @brief Add a font permanently to the font list. - * @returns TRUE on success. Reasons it may fail: out of memory, if it is already on the list, it is not a font loaded in RAM. + * @returns gTrue on success. Reasons it may fail: out of memory, if it is already on the list, it is not a font loaded in RAM. * @pre GDISP_NEED_TEXT must be GFXON in your gfxconf.h * * @param[in] font The font to add to the font list. * * @api */ - bool_t gdispAddFont(font_t font); + gBool gdispAddFont(font_t font); #endif /* Extra Arc Functions */ @@ -1225,10 +1221,6 @@ void gdispGDrawBox(GDisplay *g, coord_t x, coord_t y, coord_t cx, coord_t cy, co #define gdispGUnsetClip(g) gdispGSetClip((g),0,0,gdispGGetWidth(g),gdispGGetHeight(g)) #define gdispUnsetClip() gdispGUnsetClip(GDISP) -#ifdef __cplusplus -} -#endif - #if GDISP_NEED_IMAGE || defined(__DOXYGEN__) #include "gdisp_image.h" #endif diff --git a/src/gdisp/gdisp_driver.h b/src/gdisp/gdisp_driver.h index 14e019ff..dffce58d 100644 --- a/src/gdisp/gdisp_driver.h +++ b/src/gdisp/gdisp_driver.h @@ -383,7 +383,7 @@ typedef struct GDISPVMT { GDriverVMT d; #define GDISP_VFLG_DYNAMICONLY 0x0001 // This display should never be statically initialised #define GDISP_VFLG_PIXMAP 0x0002 // This is a pixmap display - bool_t (*init)(GDisplay *g); + gBool (*init)(GDisplay *g); void (*deinit)(GDisplay *g); void (*writestart)(GDisplay *g); // Uses p.x,p.y p.cx,p.cy void (*writepos)(GDisplay *g); // Uses p.x,p.y @@ -421,11 +421,11 @@ typedef struct GDISPVMT { /** * @brief Initialize the driver. - * @return TRUE if successful. + * @return gTrue if successful. * @param[in] g The driver structure * @param[out] g->g The driver must fill in the GDISPControl structure */ - LLDSPEC bool_t gdisp_lld_init(GDisplay *g); + LLDSPEC gBool gdisp_lld_init(GDisplay *g); #if GDISP_HARDWARE_DEINIT || defined(__DOXYGEN__) /** @@ -724,7 +724,7 @@ typedef struct GDISPVMT { #ifdef __cplusplus extern "C" { #endif - bool_t _gdispInitDriver(GDriver *g, void *param, unsigned driverinstance, unsigned systeminstance); + gBool _gdispInitDriver(GDriver *g, void *param, unsigned driverinstance, unsigned systeminstance); void _gdispPostInitDriver(GDriver *g); void _gdispDeInitDriver(GDriver *g); #ifdef __cplusplus diff --git a/src/gdisp/gdisp_fonts.c b/src/gdisp/gdisp_fonts.c index 36e8f73f..a217c4d9 100644 --- a/src/gdisp/gdisp_fonts.c +++ b/src/gdisp/gdisp_fonts.c @@ -19,7 +19,7 @@ static const struct mf_font_list_s *fontList; /** * Match a pattern against the font name. */ -static bool_t matchfont(const char *pattern, const char *name) { +static gBool matchfont(const char *pattern, const char *name) { while(1) { switch (pattern[0]) { case '*': @@ -34,7 +34,7 @@ static bool_t matchfont(const char *pattern, const char *name) { return name[0] == 0; default: if (name[0] != pattern[0]) - return FALSE; + return gFalse; pattern++; name++; break; @@ -90,14 +90,14 @@ const char *gdispGetFontName(font_t font) { return font->short_name; } -bool_t gdispAddFont(font_t font) { +gBool gdispAddFont(font_t font) { struct mf_font_list_s *hdr; if ((font->flags & (FONT_FLAG_DYNAMIC|FONT_FLAG_UNLISTED)) != (FONT_FLAG_DYNAMIC|FONT_FLAG_UNLISTED)) - return FALSE; + return gFalse; if (!(hdr = gfxAlloc(sizeof(struct mf_font_list_s)))) - return FALSE; + return gFalse; if (!fontList) fontList = mf_get_font_list(); @@ -105,7 +105,7 @@ bool_t gdispAddFont(font_t font) { hdr->next = fontList; ((struct mf_font_s *)font)->flags &= ~FONT_FLAG_UNLISTED; fontList = hdr; - return TRUE; + return gTrue; } #endif /* GFX_USE_GDISP && GDISP_NEED_TEXT */ diff --git a/src/gdisp/gdisp_image.c b/src/gdisp/gdisp_image.c index cc137209..ae6a1a77 100644 --- a/src/gdisp/gdisp_image.c +++ b/src/gdisp/gdisp_image.c @@ -35,7 +35,7 @@ extern delaytime_t gdispImageNext_BMP(gdispImage *img); extern uint16_t gdispImageGetPaletteSize_BMP(gdispImage *img); extern color_t gdispImageGetPalette_BMP(gdispImage *img, uint16_t index); - extern bool_t gdispImageAdjustPalette_BMP(gdispImage *img, uint16_t index, color_t newColor); + extern gBool gdispImageAdjustPalette_BMP(gdispImage *img, uint16_t index, color_t newColor); #endif #if GDISP_NEED_IMAGE_JPG @@ -67,7 +67,7 @@ typedef struct gdispImageHandlers { delaytime_t (*next)(gdispImage *img); /* The next frame function */ uint16_t (*getPaletteSize)(gdispImage *img); /* Retrieve the size of the palette (number of entries) */ color_t (*getPalette)(gdispImage *img, uint16_t index); /* Retrieve a specific color value of the palette */ - bool_t (*adjustPalette)(gdispImage *img, uint16_t index, color_t newColor); /* Replace a color value in the palette */ + gBool (*adjustPalette)(gdispImage *img, uint16_t index, color_t newColor); /* Replace a color value in the palette */ } gdispImageHandlers; static gdispImageHandlers ImageHandlers[] = { @@ -154,7 +154,7 @@ void gdispImageClose(gdispImage *img) { img->priv = 0; } -bool_t gdispImageIsOpen(gdispImage *img) { +gBool gdispImageIsOpen(gdispImage *img) { return img && img->type != GDISP_IMAGE_TYPE_UNKNOWN && img->fns != 0; } @@ -204,9 +204,9 @@ color_t gdispImageGetPalette(gdispImage *img, uint16_t index) { return img->fns->getPalette(img, index); } -bool_t gdispImageAdjustPalette(gdispImage *img, uint16_t index, color_t newColor) { - if (!img || !img->fns) return FALSE; - if (!img->fns->adjustPalette) return FALSE; +gBool gdispImageAdjustPalette(gdispImage *img, uint16_t index, color_t newColor) { + if (!img || !img->fns) return gFalse; + if (!img->fns->adjustPalette) return gFalse; return img->fns->adjustPalette(img, index, newColor); } diff --git a/src/gdisp/gdisp_image.h b/src/gdisp/gdisp_image.h index 4cd348cf..99391850 100644 --- a/src/gdisp/gdisp_image.h +++ b/src/gdisp/gdisp_image.h @@ -70,224 +70,216 @@ typedef struct gdispImage { void * priv; /* @< Don't mess with this! */ } gdispImage; -#ifdef __cplusplus -extern "C" { -#endif +/** + * @brief Initialise a gdispImage object + * + * @param[in] img The image structure to initialise + * + */ +void gdispImageInit(gdispImage *img); - /** - * @brief Initialise a gdispImage object - * - * @param[in] img The image structure to initialise - * - */ - void gdispImageInit(gdispImage *img); +/** + * @brief Open an image using an open GFILE and get it ready for drawing + * @details Determine the image format and get ready to decode the first image frame + * @return GDISP_IMAGE_ERR_OK (0) on success or an error code. + * + * @param[in] img The image structure + * @param[in] f The open GFILE stream. + * + * @pre The GFILE must be open for reading. + * + * @note This determines which decoder to use and then initialises all other fields + * in the gdispImage structure. + * @note The image background color is set to White. + * @note There are three types of return - everything OK, partial success and unrecoverable + * failures. For everything OK it returns GDISP_IMAGE_ERR_OK. A partial success can + * be distinguished from a unrecoverable failure by testing the GDISP_IMAGE_ERR_UNRECOVERABLE + * bit in the error code. + * A partial success return code means an image can still be drawn but perhaps with + * reduced functionality eg only the first page of a multi-page image. + * @note @p gdispImageClose() should be called when finished with the image. This will close + * the image and its underlying GFILE file. Note that images opened with partial success + * (eg GDISP_IMAGE_ERR_UNSUPPORTED_OK) + * still need to be closed when you are finished with them. + */ +gdispImageError gdispImageOpenGFile(gdispImage *img, GFILE *f); - /** - * @brief Open an image using an open GFILE and get it ready for drawing - * @details Determine the image format and get ready to decode the first image frame - * @return GDISP_IMAGE_ERR_OK (0) on success or an error code. - * - * @param[in] img The image structure - * @param[in] f The open GFILE stream. - * - * @pre The GFILE must be open for reading. - * - * @note This determines which decoder to use and then initialises all other fields - * in the gdispImage structure. - * @note The image background color is set to White. - * @note There are three types of return - everything OK, partial success and unrecoverable - * failures. For everything OK it returns GDISP_IMAGE_ERR_OK. A partial success can - * be distinguished from a unrecoverable failure by testing the GDISP_IMAGE_ERR_UNRECOVERABLE - * bit in the error code. - * A partial success return code means an image can still be drawn but perhaps with - * reduced functionality eg only the first page of a multi-page image. - * @note @p gdispImageClose() should be called when finished with the image. This will close - * the image and its underlying GFILE file. Note that images opened with partial success - * (eg GDISP_IMAGE_ERR_UNSUPPORTED_OK) - * still need to be closed when you are finished with them. - */ - gdispImageError gdispImageOpenGFile(gdispImage *img, GFILE *f); +/** + * @brief Open an image in a file and get it ready for drawing + * @details Determine the image format and get ready to decode the first image frame + * @return GDISP_IMAGE_ERR_OK (0) on success or an error code. + * + * @pre You must have included the file-system support into GFILE that you want to use. + * + * @param[in] img The image structure + * @param[in] filename The filename to open + * + * @note This function just opens the GFILE using the filename and passes it to @p gdispImageOpenGFile(). + */ +#define gdispImageOpenFile(img, filename) gdispImageOpenGFile((img), gfileOpen((filename), "rb")) - /** - * @brief Open an image in a file and get it ready for drawing - * @details Determine the image format and get ready to decode the first image frame - * @return GDISP_IMAGE_ERR_OK (0) on success or an error code. - * - * @pre You must have included the file-system support into GFILE that you want to use. - * - * @param[in] img The image structure - * @param[in] filename The filename to open - * - * @note This function just opens the GFILE using the filename and passes it to @p gdispImageOpenGFile(). - */ - #define gdispImageOpenFile(img, filename) gdispImageOpenGFile((img), gfileOpen((filename), "rb")) +/** + * @brief Open an image in a ChibiOS basefilestream and get it ready for drawing + * @details Determine the image format and get ready to decode the first image frame + * @return GDISP_IMAGE_ERR_OK (0) on success or an error code. + * + * @pre GFILE_NEED_CHIBIOSFS and GFX_USE_OS_CHIBIOS must be GFXON. This only makes sense on the ChibiOS + * operating system. + * + * @param[in] img The image structure + * @param[in] BaseFileStreamPtr A pointer to an open BaseFileStream + * + * @note This function just opens the GFILE using the basefilestream and passes it to @p gdispImageOpenGFile(). + */ +#define gdispImageOpenBaseFileStream(img, BaseFileStreamPtr) gdispImageOpenGFile((img), gfileOpenBaseFileStream((BaseFileStreamPtr), "rb")) - /** - * @brief Open an image in a ChibiOS basefilestream and get it ready for drawing - * @details Determine the image format and get ready to decode the first image frame - * @return GDISP_IMAGE_ERR_OK (0) on success or an error code. - * - * @pre GFILE_NEED_CHIBIOSFS and GFX_USE_OS_CHIBIOS must be GFXON. This only makes sense on the ChibiOS - * operating system. - * - * @param[in] img The image structure - * @param[in] BaseFileStreamPtr A pointer to an open BaseFileStream - * - * @note This function just opens the GFILE using the basefilestream and passes it to @p gdispImageOpenGFile(). - */ - #define gdispImageOpenBaseFileStream(img, BaseFileStreamPtr) gdispImageOpenGFile((img), gfileOpenBaseFileStream((BaseFileStreamPtr), "rb")) +/** + * @brief Open an image in memory and get it ready for drawing + * @details Determine the image format and get ready to decode the first image frame + * @return GDISP_IMAGE_ERR_OK (0) on success or an error code. + * + * @pre GFILE_NEED_MEMFS must be GFXON + * + * @param[in] img The image structure + * @param[in] ptr A pointer to the image bytes in memory + * + * @note This function just opens the GFILE using the basefilestream and passes it to @p gdispImageOpenGFile(). + */ +#define gdispImageOpenMemory(img, ptr) gdispImageOpenGFile((img), gfileOpenMemory((void *)(ptr), "rb")) - /** - * @brief Open an image in memory and get it ready for drawing - * @details Determine the image format and get ready to decode the first image frame - * @return GDISP_IMAGE_ERR_OK (0) on success or an error code. - * - * @pre GFILE_NEED_MEMFS must be GFXON - * - * @param[in] img The image structure - * @param[in] ptr A pointer to the image bytes in memory - * - * @note This function just opens the GFILE using the basefilestream and passes it to @p gdispImageOpenGFile(). - */ - #define gdispImageOpenMemory(img, ptr) gdispImageOpenGFile((img), gfileOpenMemory((void *)(ptr), "rb")) +/** + * @brief Close an image and release any dynamically allocated working storage. + * + * @param[in] img The image structure + * + * @pre gdispImageOpenFile() must have returned successfully. + * + * @note Also calls the IO close function (if it hasn't already been called). + */ +void gdispImageClose(gdispImage *img); - /** - * @brief Close an image and release any dynamically allocated working storage. - * - * @param[in] img The image structure - * - * @pre gdispImageOpenFile() must have returned successfully. - * - * @note Also calls the IO close function (if it hasn't already been called). - */ - void gdispImageClose(gdispImage *img); +/** + * @brief Is an image open. + * @return gTrue if the image is currently open. + * + * @param[in] img The image structure + * + * @note Be careful with calling this on an uninitialized image structure as the image + * will contain random data which may be interpreted as meaning the image + * is open. Clearing the Image structure to 0's will guarantee the image + * is seen as being closed. + */ +gBool gdispImageIsOpen(gdispImage *img); - /** - * @brief Is an image open. - * @return TRUE if the image is currently open. - * - * @param[in] img The image structure - * - * @note Be careful with calling this on an uninitialized image structure as the image - * will contain random data which may be interpreted as meaning the image - * is open. Clearing the Image structure to 0's will guarantee the image - * is seen as being closed. - */ - bool_t gdispImageIsOpen(gdispImage *img); +/** + * @brief Set the background color of the image. + * + * @param[in] img The image structure + * @param[in] bgcolor The background color to use + * + * @pre gdispImageOpen() must have returned successfully. + * + * @note This color is only used when an image has to restore part of the background before + * continuing with drawing that includes transparency eg some GIF animations. + */ +void gdispImageSetBgColor(gdispImage *img, color_t bgcolor); - /** - * @brief Set the background color of the image. - * - * @param[in] img The image structure - * @param[in] bgcolor The background color to use - * - * @pre gdispImageOpen() must have returned successfully. - * - * @note This color is only used when an image has to restore part of the background before - * continuing with drawing that includes transparency eg some GIF animations. - */ - void gdispImageSetBgColor(gdispImage *img, color_t bgcolor); +/** + * @brief Cache the image + * @details Decodes and caches the current frame into RAM. + * @return GDISP_IMAGE_ERR_OK (0) on success or an error code. + * + * @param[in] img The image structure + * + * @pre gdispImageOpen() must have returned successfully. + * + * @note This can use a LOT of RAM! + * @note The decoder may choose to ignore the request for caching. If it does so it will + * return GDISP_IMAGE_ERR_UNSUPPORTED_OK. + * @note A fatal error here does not necessarily mean that drawing the image will fail. For + * example, a GDISP_IMAGE_ERR_NOMEMORY error simply means there isn't enough RAM to + * cache the image. + */ +gdispImageError gdispImageCache(gdispImage *img); - /** - * @brief Cache the image - * @details Decodes and caches the current frame into RAM. - * @return GDISP_IMAGE_ERR_OK (0) on success or an error code. - * - * @param[in] img The image structure - * - * @pre gdispImageOpen() must have returned successfully. - * - * @note This can use a LOT of RAM! - * @note The decoder may choose to ignore the request for caching. If it does so it will - * return GDISP_IMAGE_ERR_UNSUPPORTED_OK. - * @note A fatal error here does not necessarily mean that drawing the image will fail. For - * example, a GDISP_IMAGE_ERR_NOMEMORY error simply means there isn't enough RAM to - * cache the image. - */ - gdispImageError gdispImageCache(gdispImage *img); +/** + * @brief Draw the image + * @return GDISP_IMAGE_ERR_OK (0) on success or an error code. + * + * @param[in] g The display to draw on + * @param[in] img The image structure + * @param[in] x,y The screen location to draw the image + * @param[in] cx,cy The area on the screen to draw + * @param[in] sx,sy The image position to start drawing at + * + * @pre gdispImageOpen() must have returned successfully. + * + * @note If sx,sy + cx,cy is outside the image boundaries the area outside the image + * is simply not drawn. + * @note If @p gdispImageCache() has been called first for this frame, this routine will draw using a + * fast blit from the cached frame. If not, it reads the input and decodes it as it + * is drawing. This may be significantly slower than if the image has been cached (but + * uses a lot less RAM) + */ +gdispImageError gdispGImageDraw(GDisplay *g, gdispImage *img, coord_t x, coord_t y, coord_t cx, coord_t cy, coord_t sx, coord_t sy); +#define gdispImageDraw(img,x,y,cx,cy,sx,sy) gdispGImageDraw(GDISP,img,x,y,cx,cy,sx,sy) - /** - * @brief Draw the image - * @return GDISP_IMAGE_ERR_OK (0) on success or an error code. - * - * @param[in] g The display to draw on - * @param[in] img The image structure - * @param[in] x,y The screen location to draw the image - * @param[in] cx,cy The area on the screen to draw - * @param[in] sx,sy The image position to start drawing at - * - * @pre gdispImageOpen() must have returned successfully. - * - * @note If sx,sy + cx,cy is outside the image boundaries the area outside the image - * is simply not drawn. - * @note If @p gdispImageCache() has been called first for this frame, this routine will draw using a - * fast blit from the cached frame. If not, it reads the input and decodes it as it - * is drawing. This may be significantly slower than if the image has been cached (but - * uses a lot less RAM) - */ - gdispImageError gdispGImageDraw(GDisplay *g, gdispImage *img, coord_t x, coord_t y, coord_t cx, coord_t cy, coord_t sx, coord_t sy); - #define gdispImageDraw(img,x,y,cx,cy,sx,sy) gdispGImageDraw(GDISP,img,x,y,cx,cy,sx,sy) +/** + * @brief Prepare for the next frame/page in the image file. + * @return A time in milliseconds to keep displaying the current frame before trying to draw + * the next frame. Watch out for the special values TIME_IMMEDIATE and TIME_INFINITE. + * + * @param[in] img The image structure + * + * @pre gdispImageOpen() must have returned successfully. + * + * @note It will return TIME_IMMEDIATE if the first frame/page hasn't been drawn or if the next frame + * should be drawn immediately. + * @note It will return TIME_INFINITE if another image frame doesn't exist or an error has occurred. + * @note Images that support multiple pages (eg TIFF files) will return TIME_IMMEDIATE between pages + * and then TIME_INFINITE when there are no more pages. + * @note An image that displays a looped animation will never return TIME_INFINITE unless it + * gets an error. + * @note Calling gdispImageDraw() after getting a TIME_INFINITE will go back to drawing the first + * frame/page. + */ +delaytime_t gdispImageNext(gdispImage *img); - /** - * @brief Prepare for the next frame/page in the image file. - * @return A time in milliseconds to keep displaying the current frame before trying to draw - * the next frame. Watch out for the special values TIME_IMMEDIATE and TIME_INFINITE. - * - * @param[in] img The image structure - * - * @pre gdispImageOpen() must have returned successfully. - * - * @note It will return TIME_IMMEDIATE if the first frame/page hasn't been drawn or if the next frame - * should be drawn immediately. - * @note It will return TIME_INFINITE if another image frame doesn't exist or an error has occurred. - * @note Images that support multiple pages (eg TIFF files) will return TIME_IMMEDIATE between pages - * and then TIME_INFINITE when there are no more pages. - * @note An image that displays a looped animation will never return TIME_INFINITE unless it - * gets an error. - * @note Calling gdispImageDraw() after getting a TIME_INFINITE will go back to drawing the first - * frame/page. - */ - delaytime_t gdispImageNext(gdispImage *img); +/** + * @brief Get the number of entries in the color palette. + * @return The number of entries in the color palette or 0 if the image doesn't use a color palette. + * + * @param[in] img The image structure + * + * @pre gdispImageOpen() must have returned successfully. + */ +uint16_t gdispImageGetPaletteSize(gdispImage *img); - /** - * @brief Get the number of entries in the color palette. - * @return The number of entries in the color palette or 0 if the image doesn't use a color palette. - * - * @param[in] img The image structure - * - * @pre gdispImageOpen() must have returned successfully. - */ - uint16_t gdispImageGetPaletteSize(gdispImage *img); +/** + * @brief Get an entry in the color palette. + * @return The color value at a given position in the color palette. + * + * @param[in] img The image structure + * @param[in] index The index of the color palette entry + * + * @pre gdispImageOpen() must have returned successfully. + * + * @note This function will return 0 if the index is out of bounds or if the image doesn't use a color palette. + */ +color_t gdispImageGetPalette(gdispImage *img, uint16_t index); - /** - * @brief Get an entry in the color palette. - * @return The color value at a given position in the color palette. - * - * @param[in] img The image structure - * @param[in] index The index of the color palette entry - * - * @pre gdispImageOpen() must have returned successfully. - * - * @note This function will return 0 if the index is out of bounds or if the image doesn't use a color palette. - */ - color_t gdispImageGetPalette(gdispImage *img, uint16_t index); - - /** - * @brief Modify an entry in the color palette. - * @return @p TRUE on success, @p FALSE otherwise. - * - * @param[in] img The image structure - * @param[in] index The index of the color palette entry - * @param[in] newColor The new color value of the specified entry - * - * @pre gdispImageOpen() must have returned successfully. - * @note This function will return @p FALSE if the index is out of bounds or if the image doesn't use a color palette. - */ - bool_t gdispImageAdjustPalette(gdispImage *img, uint16_t index, color_t newColor); - -#ifdef __cplusplus -} -#endif +/** + * @brief Modify an entry in the color palette. + * @return @p gTrue on success, @p gFalse otherwise. + * + * @param[in] img The image structure + * @param[in] index The index of the color palette entry + * @param[in] newColor The new color value of the specified entry + * + * @pre gdispImageOpen() must have returned successfully. + * @note This function will return @p gFalse if the index is out of bounds or if the image doesn't use a color palette. + */ +gBool gdispImageAdjustPalette(gdispImage *img, uint16_t index, color_t newColor); #endif /* GFX_USE_GDISP && GDISP_NEED_IMAGE */ #endif /* _GDISP_IMAGE_H */ diff --git a/src/gdisp/gdisp_image_bmp.c b/src/gdisp/gdisp_image_bmp.c index 02ae8da4..2cb00853 100644 --- a/src/gdisp/gdisp_image_bmp.c +++ b/src/gdisp/gdisp_image_bmp.c @@ -860,23 +860,23 @@ color_t gdispImageGetPalette_BMP(gdispImage *img, uint16_t index) { #endif } -bool_t gdispImageAdjustPalette_BMP(gdispImage *img, uint16_t index, color_t newColor) { +gBool gdispImageAdjustPalette_BMP(gdispImage *img, uint16_t index, color_t newColor) { #if GDISP_NEED_IMAGE_BMP_1 || GDISP_NEED_IMAGE_BMP_4 || GDISP_NEED_IMAGE_BMP_8 gdispImagePrivate_BMP *priv; priv = (gdispImagePrivate_BMP *)img->priv; if (!priv) - return FALSE; + return gFalse; if (!(priv->bmpflags & BMP_PALETTE)) - return FALSE; + return gFalse; if (index >= priv->palsize) - return FALSE; + return gFalse; priv->palette[(uint8_t)index] = newColor; - return TRUE; + return gTrue; #else return 0; diff --git a/src/gdisp/gdisp_image_png.c b/src/gdisp/gdisp_image_png.c index 822c7002..8032ffe6 100644 --- a/src/gdisp/gdisp_image_png.c +++ b/src/gdisp/gdisp_image_png.c @@ -138,16 +138,16 @@ static void PNG_iInit(PNG_decode *d) { } // Load the next byte of image data from the PNG file -static bool_t PNG_iLoadData(PNG_decode *d) { +static gBool PNG_iLoadData(PNG_decode *d) { uint32_t sz; // Is there data still left in the buffer? if (d->i.buflen) - return TRUE; + return gTrue; // If we are cached then we have no more data if (!d->i.f) - return FALSE; + return gFalse; // Have we finished the current chunk? if (!d->i.chunklen) { @@ -155,7 +155,7 @@ static bool_t PNG_iLoadData(PNG_decode *d) { // Find a new chunk gfileSetPos(d->i.f, d->i.chunknext); if (gfileRead(d->i.f, d->i.buf, 8) != 8) - return FALSE; + return gFalse; // Calculate the chunk length and next chunk d->i.chunklen = gdispImageGetAlignedBE32(d->i.buf, 0); @@ -168,7 +168,7 @@ static bool_t PNG_iLoadData(PNG_decode *d) { break; goto gotchunk; case 0x49454E44: // "IEND" - All done - return FALSE; + return gFalse; } } } @@ -180,11 +180,11 @@ gotchunk: if (sz > GDISP_IMAGE_PNG_FILE_BUFFER_SIZE) sz = GDISP_IMAGE_PNG_FILE_BUFFER_SIZE; if (gfileRead(d->i.f, d->i.buf, sz) != sz) - return FALSE; + return gFalse; d->i.chunklen -= sz; d->i.buflen = sz; d->i.pbuf = d->i.buf; - return TRUE; + return gTrue; } // Get the last loaded byte of image data from the PNG file @@ -222,12 +222,12 @@ static void PNG_oFlush(PNG_output *o) { } // Start a new image line -static bool_t PNG_oStartY(PNG_output *o, coord_t y) { +static gBool PNG_oStartY(PNG_output *o, coord_t y) { if (y < o->sy || y >= o->sy+o->cy) - return FALSE; + return gFalse; o->ix = 0; o->iy = y; - return TRUE; + return gTrue; } // Feed a pixel color to the display buffer @@ -283,18 +283,18 @@ static void PNG_zInit(PNG_zinflate *z) { } // Get the inflate header (slightly customized for PNG validity testing) -static bool_t PNG_zGetHeader(PNG_decode *d) { +static gBool PNG_zGetHeader(PNG_decode *d) { if (!PNG_iLoadData(d)) - return FALSE; + return gFalse; d->z.tmp[0] = PNG_iGetByte(d); if (!PNG_iLoadData(d)) - return FALSE; + return gFalse; d->z.tmp[1] = PNG_iGetByte(d); if (gdispImageGetAlignedBE16(d->z.tmp, 0) % 31 != 0 // Must be modulo 31, the FCHECK value is made that way || (d->z.tmp[0] & 0x0F) != 8 || (d->z.tmp[0] & 0x80) // only method 8: inflate 32k sliding window || (d->z.tmp[1] & 0x20)) // no preset dictionary - return FALSE; - return TRUE; + return gFalse; + return gTrue; } // Get a bit from the input (treated as a LSB first stream) @@ -400,7 +400,7 @@ static void PNG_zBuildFixedTrees(PNG_decode *d) { } // Build inflate dynamic length and distance trees -static bool_t PNG_zDecodeTrees(PNG_decode *d) { +static gBool PNG_zDecodeTrees(PNG_decode *d) { static const uint8_t IndexLookup[19] = { 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 }; unsigned hlit, hdist, hclen; unsigned i, num; @@ -412,7 +412,7 @@ static bool_t PNG_zDecodeTrees(PNG_decode *d) { hclen = PNG_zGetBits(d, 4) + 4; // 4 - 19 if ((d->z.flags & PNG_ZFLG_EOF)) - return FALSE; + return gFalse; for (i = 0; i < 19; ++i) d->z.tmp[i] = 0; @@ -422,7 +422,7 @@ static bool_t PNG_zDecodeTrees(PNG_decode *d) { d->z.tmp[IndexLookup[i]] = PNG_zGetBits(d, 3); if ((d->z.flags & PNG_ZFLG_EOF)) - return FALSE; + return gFalse; // Build the code length tree PNG_zBuildTree(&d->z.ltree, d->z.tmp, 19); @@ -431,7 +431,7 @@ static bool_t PNG_zDecodeTrees(PNG_decode *d) { for (num = 0; num < hlit + hdist; ) { symbol = PNG_zGetSymbol(d, &d->z.ltree); if ((d->z.flags & PNG_ZFLG_EOF)) - return FALSE; + return gFalse; switch(symbol) { case 16: // Copy the previous code length 3-6 times @@ -456,33 +456,33 @@ static bool_t PNG_zDecodeTrees(PNG_decode *d) { // Build the trees PNG_zBuildTree(&d->z.ltree, d->z.tmp, hlit); PNG_zBuildTree(&d->z.dtree, d->z.tmp + hlit, hdist); - return TRUE; + return gTrue; } // Copy bytes from the input stream. Completing the copy completes the block. -static bool_t PNG_zCopyInput(PNG_decode *d, unsigned length) { +static gBool PNG_zCopyInput(PNG_decode *d, unsigned length) { // Copy the block while(length--) { if (!PNG_iLoadData(d)) { // EOF? d->z.flags |= PNG_ZFLG_EOF; - return FALSE; + return gFalse; } d->z.buf[d->z.bufend++] = PNG_iGetByte(d); WRAP_ZBUF(d->z.bufend); if (d->z.bufend == d->z.bufpos) { // Buffer full? d->z.flags = (d->z.flags & ~PNG_ZFLG_RESUME_MASK) | PNG_ZFLG_RESUME_COPY; ((unsigned *)d->z.tmp)[0] = length; - return TRUE; + return gTrue; } } // The block is done d->z.flags = (d->z.flags & ~PNG_ZFLG_RESUME_MASK) | PNG_ZFLG_RESUME_NEW; - return TRUE; + return gTrue; } // Copy an uncompressed inflate block into the output -static bool_t PNG_zUncompressedBlock(PNG_decode *d) { +static gBool PNG_zUncompressedBlock(PNG_decode *d) { unsigned length; // This block works on byte boundaries @@ -492,7 +492,7 @@ static bool_t PNG_zUncompressedBlock(PNG_decode *d) { for (length = 0; length < 4; length++) { if (!PNG_iLoadData(d)) { // EOF? d->z.flags |= PNG_ZFLG_EOF; - return FALSE; + return gFalse; } d->z.tmp[length] = PNG_iGetByte(d); } @@ -503,7 +503,7 @@ static bool_t PNG_zUncompressedBlock(PNG_decode *d) { // Check length if ((uint16_t)length != (uint16_t)~gdispImageGetAlignedLE16(d->z.tmp, 2)) { d->z.flags |= PNG_ZFLG_EOF; - return FALSE; + return gFalse; } // Copy the block @@ -511,7 +511,7 @@ static bool_t PNG_zUncompressedBlock(PNG_decode *d) { } // Inflate a compressed inflate block into the output -static bool_t PNG_zInflateBlock(PNG_decode *d) { +static gBool PNG_zInflateBlock(PNG_decode *d) { static const uint8_t lbits[30] = { 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, 6 }; static const uint16_t lbase[30] = { 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 323 }; static const uint8_t dbits[30] = { 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13 }; @@ -527,7 +527,7 @@ static bool_t PNG_zInflateBlock(PNG_decode *d) { // Is the block done? if (symbol == 256) { d->z.flags = (d->z.flags & ~PNG_ZFLG_RESUME_MASK) | PNG_ZFLG_RESUME_NEW; - return TRUE; + return gTrue; } if (symbol < 256) { @@ -536,7 +536,7 @@ static bool_t PNG_zInflateBlock(PNG_decode *d) { WRAP_ZBUF(d->z.bufend); if (d->z.bufend == d->z.bufpos) { // Buffer full? d->z.flags = (d->z.flags & ~PNG_ZFLG_RESUME_MASK) | PNG_ZFLG_RESUME_INFLATE; - return TRUE; + return gTrue; } continue; } @@ -576,21 +576,21 @@ static bool_t PNG_zInflateBlock(PNG_decode *d) { d->z.flags = (d->z.flags & ~PNG_ZFLG_RESUME_MASK) | PNG_ZFLG_RESUME_OFFSET; ((unsigned *)d->z.tmp)[0] = length; ((unsigned *)d->z.tmp)[1] = offset; - return TRUE; + return gTrue; } } } iserror: d->z.flags |= PNG_ZFLG_EOF; - return FALSE; + return gFalse; } // Start a new uncompressed/inflate block -static bool_t PNG_zStartBlock(PNG_decode *d) { +static gBool PNG_zStartBlock(PNG_decode *d) { // Check for previous error, EOF or no more blocks if ((d->z.flags & (PNG_ZFLG_EOF|PNG_ZFLG_FINAL))) - return FALSE; + return gFalse; // Is this the final inflate block? if (PNG_zGetBit(d)) @@ -601,32 +601,32 @@ static bool_t PNG_zStartBlock(PNG_decode *d) { case 0: // Decompress uncompressed block if (!PNG_zUncompressedBlock(d)) - return FALSE; + return gFalse; break; case 1: // Decompress block with fixed huffman trees PNG_zBuildFixedTrees(d); if (!PNG_zInflateBlock(d)) - return FALSE; + return gFalse; break; case 2: // Decompress block with dynamic huffman trees if (!PNG_zDecodeTrees(d)) - return FALSE; + return gFalse; if (!PNG_zInflateBlock(d)) - return FALSE; + return gFalse; break; default: // Bad block type // Mark it as an error d->z.flags |= PNG_ZFLG_EOF; - return FALSE; + return gFalse; } - return TRUE; + return gTrue; } // Resume an offset copy -static bool_t PNG_zResumeOffset(PNG_decode *d, unsigned length, unsigned offset) { +static gBool PNG_zResumeOffset(PNG_decode *d, unsigned length, unsigned offset) { // Copy the matching string while (length--) { d->z.buf[d->z.bufend++] = d->z.buf[offset++]; @@ -636,7 +636,7 @@ static bool_t PNG_zResumeOffset(PNG_decode *d, unsigned length, unsigned offset) d->z.flags = (d->z.flags & ~PNG_ZFLG_RESUME_MASK) | PNG_ZFLG_RESUME_OFFSET; ((unsigned *)d->z.tmp)[0] = length; ((unsigned *)d->z.tmp)[1] = offset; - return TRUE; + return gTrue; } } return PNG_zInflateBlock(d); @@ -720,14 +720,14 @@ static uint8_t PNG_fCalcPath(uint16_t a, uint16_t b, uint16_t c) { } // Scan-line filter type 0 -static bool_t PNG_unfilter_type0(PNG_decode *d) { // PNG filter method 0 +static gBool PNG_unfilter_type0(PNG_decode *d) { // PNG filter method 0 uint8_t ft; unsigned i; // Get the filter type and check for validity (eg not EOF) ft = PNG_zGetByte(d); if (ft > 0x04) - return FALSE; + return gFalse; // Uncompress the scan line for(i = 0; i < d->f.scanbytes; i++) @@ -770,7 +770,7 @@ static bool_t PNG_unfilter_type0(PNG_decode *d) { // PNG filter method 0 break; } - return TRUE; + return gTrue; } /*----------------------------------------------------------------- diff --git a/src/gdisp/gdisp_image_support.h b/src/gdisp/gdisp_image_support.h index 9fefd3d6..ab636dae 100644 --- a/src/gdisp/gdisp_image_support.h +++ b/src/gdisp/gdisp_image_support.h @@ -120,19 +120,11 @@ #endif -#ifdef __cplusplus -extern "C" { -#endif +void *gdispImageAlloc(gdispImage *img, size_t sz); +void gdispImageFree(gdispImage *img, void *ptr, size_t sz); - void *gdispImageAlloc(gdispImage *img, size_t sz); - void gdispImageFree(gdispImage *img, void *ptr, size_t sz); - - #if GFX_CPU_ENDIAN == GFX_CPU_ENDIAN_UNKNOWN - extern const uint8_t gdispImageEndianArray[4]; - #endif - -#ifdef __cplusplus -} +#if GFX_CPU_ENDIAN == GFX_CPU_ENDIAN_UNKNOWN + extern const uint8_t gdispImageEndianArray[4]; #endif #endif /* _GDISP_IMAGE_SUPPORT_H */ diff --git a/src/gdisp/gdisp_pixmap.c b/src/gdisp/gdisp_pixmap.c index 45dee66b..88bd57a3 100644 --- a/src/gdisp/gdisp_pixmap.c +++ b/src/gdisp/gdisp_pixmap.c @@ -110,11 +110,11 @@ pixel_t *gdispPixmapGetBits(GDisplay *g) { /* Driver exported functions. */ /*===========================================================================*/ -LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { +LLDSPEC gBool gdisp_lld_init(GDisplay *g) { // The user api function should have already allocated and initialised the pixmap // structure and put it into the priv member during driver initialisation. if (!g->priv) - return FALSE; + return gFalse; // Initialize the GDISP structure // Width and height were saved into the start of the framebuffer. @@ -126,7 +126,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { g->g.Powermode = powerOn; g->board = 0; - return TRUE; + return gTrue; } LLDSPEC void gdisp_lld_deinit(GDisplay *g) { diff --git a/src/gdisp/gdisp_pixmap.h b/src/gdisp/gdisp_pixmap.h index ebf7e1db..4d5e8004 100644 --- a/src/gdisp/gdisp_pixmap.h +++ b/src/gdisp/gdisp_pixmap.h @@ -24,66 +24,58 @@ #if (GFX_USE_GDISP && GDISP_NEED_PIXMAP) || defined(__DOXYGEN__) -#ifdef __cplusplus -extern "C" { -#endif +/** + * @brief Create an off-screen pixmap that can be drawn to just like a normal display + * + * @param[in] width The width of the pixmap to be created + * @param[in] height The height of the pixmap to be created + * + * @return The created GDisplay representing the pixmap or 0 if the pixmap couldn't be created. + * + * @note Once created, an off-screen pixmap can be drawn on using the standard gdispGxxxx calls. + * @note It must be destroyed using @p gdispDeleteOffscreenPixmap + * @note Because the RAM for the display area is allocated, on small micros only very small pixmaps should be considered. + * For example a 100x100 at 16 bits per pixel would be 20K of RAM (plus some overheads). + */ +GDisplay *gdispPixmapCreate(coord_t width, coord_t height); - /** - * @brief Create an off-screen pixmap that can be drawn to just like a normal display - * - * @param[in] width The width of the pixmap to be created - * @param[in] height The height of the pixmap to be created - * - * @return The created GDisplay representing the pixmap or 0 if the pixmap couldn't be created. - * - * @note Once created, an off-screen pixmap can be drawn on using the standard gdispGxxxx calls. - * @note It must be destroyed using @p gdispDeleteOffscreenPixmap - * @note Because the RAM for the display area is allocated, on small micros only very small pixmaps should be considered. - * For example a 100x100 at 16 bits per pixel would be 20K of RAM (plus some overheads). - */ - GDisplay *gdispPixmapCreate(coord_t width, coord_t height); +/** + * @brief Destroy an off-screen pixmap + * + * @param[in] g The pixmap virtual display to delete + * + * @note If a normal display is passed to this routine, it will be ignored. + */ +void gdispPixmapDelete(GDisplay *g); - /** - * @brief Destroy an off-screen pixmap - * - * @param[in] g The pixmap virtual display to delete - * - * @note If a normal display is passed to this routine, it will be ignored. - */ - void gdispPixmapDelete(GDisplay *g); +/** + * @brief Get a pointer to the pixels of the display surface. + * @return The pointer to the pixmap display surface or NULL if this display is not a pixmap. + * + * @param[in] g The pixmap virtual display + * + * @note The pointer returned can be used for calls to @p gdispGBlitArea() or can be read or written to directly + * by the application code. For any one particular pixmap the pointer will not change over the life of the pixmap + * (although different pixmaps will have different pixel pointers). Once a pixmap is deleted, the pixel pointer + * should not be used by the application. + */ +pixel_t *gdispPixmapGetBits(GDisplay *g); +#if GDISP_NEED_PIXMAP_IMAGE || defined(__DOXYGEN__) /** - * @brief Get a pointer to the pixels of the display surface. - * @return The pointer to the pixmap display surface or NULL if this display is not a pixmap. + * @brief Get a pointer to a native format gdispImage. + * @return A pointer to a NATIVE format gdispImage in memory or NULL if this display is not a pixmap. + * @pre GDISP_NEED_PIXAMP_IMAGE must be GFXON in your gfxconf.h * * @param[in] g The pixmap virtual display * - * @note The pointer returned can be used for calls to @p gdispGBlitArea() or can be read or written to directly - * by the application code. For any one particular pixmap the pointer will not change over the life of the pixmap - * (although different pixmaps will have different pixel pointers). Once a pixmap is deleted, the pixel pointer - * should not be used by the application. + * @return The pointer to the native gdispImage + * + * @note The pointer returned can be passed to @p gdispImageOpenMemory() or to @p gfileOpenMemory(). + * @note If you are just wanting to copy to a real display it is more efficient to use @p gdispGetPixmapBits() and @p gdispGBlitArea(). + * @note Like @p gdispGetPixmapBits(), the pointer returned is valid for the life of the pixmap. */ - pixel_t *gdispPixmapGetBits(GDisplay *g); - - #if GDISP_NEED_PIXMAP_IMAGE || defined(__DOXYGEN__) - /** - * @brief Get a pointer to a native format gdispImage. - * @return A pointer to a NATIVE format gdispImage in memory or NULL if this display is not a pixmap. - * @pre GDISP_NEED_PIXAMP_IMAGE must be GFXON in your gfxconf.h - * - * @param[in] g The pixmap virtual display - * - * @return The pointer to the native gdispImage - * - * @note The pointer returned can be passed to @p gdispImageOpenMemory() or to @p gfileOpenMemory(). - * @note If you are just wanting to copy to a real display it is more efficient to use @p gdispGetPixmapBits() and @p gdispGBlitArea(). - * @note Like @p gdispGetPixmapBits(), the pointer returned is valid for the life of the pixmap. - */ - void *gdispPixmapGetMemoryImage(GDisplay *g); - #endif - -#ifdef __cplusplus -} + void *gdispPixmapGetMemoryImage(GDisplay *g); #endif #endif /* GFX_USE_GDISP && GDISP_NEED_PIXMAP */ diff --git a/src/gdriver/gdriver.h b/src/gdriver/gdriver.h index 4a1959a6..e8430fb1 100644 --- a/src/gdriver/gdriver.h +++ b/src/gdriver/gdriver.h @@ -67,7 +67,7 @@ typedef struct GDriverVMT { uint16_t type; // @< What type of driver this is uint16_t flags; // @< Flags for the driver. Meaning is specific to each driver type. uint32_t objsize; // @< How big the runtime driver structure is - bool_t (*init)(GDriver *driver, void *param, unsigned driverinstance, unsigned systeminstance); // @< Initialise the driver. Returns TRUE if OK. + gBool (*init)(GDriver *driver, void *param, unsigned driverinstance, unsigned systeminstance); // @< Initialise the driver. Returns gTrue if OK. // driverinstance is the instance 0..n of this driver. // systeminstance is the instance 0..n of this type of device. // The memory allocated is cleared before this call. diff --git a/src/gevent/gevent.c b/src/gevent/gevent.c index 733856c8..311d94fb 100644 --- a/src/gevent/gevent.c +++ b/src/gevent/gevent.c @@ -68,13 +68,13 @@ void geventListenerInit(GListener *pl) { pl->flags = 0; } -bool_t geventAttachSource(GListener *pl, GSourceHandle gsh, uint32_t flags) { +gBool geventAttachSource(GListener *pl, GSourceHandle gsh, uint32_t flags) { GSourceListener *psl, *pslfree; // Safety first if (!pl || !gsh) { - GEVENT_ASSERT(FALSE); - return FALSE; + GEVENT_ASSERT(gFalse); + return gFalse; } gfxMutexEnter(&geventMutex); @@ -87,7 +87,7 @@ bool_t geventAttachSource(GListener *pl, GSourceHandle gsh, uint32_t flags) { // Just update the flags psl->listenflags = flags; gfxMutexExit(&geventMutex); - return TRUE; + return gTrue; } if (!pslfree && !psl->pListener) pslfree = psl; diff --git a/src/gevent/gevent.h b/src/gevent/gevent.h index 8b95235d..121895ba 100644 --- a/src/gevent/gevent.h +++ b/src/gevent/gevent.h @@ -77,10 +77,6 @@ typedef struct GSourceListener_t { /* External declarations. */ /*===========================================================================*/ -#ifdef __cplusplus -extern "C" { -#endif - /* How to listen for events (act as a Listener)... 1. Get handles for all the event sources you are interested in. 2. Initialise a listener @@ -97,7 +93,7 @@ extern "C" { For each listener - check the flags to see if an event should be sent. - use geventGetEventBuffer() to get the event buffer supplied by the listener and then call geventSendEvent() to send the event. - - Note: geventGetEventBuffer() may return FALSE to indicate the listener is currently not listening and + - Note: geventGetEventBuffer() may return gFalse to indicate the listener is currently not listening and therefore no event should be sent. This situation enables the source to (optionally) flag to the listener on its next wait that there have been missed events. - Note: The GSourceListener pointer (and the GEvent buffer) are only valid between @@ -121,16 +117,16 @@ void geventListenerInit(GListener *pl); * @brief Attach a source to a listener * @details Flags are interpreted by the source when generating events for each listener. * If this source is already assigned to the listener it will update the flags. - * If insufficient resources are available it will either assert or return FALSE + * If insufficient resources are available it will either assert or return gFalse * depending on the value of GEVENT_ASSERT_NO_RESOURCE. * * @param[in] pl The listener * @param[in] gsh The source which has to be attached to the listener * @param[in] flags The flags * - * @return TRUE if succeeded, FALSE otherwise + * @return gTrue if succeeded, gFalse otherwise */ -bool_t geventAttachSource(GListener *pl, GSourceHandle gsh, uint32_t flags); +gBool geventAttachSource(GListener *pl, GSourceHandle gsh, uint32_t flags); /** * @brief Detach a source from a listener @@ -236,10 +232,6 @@ void geventSendEvent(GSourceListener *psl); */ void geventDetachSourceListeners(GSourceHandle gsh); -#ifdef __cplusplus -} -#endif - #endif /* GFX_USE_GEVENT */ #endif /* _GEVENT_H */ diff --git a/src/gfile/gfile.c b/src/gfile/gfile.c index 4bc39189..a0ef6071 100644 --- a/src/gfile/gfile.c +++ b/src/gfile/gfile.c @@ -135,7 +135,7 @@ GFILE *_gfileFindSlot(const char *mode) { * IO routines ********************************************************/ -bool_t gfileExists(const char *fname) { +gBool gfileExists(const char *fname) { const GFILEVMT * const *p; #if GFILE_ALLOW_DEVICESPECIFIC @@ -144,18 +144,18 @@ bool_t gfileExists(const char *fname) { if (p[0]->prefix == fname[0]) return p[0]->exists && p[0]->exists(fname+2); } - return FALSE; + return gFalse; } #endif for(p = FsArray; p < &FsArray[sizeof(FsArray)/sizeof(FsArray[0])]; p++) { if (p[0]->exists && p[0]->exists(fname)) - return TRUE; + return gTrue; } - return FALSE; + return gFalse; } -bool_t gfileDelete(const char *fname) { +gBool gfileDelete(const char *fname) { const GFILEVMT **p; #if GFILE_ALLOW_DEVICESPECIFIC @@ -164,15 +164,15 @@ bool_t gfileDelete(const char *fname) { if (p[0]->prefix == fname[0]) return p[0]->del && p[0]->del(fname+2); } - return FALSE; + return gFalse; } #endif for(p = FsArray; p < &FsArray[sizeof(FsArray)/sizeof(FsArray[0])]; p++) { if (p[0]->del && p[0]->del(fname)) - return TRUE; + return gTrue; } - return FALSE; + return gFalse; } long int gfileGetFilesize(const char *fname) { @@ -196,7 +196,7 @@ long int gfileGetFilesize(const char *fname) { return -1; } -bool_t gfileRename(const char *oldname, const char *newname) { +gBool gfileRename(const char *oldname, const char *newname) { const GFILEVMT * const *p; #if GFILE_ALLOW_DEVICESPECIFIC @@ -209,7 +209,7 @@ bool_t gfileRename(const char *oldname, const char *newname) { if (newname[0] && newname[1] == '|') { if (newname[0] != ch) // Both oldname and newname are fs specific but different ones. - return FALSE; + return gFalse; newname += 2; } } else { @@ -220,25 +220,25 @@ bool_t gfileRename(const char *oldname, const char *newname) { if (p[0]->prefix == ch) return p[0]->ren && p[0]->ren(oldname, newname); } - return FALSE; + return gFalse; } #endif for(p = FsArray; p < &FsArray[sizeof(FsArray)/sizeof(FsArray[0])]; p++) { if (p[0]->ren && p[0]->ren(oldname,newname)) - return TRUE; + return gTrue; } - return FALSE; + return gFalse; } -static bool_t testopen(const GFILEVMT *p, GFILE *f, const char *fname) { +static gBool testopen(const GFILEVMT *p, GFILE *f, const char *fname) { // If we want write but the fs doesn't allow it then return if ((f->flags & GFILEFLG_WRITE) && !(p->flags & GFSFLG_WRITEABLE)) - return FALSE; + return gFalse; // Try to open if (!p->open || !p->open(f, fname)) - return FALSE; + return gFalse; // File is open - fill in all the details f->vmt = p; @@ -246,7 +246,7 @@ static bool_t testopen(const GFILEVMT *p, GFILE *f, const char *fname) { f->flags |= GFILEFLG_OPEN; if (p->flags & GFSFLG_SEEKABLE) f->flags |= GFILEFLG_CANSEEK; - return TRUE; + return gTrue; } GFILE *gfileOpen(const char *fname, const char *mode) { @@ -318,13 +318,13 @@ long int gfileGetPos(GFILE *f) { return f->pos; } -bool_t gfileSetPos(GFILE *f, long int pos) { +gBool gfileSetPos(GFILE *f, long int pos) { if (!f || !(f->flags & GFILEFLG_OPEN)) - return FALSE; + return gFalse; if (!f->vmt->setpos || !f->vmt->setpos(f, pos)) - return FALSE; + return gFalse; f->pos = pos; - return TRUE; + return gTrue; } long int gfileGetSize(GFILE *f) { @@ -335,50 +335,50 @@ long int gfileGetSize(GFILE *f) { return f->vmt->getsize(f); } -bool_t gfileEOF(GFILE *f) { +gBool gfileEOF(GFILE *f) { if (!f || !(f->flags & GFILEFLG_OPEN)) - return TRUE; + return gTrue; if (!f->vmt->eof) - return FALSE; + return gFalse; return f->vmt->eof(f); } -bool_t gfileMount(char fs, const char* drive) { +gBool gfileMount(char fs, const char* drive) { const GFILEVMT * const *p; // Find the correct VMT for(p = FsArray; p < &FsArray[sizeof(FsArray)/sizeof(FsArray[0])]; p++) { if (p[0]->prefix == fs) { if (!p[0]->mount) - return FALSE; + return gFalse; return p[0]->mount(drive); } } - return FALSE; + return gFalse; } -bool_t gfileUnmount(char fs, const char* drive) { +gBool gfileUnmount(char fs, const char* drive) { const GFILEVMT * const *p; // Find the correct VMT for(p = FsArray; p < &FsArray[sizeof(FsArray)/sizeof(FsArray[0])]; p++) { if (p[0]->prefix == fs) { if (!p[0]->mount) - return FALSE; + return gFalse; return p[0]->unmount(drive); } } - return FALSE; + return gFalse; } -bool_t gfileSync(GFILE *f) { +gBool gfileSync(GFILE *f) { if (!f->vmt->sync) - return FALSE; + return gFalse; return f->vmt->sync(f); } #if GFILE_NEED_FILELISTS - gfileList *gfileOpenFileList(char fs, const char *path, bool_t dirs) { + gfileList *gfileOpenFileList(char fs, const char *path, gBool dirs) { const GFILEVMT * const *p; gfileList * pfl; diff --git a/src/gfile/gfile.h b/src/gfile/gfile.h index 0ae2a035..65088c03 100644 --- a/src/gfile/gfile.h +++ b/src/gfile/gfile.h @@ -42,429 +42,421 @@ extern GFILE *gfileStdOut; /* External declarations. */ /*===========================================================================*/ -#ifdef __cplusplus -extern "C" { +/** + * @brief Check if file exists + * + * @param[in] fname The file name + * + * @return gTrue if file exists, gFalse otherwise + * + * @api + */ +gBool gfileExists(const char *fname); + +/** + * @brief Delete file + * + * @param[in] fname The file name + * + * @return gTrue on success, gFalse otherwise + * + * @api + */ +gBool gfileDelete(const char *fname); + +/** + * @brief Get the size of a file + * @note Please use @p gfileGetSize() if the file is opened + * + * @param[in] fname The file name + * + * @return File size on success, -1 on error + * + * @api + */ +long int gfileGetFilesize(const char *fname); + +/** + * @brief Rename file + * + * @param[in] oldname The current file name + * @param[in] newname The new name of the file + * + * @return gTrue on success, gFalse otherwise + * + * @api + */ +gBool gfileRename(const char *oldname, const char *newname); + +/** + * @brief Open file + * @details A file must be opened before it can be accessed + * @details The resulting GFILE will be used for all functions that access the file. + * + * @param[in] fname The file name + * @param[in] mode The mode. + * + * @return Valid GFILE on success, 0 otherwise + * + * @note The modes follow the c library fopen() standard. + * The valid modes are: + *
  • r - Open for read, the file must exist
  • + *
  • w - Open for write, the file is truncated if it exists
  • + *
  • wx - Open for write, the file must not exist
  • + *
  • a - Open for append, the file is truncated if it exists
  • + *
  • ax - Open for append, the file must not exists
  • + *
+ * The following flags can also be added to the above modes:
+ *
  • + - Open for both read and write
  • + *
  • b - Open as a binary file rather than a text file
  • + *
+ * @note Not all file-systems support all modes. For example, write + * is not available with the ROM file-system. Similarly few platforms + * distinguish between binary and text files. + * @note Even though binary vs. text is relevant only for a small number of platforms + * the "b" flag should always be specified for binary files such as images. + * This ensures portability to other platforms. The extra flag will be ignored + * on platforms where it is not relevant. + * + * @api + */ +GFILE * gfileOpen(const char *fname, const char *mode); + +/** + * @brief Close file + * @details Closes a file after is has been opened using @p gfileOpen() + * + * @param[in] f The file + * + * @api + */ +void gfileClose(GFILE *f); + +/** + * @brief Read from file + * @details Reads a given amount of bytes from the file + * @details The read/write cursor will not be reset when calling this function + * + * @param[in] f The file + * @param[out] buf The buffer in which to save the content that has been read from the file + * @param[in] len Amount of bytes to read + * + * @return Amount of bytes read + * + * @api + */ +size_t gfileRead(GFILE *f, void *buf, size_t len); + +/** + * @brief Write to file + * @details Write a given amount of bytes to the file + * @details The read/write cursor will not be reset when calling this function + * + * @param[in] f The file + * @param[in] buf The buffer which contains the content that will be written to the file + * @param[in] len Amount of bytes to write + * + * @return Amount of bytes written + * + * @api + */ +size_t gfileWrite(GFILE *f, const void *buf, size_t len); + +/** + * @brief Get the current position of the read/write cursor + * + * @param[in] f The file + * + * @return The current position in the file + * + * @api + */ +long int gfileGetPos(GFILE *f); + +/** + * @brief Set the position of the read/write cursor + * + * @param[in] f The file + * @param[in] pos The position to which the cursor will be set + * + * @return gTrue on success, gFalse otherwise + * + * @api + */ +gBool gfileSetPos(GFILE *f, long int pos); + +/** + * @brief Get the size of file + * @note Please use @p gfileGetFilesize() if the file is not opened + * + * @param[in] f The file + * + * @return The size of the file + * + * @api + */ +long int gfileGetSize(GFILE *f); + +/** + * @brief Check for EOF + * @details Checks if the cursor is at the end of the file + * + * @param[in] f The file + * + * @return gTrue if EOF, gFalse otherwise + * + * @api + */ +gBool gfileEOF(GFILE *f); + +/** + * @brief Mount a logical drive (aka partition) + * + * @details Not supported by every file system + * @details Currently just one drive at one is supported. + * + * @param[in] fs The file system (F for FatFS) + * @param[in] drive The logical drive prefix + * + * @return gTrue on success, gFalse otherwise + * + * @api + */ +gBool gfileMount(char fs, const char *drive); + +/** + * @brief Unmount a logical drive (aka partition) + * + * @details Does have no effect if @p gfileMount() as been called before hand + * + * @param[in] fs The file system (F for FatFS) + * @param[in] drive The logical drive prefix + * + * @return gTrue on success, gFalse otherwise + * + * @api + */ +gBool gfileUnmount(char fs, const char *drive); + +/** + * @brief Syncs the file object (flushes the buffer) + * + * @details Not supported by every file system + * + * @param[in] f The file + * + * @return gTrue on success, gFalse otherwise + * + * @api + */ +gBool gfileSync(GFILE *f); + +#if GFILE_NEED_FILELISTS || defined(__DOXYGEN__) + /** + * @brief Open a file list + * + * @param[in] fs The file system (F for FatFS) + * @param[in] path Path information to pass to the file system + * @param[in] dirs Pass gTrue to get directories only, gFalse to get files only + * + * @return A pointer to a file list on success, NULL otherwise + * + * @note The path parameter is handled in a file-system specific way. It could be + * treated as a directory name, it may be treated as a file pattern, or it + * may be ignored. Passing NULL will always return the full list of files + * in at least the top level directory. + * @note For file systems that do not support directories, passing gTrue for dirs + * will return an error. + * @note You must call @p gfileCloseFileList() when you have finished with the + * file list in order to free resources. + * + * @api + */ + gfileList *gfileOpenFileList(char fs, const char *path, gBool dirs); + + /** + * @brief Get the next file in a file list. + * + * @param[in] pfl Pointer to a file list returned by @p gfileOpenFileList() + * + * @return A pointer to a file (or directory) name. Returns NULL if there are no more. + * + * @note The file name may contain the full directory path or may not depending + * on how the file system treats directories. + * @note The returned buffer may be destroyed by the next call to any of + * @p gfileOpenFileList(), @p gfileReadFileList() or @p gfileCloseFileList(). + * Do not use this pointer after one of those calls. + * + * @api + */ + const char *gfileReadFileList(gfileList *pfl); + + /** + * @brief Close a file list. + * + * @param[in] pfl Pointer to a file list returned by @p gfileOpenFileList() + * + * @api + */ + void gfileCloseFileList(gfileList *pfl); #endif +#if (GFILE_NEED_CHIBIOSFS && GFX_USE_OS_CHIBIOS) || defined(__DOXYGEN__) /** - * @brief Check if file exists - * - * @param[in] fname The file name - * - * @return TRUE if file exists, FALSE otherwise - * - * @api - */ - bool_t gfileExists(const char *fname); - - /** - * @brief Delete file - * - * @param[in] fname The file name - * - * @return TRUE on success, FALSE otherwise - * - * @api - */ - bool_t gfileDelete(const char *fname); - - /** - * @brief Get the size of a file - * @note Please use @p gfileGetSize() if the file is opened - * - * @param[in] fname The file name - * - * @return File size on success, -1 on error - * - * @api - */ - long int gfileGetFilesize(const char *fname); - - /** - * @brief Rename file + * @brief Open file from a ChibiOS FileStream * - * @param[in] oldname The current file name - * @param[in] newname The new name of the file - * - * @return TRUE on success, FALSE otherwise - * - * @api - */ - bool_t gfileRename(const char *oldname, const char *newname); - - /** - * @brief Open file - * @details A file must be opened before it can be accessed - * @details The resulting GFILE will be used for all functions that access the file. - * - * @param[in] fname The file name + * @param[in] FileStreamPtr The BaseFileStream (ChibiOS V2) or FileStream (ChibiOS V3) to open as a GFILE * @param[in] mode The mode. * * @return Valid GFILE on success, 0 otherwise * - * @note The modes follow the c library fopen() standard. - * The valid modes are: - *
  • r - Open for read, the file must exist
  • - *
  • w - Open for write, the file is truncated if it exists
  • - *
  • wx - Open for write, the file must not exist
  • - *
  • a - Open for append, the file is truncated if it exists
  • - *
  • ax - Open for append, the file must not exists
  • - *
- * The following flags can also be added to the above modes:
- *
  • + - Open for both read and write
  • - *
  • b - Open as a binary file rather than a text file
  • - *
- * @note Not all file-systems support all modes. For example, write - * is not available with the ROM file-system. Similarly few platforms - * distinguish between binary and text files. - * @note Even though binary vs. text is relevant only for a small number of platforms - * the "b" flag should always be specified for binary files such as images. - * This ensures portability to other platforms. The extra flag will be ignored - * on platforms where it is not relevant. - * - * @api - */ - GFILE * gfileOpen(const char *fname, const char *mode); - - /** - * @brief Close file - * @details Closes a file after is has been opened using @p gfileOpen() - * - * @param[in] f The file + * @note The modes are the same modes as in @p gfileOpen(). The + * open mode is NOT compared against the FileStream capabilities. + * @note Supported operations are: read, write, getpos, setpos, eof and getsize * * @api */ - void gfileClose(GFILE *f); + GFILE * gfileOpenChibiOSFileStream(void *FileStreamPtr, const char *mode); + #define gfileOpenBaseFileStream(f,m) gfileOpenChibiOSFileStream(f,m) +#endif +#if GFILE_NEED_MEMFS || defined(__DOXYGEN__) /** - * @brief Read from file - * @details Reads a given amount of bytes from the file - * @details The read/write cursor will not be reset when calling this function + * @brief Open file from a memory pointer * - * @param[in] f The file - * @param[out] buf The buffer in which to save the content that has been read from the file - * @param[in] len Amount of bytes to read + * @param[in] memptr The pointer to the memory + * @param[in] mode The mode. * - * @return Amount of bytes read + * @return Valid GFILE on success, 0 otherwise + * + * @note The modes are the same modes as in @p gfileOpen(). Note there is + * no concept of file-size. Be careful not to overwrite other memory or + * to read from inaccessible sections of memory. + * @note Supported operations are: read, write, getpos, setpos * * @api */ - size_t gfileRead(GFILE *f, void *buf, size_t len); + GFILE * gfileOpenMemory(void *memptr, const char *mode); +#endif +#if GFILE_NEED_STRINGS || defined(__DOXYGEN__) /** - * @brief Write to file - * @details Write a given amount of bytes to the file - * @details The read/write cursor will not be reset when calling this function + * @brief Open file from a null terminated C string * - * @param[in] f The file - * @param[in] buf The buffer which contains the content that will be written to the file - * @param[in] len Amount of bytes to write + * @param[in] str The pointer to the string or string buffer + * @param[in] mode The mode * - * @return Amount of bytes written + * @return Valid GFILE on success, 0 otherwise + * + * @note The modes are the same modes as in @p gfileOpen(). Note there is + * no concept of file-size. Be careful not to overwrite other memory or + * to read from inaccessible sections of memory. + * @note Reading will return EOF when the NULL character is reached. + * @note Writing will always place a NULL in the next character effectively terminating the + * string at the character just written. + * @note Supported operations are: read, write, append, getpos, setpos + * @note Be careful with setpos and getpos. They do not check for the end of the string. + * @note Reading and Writing will read/write a maximum of one character at a time. * * @api */ - size_t gfileWrite(GFILE *f, const void *buf, size_t len); + GFILE * gfileOpenString(char *str, const char *mode); +#endif - /** - * @brief Get the current position of the read/write cursor - * - * @param[in] f The file - * - * @return The current position in the file - * - * @api - */ - long int gfileGetPos(GFILE *f); +#if GFILE_NEED_PRINTG || defined(__DOXYGEN__) + #include - /** - * @brief Set the position of the read/write cursor - * - * @param[in] f The file - * @param[in] pos The position to which the cursor will be set - * - * @return TRUE on success, FALSE otherwise - * - * @api - */ - bool_t gfileSetPos(GFILE *f, long int pos); + int vfnprintg(GFILE *f, int maxlen, const char *fmt, va_list arg); + int fnprintg(GFILE *f, int maxlen, const char *fmt, ...); + #define vfprintg(f,m,a) vfnprintg(f,0,m,a) + #define fprintg(f,m,...) fnprintg(f,0,m,__VA_ARGS__) + #define vprintg(m,a) vfnprintg(gfileStdOut,0,m,a) + #define printg(m,...) fnprintg(gfileStdOut,0,m,__VA_ARGS__) - /** - * @brief Get the size of file - * @note Please use @p gfileGetFilesize() if the file is not opened - * - * @param[in] f The file - * - * @return The size of the file - * - * @api - */ - long int gfileGetSize(GFILE *f); - - /** - * @brief Check for EOF - * @details Checks if the cursor is at the end of the file - * - * @param[in] f The file - * - * @return TRUE if EOF, FALSE otherwise - * - * @api - */ - bool_t gfileEOF(GFILE *f); - - /** - * @brief Mount a logical drive (aka partition) - * - * @details Not supported by every file system - * @details Currently just one drive at one is supported. - * - * @param[in] fs The file system (F for FatFS) - * @param[in] drive The logical drive prefix - * - * @return TRUE on success, FALSE otherwise - * - * @api - */ - bool_t gfileMount(char fs, const char *drive); - - /** - * @brief Unmount a logical drive (aka partition) - * - * @details Does have no effect if @p gfileMount() as been called before hand - * - * @param[in] fs The file system (F for FatFS) - * @param[in] drive The logical drive prefix - * - * @return TRUE on success, FALSE otherwise - * - * @api - */ - bool_t gfileUnmount(char fs, const char *drive); - - /** - * @brief Syncs the file object (flushes the buffer) - * - * @details Not supported by every file system - * - * @param[in] f The file - * - * @return TRUE on success, FALSE otherwise - * - * @api - */ - bool_t gfileSync(GFILE *f); - - #if GFILE_NEED_FILELISTS || defined(__DOXYGEN__) - /** - * @brief Open a file list - * - * @param[in] fs The file system (F for FatFS) - * @param[in] path Path information to pass to the file system - * @param[in] dirs Pass TRUE to get directories only, FALSE to get files only - * - * @return A pointer to a file list on success, NULL otherwise - * - * @note The path parameter is handled in a file-system specific way. It could be - * treated as a directory name, it may be treated as a file pattern, or it - * may be ignored. Passing NULL will always return the full list of files - * in at least the top level directory. - * @note For file systems that do not support directories, passing TRUE for dirs - * will return an error. - * @note You must call @p gfileCloseFileList() when you have finished with the - * file list in order to free resources. - * - * @api - */ - gfileList *gfileOpenFileList(char fs, const char *path, bool_t dirs); - - /** - * @brief Get the next file in a file list. - * - * @param[in] pfl Pointer to a file list returned by @p gfileOpenFileList() - * - * @return A pointer to a file (or directory) name. Returns NULL if there are no more. - * - * @note The file name may contain the full directory path or may not depending - * on how the file system treats directories. - * @note The returned buffer may be destroyed by the next call to any of - * @p gfileOpenFileList(), @p gfileReadFileList() or @p gfileCloseFileList(). - * Do not use this pointer after one of those calls. - * - * @api - */ - const char *gfileReadFileList(gfileList *pfl); - - /** - * @brief Close a file list. - * - * @param[in] pfl Pointer to a file list returned by @p gfileOpenFileList() - * - * @api - */ - void gfileCloseFileList(gfileList *pfl); + #if GFILE_NEED_STRINGS + int vsnprintg(char *buf, int maxlen, const char *fmt, va_list arg); + int snprintg(char *buf, int maxlen, const char *fmt, ...); + #define vsprintg(s,m,a) vsnprintg(s,0,m,a) + #define sprintg(s,m,...) snprintg(s,0,m,__VA_ARGS__) #endif +#endif - #if (GFILE_NEED_CHIBIOSFS && GFX_USE_OS_CHIBIOS) || defined(__DOXYGEN__) - /** - * @brief Open file from a ChibiOS FileStream - * - * @param[in] FileStreamPtr The BaseFileStream (ChibiOS V2) or FileStream (ChibiOS V3) to open as a GFILE - * @param[in] mode The mode. - * - * @return Valid GFILE on success, 0 otherwise - * - * @note The modes are the same modes as in @p gfileOpen(). The - * open mode is NOT compared against the FileStream capabilities. - * @note Supported operations are: read, write, getpos, setpos, eof and getsize - * - * @api - */ - GFILE * gfileOpenChibiOSFileStream(void *FileStreamPtr, const char *mode); - #define gfileOpenBaseFileStream(f,m) gfileOpenChibiOSFileStream(f,m) +#if GFILE_NEED_SCANG || defined(__DOXYGEN__) + #include + + int vfscang(GFILE *f, const char *fmt, va_list arg); + int fscang(GFILE *f, const char *fmt, ...); + #define vscang(f,a) vfscang(gfileStdIn,f,a) + #define scang(f,...) fscang(gfileStdIn,f,__VA_ARGS__) + + #if GFILE_NEED_STRINGS + int vsscang(const char *buf, const char *fmt, va_list arg); + int sscang(const char *buf, const char *fmt, ...); #endif +#endif - #if GFILE_NEED_MEMFS || defined(__DOXYGEN__) - /** - * @brief Open file from a memory pointer - * - * @param[in] memptr The pointer to the memory - * @param[in] mode The mode. - * - * @return Valid GFILE on success, 0 otherwise - * - * @note The modes are the same modes as in @p gfileOpen(). Note there is - * no concept of file-size. Be careful not to overwrite other memory or - * to read from inaccessible sections of memory. - * @note Supported operations are: read, write, getpos, setpos - * - * @api - */ - GFILE * gfileOpenMemory(void *memptr, const char *mode); - #endif +#if GFILE_NEED_STDIO && !defined(GFILE_NEED_STDIO_MUST_BE_OFF) + // Needed routines and definitions + size_t gstdioRead(void * ptr, size_t size, size_t count, GFILE *f); + size_t gstdioWrite(const void * ptr, size_t size, size_t count, GFILE *f); + int gstdioGetpos(GFILE *f, long int *pos); + int gstdioSeek(GFILE *f, size_t offset, int origin); + #define SEEK_SET 0 + #define SEEK_CUR 1 + #define SEEK_END 2 - #if GFILE_NEED_STRINGS || defined(__DOXYGEN__) - /** - * @brief Open file from a null terminated C string - * - * @param[in] str The pointer to the string or string buffer - * @param[in] mode The mode - * - * @return Valid GFILE on success, 0 otherwise - * - * @note The modes are the same modes as in @p gfileOpen(). Note there is - * no concept of file-size. Be careful not to overwrite other memory or - * to read from inaccessible sections of memory. - * @note Reading will return EOF when the NULL character is reached. - * @note Writing will always place a NULL in the next character effectively terminating the - * string at the character just written. - * @note Supported operations are: read, write, append, getpos, setpos - * @note Be careful with setpos and getpos. They do not check for the end of the string. - * @note Reading and Writing will read/write a maximum of one character at a time. - * - * @api - */ - GFILE * gfileOpenString(char *str, const char *mode); - #endif + // Stdio emulation + #define stdin gfileStdIn + #define stdout gfileStdOut + #define stderr gfileStdErr + #define FOPEN_MAX GFILE_MAX_GFILES + #define TMP_MAX GFILE_MAX_GFILES + #define FILENAME_MAX 256 // Use a relatively small number for an embedded platform + #define L_tmpnam FILENAME_MAX + #define P_tmpdir "/tmp/" + #define FILE GFILE + #define fopen(n,m) gfileOpen(n,m) + #define fclose(f) gfileClose(f) + #define fread(p,sz,cnt,f) gstdioRead(p,sz,cnt,f) + #define fwrite(p,sz,cnt,f) gstdioWrite(p,sz,cnt,f) + #define fseek(f,ofs,org) gstdioSeek(f,ofs,org) + #define remove(n) (!gfileDelete(n)) + #define rename(o,n) (!gfileRename(o,n)) + #define fflush(f) (0) + #define ftell(f) gfileGetPos(f) + #define fpos_t long int + #define fgetpos(f,pos) gstdioGetpos(f,pos) + #define fsetpos(f, pos) (!gfileSetPos(f, *pos)) + #define rewind(f) gfileSetPos(f, 0); + #define feof(f) gfileEOF(f) + #define vfprintf(f,m,a) vfnprintg(f,0,m,a) + #define fprintf(f,m,...) fnprintg(f,0,m,__VA_ARGS__) + #define vprintf(m,a) vfnprintg(gfileStdOut,0,m,a) + #define printf(m,...) fnprintg(gfileStdOut,0,m,__VA_ARGS__) + #define vsnprintf(s,n,m,a) vsnprintg(s,n,m,a) + #define snprintf(s,n,m,...) snprintg(s,n,m,__VA_ARGS__) + #define vsprintf(s,m,a) vsnprintg(s,0,m,a) + #define sprintf(s,m,...) snprintg(s,0,m,__VA_ARGS__) - #if GFILE_NEED_PRINTG || defined(__DOXYGEN__) - #include - - int vfnprintg(GFILE *f, int maxlen, const char *fmt, va_list arg); - int fnprintg(GFILE *f, int maxlen, const char *fmt, ...); - #define vfprintg(f,m,a) vfnprintg(f,0,m,a) - #define fprintg(f,m,...) fnprintg(f,0,m,__VA_ARGS__) - #define vprintg(m,a) vfnprintg(gfileStdOut,0,m,a) - #define printg(m,...) fnprintg(gfileStdOut,0,m,__VA_ARGS__) - - #if GFILE_NEED_STRINGS - int vsnprintg(char *buf, int maxlen, const char *fmt, va_list arg); - int snprintg(char *buf, int maxlen, const char *fmt, ...); - #define vsprintg(s,m,a) vsnprintg(s,0,m,a) - #define sprintg(s,m,...) snprintg(s,0,m,__VA_ARGS__) - #endif - #endif - - #if GFILE_NEED_SCANG || defined(__DOXYGEN__) - #include - - int vfscang(GFILE *f, const char *fmt, va_list arg); - int fscang(GFILE *f, const char *fmt, ...); - #define vscang(f,a) vfscang(gfileStdIn,f,a) - #define scang(f,...) fscang(gfileStdIn,f,__VA_ARGS__) - - #if GFILE_NEED_STRINGS - int vsscang(const char *buf, const char *fmt, va_list arg); - int sscang(const char *buf, const char *fmt, ...); - #endif - #endif - - #if GFILE_NEED_STDIO && !defined(GFILE_NEED_STDIO_MUST_BE_OFF) - // Needed routines and definitions - size_t gstdioRead(void * ptr, size_t size, size_t count, GFILE *f); - size_t gstdioWrite(const void * ptr, size_t size, size_t count, GFILE *f); - int gstdioGetpos(GFILE *f, long int *pos); - int gstdioSeek(GFILE *f, size_t offset, int origin); - #define SEEK_SET 0 - #define SEEK_CUR 1 - #define SEEK_END 2 - - // Stdio emulation - #define stdin gfileStdIn - #define stdout gfileStdOut - #define stderr gfileStdErr - #define FOPEN_MAX GFILE_MAX_GFILES - #define TMP_MAX GFILE_MAX_GFILES - #define FILENAME_MAX 256 // Use a relatively small number for an embedded platform - #define L_tmpnam FILENAME_MAX - #define P_tmpdir "/tmp/" - #define FILE GFILE - #define fopen(n,m) gfileOpen(n,m) - #define fclose(f) gfileClose(f) - #define fread(p,sz,cnt,f) gstdioRead(p,sz,cnt,f) - #define fwrite(p,sz,cnt,f) gstdioWrite(p,sz,cnt,f) - #define fseek(f,ofs,org) gstdioSeek(f,ofs,org) - #define remove(n) (!gfileDelete(n)) - #define rename(o,n) (!gfileRename(o,n)) - #define fflush(f) (0) - #define ftell(f) gfileGetPos(f) - #define fpos_t long int - #define fgetpos(f,pos) gstdioGetpos(f,pos) - #define fsetpos(f, pos) (!gfileSetPos(f, *pos)) - #define rewind(f) gfileSetPos(f, 0); - #define feof(f) gfileEOF(f) - #define vfprintf(f,m,a) vfnprintg(f,0,m,a) - #define fprintf(f,m,...) fnprintg(f,0,m,__VA_ARGS__) - #define vprintf(m,a) vfnprintg(gfileStdOut,0,m,a) - #define printf(m,...) fnprintg(gfileStdOut,0,m,__VA_ARGS__) - #define vsnprintf(s,n,m,a) vsnprintg(s,n,m,a) - #define snprintf(s,n,m,...) snprintg(s,n,m,__VA_ARGS__) - #define vsprintf(s,m,a) vsnprintg(s,0,m,a) - #define sprintf(s,m,...) snprintg(s,0,m,__VA_ARGS__) - - //TODO - //void clearerr ( FILE * stream ); - //int ferror ( FILE * stream ); - //FILE * tmpfile ( void ); // Auto-deleting - //char * tmpnam ( char * str ); - //char * mktemp (char *template); - //FILE * freopen ( const char * filename, const char * mode, FILE * stream ); - //setbuf - //setvbuf - //fflush - //fgetc - //fgets - //fputc - //fputs - //getc - //getchar - //puts - //ungetc - //void perror (const char * str); - #endif - -#ifdef __cplusplus -} + //TODO + //void clearerr ( FILE * stream ); + //int ferror ( FILE * stream ); + //FILE * tmpfile ( void ); // Auto-deleting + //char * tmpnam ( char * str ); + //char * mktemp (char *template); + //FILE * freopen ( const char * filename, const char * mode, FILE * stream ); + //setbuf + //setvbuf + //fflush + //fgetc + //fgets + //fputc + //fputs + //getc + //getchar + //puts + //ungetc + //void perror (const char * str); #endif #endif /* GFX_USE_GFILE */ diff --git a/src/gfile/gfile_fatfs_wrapper.c b/src/gfile/gfile_fatfs_wrapper.c index 0156c42b..7f3a3e39 100644 --- a/src/gfile/gfile_fatfs_wrapper.c +++ b/src/gfile/gfile_fatfs_wrapper.c @@ -49,8 +49,8 @@ int ff_req_grant(_SYNC_t sobj) { if (gfxSemWait( (gfxSem*)&sobj, (delaytime_t)_FS_TIMEOUT) ) - return TRUE; - return FALSE; + return gTrue; + return gFalse; } /*------------------------------------------------------------------------*/ diff --git a/src/gfile/gfile_fs.h b/src/gfile/gfile_fs.h index c2337283..5b1f4fdc 100644 --- a/src/gfile/gfile_fs.h +++ b/src/gfile/gfile_fs.h @@ -34,7 +34,7 @@ struct GFILE { struct gfileList { const struct GFILEVMT * vmt; - bool_t dirs; + gBool dirs; }; typedef struct GFILEVMT { @@ -46,22 +46,22 @@ typedef struct GFILEVMT { #define GFSFLG_SMALL 0x0020 #define GFSFLG_TEXTMODES 0x0040 char prefix; - bool_t (*del) (const char *fname); - bool_t (*exists) (const char *fname); + gBool (*del) (const char *fname); + gBool (*exists) (const char *fname); long int (*filesize) (const char *fname); - bool_t (*ren) (const char *oldname, const char *newname); - bool_t (*open) (GFILE *f, const char *fname); + gBool (*ren) (const char *oldname, const char *newname); + gBool (*open) (GFILE *f, const char *fname); void (*close) (GFILE *f); int (*read) (GFILE *f, void *buf, int size); int (*write) (GFILE *f, const void *buf, int size); - bool_t (*setpos) (GFILE *f, long int pos); + gBool (*setpos) (GFILE *f, long int pos); long int (*getsize) (GFILE *f); - bool_t (*eof) (GFILE *f); - bool_t (*mount) (const char *drive); - bool_t (*unmount) (const char *drive); - bool_t (*sync) (GFILE *f); + gBool (*eof) (GFILE *f); + gBool (*mount) (const char *drive); + gBool (*unmount) (const char *drive); + gBool (*sync) (GFILE *f); #if GFILE_NEED_FILELISTS - gfileList * (*flopen) (const char *path, bool_t dirs); + gfileList * (*flopen) (const char *path, gBool dirs); const char *(*flread) (gfileList *pfl); void (*flclose) (gfileList *pfl); #endif diff --git a/src/gfile/gfile_fs_chibios.c b/src/gfile/gfile_fs_chibios.c index 78681a90..35b4061c 100644 --- a/src/gfile/gfile_fs_chibios.c +++ b/src/gfile/gfile_fs_chibios.c @@ -18,9 +18,9 @@ static void ChibiOSBFSClose(GFILE *f); static int ChibiOSBFSRead(GFILE *f, void *buf, int size); static int ChibiOSBFSWrite(GFILE *f, const void *buf, int size); -static bool_t ChibiOSBFSSetpos(GFILE *f, long int pos); +static gBool ChibiOSBFSSetpos(GFILE *f, long int pos); static long int ChibiOSBFSGetsize(GFILE *f); -static bool_t ChibiOSBFSEof(GFILE *f); +static gBool ChibiOSBFSEof(GFILE *f); static const GFILEVMT FsCHIBIOSVMT = { GFSFLG_SEEKABLE|GFSFLG_WRITEABLE, // flags @@ -52,12 +52,12 @@ static int ChibiOSBFSRead(GFILE *f, void *buf, int size) { static int ChibiOSBFSWrite(GFILE *f, const void *buf, int size) { return fileStreamWrite(((FileStream *)f->obj), (uint8_t *)buf, size); } -static bool_t ChibiOSBFSSetpos(GFILE *f, long int pos) { +static gBool ChibiOSBFSSetpos(GFILE *f, long int pos) { fileStreamSeek(((FileStream *)f->obj), pos); - return TRUE; + return gTrue; } static long int ChibiOSBFSGetsize(GFILE *f) { return fileStreamGetSize(((FileStream *)f->obj)); } -static bool_t ChibiOSBFSEof(GFILE *f) { return f->pos >= fileStreamGetSize(((FileStream *)f->obj)); } +static gBool ChibiOSBFSEof(GFILE *f) { return f->pos >= fileStreamGetSize(((FileStream *)f->obj)); } GFILE * gfileOpenChibiOSFileStream(void *FileStreamPtr, const char *mode) { GFILE * f; diff --git a/src/gfile/gfile_fs_fatfs.c b/src/gfile/gfile_fs_fatfs.c index 7f67cd76..03c8d2e9 100644 --- a/src/gfile/gfile_fs_fatfs.c +++ b/src/gfile/gfile_fs_fatfs.c @@ -20,22 +20,22 @@ * The FAT file-system VMT ********************************************************/ -static bool_t fatfsDel(const char* fname); -static bool_t fatfsExists(const char* fname); +static gBool fatfsDel(const char* fname); +static gBool fatfsExists(const char* fname); static long int fatfsFileSize(const char* fname); -static bool_t fatfsRename(const char* oldname, const char* newname); -static bool_t fatfsOpen(GFILE* f, const char* fname); +static gBool fatfsRename(const char* oldname, const char* newname); +static gBool fatfsOpen(GFILE* f, const char* fname); static void fatfsClose(GFILE* f); static int fatfsRead(GFILE* f, void* buf, int size); static int fatfsWrite(GFILE* f, const void* buf, int size); -static bool_t fatfsSetPos(GFILE* f, long int pos); +static gBool fatfsSetPos(GFILE* f, long int pos); static long int fatfsGetSize(GFILE* f); -static bool_t fatfsEOF(GFILE* f); -static bool_t fatfsMount(const char* drive); -static bool_t fatfsUnmount(const char* drive); -static bool_t fatfsSync(GFILE* f); +static gBool fatfsEOF(GFILE* f); +static gBool fatfsMount(const char* drive); +static gBool fatfsUnmount(const char* drive); +static gBool fatfsSync(GFILE* f); #if GFILE_NEED_FILELISTS && _FS_MINIMIZE <= 1 - static gfileList *fatfsFlOpen(const char *path, bool_t dirs); + static gfileList *fatfsFlOpen(const char *path, gBool dirs); static const char *fatfsFlRead(gfileList *pfl); static void fatfsFlClose(gfileList *pfl); #endif @@ -75,7 +75,7 @@ typedef struct fatfsList { } fatfsList; // optimize these later on. Use an array to have multiple FatFS -static bool_t fatfs_mounted = FALSE; +static gBool fatfs_mounted = gFalse; static FATFS fatfs_fs; static BYTE fatfs_flags2mode(GFILE* f) @@ -95,27 +95,27 @@ static BYTE fatfs_flags2mode(GFILE* f) return mode; } -static bool_t fatfsDel(const char* fname) +static gBool fatfsDel(const char* fname) { FRESULT ferr; ferr = f_unlink( (const TCHAR*)fname ); if (ferr != FR_OK) - return FALSE; + return gFalse; - return TRUE; + return gTrue; } -static bool_t fatfsExists(const char* fname) +static gBool fatfsExists(const char* fname) { FRESULT ferr; FILINFO fno; ferr = f_stat( (const TCHAR*)fname, &fno); if (ferr != FR_OK) - return FALSE; + return gFalse; - return TRUE; + return gTrue; } static long int fatfsFileSize(const char* fname) @@ -130,34 +130,34 @@ static long int fatfsFileSize(const char* fname) return (long int)fno.fsize; } -static bool_t fatfsRename(const char* oldname, const char* newname) +static gBool fatfsRename(const char* oldname, const char* newname) { FRESULT ferr; ferr = f_rename( (const TCHAR*)oldname, (const TCHAR*)newname ); if (ferr != FR_OK) - return FALSE; + return gFalse; - return TRUE; + return gTrue; } -static bool_t fatfsOpen(GFILE* f, const char* fname) +static gBool fatfsOpen(GFILE* f, const char* fname) { FIL* fd; #if !GFILE_NEED_NOAUTOMOUNT if (!fatfs_mounted && !fatfsMount("")) - return FALSE; + return gFalse; #endif if (!(fd = gfxAlloc(sizeof(FIL)))) - return FALSE; + return gFalse; if (f_open(fd, fname, fatfs_flags2mode(f)) != FR_OK) { gfxFree(fd); f->obj = 0; - return FALSE; + return gFalse; } f->obj = (void*)fd; @@ -169,7 +169,7 @@ static bool_t fatfsOpen(GFILE* f, const char* fname) } #endif - return TRUE; + return gTrue; } static void fatfsClose(GFILE* f) @@ -201,15 +201,15 @@ static int fatfsWrite(GFILE* f, const void* buf, int size) return wr; } -static bool_t fatfsSetPos(GFILE* f, long int pos) +static gBool fatfsSetPos(GFILE* f, long int pos) { FRESULT ferr; ferr = f_lseek( (FIL*)f->obj, (DWORD)pos ); if (ferr != FR_OK) - return FALSE; + return gFalse; - return TRUE; + return gTrue; } static long int fatfsGetSize(GFILE* f) @@ -217,56 +217,56 @@ static long int fatfsGetSize(GFILE* f) return (long int)f_size( (FIL*)f->obj ); } -static bool_t fatfsEOF(GFILE* f) +static gBool fatfsEOF(GFILE* f) { if ( f_eof( (FIL*)f->obj ) != 0) - return TRUE; + return gTrue; else - return FALSE; + return gFalse; } -static bool_t fatfsMount(const char* drive) +static gBool fatfsMount(const char* drive) { FRESULT ferr; if (!fatfs_mounted) { ferr = f_mount(&fatfs_fs, drive, 1); if (ferr != FR_OK) - return FALSE; - fatfs_mounted = TRUE; - return TRUE; + return gFalse; + fatfs_mounted = gTrue; + return gTrue; } - return FALSE; + return gFalse; } -static bool_t fatfsUnmount(const char* drive) +static gBool fatfsUnmount(const char* drive) { (void)drive; if (fatfs_mounted) { // FatFS does not provide an unmount routine. - fatfs_mounted = FALSE; - return TRUE; + fatfs_mounted = gFalse; + return gTrue; } - return FALSE; + return gFalse; } -static bool_t fatfsSync(GFILE *f) +static gBool fatfsSync(GFILE *f) { FRESULT ferr; ferr = f_sync( (FIL*)f->obj ); if (ferr != FR_OK) { - return FALSE; + return gFalse; } - return TRUE; + return gTrue; } #if GFILE_NEED_FILELISTS && _FS_MINIMIZE <= 1 - static gfileList *fatfsFlOpen(const char *path, bool_t dirs) { + static gfileList *fatfsFlOpen(const char *path, gBool dirs) { fatfsList *p; (void) dirs; diff --git a/src/gfile/gfile_fs_mem.c b/src/gfile/gfile_fs_mem.c index 4aad43fe..1f6fd050 100644 --- a/src/gfile/gfile_fs_mem.c +++ b/src/gfile/gfile_fs_mem.c @@ -19,7 +19,7 @@ static int MEMRead(GFILE *f, void *buf, int size); static int MEMWrite(GFILE *f, const void *buf, int size); -static bool_t MEMSetpos(GFILE *f, long int pos); +static gBool MEMSetpos(GFILE *f, long int pos); static const GFILEVMT FsMemVMT = { GFSFLG_SEEKABLE|GFSFLG_WRITEABLE, // flags @@ -41,10 +41,10 @@ static int MEMWrite(GFILE *f, const void *buf, int size) { memcpy(((char *)f->obj)+f->pos, buf, size); return size; } -static bool_t MEMSetpos(GFILE *f, long int pos) { +static gBool MEMSetpos(GFILE *f, long int pos) { (void) f; (void) pos; - return TRUE; + return gTrue; } GFILE * gfileOpenMemory(void *memptr, const char *mode) { diff --git a/src/gfile/gfile_fs_native.c b/src/gfile/gfile_fs_native.c index d1e2a1fc..a9bc5065 100644 --- a/src/gfile/gfile_fs_native.c +++ b/src/gfile/gfile_fs_native.c @@ -22,19 +22,19 @@ #include #include -static bool_t NativeDel(const char *fname); -static bool_t NativeExists(const char *fname); +static gBool NativeDel(const char *fname); +static gBool NativeExists(const char *fname); static long int NativeFilesize(const char *fname); -static bool_t NativeRen(const char *oldname, const char *newname); -static bool_t NativeOpen(GFILE *f, const char *fname); +static gBool NativeRen(const char *oldname, const char *newname); +static gBool NativeOpen(GFILE *f, const char *fname); static void NativeClose(GFILE *f); static int NativeRead(GFILE *f, void *buf, int size); static int NativeWrite(GFILE *f, const void *buf, int size); -static bool_t NativeSetpos(GFILE *f, long int pos); +static gBool NativeSetpos(GFILE *f, long int pos); static long int NativeGetsize(GFILE *f); -static bool_t NativeEof(GFILE *f); +static gBool NativeEof(GFILE *f); #if GFILE_NEED_FILELISTS - static gfileList *NativeFlOpen(const char *path, bool_t dirs); + static gfileList *NativeFlOpen(const char *path, gBool dirs); static const char *NativeFlRead(gfileList *pfl); static void NativeFlClose(gfileList *pfl); #endif @@ -95,33 +95,33 @@ static void Native_flags2mode(char *buf, uint16_t flags) { *buf++ = 0; } -static bool_t NativeDel(const char *fname) { return remove(fname) ? FALSE : TRUE; } +static gBool NativeDel(const char *fname) { return remove(fname) ? gFalse : gTrue; } static void NativeClose(GFILE *f) { fclose((FILE *)f->obj); } static int NativeRead(GFILE *f, void *buf, int size) { return fread(buf, 1, size, (FILE *)f->obj); } static int NativeWrite(GFILE *f, const void *buf, int size) { return fwrite(buf, 1, size, (FILE *)f->obj); } -static bool_t NativeSetpos(GFILE *f, long int pos) { return fseek((FILE *)f->obj, pos, SEEK_SET) ? FALSE : TRUE; } -static bool_t NativeEof(GFILE *f) { return feof((FILE *)f->obj) ? TRUE : FALSE; } -static bool_t NativeRen(const char *oldname, const char *newname) { return rename(oldname, newname) ? FALSE : TRUE; } -static bool_t NativeExists(const char *fname) { +static gBool NativeSetpos(GFILE *f, long int pos) { return fseek((FILE *)f->obj, pos, SEEK_SET) ? gFalse : gTrue; } +static gBool NativeEof(GFILE *f) { return feof((FILE *)f->obj) ? gTrue : gFalse; } +static gBool NativeRen(const char *oldname, const char *newname) { return rename(oldname, newname) ? gFalse : gTrue; } +static gBool NativeExists(const char *fname) { // We define access this way so we don't have to include which may // (and does under windows) contain conflicting definitions for types such as uint16_t. extern int access(const char *pathname, int mode); - return access(fname, 0) ? FALSE : TRUE; + return access(fname, 0) ? gFalse : gTrue; } static long int NativeFilesize(const char *fname) { struct stat st; if (stat(fname, &st)) return -1; return st.st_size; } -static bool_t NativeOpen(GFILE *f, const char *fname) { +static gBool NativeOpen(GFILE *f, const char *fname) { FILE *fd; char mode[5]; Native_flags2mode(mode, f->flags); if (!(fd = fopen(fname, mode))) - return FALSE; + return gFalse; f->obj = (void *)fd; - return TRUE; + return gTrue; } static long int NativeGetsize(GFILE *f) { struct stat st; @@ -135,10 +135,10 @@ static long int NativeGetsize(GFILE *f) { gfileList fl; HANDLE d; WIN32_FIND_DATA f; - bool_t first; + gBool first; } NativeFileList; - static gfileList *NativeFlOpen(const char *path, bool_t dirs) { + static gfileList *NativeFlOpen(const char *path, gBool dirs) { NativeFileList *p; (void) dirs; @@ -148,7 +148,7 @@ static long int NativeGetsize(GFILE *f) { gfxFree(p); return 0; } - p->first = TRUE; + p->first = gTrue; return &p->fl; } @@ -157,7 +157,7 @@ static long int NativeGetsize(GFILE *f) { while(1) { if (!nfl->first && !FindNextFile(nfl->d, &nfl->f)) return 0; - nfl->first = FALSE; + nfl->first = gFalse; if (nfl->f.cFileName[0] == '.') continue; if (nfl->fl.dirs) { @@ -186,7 +186,7 @@ static long int NativeGetsize(GFILE *f) { struct dirent * f; } NativeFileList; - static gfileList *NativeFlOpen(const char *path, bool_t dirs) { + static gfileList *NativeFlOpen(const char *path, gBool dirs) { NativeFileList *p; (void) dirs; diff --git a/src/gfile/gfile_fs_petitfs.c b/src/gfile/gfile_fs_petitfs.c index 553c29ff..84405f25 100644 --- a/src/gfile/gfile_fs_petitfs.c +++ b/src/gfile/gfile_fs_petitfs.c @@ -16,12 +16,12 @@ #include "gfile_fs.h" #include "gfile_petitfs_wrapper.h" -static bool_t petitfsExists(const char* fname); -static bool_t petitfsOpen(GFILE* f, const char* fname); +static gBool petitfsExists(const char* fname); +static gBool petitfsOpen(GFILE* f, const char* fname); static int petitfsRead(GFILE* f, void* buf, int size); -static bool_t petitfsSetPos(GFILE* f, long int pos); +static gBool petitfsSetPos(GFILE* f, long int pos); #if GFILE_NEED_FILELISTS && _FS_MINIMIZE <= 1 - static gfileList *petitfsFlOpen(const char *path, bool_t dirs); + static gfileList *petitfsFlOpen(const char *path, gBool dirs); static const char *petitfsFlRead(gfileList *pfl); static void petitfsFlClose(gfileList *pfl); #endif @@ -58,38 +58,38 @@ typedef struct petitfsList { } petitfsList; // optimize these later on. Use an array to have multiple -static bool_t petitfs_mounted = FALSE; +static gBool petitfs_mounted = gFalse; static FATFS petitfs_fs; -static bool_t petitfsExists(const char* fname) +static gBool petitfsExists(const char* fname) { // Mount first if (!petitfs_mounted && pf_mount(&petitfs_fs) != FR_OK) - return FALSE; + return gFalse; // Open if (pf_open(fname) != FR_OK) - return FALSE; + return gFalse; - return TRUE; + return gTrue; } -static bool_t petitfsOpen(GFILE* f, const char* fname) +static gBool petitfsOpen(GFILE* f, const char* fname) { // No writing if ((f->flags & GFILEFLG_WRITE)) - return FALSE; + return gFalse; // Mount first if (!petitfs_mounted && pf_mount(&petitfs_fs) != FR_OK) - return FALSE; + return gFalse; // Open if (pf_open(fname) != FR_OK) - return FALSE; + return gFalse; f->obj = &petitfs_fs; - return TRUE; + return gTrue; } static int petitfsRead(GFILE* f, void* buf, int size) @@ -103,14 +103,14 @@ static int petitfsRead(GFILE* f, void* buf, int size) return br; } -static bool_t petitfsSetPos(GFILE* f, long int pos) +static gBool petitfsSetPos(GFILE* f, long int pos) { (void) f; return pf_lseek((DWORD)pos) == FR_OK; } #if GFILE_NEED_FILELISTS - static gfileList *petitfsFlOpen(const char *path, bool_t dirs) { + static gfileList *petitfsFlOpen(const char *path, gBool dirs) { petitfsList *p; (void) dirs; diff --git a/src/gfile/gfile_fs_rom.c b/src/gfile/gfile_fs_rom.c index ec07ec34..578a28e5 100644 --- a/src/gfile/gfile_fs_rom.c +++ b/src/gfile/gfile_fs_rom.c @@ -42,16 +42,16 @@ typedef struct ROMFileList { } ROMFileList; -static bool_t ROMExists(const char *fname); +static gBool ROMExists(const char *fname); static long int ROMFilesize(const char *fname); -static bool_t ROMOpen(GFILE *f, const char *fname); +static gBool ROMOpen(GFILE *f, const char *fname); static void ROMClose(GFILE *f); static int ROMRead(GFILE *f, void *buf, int size); -static bool_t ROMSetpos(GFILE *f, long int pos); +static gBool ROMSetpos(GFILE *f, long int pos); static long int ROMGetsize(GFILE *f); -static bool_t ROMEof(GFILE *f); +static gBool ROMEof(GFILE *f); #if GFILE_NEED_FILELISTS - static gfileList *ROMFlOpen(const char *path, bool_t dirs); + static gfileList *ROMFlOpen(const char *path, gBool dirs); static const char *ROMFlRead(gfileList *pfl); static void ROMFlClose(gfileList *pfl); #endif @@ -79,7 +79,7 @@ static const ROMFS_DIRENTRY *ROMFindFile(const char *fname) return p; } -static bool_t ROMExists(const char *fname) +static gBool ROMExists(const char *fname) { return ROMFindFile(fname) != 0; } @@ -92,13 +92,13 @@ static long int ROMFilesize(const char *fname) return p->size; } -static bool_t ROMOpen(GFILE *f, const char *fname) +static gBool ROMOpen(GFILE *f, const char *fname) { const ROMFS_DIRENTRY *p; - if (!(p = ROMFindFile(fname))) return FALSE; + if (!(p = ROMFindFile(fname))) return gFalse; f->obj = (void *)p; - return TRUE; + return gTrue; } static void ROMClose(GFILE *f) @@ -118,7 +118,7 @@ static int ROMRead(GFILE *f, void *buf, int size) return size; } -static bool_t ROMSetpos(GFILE *f, long int pos) +static gBool ROMSetpos(GFILE *f, long int pos) { return pos <= ((const ROMFS_DIRENTRY *)f->obj)->size; } @@ -128,13 +128,13 @@ static long int ROMGetsize(GFILE *f) return ((const ROMFS_DIRENTRY *)f->obj)->size; } -static bool_t ROMEof(GFILE *f) +static gBool ROMEof(GFILE *f) { return f->pos >= ((const ROMFS_DIRENTRY *)f->obj)->size; } #if GFILE_NEED_FILELISTS - static gfileList *ROMFlOpen(const char *path, bool_t dirs) { + static gfileList *ROMFlOpen(const char *path, gBool dirs) { ROMFileList * p; (void) path; diff --git a/src/gfile/gfile_printg.c b/src/gfile/gfile_printg.c index 8f9d2570..697593d3 100644 --- a/src/gfile/gfile_printg.c +++ b/src/gfile/gfile_printg.c @@ -56,7 +56,7 @@ int vfnprintg(GFILE *f, int maxlen, const char *fmt, va_list arg) { int ret; char *p, *s, c, filler; int i, precision, width; - bool_t is_long, left_align; + gBool is_long, left_align; long l; #if GFILE_ALLOW_FLOATS float fpv; @@ -81,14 +81,14 @@ int vfnprintg(GFILE *f, int maxlen, const char *fmt, va_list arg) { fmt++; p = s = tmpbuf; - left_align = FALSE; + left_align = gFalse; filler = ' '; width = 0; precision = 0; if (*fmt == '-') { fmt++; - left_align = TRUE; + left_align = gTrue; } if (*fmt == '0') { fmt++; @@ -119,7 +119,7 @@ int vfnprintg(GFILE *f, int maxlen, const char *fmt, va_list arg) { } /* Long modifier.*/ if (c == 'l' || c == 'L') { - is_long = TRUE; + is_long = gTrue; if (*fmt) c = *fmt++; } @@ -194,7 +194,7 @@ int vfnprintg(GFILE *f, int maxlen, const char *fmt, va_list arg) { i = (int)(p - s); if ((width -= i) < 0) width = 0; - if (left_align == FALSE) + if (!left_align) width = -width; if (width < 0) { if (*s == '-' && filler == '0') { diff --git a/src/gfile/gfile_scang.c b/src/gfile/gfile_scang.c index a79cc6a3..8e1ee69c 100644 --- a/src/gfile/gfile_scang.c +++ b/src/gfile/gfile_scang.c @@ -27,7 +27,7 @@ int vfscang(GFILE *f, const char *fmt, va_list arg) { int res, width, size, base; unsigned long num; char c; - bool_t assign, negate; + gBool assign, negate; char *p; for(res = 0; *fmt; fmt++) { @@ -37,15 +37,15 @@ int vfscang(GFILE *f, const char *fmt, va_list arg) { case '%': fmt++; - assign = TRUE; - negate = FALSE; + assign = gTrue; + negate = gFalse; width = 0; size = 1; num = 0; if (*fmt == '*') { fmt++; - assign = FALSE; + assign = gFalse; } while(*fmt >= '0' && *fmt <= '9') width = width * 10 + (*fmt++ - '0'); @@ -145,7 +145,7 @@ int vfscang(GFILE *f, const char *fmt, va_list arg) { break; } if (c == '-' && *fmt != 'u') { - negate = TRUE; + negate = gTrue; if ((width && !--width) || !gfileRead(f, &c, 1)) return res; } if (base == -1) { diff --git a/src/gfx.c b/src/gfx.c index 67f034a1..564bef35 100644 --- a/src/gfx.c +++ b/src/gfx.c @@ -15,7 +15,7 @@ #include "../gfx.h" -static bool_t gfxInitDone = FALSE; +static gBool gfxInitDone = gFalse; /* These init functions are defined by each module but not published */ extern void _gosInit(void); @@ -84,7 +84,7 @@ void gfxInit(void) /* Ensure we only initialise once */ if (gfxInitDone) return; - gfxInitDone = TRUE; + gfxInitDone = gTrue; // These must be initialised in the order of their dependancies @@ -141,7 +141,7 @@ void gfxDeinit(void) { if (!gfxInitDone) return; - gfxInitDone = FALSE; + gfxInitDone = gFalse; // We deinitialise the opposite way as we initialised #if GFX_USE_GWIN diff --git a/src/gfx.h b/src/gfx.h new file mode 100644 index 00000000..cb92a10c --- /dev/null +++ b/src/gfx.h @@ -0,0 +1,238 @@ +/* + * This file is subject to the terms of the GFX License. If a copy of + * the license was not distributed with this file, you can obtain one at: + * + * http://ugfx.org/license.html + */ + +/** + * @file gfx.h + * @brief GFX system header file. + * + * @addtogroup GFX + * + * @brief Main module to glue all the others together + * + * @{ + */ + +#ifndef _GFX_H +#define _GFX_H + +// Everything here is C, not C++ +#ifdef __cplusplus +extern "C" { +#endif + +// ------------------------------ Initial preparation --------------------------------- +#undef GFX_COMPILESTAGE +#define GFX_COMPILESTAGE GFX_COMPILESTAGE_PREP + +// Compiling stages +#define GFX_COMPILESTAGE_USERPROGRAM 0 // Compiling the user program +#define GFX_COMPILESTAGE_PREP 1 // gfx.h: Initial preparation +#define GFX_COMPILESTAGE_USERCONFIG 2 // gfx.h: Load the user configuration +#define GFX_COMPILESTAGE_COMPILECONFIG 3 // gfx.h: Determine build environment info - COMPILER, CPU etc +#define GFX_COMPILESTAGE_OPTIONS 3 // gfx.h: Enumerate all options +#define GFX_COMPILESTAGE_DRIVERCONFIG 4 // gfx.h: Load driver configuration +#define GFX_COMPILESTAGE_DRIVERAPI 5 // gfx.h: Load driver public api +#define GFX_COMPILESTAGE_RULES 6 // gfx.h: Apply configuration rules +#define GFX_COMPILESTAGE_APIDEFS 7 // gfx.h: Define API definitions +#define GFX_COMPILESTAGE_COMPILEDRIVERS 100 // gfx.c: Compile drivers +#define GFX_COMPILESTAGE_COMPILECAPI 101 // gfx.c: Compile the uGFX C API +#define GFX_COMPILESTAGE_COMPILECPPAPI 102 // gfx.cpp: Compile the uGFX C++ API + +// ------------------------------ Load the user configuration --------------------------------- +#undef GFX_COMPILESTAGE +#define GFX_COMPILESTAGE GFX_COMPILESTAGE_USERCONFIG + +// Definitions for option configuration +#define GFXOFF (0) +#define GFXON (-1) + +// gfxconf.h is the user's project configuration for the GFX system. +#include "gfxconf.h" + +// ------------------------------ Determine build environment info - COMPILER, CPU etc --------------------------------- +#undef GFX_COMPILESTAGE +#define GFX_COMPILESTAGE GFX_COMPILESTAGE_COMPILECONFIG + +/** + * @name GFX compatibility options + * @{ + */ + /** + * @brief Include the uGFX V2.x API + * @details Defaults to GFXON + */ + #ifndef GFX_COMPAT_V2 + #define GFX_COMPAT_V2 GFXON + #endif +/** @} */ + +#if GFX_COMPAT_V2 + // These need to be defined here for compatibility with V2.x user config files + #if !defined(FALSE) + #define FALSE 0 + #endif + #if !defined(TRUE) + #define TRUE -1 + #endif +#endif + +// Are we in the uGFX library implementation itself? - not API documented +#ifndef GFX_COMPILE_INTERNAL_API + #define GFX_COMPILE_INTERNAL_API GFXOFF +#endif + +// Macro concatination and strify - not API documented +#define GFXCAT(a, b) a ## b +#define GFXCATX(a, b) GFXCAT(a, b) +#define GFXSTR(a) #a +#define GFXSTRX(a) GFXSTR(a) + +// Include Compiler and CPU support +#include "gfx_compilers.h" + +// Include standard types +#include "gfx_types.h" + +// Public uGFX API calling convention +#ifndef GFXAPI + #define GFXAPI +#endif + +// Public uGFX API callback convention +#ifndef GFXUSERFN + #define GFXUSERFN GFXAPI +#endif + +// Private uGFX API calling convention +#if GFX_COMPILE_INTERNAL_API && !defined(GFXINTERNAL) + #define GFXINTERNAL +#endif + +// ------------------------------ Enumerate all options --------------------------------- +#undef GFX_COMPILESTAGE +#define GFX_COMPILESTAGE GFX_COMPILESTAGE_OPTIONS + +/** + * Get all the options for each sub-system. + */ +#include "gfx_options.h" +#include "gos/gos_options.h" +#include "gdriver/gdriver_options.h" +#include "gfile/gfile_options.h" +#include "gmisc/gmisc_options.h" +#include "gtrans/gtrans_options.h" +#include "gqueue/gqueue_options.h" +#include "gevent/gevent_options.h" +#include "gtimer/gtimer_options.h" +#include "gdisp/gdisp_options.h" +#include "gwin/gwin_options.h" +#include "ginput/ginput_options.h" +#include "gadc/gadc_options.h" +#include "gaudio/gaudio_options.h" + +// ------------------------------ Load driver configuration --------------------------------- +#undef GFX_COMPILESTAGE +#define GFX_COMPILESTAGE GFX_COMPILESTAGE_DRIVERCONFIG + +// ------------------------------ Apply configuration rules --------------------------------- +#undef GFX_COMPILESTAGE +#define GFX_COMPILESTAGE GFX_COMPILESTAGE_RULES + +/** + * Interdependency safety checks on the sub-systems. + * These must be in dependency order. + */ +#ifndef GFX_DISPLAY_RULE_WARNINGS + #define GFX_DISPLAY_RULE_WARNINGS GFXOFF +#endif +#include "gwin/gwin_rules.h" +#include "ginput/ginput_rules.h" +#include "gdisp/gdisp_rules.h" +#include "gaudio/gaudio_rules.h" +#include "gadc/gadc_rules.h" +#include "gevent/gevent_rules.h" +#include "gtimer/gtimer_rules.h" +#include "gqueue/gqueue_rules.h" +#include "gmisc/gmisc_rules.h" +#include "gtrans/gtrans_rules.h" +#include "gfile/gfile_rules.h" +#include "gdriver/gdriver_rules.h" +#include "gos/gos_rules.h" + +// ------------------------------ Define API definitions --------------------------------- +#undef GFX_COMPILESTAGE +#define GFX_COMPILESTAGE GFX_COMPILESTAGE_APIDEFS + +/** + * Include the sub-system header files + */ +#include "gos/gos.h" +#if GFX_COMPILE_INTERNAL_API + #include "gdriver/gdriver.h" +#endif +#include "gfile/gfile.h" +#include "gmisc/gmisc.h" +#include "gtrans/gtrans.h" +#include "gqueue/gqueue.h" +#include "gevent/gevent.h" +#include "gtimer/gtimer.h" +#include "gdisp/gdisp.h" +#include "gwin/gwin.h" +#include "ginput/ginput.h" +#include "gadc/gadc.h" +#include "gaudio/gaudio.h" + +/** + * @brief The one call to start it all + * + * @note This will initialise each sub-system that has been turned on. + * For example, if GFX_USE_GDISP is defined then display will be initialised + * and cleared to black. + * @note If you define GFX_OS_NO_INIT as GFXON in your gfxconf.h file then ugfx doesn't try to + * initialise the operating system for you when you call @p gfxInit(). + * @note If you define GFX_OS_EXTRA_INIT_FUNCTION in your gfxconf.h file the macro is the + * name of a void function with no parameters that is called immediately after + * operating system initialisation (whether or not GFX_OS_NO_INIT is set). + * @note If you define GFX_OS_EXTRA_DEINIT_FUNCTION in your gfxconf.h file the macro is the + * name of a void function with no parameters that is called immediately before + * operating system de-initialisation (as ugfx is exiting). + * @note If GFX_OS_CALL_UGFXMAIN is set uGFXMain() is called after all initialisation is complete. + * + * @api + */ +void GFXAPI gfxInit(void); + +/** + * @brief The one call to end it all + * + * @note This will de-initialise each sub-system that has been turned on. + * + * @api + */ +void GFXAPI gfxDeinit(void); + +#if GFX_OS_CALL_UGFXMAIN || defined(__DOXYGEN__) + /** + * @brief The user supplied function containing all the user uGFX application code. + * + * @note This is called by gfxInit() and is expected to never return. + * It is defined by the user. + * + * @pre GFX_OS_CALL_UGFXMAIN is GFXON + */ + void GFXUSERFN uGFXMain(void); +#endif + +// ------------------------------ Compiling the user program --------------------------------- +#undef GFX_COMPILESTAGE +#define GFX_COMPILESTAGE GFX_COMPILESTAGE_USERPROGRAM + +#ifdef __cplusplus +} +#endif +#endif /* _GFX_H */ +/** @} */ diff --git a/src/gfx_options.h b/src/gfx_options.h new file mode 100644 index 00000000..608180ff --- /dev/null +++ b/src/gfx_options.h @@ -0,0 +1,145 @@ +/* + * This file is subject to the terms of the GFX License. If a copy of + * the license was not distributed with this file, you can obtain one at: + * + * http://ugfx.org/license.html + */ + +/** + * @file gfx_options.h + * @brief GFX system options. + * + * @addtogroup GFX + * @{ + */ + +/** + * @name GFX sub-systems that can be turned on + * @{ + */ + /** + * @brief GFX Driver API + * @details Defaults to GFXON + * @note Not much useful can be done without a driver + */ + #ifndef GFX_USE_GDRIVER + #define GFX_USE_GDRIVER GFXON + #endif + /** + * @brief GFX Graphics Display Basic API + * @details Defaults to GFXOFF + * @note Also add the specific hardware driver to your makefile. + * Eg. include $(GFXLIB)/drivers/gdisp/Nokia6610/driver.mk + */ + #ifndef GFX_USE_GDISP + #define GFX_USE_GDISP GFXOFF + #endif + /** + * @brief GFX Graphics Windowing API + * @details Defaults to GFXOFF + * @details Extends the GDISP API to add the concept of graphic windows. + * @note Also supports high-level "window" objects such as console windows, + * buttons, graphing etc + */ + #ifndef GFX_USE_GWIN + #define GFX_USE_GWIN GFXOFF + #endif + /** + * @brief GFX Event API + * @details Defaults to GFXOFF + * @details Defines the concept of a "Source" that can send "Events" to "Listeners". + */ + #ifndef GFX_USE_GEVENT + #define GFX_USE_GEVENT GFXOFF + #endif + /** + * @brief GFX Timer API + * @details Defaults to GFXOFF + * @details Provides thread context timers - both one-shot and periodic. + */ + #ifndef GFX_USE_GTIMER + #define GFX_USE_GTIMER GFXOFF + #endif + /** + * @brief GFX Queue API + * @details Defaults to GFXOFF + * @details Provides queue management. + */ + #ifndef GFX_USE_GQUEUE + #define GFX_USE_GQUEUE GFXOFF + #endif + /** + * @brief GFX Input Device API + * @details Defaults to GFXOFF + * @note Also add the specific hardware drivers to your makefile. + * Eg. + * include $(GFXLIB)/drivers/ginput/toggle/Pal/driver.mk + * and... + * include $(GFXLIB)/drivers/ginput/touch/MCU/driver.mk + */ + #ifndef GFX_USE_GINPUT + #define GFX_USE_GINPUT GFXOFF + #endif + /** + * @brief GFX Generic Periodic ADC API + * @details Defaults to GFXOFF + */ + #ifndef GFX_USE_GADC + #define GFX_USE_GADC GFXOFF + #endif + /** + * @brief GFX Audio API + * @details Defaults to GFXOFF + * @note Also add the specific hardware drivers to your makefile. + * Eg. + * include $(GFXLIB)/drivers/gaudio/GADC/driver.mk + */ + #ifndef GFX_USE_GAUDIO + #define GFX_USE_GAUDIO GFXOFF + #endif + /** + * @brief GFX Miscellaneous Routines API + * @details Defaults to GFXOFF + * @note Turning this on without turning on any GMISC_NEED_xxx macros will result + * in no extra code being compiled in. GMISC is made up from the sum of its + * parts. + */ + #ifndef GFX_USE_GMISC + #define GFX_USE_GMISC GFXOFF + #endif + /** + * @brief GFX File API + * @details Defaults to GFXOFF + */ + #ifndef GFX_USE_GFILE + #define GFX_USE_GFILE GFXOFF + #endif + /** + * @brief GFX Translation Support API + * @details Defaults to GFXOFF + */ + #ifndef GFX_USE_GTRANS + #define GFX_USE_GTRANS GFXOFF + #endif +/** @} */ + +/** + * @name GFX compatibility options + * @{ + */ + /** + * @brief Include the uGFX V2.x Old Colors + * @details Defaults to GFXON + * @pre Requires GFX_COMPAT_V2 to be GFXON + * @note The old color definitions (particularly Red, Green & Blue) can + * cause symbol conflicts with many platforms eg Win32, STM32 HAL etc. + * Although officially these symbols are part of the V2.x API, this + * option allows them to be turned off even when the rest of the V2.x + * API is turned on. + */ + #ifndef GFX_COMPAT_OLDCOLORS + #define GFX_COMPAT_OLDCOLORS GFXON + #endif +/** @} */ + +/** @} */ diff --git a/src/gfx_types.h b/src/gfx_types.h new file mode 100644 index 00000000..f6b2ee0f --- /dev/null +++ b/src/gfx_types.h @@ -0,0 +1,165 @@ +/* + * 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 + */ + +// Safety first! +#if (!defined(__STDC__) || !__STDC__) && !defined(__cplusplus) && !defined(_MSC_VER) + #error "K&R C Compilers are not supported. Try turning on ANSI C compliance or at least defining macro __STDC__=1" +#endif + +// This guarantees definition (even in C89) of: +// offsetof(s, m) - required and compiler dependant +// size_t - we try not to use this in uGFX as it may be 64 bit +// NULL - globally useful +// ptrdiff_t - globally useful + +#include + +#if (defined(__STDC__) && __STDC__ && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || (defined(__SUNPRO_C) && __SUNPRO_C >= 0x570) || (defined(_MSC_VER) && _MSC_VER >= 1600) || (defined (__WATCOMC__) && (defined (_STDINT_H_INCLUDED) || __WATCOMC__ >= 1250)) || (defined(__GNUC__) && (__GNUC__ > 3 || defined(_STDINT_H) || defined(_STDINT_H_) || defined (__UINT_FAST64_TYPE__)) ) + #include + typedef int_least8_t gI8; + typedef uint_least8_t gU8; + typedef int_least16_t gI16; + typedef uint_least16_t gU16; + typedef int_least32_t gI32; + typedef uint_least32_t gU32; + + #define GI8_C(v) INT8_C(v) + #define GU8_C(v) UINT8_C(v) + #define GI16_C(v) INT16_C(v) + #define GU16_C(v) UINT16_C(v) + #define GI32_C(v) INT32_C(v) + #define GU32_C(v) UINT32_C(v) + + #ifdef INT64_C + typedef int_least64_t gI64; + typedef uint_least64_t gU64; + #define GI64_C(v) INT64_C(v) + #define GU64_C(v) UINT64_C(v) + #define GFX_TYPE_64 GFXON + #else + #define GFX_TYPE_64 GFXOFF + #endif + +#elif defined(_MSC_VER) + #if (_MSC_VER < 1300) + typedef signed char gI8; + typedef unsigned char gU8; + typedef signed short gI16; + typedef unsigned short gU16; + typedef signed int gI32; + typedef unsigned int gU32; + #else + typedef signed __int8 gI8; + typedef unsigned __int8 gU8; + typedef signed __int16 gI16; + typedef unsigned __int16 gU16; + typedef signed __int32 gI32; + typedef unsigned __int32 gU32; + #endif + typedef signed __int64 gI64; + typedef unsigned __int64 gU64; + + #define GI8_C(v) v ## i8 + #define GU8_C(v) v ## ui8 + #define GI16_C(v) v ## i16 + #define GU16_C(v) v ## ui16 + #define GI32_C(v) v ## i32 + #define GU32_C(v) v ## ui32 + #define GI64_C(v) v ## i64 + #define GU64_C(v) v ## ui64 + + #define GFX_TYPE_64 GFXON + +/*#elif defined(__GNUC__) || defined(__GNUG__) + typedef __INT8_TYPE__ int8_t; + typedef __UINT8_TYPE__ uint8_t; + typedef __INT16_TYPE__ int16_t; + typedef __UINT16_TYPE__ uint16_t; + typedef __INT32_TYPE__ int32_t; + typedef __UINT32_TYPE__ uint32_t; +*/ +#else + #include + + /* char's are the smallest common type definition */ + typedef signed char gI8; + typedef unsigned char gU8; + #define GI8_C(v) v + #define GU8_C(v) v ## U + + /* + * Deduce the type assignments from limits.h under the assumption that + * integer sizes in bits are powers of 2, and follow the ANSI + * definitions. + */ + #if defined(SHRT_MAX) && SHRT_MAX >= 0x7FFF + typedef signed short gI16 + typedef unsigned short gU16 + #else + typedef signed int gI16 + typedef unsigned int gU16 + #endif + #define GI16_C(v) v + #define GU16_C(v) v ## U + + #if defined(INT_MAX) && INT_MAX >= 0x7FFFFFFL + typedef signed int gI32 + typedef unsigned int gU32 + #define GI32_C(v) v + #define GU32_C(v) v ## U + #else + typedef signed long gI32 + typedef unsigned long gU32 + #define GI32_C(v) v ## L + #define GU32_C(v) v ## UL + #endif + + #if defined(__GNUC__) && !defined(vxWorks) + #define GFX_TYPE_64 GFXON + __extension__ typedef long long gI64; + __extension__ typedef unsigned long long gU64; + #define GI64_C(v) v ## LL + #define GU64_C(v) v ## ULL + #elif defined(__MWERKS__) || defined (__SUNPRO_C) || defined (__SUNPRO_CC) || defined (__APPLE_CC__) || defined (_LONG_LONG) || defined (_CRAYC) || defined (S_SPLINT_S) + #define GFX_TYPE_64 GFXON + typedef long long gI64; + typedef unsigned long long gU64; + #define GI64_C(v) v ## LL + #define GU64_C(v) v ## ULL + #elif (defined(__WATCOMC__) && defined(__WATCOM_INT64__)) || (defined(_MSC_VER) && _INTEGRAL_MAX_BITS >= 64) || (defined (__BORLANDC__) && __BORLANDC__ > 0x460) || defined (__alpha) || defined (__DECC) + #define GFX_TYPE_64 GFXON + typedef signed __int64 gI64; + typedef unsigned __int64 gU64; + #else + #define GFX_TYPE_64 GFXOFF + #endif +#endif + +typedef void * gPtr; +typedef ptrdiff_t gPtrDiff; +typedef gI8 gBool; +#define gTrue (-1) +#define gFalse (0) + +#if GFX_COMPAT_V2 + /* Is stdint.h already included? */ + #ifndef INT16_C + typedef gI8 int8_t; + typedef gU8 uint8_t; + typedef gI16 int16_t; + typedef gU16 uint16_t; + typedef gI32 int32_t; + typedef gU32 uint32_t; + #endif + typedef gI8 bool_t; + #ifndef TRUE + #define TRUE gTrue + #endif + #ifndef FALSE + #define FALSE gFalse + #endif +#endif diff --git a/src/ginput/ginput_dial.c b/src/ginput/ginput_dial.c index 0d853498..164b5e17 100644 --- a/src/ginput/ginput_dial.c +++ b/src/ginput/ginput_dial.c @@ -80,7 +80,7 @@ GSourceHandle ginputGetDial(uint16_t instance) { pds->lastvalue = 0; } ginput_lld_dial_init(); - gtimerStart(&DialTimer, (GTimerFunction)ginput_lld_dial_poll, DialCallback, TRUE, GINPUT_DIAL_POLL_PERIOD); + gtimerStart(&DialTimer, (GTimerFunction)ginput_lld_dial_poll, DialCallback, gTrue, GINPUT_DIAL_POLL_PERIOD); } // OK - return this input @@ -137,16 +137,16 @@ void ginputSetDialSensitivity(uint16_t instance, uint16_t diff) { * @param[in] instance The ID of the dial input instance * @param[in] pdial The dial event struct * - * @return Returns FALSE on an error (eg invalid instance) + * @return Returns gFalse on an error (eg invalid instance) */ -bool_t ginputGetDialStatus(uint16_t instance, GEventDial *pdial) { +gBool ginputGetDialStatus(uint16_t instance, GEventDial *pdial) { if (instance >= GINPUT_DIAL_NUM_PORTS) - return FALSE; + return gFalse; pdial->type = GEVENT_DIAL; pdial->instance = instance; pdial->value = DialStatus[instance].lastvalue; pdial->maxvalue = DialStatus[instance].max; - return TRUE; + return gTrue; } #endif /* GFX_USE_GINPUT && GINPUT_NEED_DIAL */ diff --git a/src/ginput/ginput_dial.h b/src/ginput/ginput_dial.h index 77c1b05c..af93391e 100644 --- a/src/ginput/ginput_dial.h +++ b/src/ginput/ginput_dial.h @@ -44,67 +44,59 @@ typedef struct GEventDial_t { /* External declarations. */ /*===========================================================================*/ -#ifdef __cplusplus -extern "C" { -#endif +/** + * @brief Create a dial input instance + * + * @param[in] instance The ID of the dial input instance (from 0 to 9999) + * + * @return The soure handle of the created dial instance + */ +GSourceHandle ginputGetDial(uint16_t instance); - /** - * @brief Create a dial input instance - * - * @param[in] instance The ID of the dial input instance (from 0 to 9999) - * - * @return The soure handle of the created dial instance - */ - GSourceHandle ginputGetDial(uint16_t instance); - - /** - * @brief Reset the value back to the hardware default - * - * @param[in] instance The ID of the dial input instance - */ - void ginputResetDialRange(uint16_t instance); +/** + * @brief Reset the value back to the hardware default + * + * @param[in] instance The ID of the dial input instance + */ +void ginputResetDialRange(uint16_t instance); - /** - * @brief Get the maximum value - * @details The readings are scaled to be 0 ... max. - * - * @param[in] instance The ID of the dial input instance - * - * @return The maximum value - */ - uint16_t ginputGetDialRange(uint16_t instance); +/** + * @brief Get the maximum value + * @details The readings are scaled to be 0 ... max. + * + * @param[in] instance The ID of the dial input instance + * + * @return The maximum value + */ +uint16_t ginputGetDialRange(uint16_t instance); - /** - * @brief Set the maximum value - * @details The readings are scaled to be 0 ... max. - * - * @param[in] instance The ID of the dial input instance - * @param[in] max The maximum value to be set - */ - void ginputSetDialRange(uint16_t instance, uint16_t max); +/** + * @brief Set the maximum value + * @details The readings are scaled to be 0 ... max. + * + * @param[in] instance The ID of the dial input instance + * @param[in] max The maximum value to be set + */ +void ginputSetDialRange(uint16_t instance, uint16_t max); - /** - * @brief Set the level change required before a dial even is generated (threshold) - * @note This is done after range scaling - * - * @param[in] instance The ID of the dial input instance - * @param[in] diff The amount of level changes - */ - void ginputSetDialSensitivity(uint16_t instance, uint16_t diff); - - /** - * @brief Get the current dial status - * - * @param[in] instance The ID of the dial input instance - * @param[in] pdial The dial event struct - * - * @return Returns FALSE on an error (eg invalid instance) - */ - bool_t ginputGetDialStatus(uint16_t instance, GEventDial *pdial); - -#ifdef __cplusplus -} -#endif +/** + * @brief Set the level change required before a dial even is generated (threshold) + * @note This is done after range scaling + * + * @param[in] instance The ID of the dial input instance + * @param[in] diff The amount of level changes + */ +void ginputSetDialSensitivity(uint16_t instance, uint16_t diff); + +/** + * @brief Get the current dial status + * + * @param[in] instance The ID of the dial input instance + * @param[in] pdial The dial event struct + * + * @return Returns gFalse on an error (eg invalid instance) + */ +gBool ginputGetDialStatus(uint16_t instance, GEventDial *pdial); #endif /* GINPUT_NEED_DIAL */ diff --git a/src/ginput/ginput_driver_keyboard.h b/src/ginput/ginput_driver_keyboard.h index 1e0c6c2a..1d9fabf9 100644 --- a/src/ginput/ginput_driver_keyboard.h +++ b/src/ginput/ginput_driver_keyboard.h @@ -41,7 +41,7 @@ typedef struct GKeyboardVMT { #define GKEYBOARD_VFLG_NOPOLL 0x0001 // Do not poll this device - it is purely interrupt driven #define GKEYBOARD_VFLG_DYNAMICONLY 0x8000 // This keyboard driver should not be statically initialized eg Win32 const uint8_t * defLayout; // The default keyboard layout - bool_t (*init)(GKeyboard *m, unsigned driverinstance); // Required + gBool (*init)(GKeyboard *m, unsigned driverinstance); // Required void (*deinit)(GKeyboard *m); // Optional int (*getdata)(GKeyboard *k, uint8_t *pch, int sz); // Required. Get zero or more scancode bytes. Returns the number of scancode bytes returns void (*putdata)(GKeyboard *k, char ch); // Optional. Send a single byte to the keyboard. @@ -70,13 +70,13 @@ extern "C" { * @param[in] driverinstance The driver instance ToDo: Add some more details * @param[in] systeminstance The mouse instance ToDo: Add some more details * - * @return TRUE on success, FALSE otherwise + * @return gTrue on success, gFalse otherwise * @note This routine is provided by the high level code for * use in the driver VMT's GMouseVMT.d structure. * * @notapi */ - bool_t _gkeyboardInitDriver(GDriver *g, void *param, unsigned driverinstance, unsigned systeminstance); + gBool _gkeyboardInitDriver(GDriver *g, void *param, unsigned driverinstance, unsigned systeminstance); /** * @brief Routine that is called after initialization diff --git a/src/ginput/ginput_driver_mouse.h b/src/ginput/ginput_driver_mouse.h index 858d847a..ac5fb02d 100644 --- a/src/ginput/ginput_driver_mouse.h +++ b/src/ginput/ginput_driver_mouse.h @@ -85,11 +85,11 @@ typedef struct GMouseVMT { GMouseJitter pen_jitter; // PEN MODE: Jitter settings GMouseJitter finger_jitter; // FINGER MODE: Jitter settings - bool_t (*init)(GMouse *m, unsigned driverinstance); // Required + gBool (*init)(GMouse *m, unsigned driverinstance); // Required void (*deinit)(GMouse *m); // Optional - bool_t (*get)(GMouse *m, GMouseReading *prd); // Required + gBool (*get)(GMouse *m, GMouseReading *prd); // Required void (*calsave)(GMouse *m, const void *buf, size_t sz); // Optional - bool_t (*calload)(GMouse *m, void *buf, size_t sz); // Optional + gBool (*calload)(GMouse *m, void *buf, size_t sz); // Optional } GMouseVMT; #define gmvmt(m) ((const GMouseVMT const *)((m)->d.vmt)) @@ -115,13 +115,13 @@ extern "C" { * @param[in] driverinstance The driver instance ToDo: Add some more details * @param[in] systeminstance The mouse instance ToDo: Add some more details * - * @return TRUE on success, FALSE otherwise + * @return gTrue on success, gFalse otherwise * @note This routine is provided by the high level code for * use in the driver VMT's GMouseVMT.d structure. * * @notapi */ - bool_t _gmouseInitDriver(GDriver *g, void *display, unsigned driverinstance, unsigned systeminstance); + gBool _gmouseInitDriver(GDriver *g, void *display, unsigned driverinstance, unsigned systeminstance); /** * @brief Routine that is called after initialization diff --git a/src/ginput/ginput_keyboard.c b/src/ginput/ginput_keyboard.c index 68f05cea..b50cbc24 100644 --- a/src/ginput/ginput_keyboard.c +++ b/src/ginput/ginput_keyboard.c @@ -492,7 +492,7 @@ void _gkeyboardDeinit(void) { gtimerDeinit(&KeyboardTimer); } -bool_t _gkeyboardInitDriver(GDriver *g, void *param, unsigned driverinstance, unsigned systeminstance) { +gBool _gkeyboardInitDriver(GDriver *g, void *param, unsigned driverinstance, unsigned systeminstance) { #define k ((GKeyboard *)g) (void) param; (void) systeminstance; @@ -502,13 +502,13 @@ bool_t _gkeyboardInitDriver(GDriver *g, void *param, unsigned driverinstance, un // Init the mouse if (!gkvmt(k)->init((GKeyboard *)g, driverinstance)) - return FALSE; + return gFalse; // Ensure the Poll timer is started if (!gtimerIsActive(&KeyboardTimer)) - gtimerStart(&KeyboardTimer, KeyboardPoll, 0, TRUE, GINPUT_KEYBOARD_POLL_PERIOD); + gtimerStart(&KeyboardTimer, KeyboardPoll, 0, gTrue, GINPUT_KEYBOARD_POLL_PERIOD); - return TRUE; + return gTrue; #undef k } @@ -532,7 +532,7 @@ GSourceHandle ginputGetKeyboard(unsigned instance) { return (GSourceHandle)gdriverGetInstance(GDRIVER_TYPE_KEYBOARD, instance); } -bool_t ginputGetKeyboardStatus(unsigned instance, GEventKeyboard *pe) { +gBool ginputGetKeyboardStatus(unsigned instance, GEventKeyboard *pe) { GKeyboard *k; // Win32 threads don't seem to recognise priority and/or pre-emption @@ -540,26 +540,26 @@ bool_t ginputGetKeyboardStatus(unsigned instance, GEventKeyboard *pe) { gfxSleepMilliseconds(1); if (!(k = (GKeyboard *)gdriverGetInstance(GDRIVER_TYPE_KEYBOARD, instance))) - return FALSE; + return gFalse; pe->type = GEVENT_KEYBOARD; // TODO - return TRUE; + return gTrue; } #if !GKEYBOARD_LAYOUT_OFF - bool_t ginputSetKeyboardLayout(unsigned instance, const void *pLayout) { + gBool ginputSetKeyboardLayout(unsigned instance, const void *pLayout) { GKeyboard *k; if (!(k = (GKeyboard *)gdriverGetInstance(GDRIVER_TYPE_KEYBOARD, instance))) - return FALSE; + return gFalse; if (pLayout) k->pLayout = pLayout; else k->pLayout = gkvmt(k)->defLayout; - return TRUE; + return gTrue; } #endif diff --git a/src/ginput/ginput_keyboard.h b/src/ginput/ginput_keyboard.h index a80e23d0..61a7a8af 100644 --- a/src/ginput/ginput_keyboard.h +++ b/src/ginput/ginput_keyboard.h @@ -175,47 +175,39 @@ typedef struct GEventKeyboard_t { /* External declarations. */ /*===========================================================================*/ -#ifdef __cplusplus -extern "C" { -#endif +/** + * @brief Create a keyboard input instance + * + * @param[in] instance The ID of the keyboard input instance (from 0 to 9999) + * + * @return The source handle of the created input instance + */ +GSourceHandle ginputGetKeyboard(unsigned instance); + +#if GINPUT_NEED_KEYBOARD || defined(__DOXYGEN__) /** - * @brief Create a keyboard input instance + * @brief Get the current keyboard status * - * @param[in] instance The ID of the keyboard input instance (from 0 to 9999) + * @param[in] instance The ID of the keyboard input instance + * @param[in] pkeyboard The keyboard event struct * - * @return The source handle of the created input instance + * @return Returns gFalse on an error (eg invalid instance) */ - GSourceHandle ginputGetKeyboard(unsigned instance); - - #if GINPUT_NEED_KEYBOARD || defined(__DOXYGEN__) + gBool ginputGetKeyboardStatus(unsigned instance, GEventKeyboard *pkeyboard); + #if !GKEYBOARD_LAYOUT_OFF || defined(__DOXYGEN__) /** - * @brief Get the current keyboard status + * @brief Set the keyboard layout * * @param[in] instance The ID of the keyboard input instance - * @param[in] pkeyboard The keyboard event struct + * @param[in] pLayout The keyboard layout micro-code. Passing NULL defaults to the driver's default layout. * - * @return Returns FALSE on an error (eg invalid instance) + * @return Returns gFalse on an error (eg invalid instance) */ - bool_t ginputGetKeyboardStatus(unsigned instance, GEventKeyboard *pkeyboard); - - #if !GKEYBOARD_LAYOUT_OFF || defined(__DOXYGEN__) - /** - * @brief Set the keyboard layout - * - * @param[in] instance The ID of the keyboard input instance - * @param[in] pLayout The keyboard layout micro-code. Passing NULL defaults to the driver's default layout. - * - * @return Returns FALSE on an error (eg invalid instance) - */ - bool_t ginputSetKeyboardLayout(unsigned instance, const void *pLayout); - #endif - #endif /* GINPUT_NEED_KEYBOARD */ - -#ifdef __cplusplus -} -#endif + gBool ginputSetKeyboardLayout(unsigned instance, const void *pLayout); + #endif +#endif /* GINPUT_NEED_KEYBOARD */ #endif /* _GINPUT_KEYBOARD_H */ /** @} */ diff --git a/src/ginput/ginput_mouse.c b/src/ginput/ginput_mouse.c index 356ad11e..ca032623 100644 --- a/src/ginput/ginput_mouse.c +++ b/src/ginput/ginput_mouse.c @@ -676,7 +676,7 @@ void _gmouseDeinit(void) { gtimerDeinit(&MouseTimer); } -bool_t _gmouseInitDriver(GDriver *g, void *display, unsigned driverinstance, unsigned systeminstance) { +gBool _gmouseInitDriver(GDriver *g, void *display, unsigned driverinstance, unsigned systeminstance) { #define m ((GMouse *)g) (void) systeminstance; @@ -691,13 +691,13 @@ bool_t _gmouseInitDriver(GDriver *g, void *display, unsigned driverinstance, uns // Init the mouse if (!gmvmt(m)->init((GMouse *)g, driverinstance)) - return FALSE; + return gFalse; // Ensure the Poll timer is started if (!gtimerIsActive(&MouseTimer)) - gtimerStart(&MouseTimer, MousePoll, 0, TRUE, GINPUT_MOUSE_POLL_PERIOD); + gtimerStart(&MouseTimer, MousePoll, 0, gTrue, GINPUT_MOUSE_POLL_PERIOD); - return TRUE; + return gTrue; #undef m } @@ -759,7 +759,7 @@ GDisplay *ginputGetMouseDisplay(unsigned instance) { return m->display; } -bool_t ginputGetMouseStatus(unsigned instance, GEventMouse *pe) { +gBool ginputGetMouseStatus(unsigned instance, GEventMouse *pe) { GMouse *m; // Win32 threads don't seem to recognise priority and/or pre-emption @@ -767,11 +767,11 @@ bool_t ginputGetMouseStatus(unsigned instance, GEventMouse *pe) { gfxSleepMilliseconds(1); if (!(m = (GMouse *)gdriverGetInstance(GDRIVER_TYPE_MOUSE, instance))) - return FALSE; + return gFalse; #if !GINPUT_TOUCH_NOCALIBRATE_GUI if ((m->flags & GMOUSE_FLG_IN_CAL)) - return FALSE; + return gFalse; #endif #if !GINPUT_TOUCH_NOTOUCH @@ -784,11 +784,11 @@ bool_t ginputGetMouseStatus(unsigned instance, GEventMouse *pe) { pe->z = m->r.z; pe->buttons = m->r.buttons; pe->display = m->display; - return TRUE; + return gTrue; } #if !GINPUT_TOUCH_NOTOUCH - void ginputSetFingerMode(unsigned instance, bool_t on) { + void ginputSetFingerMode(unsigned instance, gBool on) { GMouse *m; if (!(m = (GMouse *)gdriverGetInstance(GDRIVER_TYPE_MOUSE, instance))) diff --git a/src/ginput/ginput_mouse.h b/src/ginput/ginput_mouse.h index 8d8b3b9a..0d641d90 100644 --- a/src/ginput/ginput_mouse.h +++ b/src/ginput/ginput_mouse.h @@ -77,111 +77,103 @@ typedef struct GEventMouse_t { /* External declarations. */ /*===========================================================================*/ -#ifdef __cplusplus -extern "C" { -#endif +/** + * @brief Get the Source handler for a mouse using the instance number + * + * @param[in] instance The mouse instance number + * + * @return The source handle of the mouse or NULL + * @note You can use the special value of GMOUSE_ALL_INSTANCES to + * get a source handle that returns events for all mice rather + * than a specific mouse. Using GMOUSE_ALL_INSTANCES will always + * return a valid spurce handle even if there are currently no mice + * in the system. + */ +GSourceHandle ginputGetMouse(unsigned instance); - /** - * @brief Get the Source handler for a mouse using the instance number - * - * @param[in] instance The mouse instance number - * - * @return The source handle of the mouse or NULL - * @note You can use the special value of GMOUSE_ALL_INSTANCES to - * get a source handle that returns events for all mice rather - * than a specific mouse. Using GMOUSE_ALL_INSTANCES will always - * return a valid spurce handle even if there are currently no mice - * in the system. - */ - GSourceHandle ginputGetMouse(unsigned instance); +/** + * @brief Should this device be in Pen mode or Finger mode + * @note A touch device (and even theoritically a mouse) can operate + * in either pen or finger mode. In finger mode typically a + * touch device will be far more tolerant of movement and other + * inaccuracies. Each driver specifies its own tolerances for + * pen versus finger mode. + * + * @param[in] instance The ID of the mouse input instance + * @param[in] on If true then finger mode is turned on. + */ +void ginputSetFingerMode(unsigned instance, gBool on); - /** - * @brief Should this device be in Pen mode or Finger mode - * @note A touch device (and even theoritically a mouse) can operate - * in either pen or finger mode. In finger mode typically a - * touch device will be far more tolerant of movement and other - * inaccuracies. Each driver specifies its own tolerances for - * pen versus finger mode. - * - * @param[in] instance The ID of the mouse input instance - * @param[in] on If true then finger mode is turned on. - */ - void ginputSetFingerMode(unsigned instance, bool_t on); +/** + * @brief Assign the display associated with the mouse + * @note This only needs to be called if the mouse is associated with a display + * other than the current default display. It must be called before + * @p ginputGetMouse() if the new display is to be used during the calibration + * process. Other than calibration the display is used for range checking, + * and may also be used to display a mouse pointer. + * + * @param[in] instance The ID of the mouse input instance + * @param[in] g The GDisplay to which this mouse belongs + */ +void ginputSetMouseDisplay(unsigned instance, GDisplay *g); - /** - * @brief Assign the display associated with the mouse - * @note This only needs to be called if the mouse is associated with a display - * other than the current default display. It must be called before - * @p ginputGetMouse() if the new display is to be used during the calibration - * process. Other than calibration the display is used for range checking, - * and may also be used to display a mouse pointer. - * - * @param[in] instance The ID of the mouse input instance - * @param[in] g The GDisplay to which this mouse belongs - */ - void ginputSetMouseDisplay(unsigned instance, GDisplay *g); +/** + * @brief Get the display currently associated with the mouse + * @return A pointer to the display + * + * @param[in] instance The ID of the mouse input instance + */ +GDisplay *ginputGetMouseDisplay(unsigned instance); - /** - * @brief Get the display currently associated with the mouse - * @return A pointer to the display - * - * @param[in] instance The ID of the mouse input instance - */ - GDisplay *ginputGetMouseDisplay(unsigned instance); +/** + * @brief Get the current mouse position and button status + * @note Unlinke a listener event, this status cannot record meta events such as + * "CLICK". + * + * @param[in] instance The ID of the mouse input instance + * @param[in] pmouse The mouse event + * + * @return gFalse on an error (eg. invalid instance) + */ +gBool ginputGetMouseStatus(unsigned instance, GEventMouse *pmouse); - /** - * @brief Get the current mouse position and button status - * @note Unlinke a listener event, this status cannot record meta events such as - * "CLICK". - * - * @param[in] instance The ID of the mouse input instance - * @param[in] pmouse The mouse event - * - * @return FALSE on an error (eg. invalid instance) - */ - bool_t ginputGetMouseStatus(unsigned instance, GEventMouse *pmouse); +/** + * @brief Performs a calibration + * + * @param[in] instance The ID of the mouse input instance + * + * @return The calibration error squared if calibration fails, or 0 on success or if the driver dosen't need calibration. + * @note An invalid instance will also return 0. + */ +uint32_t ginputCalibrateMouse(unsigned instance); - /** - * @brief Performs a calibration - * - * @param[in] instance The ID of the mouse input instance - * - * @return The calibration error squared if calibration fails, or 0 on success or if the driver dosen't need calibration. - * @note An invalid instance will also return 0. - */ - uint32_t ginputCalibrateMouse(unsigned instance); +/** + * @brief Load a set of mouse calibration data + * @return A pointer to the data or NULL on failure + * + * @param[in] instance The mouse input instance number + * @param[in] data Where the data should be placed + * @param[in] sz The size in bytes of the data to retrieve. + * + * @note This routine is provided by the user application. It is only + * called if GINPUT_TOUCH_USER_CALIBRATION_LOAD has been set to GFXON in the + * users gfxconf.h file. + */ +gBool LoadMouseCalibration(unsigned instance, void *data, size_t sz); - /** - * @brief Load a set of mouse calibration data - * @return A pointer to the data or NULL on failure - * - * @param[in] instance The mouse input instance number - * @param[in] data Where the data should be placed - * @param[in] sz The size in bytes of the data to retrieve. - * - * @note This routine is provided by the user application. It is only - * called if GINPUT_TOUCH_USER_CALIBRATION_LOAD has been set to GFXON in the - * users gfxconf.h file. - */ - bool_t LoadMouseCalibration(unsigned instance, void *data, size_t sz); - - /** - * @brief Save a set of mouse calibration data - * @return TRUE if the save operation was successful. - * - * @param[in] instance The mouse input instance number - * @param[in] data The data to save - * @param[in] sz The size in bytes of the data to retrieve. - * - * @note This routine is provided by the user application. It is only - * called if GINPUT_TOUCH_USER_CALIBRATION_SAVE has been set to GFXON in the - * users gfxconf.h file. - */ - bool_t SaveMouseCalibration(unsigned instance, const void *data, size_t sz); - -#ifdef __cplusplus -} -#endif +/** + * @brief Save a set of mouse calibration data + * @return gTrue if the save operation was successful. + * + * @param[in] instance The mouse input instance number + * @param[in] data The data to save + * @param[in] sz The size in bytes of the data to retrieve. + * + * @note This routine is provided by the user application. It is only + * called if GINPUT_TOUCH_USER_CALIBRATION_SAVE has been set to GFXON in the + * users gfxconf.h file. + */ +gBool SaveMouseCalibration(unsigned instance, const void *data, size_t sz); #endif /* GINPUT_NEED_MOUSE */ diff --git a/src/ginput/ginput_toggle.c b/src/ginput/ginput_toggle.c index eb65d6e0..592d6b18 100644 --- a/src/ginput/ginput_toggle.c +++ b/src/ginput/ginput_toggle.c @@ -71,14 +71,14 @@ static void TogglePoll(void *param) { if ((psl->listenflags & GLISTEN_TOGGLE_ON)) { pe->type = GEVENT_TOGGLE; pe->instance = i; - pe->on = TRUE; + pe->on = gTrue; geventSendEvent(psl); } } else { if ((psl->listenflags & GLISTEN_TOGGLE_OFF)) { pe->type = GEVENT_TOGGLE; pe->instance = i; - pe->on = FALSE; + pe->on = gFalse; geventSendEvent(psl); } } @@ -102,7 +102,7 @@ GSourceHandle ginputGetToggle(uint16_t instance) { if (!gtimerIsActive(&ToggleTimer)) { for(ptc = GInputToggleConfigTable; ptc < GInputToggleConfigTable+sizeof(GInputToggleConfigTable)/sizeof(GInputToggleConfigTable[0]); ptc++) ginput_lld_toggle_init(ptc); - gtimerStart(&ToggleTimer, TogglePoll, 0, TRUE, GINPUT_TOGGLE_POLL_PERIOD); + gtimerStart(&ToggleTimer, TogglePoll, 0, gTrue, GINPUT_TOGGLE_POLL_PERIOD); } // OK - return this input @@ -110,7 +110,7 @@ GSourceHandle ginputGetToggle(uint16_t instance) { } // If invert is true, invert the on/off sense for the toggle -void ginputInvertToggle(uint16_t instance, bool_t invert) { +void ginputInvertToggle(uint16_t instance, gBool invert) { if (instance >= GINPUT_TOGGLE_NUM_PORTS) return; if (invert) { @@ -127,19 +127,19 @@ void ginputInvertToggle(uint16_t instance, bool_t invert) { } /* Get the current toggle status. - * Returns FALSE on error (eg invalid instance) + * Returns gFalse on error (eg invalid instance) */ -bool_t ginputGetToggleStatus(uint16_t instance, GEventToggle *ptoggle) { +gBool ginputGetToggleStatus(uint16_t instance, GEventToggle *ptoggle) { // Win32 threads don't seem to recognise priority and/or pre-emption // so we add a sleep here to prevent 100% polled applications from locking up. gfxSleepMilliseconds(1); if (instance >= GINPUT_TOGGLE_NUM_PORTS) - return FALSE; + return gFalse; ptoggle->type = GEVENT_TOGGLE; ptoggle->instance = instance; - ptoggle->on = (ToggleStatus[instance].status & GINPUT_TOGGLE_ISON) ? TRUE : FALSE; - return TRUE; + ptoggle->on = (ToggleStatus[instance].status & GINPUT_TOGGLE_ISON) ? gTrue : gFalse; + return gTrue; } /* Wake up the mouse driver from an interrupt service routine (there may be new readings available) */ diff --git a/src/ginput/ginput_toggle.h b/src/ginput/ginput_toggle.h index 7d028301..a8719db6 100644 --- a/src/ginput/ginput_toggle.h +++ b/src/ginput/ginput_toggle.h @@ -48,7 +48,7 @@ typedef struct GEventToggle_t { GEventType type; // The type of this event (GEVENT_TOGGLE) uint16_t instance; // The toggle instance - bool_t on; // True if the toggle/button is on + gBool on; // True if the toggle/button is on } GEventToggle; // Toggle Listen Flags - passed to geventAddSourceToListener() @@ -59,40 +59,32 @@ typedef struct GEventToggle_t { /* External declarations. */ /*===========================================================================*/ -#ifdef __cplusplus -extern "C" { -#endif +/** + * @brief Create a toggle input instance + * + * @param[in] instance The ID of the toggle input instance (from 0 to 9999) + * + * @return The source handle of the created instance + */ +GSourceHandle ginputGetToggle(uint16_t instance); - /** - * @brief Create a toggle input instance - * - * @param[in] instance The ID of the toggle input instance (from 0 to 9999) - * - * @return The source handle of the created instance - */ - GSourceHandle ginputGetToggle(uint16_t instance); +/** + * @brief Can be used to invert the sense of a toggle + * + * @param[in] instance The ID of the toggle input instance + * @param[in] invert If gTrue, will be inverted + */ +void ginputInvertToggle(uint16_t instance, gBool invert); - /** - * @brief Can be used to invert the sense of a toggle - * - * @param[in] instance The ID of the toggle input instance - * @param[in] invert If TRUE, will be inverted - */ - void ginputInvertToggle(uint16_t instance, bool_t invert); - - /** - * @brief Get the current toggle status - * - * @param[in] instance The ID of the toggle input instance - * @param[in] ptoggle The toggle event struct - * - * @return Returns FALSE on an error (eg invalid instance) - */ - bool_t ginputGetToggleStatus(uint16_t instance, GEventToggle *ptoggle); - -#ifdef __cplusplus -} -#endif +/** + * @brief Get the current toggle status + * + * @param[in] instance The ID of the toggle input instance + * @param[in] ptoggle The toggle event struct + * + * @return Returns gFalse on an error (eg invalid instance) + */ +gBool ginputGetToggleStatus(uint16_t instance, GEventToggle *ptoggle); #endif /* GINPUT_NEED_TOGGLE */ diff --git a/src/gmisc/gmisc.h b/src/gmisc/gmisc.h index 21178774..8d767270 100644 --- a/src/gmisc/gmisc.h +++ b/src/gmisc/gmisc.h @@ -90,10 +90,6 @@ typedef int32_t fixed; #if GFX_USE_GMISC || defined(__DOXYGEN__) -#ifdef __cplusplus -extern "C" { -#endif - #if GMISC_NEED_ARRAYOPS || defined(__DOXYGEN__) /** * @brief Convert from one array format to another array format. @@ -476,17 +472,13 @@ extern "C" { * @param[in] cnt The number of points in the point array @p pntarray * @param[in] p The point to test * - * @return @p TRUE if the point @p p is inside or on the edge of the polygon @p pntarray, @p FALSE otherwise. + * @return @p gTrue if the point @p p is inside or on the edge of the polygon @p pntarray, @p gFalse otherwise. * * @api */ - bool_t gmiscHittestPoly(const point *pntarray, unsigned cnt, const point *p); + gBool gmiscHittestPoly(const point *pntarray, unsigned cnt, const point *p); #endif // GMISC_NEED_HITTEST_POLY -#ifdef __cplusplus -} -#endif - #endif /* GFX_USE_MISC */ #endif /* _GMISC_H */ diff --git a/src/gmisc/gmisc_hittest.c b/src/gmisc/gmisc_hittest.c index f84a66cf..6e977cb2 100644 --- a/src/gmisc/gmisc_hittest.c +++ b/src/gmisc/gmisc_hittest.c @@ -64,7 +64,7 @@ static char _pointCrossingSegment(const point *a, const point *b, const point *c return -1; } -bool_t gmiscHittestPoly(const point *pntarray, unsigned cnt, const point *p) { +gBool gmiscHittestPoly(const point *pntarray, unsigned cnt, const point *p) { unsigned i = 0; uint8_t nbrIntersection = 0; int8_t crossResult; @@ -80,7 +80,7 @@ bool_t gmiscHittestPoly(const point *pntarray, unsigned cnt, const point *p) { /* Point on the edge of the polygon */ if (crossResult == 0) { - return TRUE; + return gTrue; } /* Point crossing the polygon */ else if(crossResult == 1) { @@ -98,18 +98,18 @@ bool_t gmiscHittestPoly(const point *pntarray, unsigned cnt, const point *p) { } if (crossResult == 0) { - return TRUE; + return gTrue; } else if(crossResult == 1) { nbrIntersection++; } /* If we cross an even pair of segments, we are outside */ if (nbrIntersection % 2 == 0) { - return FALSE; + return gFalse; } /* Else we are inside the polygon */ - return TRUE; + return gTrue; } #endif // GMISC_NEED_HITTEST_POLY diff --git a/src/gos/gos.h b/src/gos/gos.h index 9ba12889..f68c9fda 100644 --- a/src/gos/gos.h +++ b/src/gos/gos.h @@ -28,16 +28,28 @@ /** * @name Various integer sizes - * @note Your platform may use slightly different definitions to these + * @note Your platform may define these differently to these. + * @note These sizes are guaranteed minimum sizes for the type. It might actually be larger. + * eg gI8 may actually be 9 bits. * @{ */ - typedef unsigned char bool_t; - typedef char int8_t; - typedef unsigned char uint8_t; - typedef short int16_t; - typedef unsigned short uint16_t; - typedef long int32_t; - typedef unsigned long uint32_t; + typedef unsigned char gBool; + typedef signed char gI8; + typedef unsigned char gU8; + typedef short gI16; + typedef unsigned short gU16; + typedef long gI32; + typedef unsigned long gU32; + /** @} */ + + /** + * @name More integer sizes + * @pre These are only available if GFX_TYPE_64 is GFXON as not all compilers support 64 bit. + * @note GFX_TYPE_64 is set to GFXON or GFXOFF by the compiler detector. It is not a user configuration macro. + * @{ + */ + typedef long long gI64; + typedef unsigned long long gU64; /** @} */ /** @@ -45,7 +57,6 @@ * @note Your platform may use slightly different definitions to these * @{ */ - typedef unsigned long size_t; typedef unsigned long delaytime_t; typedef unsigned long systemticks_t; typedef short semcount_t; @@ -118,10 +129,6 @@ /* Function declarations. */ /*===========================================================================*/ - #ifdef __cplusplus - extern "C" { - #endif - /** * @brief Halt the GFX application due to an error. * @@ -354,26 +361,26 @@ * @brief Wait on a semaphore * @details The semaphore counter is decreased and if the result becomes negative the thread waits for it to become * non-negative again - * @return FALSE if the wait timeout occurred otherwise TRUE + * @return gFalse if the wait timeout occurred otherwise gTrue * * @param[in] psem A pointer to the semaphore * @param[in] ms The maximum time to wait for the semaphore * * @api */ - bool_t gfxSemWait(gfxSem *psem, delaytime_t ms); + gBool gfxSemWait(gfxSem *psem, delaytime_t ms); /** * @brief Test if a wait on a semaphore can be satisfied immediately * @details Equivalent to @p gfxSemWait(psem, TIME_IMMEDIATE) except it can be called at interrupt level - * @return FALSE if the wait would occur occurred otherwise TRUE + * @return gFalse if the wait would occur occurred otherwise gTrue * * @param[in] psem A pointer to the semaphore * * @iclass * @api */ - bool_t gfxSemWaitI(gfxSem *psem); + gBool gfxSemWaitI(gfxSem *psem); /** * @brief Signal a semaphore @@ -446,10 +453,6 @@ */ void gfxThreadClose(gfxThreadHandle thread); - #ifdef __cplusplus - } - #endif - /** * All the above was just for the doxygen documentation. All the implementation of the above * (without any of the documentation overheads) is in the files below. diff --git a/src/gos/gos_arduino.h b/src/gos/gos_arduino.h index a9b0c140..b14f812a 100644 --- a/src/gos/gos_arduino.h +++ b/src/gos/gos_arduino.h @@ -31,29 +31,8 @@ /* Type definitions */ /*===========================================================================*/ -typedef unsigned char bool_t; - -#if 0 - // Already defined by Arduino - typedef signed char int8_t; - typedef unsigned char uint8_t; - typedef signed short int16_t; - typedef unsigned short uint16_t; - typedef signed int int32_t; - typedef unsigned int uint32_t; - typedef uint32_t size_t; -#endif - -#ifdef __cplusplus -extern "C" { -#endif - - void gfxHalt(const char *msg); - void gfxExit(void); - -#ifdef __cplusplus -} -#endif +void gfxHalt(const char *msg); +void gfxExit(void); /*===========================================================================*/ /* Use the generic thread handling and heap handling */ diff --git a/src/gos/gos_chibios.c b/src/gos/gos_chibios.c index cb2193fe..725a8763 100644 --- a/src/gos/gos_chibios.c +++ b/src/gos/gos_chibios.c @@ -120,34 +120,34 @@ void gfxSemDestroy(gfxSem *psem) chSemReset(&psem->sem, 1); } -bool_t gfxSemWait(gfxSem *psem, delaytime_t ms) +gBool gfxSemWait(gfxSem *psem, delaytime_t ms) { #if CH_KERNEL_MAJOR == 2 switch(ms) { case TIME_IMMEDIATE: return chSemWaitTimeout(&psem->sem, TIME_IMMEDIATE) != RDY_TIMEOUT; - case TIME_INFINITE: chSemWait(&psem->sem); return TRUE; + case TIME_INFINITE: chSemWait(&psem->sem); return gTrue; default: return chSemWaitTimeout(&psem->sem, MS2ST(ms)) != RDY_TIMEOUT; } #elif (CH_KERNEL_MAJOR == 3) || (CH_KERNEL_MAJOR == 4) switch(ms) { case TIME_IMMEDIATE: return chSemWaitTimeout(&psem->sem, TIME_IMMEDIATE) != MSG_TIMEOUT; - case TIME_INFINITE: chSemWait(&psem->sem); return TRUE; + case TIME_INFINITE: chSemWait(&psem->sem); return gTrue; default: return chSemWaitTimeout(&psem->sem, MS2ST(ms)) != MSG_TIMEOUT; } #endif } -bool_t gfxSemWaitI(gfxSem *psem) +gBool gfxSemWaitI(gfxSem *psem) { #if (CH_KERNEL_MAJOR == 2) || (CH_KERNEL_MAJOR == 3) if (psem->sem.s_cnt <= 0) - return FALSE; + return gFalse; #elif (CH_KERNEL_MAJOR == 4) if (psem->sem.cnt <= 0) - return FALSE; + return gFalse; #endif chSemFastWaitI(&psem->sem); - return TRUE; + return gTrue; } void gfxSemSignal(gfxSem *psem) diff --git a/src/gos/gos_chibios.h b/src/gos/gos_chibios.h index cb683631..7c0d1447 100644 --- a/src/gos/gos_chibios.h +++ b/src/gos/gos_chibios.h @@ -26,20 +26,10 @@ /*===========================================================================*/ /** - * bool_t, - * int8_t, uint8_t, - * int16_t, uint16_t, - * int32_t, uint32_t, - * size_t - * TRUE, FALSE * TIME_IMMEDIATE, TIME_INFINITE * are already defined by ChibiOS */ -#if (CH_KERNEL_MAJOR == 3) || (CH_KERNEL_MAJOR == 4) - typedef char bool_t; -#endif - typedef systime_t delaytime_t; typedef systime_t systemticks_t; typedef cnt_t semcount_t; @@ -66,7 +56,7 @@ typedef tprio_t threadpriority_t; #elif (CH_KERNEL_MAJOR == 3) || (CH_KERNEL_MAJOR == 4) #undef DECLARE_THREAD_STACK #define DECLARE_THREAD_STACK(a, b) THD_WORKING_AREA(a, b) - + typedef struct { semaphore_t sem; semcount_t limit; @@ -81,10 +71,6 @@ typedef tprio_t threadpriority_t; /* Function declarations. */ /*===========================================================================*/ -#ifdef __cplusplus -extern "C" { -#endif - // First the kernel version specific ones #if CH_KERNEL_MAJOR == 2 #define gfxSystemTicks() chTimeNow() @@ -113,8 +99,8 @@ void gfxSleepMilliseconds(delaytime_t ms); void gfxSleepMicroseconds(delaytime_t ms); void gfxSemInit(gfxSem *psem, semcount_t val, semcount_t limit); void gfxSemDestroy(gfxSem *psem); -bool_t gfxSemWait(gfxSem *psem, delaytime_t ms); -bool_t gfxSemWaitI(gfxSem *psem); +gBool gfxSemWait(gfxSem *psem, delaytime_t ms); +gBool gfxSemWaitI(gfxSem *psem); void gfxSemSignal(gfxSem *psem); void gfxSemSignalI(gfxSem *psem); gfxThreadHandle gfxThreadCreate(void *stackarea, size_t stacksz, threadpriority_t prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param); @@ -122,9 +108,5 @@ gfxThreadHandle gfxThreadCreate(void *stackarea, size_t stacksz, threadpriority_ #define gfxThreadMe() chThdSelf() #define gfxThreadClose(thread) (void)thread -#ifdef __cplusplus -} -#endif - #endif /* GFX_USE_OS_CHIBIOS */ #endif /* _GOS_CHIBIOS_H */ diff --git a/src/gos/gos_cmsis.c b/src/gos/gos_cmsis.c index 2798dcba..5859752b 100644 --- a/src/gos/gos_cmsis.c +++ b/src/gos/gos_cmsis.c @@ -61,16 +61,16 @@ void gfxSemDestroy(gfxSem* psem) osSemaphoreDelete(psem->id); } -bool_t gfxSemWait(gfxSem* psem, delaytime_t ms) +gBool gfxSemWait(gfxSem* psem, delaytime_t ms) { if (osSemaphoreWait(psem->id, ms) > 0) { psem->available++; - return TRUE; + return gTrue; } - return FALSE; + return gFalse; } -bool_t gfxSemWaitI(gfxSem* psem) +gBool gfxSemWaitI(gfxSem* psem) { return gfxSemWait(psem, 0); } diff --git a/src/gos/gos_cmsis.h b/src/gos/gos_cmsis.h index aad4cb84..72b59ce9 100644 --- a/src/gos/gos_cmsis.h +++ b/src/gos/gos_cmsis.h @@ -15,7 +15,6 @@ #if GFX_USE_OS_CMSIS -#include #include "cmsis_os.h" #ifndef GFX_OS_HEAP_SIZE @@ -26,8 +25,6 @@ /* Type definitions */ /*===========================================================================*/ -typedef bool bool_t; - #define TIME_IMMEDIATE 0 #define TIME_INFINITE osWaitForever typedef uint32_t delaytime_t; @@ -62,10 +59,6 @@ typedef osThreadId gfxThreadHandle; /* Function declarations. */ /*===========================================================================*/ -#ifdef __cplusplus -extern "C" { -#endif - #define gfxExit() os_error(0) #define gfxHalt(msg) os_error(1) #define gfxSystemTicks() osKernelSysTick() @@ -81,8 +74,8 @@ void gfxMutexInit(gfxMutex* pmutex); void gfxSemInit(gfxSem* psem, semcount_t val, semcount_t limit); void gfxSemDestroy(gfxSem* psem); -bool_t gfxSemWait(gfxSem* psem, delaytime_t ms); -bool_t gfxSemWaitI(gfxSem* psem); +gBool gfxSemWait(gfxSem* psem, delaytime_t ms); +gBool gfxSemWaitI(gfxSem* psem); void gfxSemSignal(gfxSem* psem); void gfxSemSignalI(gfxSem* psem); @@ -91,10 +84,6 @@ gfxThreadHandle gfxThreadCreate(void* stackarea, size_t stacksz, threadpriority_ #define gfxThreadMe() osThreadGetId() #define gfxThreadClose(thread) {} -#ifdef __cplusplus -} -#endif - /*===========================================================================*/ /* Use the generic heap handling */ /*===========================================================================*/ diff --git a/src/gos/gos_cmsis2.c b/src/gos/gos_cmsis2.c index ca2d6eb6..46ee79cb 100644 --- a/src/gos/gos_cmsis2.c +++ b/src/gos/gos_cmsis2.c @@ -69,11 +69,11 @@ void gfxSemInit(gfxSem* psem, semcount_t val, semcount_t limit) *psem = osSemaphoreNew(limit, val, NULL); } -bool_t gfxSemWait(gfxSem* psem, delaytime_t ms) +gBool gfxSemWait(gfxSem* psem, delaytime_t ms) { if (osSemaphoreAcquire(*psem, gfxMillisecondsToTicks(ms)) == osOK) - return TRUE; - return FALSE; + return gTrue; + return gFalse; } gfxThreadHandle gfxThreadCreate(void* stackarea, size_t stacksz, threadpriority_t prio, DECLARE_THREAD_FUNCTION((*fn),p), void* param) diff --git a/src/gos/gos_cmsis2.h b/src/gos/gos_cmsis2.h index 1f4eab5e..7504d530 100644 --- a/src/gos/gos_cmsis2.h +++ b/src/gos/gos_cmsis2.h @@ -15,7 +15,6 @@ #if GFX_USE_OS_CMSIS2 -#include #include "cmsis_os2.h" #ifndef GFX_OS_HEAP_SIZE @@ -26,8 +25,6 @@ /* Type definitions */ /*===========================================================================*/ -typedef bool bool_t; - #define TIME_IMMEDIATE 0 #define TIME_INFINITE osWaitForever typedef uint32_t delaytime_t; @@ -55,10 +52,6 @@ typedef osThreadId_t gfxThreadHandle; /* Function declarations. */ /*===========================================================================*/ -#ifdef __cplusplus -extern "C" { -#endif - #define gfxExit() os_error(0) #define gfxHalt(msg) os_error(1) #define gfxSystemTicks() osKernelGetTickCount() @@ -74,7 +67,7 @@ void gfxMutexInit(gfxMutex* pmutex); void gfxSemInit(gfxSem* psem, semcount_t val, semcount_t limit); #define gfxSemDestroy(psem) osSemaphoreDelete(*(psem)) -bool_t gfxSemWait(gfxSem* psem, delaytime_t ms); +gBool gfxSemWait(gfxSem* psem, delaytime_t ms); #define gfxSemWaitI(psem) gfxSemWait((psem), 0) #define gfxSemSignal(psem) osSemaphoreRelease(*(psem)) #define gfxSemSignalI(psem) osSemaphoreRelease(*(psem)) @@ -84,10 +77,6 @@ gfxThreadHandle gfxThreadCreate(void* stackarea, size_t stacksz, threadpriority_ #define gfxThreadMe() osThreadGetId() #define gfxThreadClose(thread) {} -#ifdef __cplusplus -} -#endif - /*===========================================================================*/ /* Use the generic heap handling */ /*===========================================================================*/ diff --git a/src/gos/gos_ecos.c b/src/gos/gos_ecos.c index a2af5dbf..2f875f0f 100644 --- a/src/gos/gos_ecos.c +++ b/src/gos/gos_ecos.c @@ -64,7 +64,7 @@ void gfxSemDestroy(gfxSem *psem) cyg_semaphore_destroy(&psem->sem); } -bool_t gfxSemWait(gfxSem *psem, delaytime_t ms) +gBool gfxSemWait(gfxSem *psem, delaytime_t ms) { switch(ms) { case TIME_IMMEDIATE: return cyg_semaphore_trywait(&psem->sem); @@ -73,7 +73,7 @@ bool_t gfxSemWait(gfxSem *psem, delaytime_t ms) } } -bool_t gfxSemWaitI(gfxSem *psem) +gBool gfxSemWaitI(gfxSem *psem) { return cyg_semaphore_trywait(&psem->sem); } diff --git a/src/gos/gos_ecos.h b/src/gos/gos_ecos.h index b03243f3..910924c0 100644 --- a/src/gos/gos_ecos.h +++ b/src/gos/gos_ecos.h @@ -18,15 +18,6 @@ /* Type definitions */ /*===========================================================================*/ -typedef cyg_bool_t bool_t; -typedef cyg_int8 int8_t; -typedef cyg_uint8 uint8_t; -typedef cyg_int16 int16_t; -typedef cyg_uint16 uint16_t; -typedef cyg_int32 int32_t; -typedef cyg_uint32 uint32_t; -typedef cyg_uint32 size_t; - #define TIME_IMMEDIATE 0 #define TIME_INFINITE 0xFFFFFFFF @@ -58,10 +49,6 @@ typedef cyg_mutex_t gfxMutex; /* Function declarations. */ /*===========================================================================*/ -#ifdef __cplusplus -extern "C" { -#endif - #define gfxSystemTicks() cyg_current_time() #define gfxExit() exit(0) #define gfxHalt(msg) exit(-1) @@ -85,8 +72,8 @@ void gfxSleepMicroseconds(delaytime_t ms); void gfxSemInit(gfxSem *psem, semcount_t val, semcount_t limit); void gfxSemDestroy(gfxSem *psem); -bool_t gfxSemWait(gfxSem *psem, delaytime_t ms); -bool_t gfxSemWaitI(gfxSem *psem); +gBool gfxSemWait(gfxSem *psem, delaytime_t ms); +gBool gfxSemWaitI(gfxSem *psem); void gfxSemSignal(gfxSem *psem); void gfxSemSignalI(gfxSem *psem); @@ -95,9 +82,5 @@ gfxThreadHandle gfxThreadCreate(void *stackarea, size_t stacksz, threadpriority_ #define gfxThreadMe() cyg_thread_self() #define gfxThreadClose(thread) (void)thread -#ifdef __cplusplus -} -#endif - #endif /* GFX_USE_OS_ECOS */ #endif /* _GOS_ECOS_H */ diff --git a/src/gos/gos_freertos.c b/src/gos/gos_freertos.c index ff424e70..025d57b2 100644 --- a/src/gos/gos_freertos.c +++ b/src/gos/gos_freertos.c @@ -117,20 +117,20 @@ void gfxSemInit(gfxSem* psem, semcount_t val, semcount_t limit) #endif } -bool_t gfxSemWait(gfxSem* psem, delaytime_t ms) +gBool gfxSemWait(gfxSem* psem, delaytime_t ms) { if (xSemaphoreTake(*psem, gfxMillisecondsToTicks(ms)) == pdPASS) - return TRUE; - return FALSE; + return gTrue; + return gFalse; } -bool_t gfxSemWaitI(gfxSem* psem) +gBool gfxSemWaitI(gfxSem* psem) { portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE; if (xSemaphoreTakeFromISR(*psem, &xHigherPriorityTaskWoken) == pdTRUE) - return TRUE; - return FALSE; + return gTrue; + return gFalse; } void gfxSemSignal(gfxSem* psem) diff --git a/src/gos/gos_freertos.h b/src/gos/gos_freertos.h index 87ef8163..e7ee43b8 100644 --- a/src/gos/gos_freertos.h +++ b/src/gos/gos_freertos.h @@ -24,29 +24,8 @@ /* Type definitions */ /*===========================================================================*/ -/* Additional types are required when FreeRTOS 7.x is used */ -#if !defined(tskKERNEL_VERSION_MAJOR) && !tskKERNEL_VERSION_MAJOR == 8 - typedef signed char int8_t - typedef unsigned char uint8_t - typedef signed int int16_t - typedef unsigned int uint16_t - typedef signed long int int32_t - typedef unsigned long int uint32_t - typedef signed long long int int64_t - typedef unsigned long long int uint64_t -#endif - -/** - * bool_t, - * int8_t, uint8_t, - * int16_t, uint16_t, - * int32_t, uint32_t, - * size_t - * are already defined by FreeRTOS - */ #define TIME_IMMEDIATE 0 #define TIME_INFINITE ((delaytime_t)-1) -typedef int8_t bool_t; typedef uint32_t delaytime_t; typedef portTickType systemticks_t; typedef int32_t semcount_t; @@ -71,10 +50,6 @@ typedef xTaskHandle gfxThreadHandle; /* Function declarations. */ /*===========================================================================*/ -#ifdef __cplusplus -extern "C" { -#endif - #define gfxHalt(msg) {while(1);} #define gfxExit() {while(1);} #define gfxAlloc(sz) pvPortMalloc(sz) @@ -96,8 +71,8 @@ void gfxSleepMicroseconds(delaytime_t ms); void gfxSemInit(gfxSem* psem, semcount_t val, semcount_t limit); #define gfxSemDestroy(psem) vSemaphoreDelete(*(psem)) -bool_t gfxSemWait(gfxSem* psem, delaytime_t ms); -bool_t gfxSemWaitI(gfxSem* psem); +gBool gfxSemWait(gfxSem* psem, delaytime_t ms); +gBool gfxSemWaitI(gfxSem* psem); void gfxSemSignal(gfxSem* psem); void gfxSemSignalI(gfxSem* psem); gfxThreadHandle gfxThreadCreate(void *stackarea, size_t stacksz, threadpriority_t prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param); @@ -108,9 +83,5 @@ gfxThreadHandle gfxThreadCreate(void *stackarea, size_t stacksz, threadpriority_ #endif #define gfxThreadClose(thread) -#ifdef __cplusplus -} -#endif - #endif /* GFX_USE_OS_FREERTOS */ #endif /* _GOS_CHIBIOS_H */ diff --git a/src/gos/gos_linux.c b/src/gos/gos_linux.c index bd4e0060..7e71ca95 100644 --- a/src/gos/gos_linux.c +++ b/src/gos/gos_linux.c @@ -145,13 +145,13 @@ threadreturn_t gfxThreadWait(gfxThreadHandle thread) { void gfxSemDestroy(gfxSem *pSem) { sem_destroy(&pSem->sem); } - bool_t gfxSemWait(gfxSem *pSem, delaytime_t ms) { + gBool gfxSemWait(gfxSem *pSem, delaytime_t ms) { switch (ms) { case TIME_INFINITE: - return sem_wait(&pSem->sem) ? FALSE : TRUE; + return sem_wait(&pSem->sem) ? gFalse : gTrue; case TIME_IMMEDIATE: - return sem_trywait(&pSem->sem) ? FALSE : TRUE; + return sem_trywait(&pSem->sem) ? gFalse : gTrue; default: { @@ -160,7 +160,7 @@ threadreturn_t gfxThreadWait(gfxThreadHandle thread) { clock_gettime(CLOCK_REALTIME, &tm); tm.tv_sec += ms / 1000; tm.tv_nsec += (ms % 1000) * 1000000; - return sem_timedwait(&pSem->sem, &tm) ? FALSE : TRUE; + return sem_timedwait(&pSem->sem, &tm) ? gFalse : gTrue; } } } @@ -185,7 +185,7 @@ threadreturn_t gfxThreadWait(gfxThreadHandle thread) { pthread_mutex_destroy(&pSem->mtx); pthread_cond_destroy(&pSem->cond); } - bool_t gfxSemWait(gfxSem *pSem, delaytime_t ms) { + gBool gfxSemWait(gfxSem *pSem, delaytime_t ms) { pthread_mutex_lock(&pSem->mtx); switch (ms) { @@ -197,7 +197,7 @@ threadreturn_t gfxThreadWait(gfxThreadHandle thread) { case TIME_IMMEDIATE: if (!pSem->cnt) { pthread_mutex_unlock(&pSem->mtx); - return FALSE; + return gFalse; } break; @@ -211,11 +211,11 @@ threadreturn_t gfxThreadWait(gfxThreadHandle thread) { while (!pSem->cnt) { // We used to test the return value for ETIMEDOUT. This doesn't // work in some current pthread libraries which return -1 instead - // and set errno to ETIMEDOUT. So, we will return FALSE on any error + // and set errno to ETIMEDOUT. So, we will return gFalse on any error // including a ETIMEDOUT. if (pthread_cond_timedwait(&pSem->cond, &pSem->mtx, &tm)) { pthread_mutex_unlock(&pSem->mtx); - return FALSE; + return gFalse; } } } @@ -224,7 +224,7 @@ threadreturn_t gfxThreadWait(gfxThreadHandle thread) { pSem->cnt--; pthread_mutex_unlock(&pSem->mtx); - return TRUE; + return gTrue; } void gfxSemSignal(gfxSem *pSem) { pthread_mutex_lock(&pSem->mtx); diff --git a/src/gos/gos_linux.h b/src/gos/gos_linux.h index f1973615..3d463226 100644 --- a/src/gos/gos_linux.h +++ b/src/gos/gos_linux.h @@ -17,16 +17,12 @@ #include #include -#include #include #if GFX_USE_POSIX_SEMAPHORES #include #endif -/* Already defined int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t, size_t */ - -typedef int8_t bool_t; typedef unsigned long systemticks_t; typedef void * threadreturn_t; typedef unsigned long delaytime_t; @@ -78,10 +74,6 @@ typedef pthread_mutex_t gfxMutex; /* Function declarations. */ /*===========================================================================*/ -#ifdef __cplusplus -extern "C" { -#endif - void gfxYield(void); void gfxHalt(const char *msg); void gfxSleepMilliseconds(delaytime_t ms); @@ -91,15 +83,11 @@ void gfxSystemLock(void); void gfxSystemUnlock(void); void gfxSemInit(gfxSem *psem, semcount_t val, semcount_t limit); void gfxSemDestroy(gfxSem *psem); -bool_t gfxSemWait(gfxSem *psem, delaytime_t ms); +gBool gfxSemWait(gfxSem *psem, delaytime_t ms); void gfxSemSignal(gfxSem *psem); gfxThreadHandle gfxThreadCreate(void *stackarea, size_t stacksz, threadpriority_t prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param); threadreturn_t gfxThreadWait(gfxThreadHandle thread); -#ifdef __cplusplus -} -#endif - #endif /* GFX_USE_OS_LINUX */ #endif /* _GOS_LINUX_H */ diff --git a/src/gos/gos_nios.h b/src/gos/gos_nios.h index 75bf5676..3ef7756f 100644 --- a/src/gos/gos_nios.h +++ b/src/gos/gos_nios.h @@ -10,29 +10,16 @@ #if GFX_USE_OS_NIOS -#include -#include -#include #include typedef alt_u32 systemticks_t; typedef alt_u32 delaytime_t; -typedef unsigned char bool_t; - -#ifdef __cplusplus -extern "C" { -#endif void gfxHalt(const char* msg); void gfxExit(void); systemticks_t gfxSystemTicks(void); systemticks_t gfxMillisecondsToTicks(delaytime_t ms); -#ifdef __cplusplus -} -#endif - - // Use the generic thread handling and heap handling #define GOS_NEED_X_THREADS GFXON #define GOS_NEED_X_HEAP GFXON diff --git a/src/gos/gos_osx.c b/src/gos/gos_osx.c index 56d64d98..a09647ee 100644 --- a/src/gos/gos_osx.c +++ b/src/gos/gos_osx.c @@ -132,7 +132,7 @@ void gfxSemDestroy(gfxSem *pSem) { pthread_cond_destroy(&pSem->cond); } -bool_t gfxSemWait(gfxSem *pSem, delaytime_t ms) { +gBool gfxSemWait(gfxSem *pSem, delaytime_t ms) { pthread_mutex_lock(&pSem->mtx); switch (ms) { case TIME_INFINITE: @@ -142,7 +142,7 @@ bool_t gfxSemWait(gfxSem *pSem, delaytime_t ms) { case TIME_IMMEDIATE: if (!pSem->cnt) { pthread_mutex_unlock(&pSem->mtx); - return FALSE; + return gFalse; } break; default: @@ -156,11 +156,11 @@ bool_t gfxSemWait(gfxSem *pSem, delaytime_t ms) { while (!pSem->cnt) { // We used to test the return value for ETIMEDOUT. This doesn't // work in some current pthread libraries which return -1 instead - // and set errno to ETIMEDOUT. So, we will return FALSE on any error + // and set errno to ETIMEDOUT. So, we will return gFalse on any error // including a ETIMEDOUT. if (pthread_cond_timedwait(&pSem->cond, &pSem->mtx, &tm)) { pthread_mutex_unlock(&pSem->mtx); - return FALSE; + return gFalse; } } } @@ -168,7 +168,7 @@ bool_t gfxSemWait(gfxSem *pSem, delaytime_t ms) { } pSem->cnt--; pthread_mutex_unlock(&pSem->mtx); - return TRUE; + return gTrue; } void gfxSemSignal(gfxSem *pSem) { diff --git a/src/gos/gos_osx.h b/src/gos/gos_osx.h index 94c67eab..6b5a762a 100644 --- a/src/gos/gos_osx.h +++ b/src/gos/gos_osx.h @@ -11,13 +11,9 @@ #if GFX_USE_OS_OSX #include -#include #include #include -/* Already defined int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t, size_t */ - -typedef int8_t bool_t; typedef unsigned long systemticks_t; typedef void * threadreturn_t; typedef unsigned long delaytime_t; @@ -63,10 +59,6 @@ typedef struct gfxSem { /* Function declarations. */ /*===========================================================================*/ -#ifdef __cplusplus -extern "C" { -#endif - void gfxHalt(const char *msg); void gfxSleepMilliseconds(delaytime_t ms); void gfxSleepMicroseconds(delaytime_t ms); @@ -75,14 +67,10 @@ void gfxSystemLock(void); void gfxSystemUnlock(void); void gfxSemInit(gfxSem *psem, semcount_t val, semcount_t limit); void gfxSemDestroy(gfxSem *psem); -bool_t gfxSemWait(gfxSem *psem, delaytime_t ms); +gBool gfxSemWait(gfxSem *psem, delaytime_t ms); void gfxSemSignal(gfxSem *psem); gfxThreadHandle gfxThreadCreate(void *stackarea, size_t stacksz, threadpriority_t prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param); threadreturn_t gfxThreadWait(gfxThreadHandle thread); -#ifdef __cplusplus -} -#endif - #endif /* GFX_USE_OS_OSX */ #endif /* _GOS_OSX_H */ diff --git a/src/gos/gos_qt.cpp b/src/gos/gos_qt.cpp index c6eb6f8d..4171d4fe 100644 --- a/src/gos/gos_qt.cpp +++ b/src/gos/gos_qt.cpp @@ -165,12 +165,12 @@ void gfxSemDestroy(gfxSem *psem) delete static_cast(*psem); } -bool_t gfxSemWait(gfxSem *psem, delaytime_t ms) +gBool gfxSemWait(gfxSem *psem, delaytime_t ms) { return static_cast(*psem)->tryAcquire(1, ms); } -bool_t gfxSemWaitI(gfxSem *psem) +gBool gfxSemWaitI(gfxSem *psem) { return static_cast(*psem)->tryAcquire(1); } diff --git a/src/gos/gos_qt.h b/src/gos/gos_qt.h index 75947242..367e2a87 100644 --- a/src/gos/gos_qt.h +++ b/src/gos/gos_qt.h @@ -10,10 +10,6 @@ #if GFX_USE_OS_QT -#include -#include -#include - #define DECLARE_THREAD_FUNCTION(fnName, param) threadreturn_t fnName(void *param) #define DECLARE_THREAD_STACK(name, sz) uint8_t name[0] #define THREAD_RETURN(retval) return retval @@ -25,7 +21,6 @@ #define NORMAL_PRIORITY 3 #define HIGH_PRIORITY 4 -typedef bool bool_t; typedef int systemticks_t; typedef int delaytime_t; typedef void* gfxMutex; @@ -35,10 +30,6 @@ typedef int threadreturn_t; typedef int threadpriority_t; typedef void* gfxThreadHandle; -#ifdef __cplusplus -extern "C" { -#endif - void _gosInit(); void _gosDeinit(); @@ -60,8 +51,8 @@ void gfxMutexEnter(gfxMutex *pmutex); void gfxMutexExit(gfxMutex *pmutex); void gfxSemInit(gfxSem *psem, semcount_t val, semcount_t limit); void gfxSemDestroy(gfxSem *psem); -bool_t gfxSemWait(gfxSem *psem, delaytime_t ms); -bool_t gfxSemWaitI(gfxSem *psem); +gBool gfxSemWait(gfxSem *psem, delaytime_t ms); +gBool gfxSemWaitI(gfxSem *psem); void gfxSemSignal(gfxSem *psem); void gfxSemSignalI(gfxSem *psem); gfxThreadHandle gfxThreadCreate(void *stackarea, size_t stacksz, threadpriority_t prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param); @@ -69,9 +60,5 @@ threadreturn_t gfxThreadWait(gfxThreadHandle thread); gfxThreadHandle gfxThreadMe(void); void gfxThreadClose(gfxThreadHandle thread); -#ifdef __cplusplus -} -#endif - #endif /* GFX_USE_OS_QT */ #endif /* _GOS_QT_H */ diff --git a/src/gos/gos_raw32.h b/src/gos/gos_raw32.h index 5ff38028..6b6bce93 100644 --- a/src/gos/gos_raw32.h +++ b/src/gos/gos_raw32.h @@ -29,42 +29,8 @@ /* Type definitions */ /*===========================================================================*/ -typedef unsigned char bool_t; - -#if __STDC_VERSION__ >= 199901L - #include -#elif defined(__GNUC__) || defined(__GNUG__) - typedef __INT8_TYPE__ int8_t; - typedef __UINT8_TYPE__ uint8_t; - typedef __INT16_TYPE__ int16_t; - typedef __UINT16_TYPE__ uint16_t; - typedef __INT32_TYPE__ int32_t; - typedef __UINT32_TYPE__ uint32_t; -#else - typedef signed char int8_t; - typedef unsigned char uint8_t; - typedef signed short int16_t; - typedef unsigned short uint16_t; - typedef signed int int32_t; - typedef unsigned int uint32_t; -#endif - -#if defined(__STDC__) - #include -#else - typedef uint32_t size_t; -#endif - -#ifdef __cplusplus -extern "C" { -#endif - - void gfxHalt(const char *msg); - void gfxExit(void); - -#ifdef __cplusplus -} -#endif +void gfxHalt(const char *msg); +void gfxExit(void); /*===========================================================================*/ /* Use the generic thread handling and heap handling */ diff --git a/src/gos/gos_rawrtos.c b/src/gos/gos_rawrtos.c index 8ff53883..fd50a3f7 100644 --- a/src/gos/gos_rawrtos.c +++ b/src/gos/gos_rawrtos.c @@ -59,20 +59,20 @@ void gfxSleepMicroseconds(delaytime_t us) raw_sleep(ticks); } -bool_t gfxSemWait(gfxSem* psem, delaytime_t ms) +gBool gfxSemWait(gfxSem* psem, delaytime_t ms) { systemticks_t ticks = ms*RAW_TICKS_PER_SECOND/1000; if(!ticks)ticks=1; if(raw_semaphore_get((psem), ticks)==RAW_SUCCESS) - return TRUE; - return FALSE; + return gTrue; + return gFalse; } -bool_t gfxSemWaitI(gfxSem* psem) +gBool gfxSemWaitI(gfxSem* psem) { if(raw_semaphore_get((psem), TIME_IMMEDIATE)==RAW_SUCCESS) - return TRUE; - return FALSE; + return gTrue; + return gFalse; } gfxThreadHandle gfxThreadCreate(void *stackarea, size_t stacksz, threadpriority_t prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param) diff --git a/src/gos/gos_rawrtos.h b/src/gos/gos_rawrtos.h index d1026c9d..8dc5549e 100644 --- a/src/gos/gos_rawrtos.h +++ b/src/gos/gos_rawrtos.h @@ -4,17 +4,14 @@ #if GFX_USE_OS_RAWRTOS #include "raw_api.h" -#include #define TIME_IMMEDIATE (RAW_NO_WAIT) #define TIME_INFINITE (RAW_WAIT_FOREVER) -typedef int8_t bool_t; typedef uint32_t delaytime_t; typedef RAW_TICK_TYPE systemticks_t; typedef int32_t semcount_t; typedef uint32_t threadreturn_t; typedef RAW_U8 threadpriority_t; -typedef uint32_t size_t; #define MAX_SEMAPHORE_COUNT RAW_SEMAPHORE_COUNT #define LOW_PRIORITY (CONFIG_RAW_PRIO_MAX-2) @@ -53,7 +50,7 @@ typedef RAW_TASK_OBJ* gfxThreadHandle; extern RAW_VOID *raw_malloc(RAW_U32 size); extern RAW_VOID raw_free(void *ptr); extern RAW_VOID *raw_calloc(RAW_U32 nmemb, RAW_U32 size); - + extern RAW_U16 raw_sleep(RAW_TICK_TYPE dly); extern RAW_TICK_TYPE raw_system_time_get(void); @@ -68,8 +65,8 @@ extern RAW_U16 raw_semaphore_put(RAW_SEMAPHORE *semaphore_ptr); void gfxSleepMilliseconds(delaytime_t ms); void gfxSleepMicroseconds(delaytime_t us); -bool_t gfxSemWait(gfxSem* psem, delaytime_t ms); -bool_t gfxSemWaitI(gfxSem* psem); +gBool gfxSemWait(gfxSem* psem, delaytime_t ms); +gBool gfxSemWaitI(gfxSem* psem); gfxThreadHandle gfxThreadCreate(void *stackarea, size_t stacksz, threadpriority_t prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param); #endif diff --git a/src/gos/gos_win32.c b/src/gos/gos_win32.c index 1aa13dd6..11b2e0aa 100644 --- a/src/gos/gos_win32.c +++ b/src/gos/gos_win32.c @@ -74,7 +74,7 @@ void gfxSystemUnlock(void) { ReleaseMutex(SystemMutex); } -bool_t gfxSemWait(gfxSem *psem, delaytime_t ms) { +gBool gfxSemWait(gfxSem *psem, delaytime_t ms) { return WaitForSingleObject(*psem, ms) == WAIT_OBJECT_0; } diff --git a/src/gos/gos_win32.h b/src/gos/gos_win32.h index 62602ad3..3cdd5214 100644 --- a/src/gos/gos_win32.h +++ b/src/gos/gos_win32.h @@ -25,21 +25,6 @@ #include -/* Stop cygwin from defining these types */ -#define __int8_t_defined - -/** - * size_t - * TRUE, FALSE - * are already defined by Win32 - */ -typedef __int8 bool_t; -typedef __int8 int8_t; -typedef unsigned __int8 uint8_t; -typedef __int16 int16_t; -typedef unsigned __int16 uint16_t; -typedef __int32 int32_t; -typedef unsigned __int32 uint32_t; typedef DWORD delaytime_t; typedef DWORD systemticks_t; typedef LONG semcount_t; @@ -85,22 +70,14 @@ typedef HANDLE gfxThreadHandle; /* Function declarations. */ /*===========================================================================*/ -#ifdef __cplusplus -extern "C" { -#endif - void gfxHalt(const char *msg); void gfxSleepMicroseconds(delaytime_t ms); -bool_t gfxSemWait(gfxSem *psem, delaytime_t ms); +gBool gfxSemWait(gfxSem *psem, delaytime_t ms); void gfxSystemLock(void); void gfxSystemUnlock(void); gfxThreadHandle gfxThreadCreate(void *stackarea, size_t stacksz, threadpriority_t prio, DECLARE_THREAD_FUNCTION(*fn,p), void *param); threadreturn_t gfxThreadWait(gfxThreadHandle thread); -#ifdef __cplusplus -} -#endif - #endif /* GFX_USE_OS_WIN32 */ #endif /* _GOS_WIN32_H */ diff --git a/src/gos/gos_x_heap.h b/src/gos/gos_x_heap.h index 0fbfc905..1434b991 100644 --- a/src/gos/gos_x_heap.h +++ b/src/gos/gos_x_heap.h @@ -14,31 +14,23 @@ /* Type definitions */ /*===========================================================================*/ -#ifdef __cplusplus -extern "C" { +#if GFX_OS_HEAP_SIZE != 0 || defined(__DOXYGEN__) + /** + * @brief Take a chunk of memory and add it to the available heap + * @note Memory added must obviously not already be on the heap. + * @note It is allowable to add multiple non-contiguous blocks of memory + * to the heap. If however it is contiguous with a previously added block + * it will get merged with the existing block in order to allow + * allocations that span the boundary. + * @pre GFX_OS_HEAP_SIZE != 0 and an operating system that uses the + * internal ugfx heap allocator rather than its own allocator. + */ + void gfxAddHeapBlock(void *ptr, size_t sz); #endif - #if GFX_OS_HEAP_SIZE != 0 || defined(__DOXYGEN__) - /** - * @brief Take a chunk of memory and add it to the available heap - * @note Memory added must obviously not already be on the heap. - * @note It is allowable to add multiple non-contiguous blocks of memory - * to the heap. If however it is contiguous with a previously added block - * it will get merged with the existing block in order to allow - * allocations that span the boundary. - * @pre GFX_OS_HEAP_SIZE != 0 and an operating system that uses the - * internal ugfx heap allocator rather than its own allocator. - */ - void gfxAddHeapBlock(void *ptr, size_t sz); - #endif - - void *gfxAlloc(size_t sz); - void *gfxRealloc(void *ptr, size_t oldsz, size_t newsz); - void gfxFree(void *ptr); - -#ifdef __cplusplus -} -#endif +void *gfxAlloc(size_t sz); +void *gfxRealloc(void *ptr, size_t oldsz, size_t newsz); +void gfxFree(void *ptr); #endif /* GOS_NEED_X_HEAP */ #endif /* _GOS_X_HEAP_H */ diff --git a/src/gos/gos_x_threads.c b/src/gos/gos_x_threads.c index 52afd5c1..efff9f20 100644 --- a/src/gos/gos_x_threads.c +++ b/src/gos/gos_x_threads.c @@ -50,7 +50,7 @@ void gfxSemInit(gfxSem *psem, semcount_t val, semcount_t limit) { psem->limit = limit; } -bool_t gfxSemWait(gfxSem *psem, delaytime_t ms) { +gBool gfxSemWait(gfxSem *psem, delaytime_t ms) { systemticks_t starttm, delay; // Convert our delay to ticks @@ -74,12 +74,12 @@ bool_t gfxSemWait(gfxSem *psem, delaytime_t ms) { // Check if we have exceeded the defined delay switch (delay) { case TIME_IMMEDIATE: - return FALSE; + return gFalse; case TIME_INFINITE: break; default: if (gfxSystemTicks() - starttm >= delay) - return FALSE; + return gFalse; break; } gfxYield(); @@ -87,14 +87,14 @@ bool_t gfxSemWait(gfxSem *psem, delaytime_t ms) { } psem->cnt--; INTERRUPTS_ON(); - return TRUE; + return gTrue; } -bool_t gfxSemWaitI(gfxSem *psem) { +gBool gfxSemWaitI(gfxSem *psem) { if (psem->cnt <= 0) - return FALSE; + return gFalse; psem->cnt--; - return TRUE; + return gTrue; } void gfxSemSignal(gfxSem *psem) { @@ -243,7 +243,7 @@ static thread mainthread; // The main thread context * MACROS: * * AUTO_DETECT_STACKFRAME GFXON/GFXOFF - GFXON to auto-detect stack frame structure - * STACK_DIR_UP Macro/bool_t - GFXON if the stack grows up instead of down + * STACK_DIR_UP Macro/gBool - GFXON if the stack grows up instead of down * MASK1 Macro/uint32_t - The 1st mask of jmp_buf elements that need relocation * MASK2 Macro/uint32_t - The 2nd mask of jmp_buf elements that need relocation * STACK_BASE Macro/size_t - The base of the stack frame relative to the local variables @@ -275,7 +275,7 @@ static thread mainthread; // The main thread context jmp_buf cxt; } saveloc; - static bool_t stackdirup; + static gBool stackdirup; static uint32_t jmpmask1; static uint32_t jmpmask2; static size_t stackbase; @@ -384,7 +384,7 @@ static thread mainthread; // The main thread context } #endif } - static void _gfxXSwitch(thread *oldt, thread *newt, bool_t doBuildFrame) { + static void _gfxXSwitch(thread *oldt, thread *newt, gBool doBuildFrame) { // Save the old context if (CXT_SAVE(oldt->cxt)) return; @@ -415,8 +415,8 @@ static thread mainthread; // The main thread context CXT_RESTORE(newt->cxt, 1); } - #define _gfxTaskSwitch(oldt, newt) _gfxXSwitch(oldt, newt, FALSE) - #define _gfxStartThread(oldt, newt) _gfxXSwitch(oldt, newt, TRUE) + #define _gfxTaskSwitch(oldt, newt) _gfxXSwitch(oldt, newt, gFalse) + #define _gfxStartThread(oldt, newt) _gfxXSwitch(oldt, newt, gTrue) #endif #undef GFX_THREADS_DONE diff --git a/src/gos/gos_x_threads.h b/src/gos/gos_x_threads.h index 546e9e13..7f7b57e7 100644 --- a/src/gos/gos_x_threads.h +++ b/src/gos/gos_x_threads.h @@ -49,52 +49,44 @@ typedef struct { typedef uint32_t gfxMutex; typedef void * gfxThreadHandle; -#ifdef __cplusplus -extern "C" { -#endif +// Required timing functions - supplied by the user or the operating system +systemticks_t gfxSystemTicks(void); +systemticks_t gfxMillisecondsToTicks(delaytime_t ms); - // Required timing functions - supplied by the user or the operating system - systemticks_t gfxSystemTicks(void); - systemticks_t gfxMillisecondsToTicks(delaytime_t ms); +// Sleep Functions +void gfxSleepMilliseconds(delaytime_t ms); +void gfxSleepMicroseconds(delaytime_t ms); +void gfxYield(void); - // Sleep Functions - void gfxSleepMilliseconds(delaytime_t ms); - void gfxSleepMicroseconds(delaytime_t ms); - void gfxYield(void); +// System Locking +void gfxSystemLock(void); +void gfxSystemUnlock(void); - // System Locking - void gfxSystemLock(void); - void gfxSystemUnlock(void); +// Mutexes +void gfxMutexInit(gfxMutex *pmutex); +#define gfxMutexDestroy(pmutex) +void gfxMutexEnter(gfxMutex *pmutex); +void gfxMutexExit(gfxMutex *pmutex); - // Mutexes - void gfxMutexInit(gfxMutex *pmutex); - #define gfxMutexDestroy(pmutex) - void gfxMutexEnter(gfxMutex *pmutex); - void gfxMutexExit(gfxMutex *pmutex); +// Semaphores +void gfxSemInit(gfxSem *psem, semcount_t val, semcount_t limit); +#define gfxSemDestroy(psem) +gBool gfxSemWait(gfxSem *psem, delaytime_t ms); +gBool gfxSemWaitI(gfxSem *psem); +void gfxSemSignal(gfxSem *psem); +void gfxSemSignalI(gfxSem *psem); - // Semaphores - void gfxSemInit(gfxSem *psem, semcount_t val, semcount_t limit); - #define gfxSemDestroy(psem) - bool_t gfxSemWait(gfxSem *psem, delaytime_t ms); - bool_t gfxSemWaitI(gfxSem *psem); - void gfxSemSignal(gfxSem *psem); - void gfxSemSignalI(gfxSem *psem); +// Threads +gfxThreadHandle gfxThreadCreate(void *stackarea, size_t stacksz, threadpriority_t prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param); +#define gfxThreadClose(thread) +threadreturn_t gfxThreadWait(gfxThreadHandle thread); +gfxThreadHandle gfxThreadMe(void); - // Threads - gfxThreadHandle gfxThreadCreate(void *stackarea, size_t stacksz, threadpriority_t prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param); - #define gfxThreadClose(thread) - threadreturn_t gfxThreadWait(gfxThreadHandle thread); - gfxThreadHandle gfxThreadMe(void); - - /** The following is not part of the public ugfx API as some operating systems - * simply do not provide this capability. - * For RAW32 we need it anyway so we might as well declare it here. - */ - void gfxThreadExit(threadreturn_t ret); - -#ifdef __cplusplus -} -#endif +/** The following is not part of the public ugfx API as some operating systems + * simply do not provide this capability. + * For RAW32 we need it anyway so we might as well declare it here. + */ +void gfxThreadExit(threadreturn_t ret); #endif /* GOS_NEED_X_THREADS */ #endif /* _GOS_X_THREADS_H */ diff --git a/src/gos/gos_zephyr.h b/src/gos/gos_zephyr.h index 0acb2c43..07f9107b 100644 --- a/src/gos/gos_zephyr.h +++ b/src/gos/gos_zephyr.h @@ -10,99 +10,79 @@ #if GFX_USE_OS_ZEPHYR -// #include -// #include - #include - /*===========================================================================*/ - /* Type definitions */ - /*===========================================================================*/ +/*===========================================================================*/ +/* Type definitions */ +/*===========================================================================*/ - typedef bool bool_t; - typedef s8_t int8_t; - typedef u8_t uint8_t; - typedef s16_t int16_t; - typedef u16_t uint16_t; - typedef s32_t int32_t; - typedef u32_t uint32_t; +typedef s32_t delaytime_t; +typedef u32_t systemticks_t; +typedef u32_t semcount_t; +typedef void threadreturn_t; +typedef int threadpriority_t; - // typedef unsigned long size_t; - typedef s32_t delaytime_t; - typedef u32_t systemticks_t; - typedef u32_t semcount_t; - typedef void threadreturn_t; - typedef int threadpriority_t; +#define DECLARE_THREAD_FUNCTION(fnName, param)\ + threadreturn_t fnName(void* param, void* p2, void* p3) - #define DECLARE_THREAD_FUNCTION(fnName, param)\ - threadreturn_t fnName(void* param, void* p2, void* p3) +#define DECLARE_THREAD_STACK(name, sz)\ + K_THREAD_STACK_DEFINE(name, sz) - #define DECLARE_THREAD_STACK(name, sz)\ - K_THREAD_STACK_DEFINE(name, sz) +#define THREAD_RETURN(retval) return - #define THREAD_RETURN(retval) return +#define TIME_IMMEDIATE K_NO_WAIT +#define TIME_INFINITE K_FOREVER +#define MAX_SEMAPHORE_COUNT ((semcount_t)(((unsigned long)((semcount_t)(-1))) >> 1)) +#define LOW_PRIORITY CONFIG_NUM_PREEMPT_PRIORITIES-1 +#define NORMAL_PRIORITY 1 +#define HIGH_PRIORITY 0 - #define TIME_IMMEDIATE K_NO_WAIT - #define TIME_INFINITE K_FOREVER - #define MAX_SEMAPHORE_COUNT ((semcount_t)(((unsigned long)((semcount_t)(-1))) >> 1)) - #define LOW_PRIORITY CONFIG_NUM_PREEMPT_PRIORITIES-1 - #define NORMAL_PRIORITY 1 - #define HIGH_PRIORITY 0 +typedef struct k_sem gfxSem; - typedef struct k_sem gfxSem; +typedef struct k_mutex gfxMutex; - typedef struct k_mutex gfxMutex; +typedef k_tid_t gfxThreadHandle; - typedef k_tid_t gfxThreadHandle; +/*===========================================================================*/ +/* Function declarations. */ +/*===========================================================================*/ - /*===========================================================================*/ - /* Function declarations. */ - /*===========================================================================*/ +#define gfxHalt(msg) do{}while(0) +#define gfxExit() do{}while(0) - #ifdef __cplusplus - extern "C" { - #endif +// Don't forget to set CONFIG_HEAP_MEM_POOL_SIZE +#define gfxAlloc(sz) k_malloc(sz) +#define gfxFree(ptr) k_free(ptr) +#define gfxRealloc(ptr, oldsz, newsz) do{}while(0) - #define gfxHalt(msg) do{}while(0) - #define gfxExit() do{}while(0) +#define gfxYield() k_yield() +#define gfxSleepMilliseconds(ms) k_sleep(ms) +#define gfxSleepMicroseconds(us) do{}while(0) +#define gfxMillisecondsToTicks(ms) CONFIG_SYS_CLOCK_TICKS_PER_SEC*ms/1000 +systemticks_t gfxSystemTicks(); - // Don't forget to set CONFIG_HEAP_MEM_POOL_SIZE - #define gfxAlloc(sz) k_malloc(sz) - #define gfxFree(ptr) k_free(ptr) - #define gfxRealloc(ptr, oldsz, newsz) do{}while(0) +#define gfxSystemLock() k_sched_lock() +#define gfxSystemUnlock() k_sched_unlock() - #define gfxYield() k_yield() - #define gfxSleepMilliseconds(ms) k_sleep(ms) - #define gfxSleepMicroseconds(us) do{}while(0) - #define gfxMillisecondsToTicks(ms) CONFIG_SYS_CLOCK_TICKS_PER_SEC*ms/1000 - systemticks_t gfxSystemTicks(); +#define gfxMutexInit(pmutex) k_mutex_init(pmutex) +#define gfxMutexDestroy(pmutex) do{}while(0) +#define gfxMutexEnter(pmutex) k_mutex_lock(pmutex, K_FOREVER) +#define gfxMutexExit(pmutex) k_mutex_unlock(pmutex) - #define gfxSystemLock() k_sched_lock() - #define gfxSystemUnlock() k_sched_unlock() +#define gfxSemInit(psem, val, limit) k_sem_init(psem, val, limit) +#define gfxSemDestroy(psem) do{}while(0) +#define gfxSemWait(psem, ms) (k_sem_take(psem, ms) == 0) ? gTrue : gFalse +#define gfxSemWaitI(psem) (k_sem_take(psem, K_NO_WAIT) == 0) ? gTrue : gFalse +#define gfxSemSignal(psem) k_sem_give(psem) +#define gfxSemSignalI(psem) k_sem_give(psem) +#define gfxSemCounter(psem) k_sem_count_get(psem) +#define gfxSemCounterI(psem) k_sem_count_get(psem) - #define gfxMutexInit(pmutex) k_mutex_init(pmutex) - #define gfxMutexDestroy(pmutex) do{}while(0) - #define gfxMutexEnter(pmutex) k_mutex_lock(pmutex, K_FOREVER) - #define gfxMutexExit(pmutex) k_mutex_unlock(pmutex) - - #define gfxSemInit(psem, val, limit) k_sem_init(psem, val, limit) - #define gfxSemDestroy(psem) do{}while(0) - #define gfxSemWait(psem, ms) (k_sem_take(psem, ms) == 0) ? TRUE : FALSE - #define gfxSemWaitI(psem) (k_sem_take(psem, K_NO_WAIT) == 0) ? TRUE : FALSE - #define gfxSemSignal(psem) k_sem_give(psem) - #define gfxSemSignalI(psem) k_sem_give(psem) - #define gfxSemCounter(psem) k_sem_count_get(psem) - #define gfxSemCounterI(psem) k_sem_count_get(psem) - - #define gfxThreadCreate(stackarea, stacksz, prio, fn, param)\ - k_thread_spawn(stackarea, stacksz, fn, param, NULL, NULL, prio, 0, K_NO_WAIT) - #define gfxThreadWait(thread) 0 - #define gfxThreadMe() k_current_get() - #define gfxThreadClose(thread) k_thread_abort(thread) - - #ifdef __cplusplus - } - #endif +#define gfxThreadCreate(stackarea, stacksz, prio, fn, param)\ + k_thread_spawn(stackarea, stacksz, fn, param, NULL, NULL, prio, 0, K_NO_WAIT) +#define gfxThreadWait(thread) 0 +#define gfxThreadMe() k_current_get() +#define gfxThreadClose(thread) k_thread_abort(thread) #endif /* GFX_USE_OS_ZEPHYR */ #endif /* _GOS_H */ diff --git a/src/gqueue/gqueue.c b/src/gqueue/gqueue.c index e9143654..0e4c7020 100644 --- a/src/gqueue/gqueue.c +++ b/src/gqueue/gqueue.c @@ -133,8 +133,8 @@ void _gqueueDeinit(void) } } - bool_t gfxQueueASyncIsIn(gfxQueueASync *pqueue, const gfxQueueASyncItem *pitem) { - bool_t res; + gBool gfxQueueASyncIsIn(gfxQueueASync *pqueue, const gfxQueueASyncItem *pitem) { + gBool res; gfxSystemLock(); res = gfxQueueASyncIsInI(pqueue, pitem); @@ -142,14 +142,14 @@ void _gqueueDeinit(void) return res; } - bool_t gfxQueueASyncIsInI(gfxQueueASync *pqueue, const gfxQueueASyncItem *pitem) { + gBool gfxQueueASyncIsInI(gfxQueueASync *pqueue, const gfxQueueASyncItem *pitem) { gfxQueueASyncItem *pi; for(pi = pqueue->head; pi; pi = pi->next) { if (pi == pitem) - return TRUE; + return gTrue; } - return FALSE; + return gFalse; } #endif @@ -271,8 +271,8 @@ void _gqueueDeinit(void) } } - bool_t gfxQueueGSyncIsIn(gfxQueueGSync *pqueue, const gfxQueueGSyncItem *pitem) { - bool_t res; + gBool gfxQueueGSyncIsIn(gfxQueueGSync *pqueue, const gfxQueueGSyncItem *pitem) { + gBool res; gfxSystemLock(); res = gfxQueueGSyncIsInI(pqueue, pitem); @@ -280,14 +280,14 @@ void _gqueueDeinit(void) return res; } - bool_t gfxQueueGSyncIsInI(gfxQueueGSync *pqueue, const gfxQueueGSyncItem *pitem) { + gBool gfxQueueGSyncIsInI(gfxQueueGSync *pqueue, const gfxQueueGSyncItem *pitem) { gfxQueueGSyncItem *pi; for(pi = pqueue->head; pi; pi = pi->next) { if (pi == pitem) - return TRUE; + return gTrue; } - return FALSE; + return gFalse; } #endif @@ -320,7 +320,7 @@ void _gqueueDeinit(void) return pi; } - bool_t gfxQueueFSyncPut(gfxQueueFSync *pqueue, gfxQueueFSyncItem *pitem, delaytime_t ms) { + gBool gfxQueueFSyncPut(gfxQueueFSync *pqueue, gfxQueueFSyncItem *pitem, delaytime_t ms) { if (!pitem) return; // Safety gfxSemInit(&pitem->sem, 0, 1); pitem->next = 0; @@ -339,7 +339,7 @@ void _gqueueDeinit(void) return gfxSemWait(&pitem->sem, ms); } - bool_t gfxQueueFSyncPush(gfxQueueFSync *pqueue, gfxQueueFSyncItem *pitem, delaytime_t ms) { + gBool gfxQueueFSyncPush(gfxQueueFSync *pqueue, gfxQueueFSyncItem *pitem, delaytime_t ms) { if (!pitem) return; // Safety gfxSemInit(&pitem->sem, 0, 1); @@ -355,7 +355,7 @@ void _gqueueDeinit(void) return gfxSemWait(&pitem->sem, ms); } - bool_t gfxQueueFSyncInsert(gfxQueueFSync *pqueue, gfxQueueFSyncItem *pitem, gfxQueueASyncItem *pafter, delaytime_t ms) { + gBool gfxQueueFSyncInsert(gfxQueueFSync *pqueue, gfxQueueFSyncItem *pitem, gfxQueueASyncItem *pafter, delaytime_t ms) { if (!pitem) return; // Safety gfxSemInit(&pitem->sem, 0, 1); @@ -409,8 +409,8 @@ void _gqueueDeinit(void) gfxSystemUnlock(); } - bool_t gfxQueueFSyncIsIn(gfxQueueFSync *pqueue, const gfxQueueFSyncItem *pitem) { - bool_t res; + gBool gfxQueueFSyncIsIn(gfxQueueFSync *pqueue, const gfxQueueFSyncItem *pitem) { + gBool res; gfxSystemLock(); res = gfxQueueFSyncIsInI(pqueue, pitem); @@ -418,30 +418,30 @@ void _gqueueDeinit(void) return res; } - bool_t gfxQueueFSyncIsInI(gfxQueueFSync *pqueue, const gfxQueueFSyncItem *pitem) { + gBool gfxQueueFSyncIsInI(gfxQueueFSync *pqueue, const gfxQueueFSyncItem *pitem) { gfxQueueASyncItem *pi; for(pi = pqueue->head; pi; pi = pi->next) { if (pi == pitem) - return TRUE; + return gTrue; } - return FALSE; + return gFalse; } #endif #if GQUEUE_NEED_BUFFERS - bool_t gfxBufferAlloc(unsigned num, size_t size) { + gBool gfxBufferAlloc(unsigned num, size_t size) { GDataBuffer *pd; if (num < 1) - return FALSE; + return gFalse; // Round up to a multiple of 4 to prevent problems with structure alignment size = (size + 3) & ~0x03; // Allocate the memory if (!(pd = gfxAlloc((size+sizeof(GDataBuffer)) * num))) - return FALSE; + return gFalse; // Add each of them to our free list for(;num--; pd = (GDataBuffer *)((char *)(pd+1)+size)) { @@ -449,14 +449,14 @@ void _gqueueDeinit(void) gfxBufferRelease(pd); } - return TRUE; + return gTrue; } void gfxBufferRelease(GDataBuffer *pd) { gfxQueueGSyncPut(&bufferFreeList, (gfxQueueGSyncItem *)pd); } void gfxBufferReleaseI(GDataBuffer *pd) { gfxQueueGSyncPutI(&bufferFreeList, (gfxQueueGSyncItem *)pd); } GDataBuffer *gfxBufferGet(delaytime_t ms) { return (GDataBuffer *)gfxQueueGSyncGet(&bufferFreeList, ms); } GDataBuffer *gfxBufferGetI(void) { return (GDataBuffer *)gfxQueueGSyncGetI(&bufferFreeList); } - bool_t gfxBufferIsAvailable(void) { return bufferFreeList.head != 0; } + gBool gfxBufferIsAvailable(void) { return bufferFreeList.head != 0; } #endif diff --git a/src/gqueue/gqueue.h b/src/gqueue/gqueue.h index 40a41bce..c0da77d9 100644 --- a/src/gqueue/gqueue.h +++ b/src/gqueue/gqueue.h @@ -85,10 +85,6 @@ typedef struct GDataBuffer { /* Function declarations. */ /*===========================================================================*/ -#ifdef __cplusplus -extern "C" { -#endif - /** * @name Initialisation functions * @brief Initialise a queue. @@ -145,7 +141,7 @@ gfxQueueFSyncItem *gfxQueueFSyncGet(gfxQueueFSync *pqueue, delaytime_t ms); /** * @name Put() Functions * @brief Put an item on the end of the queue. - * @return none for ASync and GSync queues; For FSync queues - FALSE on timeout, otherwise TRUE + * @return none for ASync and GSync queues; For FSync queues - gFalse on timeout, otherwise gTrue * * @param[in] pqueue A pointer to the queue * @param[in] pitem A pointer to the queue item @@ -163,7 +159,7 @@ void gfxQueueASyncPut(gfxQueueASync *pqueue, gfxQueueASyncItem *pitem); void gfxQueueASyncPutI(gfxQueueASync *pqueue, gfxQueueASyncItem *pitem); void gfxQueueGSyncPut(gfxQueueGSync *pqueue, gfxQueueGSyncItem *pitem); void gfxQueueGSyncPutI(gfxQueueGSync *pqueue, gfxQueueGSyncItem *pitem); -bool_t gfxQueueFSyncPut(gfxQueueFSync *pqueue, gfxQueueFSyncItem *pitem, delaytime_t ms); +gBool gfxQueueFSyncPut(gfxQueueFSync *pqueue, gfxQueueFSyncItem *pitem, delaytime_t ms); /** @} */ /** @@ -183,7 +179,7 @@ bool_t gfxQueueFSyncPut(gfxQueueFSync *pqueue, gfxQueueFSyncItem *pitem, delayti /** * @name Push() Functions * @brief Push an item into the start of the queue. - * @return none for ASync and GSync queues; For FSync queues - FALSE on timeout, otherwise TRUE + * @return none for ASync and GSync queues; For FSync queues - gFalse on timeout, otherwise gTrue * * @param[in] pqueue A pointer to the queue * @param[in] pitem A pointer to the queue item @@ -201,13 +197,13 @@ void gfxQueueASyncPush(gfxQueueASync *pqueue, gfxQueueASyncItem *pitem); void gfxQueueASyncPushI(gfxQueueASync *pqueue, gfxQueueASyncItem *pitem); void gfxQueueGSyncPush(gfxQueueGSync *pqueue, gfxQueueGSyncItem *pitem); void gfxQueueGSyncPushI(gfxQueueGSync *pqueue, gfxQueueGSyncItem *pitem); -bool_t gfxQueueFSyncPush(gfxQueueFSync *pqueue, gfxQueueFSyncItem *pitem, delaytime_t ms); +gBool gfxQueueFSyncPush(gfxQueueFSync *pqueue, gfxQueueFSyncItem *pitem, delaytime_t ms); /** @} */ /** * @name Insert() Functions * @brief Insert an item on the queue after the specified item. - * @return none for ASync and GSync queues; For FSync queues - FALSE on timeout, otherwise TRUE + * @return none for ASync and GSync queues; For FSync queues - gFalse on timeout, otherwise gTrue * * @param[in] pqueue A pointer to the queue * @param[in] pitem A pointer to the queue item @@ -227,7 +223,7 @@ void gfxQueueASyncInsert(gfxQueueASync *pqueue, gfxQueueASyncItem *pitem, gfxQue void gfxQueueASyncInsertI(gfxQueueASync *pqueue, gfxQueueASyncItem *pitem, gfxQueueASyncItem *pafter); void gfxQueueGSyncInsert(gfxQueueGSync *pqueue, gfxQueueGSyncItem *pitem, gfxQueueASyncItem *pafter); void gfxQueueGSyncInsertI(gfxQueueGSync *pqueue, gfxQueueGSyncItem *pitem, gfxQueueASyncItem *pafter); -bool_t gfxQueueFSyncInsert(gfxQueueFSync *pqueue, gfxQueueFSyncItem *pitem, gfxQueueASyncItem *pafter, delaytime_t ms); +gBool gfxQueueFSyncInsert(gfxQueueFSync *pqueue, gfxQueueFSyncItem *pitem, gfxQueueASyncItem *pafter, delaytime_t ms); /** @} */ /** @@ -256,7 +252,7 @@ void gfxQueueFSyncRemove(gfxQueueFSync *pqueue, gfxQueueFSyncItem *pitem); /** * @name isEmpty() Functions * @brief Is the queue empty? - * @return TRUE if the queue is empty + * @return gTrue if the queue is empty * * @param[in] pqueue A pointer to the queue * @@ -276,7 +272,7 @@ void gfxQueueFSyncRemove(gfxQueueFSync *pqueue, gfxQueueFSyncItem *pitem); /** * @name IsInQueue() Functions * @brief Is an item in the queue? - * @return TRUE if the item is in the queue? + * @return gTrue if the item is in the queue? * * @param[in] pqueue A pointer to the queue * @param[in] pitem A pointer to the queue item @@ -287,12 +283,12 @@ void gfxQueueFSyncRemove(gfxQueueFSync *pqueue, gfxQueueFSyncItem *pitem); * @api * @{ */ -bool_t gfxQueueASyncIsIn(gfxQueueASync *pqueue, const gfxQueueASyncItem *pitem); -bool_t gfxQueueASyncIsInI(gfxQueueASync *pqueue, const gfxQueueASyncItem *pitem); -bool_t gfxQueueGSyncIsIn(gfxQueueGSync *pqueue, const gfxQueueGSyncItem *pitem); -bool_t gfxQueueGSyncIsInI(gfxQueueGSync *pqueue, const gfxQueueGSyncItem *pitem); -bool_t gfxQueueFSyncIsIn(gfxQueueFSync *pqueue, const gfxQueueFSyncItem *pitem); -bool_t gfxQueueFSyncIsInI(gfxQueueFSync *pqueue, const gfxQueueFSyncItem *pitem); +gBool gfxQueueASyncIsIn(gfxQueueASync *pqueue, const gfxQueueASyncItem *pitem); +gBool gfxQueueASyncIsInI(gfxQueueASync *pqueue, const gfxQueueASyncItem *pitem); +gBool gfxQueueGSyncIsIn(gfxQueueGSync *pqueue, const gfxQueueGSyncItem *pitem); +gBool gfxQueueGSyncIsInI(gfxQueueGSync *pqueue, const gfxQueueGSyncItem *pitem); +gBool gfxQueueFSyncIsIn(gfxQueueFSync *pqueue, const gfxQueueFSyncItem *pitem); +gBool gfxQueueFSyncIsInI(gfxQueueFSync *pqueue, const gfxQueueFSyncItem *pitem); /** @} */ /** @@ -348,7 +344,7 @@ bool_t gfxQueueFSyncIsInI(gfxQueueFSync *pqueue, const gfxQueueFSyncItem *pitem) /** * @name BufferAlloc() Functions * @brief Allocate some buffers and put them on the free list - * @return TRUE is it succeeded. FALSE on allocation failure. + * @return gTrue is it succeeded. gFalse on allocation failure. * * @param[in] num The number of buffers to allocate * @param[in] size The size (in bytes) of each buffer @@ -356,18 +352,18 @@ bool_t gfxQueueFSyncIsInI(gfxQueueFSync *pqueue, const gfxQueueFSyncItem *pitem) * @api * @{ */ -bool_t gfxBufferAlloc(unsigned num, size_t size); +gBool gfxBufferAlloc(unsigned num, size_t size); /** @} */ /** * @name BufferIsAvailable() Functions * @brief Is there one or more buffers currently available on the free list - * @return TRUE if there are buffers in the free list + * @return gTrue if there are buffers in the free list * * @api * @{ */ -bool_t gfxBufferIsAvailable(void); +gBool gfxBufferIsAvailable(void); /** @} */ /** @@ -402,11 +398,6 @@ void gfxBufferRelease(GDataBuffer *pd); void gfxBufferReleaseI(GDataBuffer *pd); /** @} */ - -#ifdef __cplusplus -} -#endif - #endif /* GFX_USE_GQUEUE */ #endif /* _GQUEUE_H */ /** @} */ diff --git a/src/gtimer/gtimer.c b/src/gtimer/gtimer.c index 22ec9ed2..7ae0b652 100644 --- a/src/gtimer/gtimer.c +++ b/src/gtimer/gtimer.c @@ -136,7 +136,7 @@ void gtimerDeinit(GTimer* pt) gtimerStop(pt); } -void gtimerStart(GTimer *pt, GTimerFunction fn, void *param, bool_t periodic, delaytime_t millisec) { +void gtimerStart(GTimer *pt, GTimerFunction fn, void *param, gBool periodic, delaytime_t millisec) { gfxMutexEnter(&mutex); // Start our thread if not already going @@ -205,8 +205,8 @@ void gtimerStop(GTimer *pt) { gfxMutexExit(&mutex); } -bool_t gtimerIsActive(GTimer *pt) { - return (pt->flags & GTIMER_FLG_SCHEDULED) ? TRUE : FALSE; +gBool gtimerIsActive(GTimer *pt) { + return (pt->flags & GTIMER_FLG_SCHEDULED) ? gTrue : gFalse; } void gtimerJab(GTimer *pt) { diff --git a/src/gtimer/gtimer.h b/src/gtimer/gtimer.h index cecf8e70..402c3f1e 100644 --- a/src/gtimer/gtimer.h +++ b/src/gtimer/gtimer.h @@ -63,10 +63,6 @@ typedef struct GTimer_t { /* External declarations. */ /*===========================================================================*/ -#ifdef __cplusplus -extern "C" { -#endif - /** * @brief Initialise a timer * @@ -91,7 +87,7 @@ void gtimerDeinit(GTimer* pt); * @param[in] pt Pointer to a GTimer structure * @param[in] fn The callback function * @param[in] param The parameter to pass to the callback function - * @param[in] periodic Is the timer a periodic timer? FALSE is a once-only timer. + * @param[in] periodic Is the timer a periodic timer? gFalse is a once-only timer. * @param[in] millisec The timer period. The following special values are allowed: * TIME_IMMEDIATE causes the callback function to be called asap. * A periodic timer with this value will fire once only. @@ -114,7 +110,7 @@ void gtimerDeinit(GTimer* pt); * * @api */ -void gtimerStart(GTimer *pt, GTimerFunction fn, void *param, bool_t periodic, delaytime_t millisec); +void gtimerStart(GTimer *pt, GTimerFunction fn, void *param, gBool periodic, delaytime_t millisec); /** * @brief Stop a timer (periodic or otherwise) @@ -132,11 +128,11 @@ void gtimerStop(GTimer *pt); * * @param[in] pt Pointer to a GTimer structure * - * @return TRUE if active, FALSE otherwise + * @return gTrue if active, gFalse otherwise * * @api */ -bool_t gtimerIsActive(GTimer *pt); +gBool gtimerIsActive(GTimer *pt); /** * @brief Jab a timer causing the current period to immediate expire @@ -169,10 +165,6 @@ void gtimerJab(GTimer *pt); */ void gtimerJabI(GTimer *pt); -#ifdef __cplusplus -} -#endif - #endif /* GFX_USE_GTIMER */ #endif /* _GTIMER_H */ diff --git a/src/gtrans/gtrans.h b/src/gtrans/gtrans.h index da3cae5e..49d5d168 100644 --- a/src/gtrans/gtrans.h +++ b/src/gtrans/gtrans.h @@ -31,10 +31,6 @@ typedef struct transTable { const char** strings; /**< The translated strings */ } transTable; -#ifdef __cplusplus -extern "C" { -#endif - /** * @brief A wrapper macro to make writing and reading translatable applications easier. */ @@ -84,10 +80,6 @@ void gtransSetBaseLanguage(const transTable* const translation); */ void gtransSetLanguage(const transTable* const translation); -#ifdef __cplusplus -} -#endif - #endif /* GFX_USE_GTRANS */ #endif /* _TRANS_H */ diff --git a/src/gwin/gwin.c b/src/gwin/gwin.c index 2de0c125..7bc257bf 100644 --- a/src/gwin/gwin.c +++ b/src/gwin/gwin.c @@ -121,7 +121,7 @@ void _gwinDestroy(GHandle gh, GRedrawMethod how) { return; // Make the window invisible - gwinSetVisible(gh, FALSE); + gwinSetVisible(gh, gFalse); // Make sure it is flushed first - must be REDRAW_WAIT or REDRAW_INSESSION _gwinFlushRedraws(how); @@ -209,12 +209,12 @@ const char *gwinGetClassName(GHandle gh) { return gh->vmt->classname; } -bool_t gwinGetVisible(GHandle gh) { - return (gh->flags & GWIN_FLG_SYSVISIBLE) ? TRUE : FALSE; +gBool gwinGetVisible(GHandle gh) { + return (gh->flags & GWIN_FLG_SYSVISIBLE) ? gTrue : gFalse; } -bool_t gwinGetEnabled(GHandle gh) { - return (gh->flags & GWIN_FLG_SYSENABLED) ? TRUE : FALSE; +gBool gwinGetEnabled(GHandle gh) { + return (gh->flags & GWIN_FLG_SYSENABLED) ? gTrue : gFalse; } #if GDISP_NEED_TEXT @@ -395,7 +395,7 @@ void gwinBlitArea(GHandle gh, coord_t x, coord_t y, coord_t cx, coord_t cy, coor gdispGFillConvexPoly(gh->display, tx+gh->x, ty+gh->y, pntarray, cnt, gh->color); _gwinDrawEnd(gh); } - void gwinDrawThickLine(GHandle gh, coord_t x0, coord_t y0, coord_t x1, coord_t y1, coord_t width, bool_t round) { + void gwinDrawThickLine(GHandle gh, coord_t x0, coord_t y0, coord_t x1, coord_t y1, coord_t width, gBool round) { if (!_gwinDrawStart(gh)) return; gdispGDrawThickLine(gh->display, gh->x+x0, gh->y+y0, gh->x+x1, gh->y+y1, gh->color, width, round); _gwinDrawEnd(gh); diff --git a/src/gwin/gwin.h b/src/gwin/gwin.h index 54421bd4..79768366 100644 --- a/src/gwin/gwin.h +++ b/src/gwin/gwin.h @@ -77,7 +77,7 @@ typedef struct GWindowInit { coord_t y; /**< The initial position relative to its parent */ coord_t width; /**< The width */ coord_t height; /**< The height */ - bool_t show; /**< Should the window be visible initially */ + gBool show; /**< Should the window be visible initially */ #if GWIN_NEED_CONTAINERS GHandle parent; /**< The parent - must be a container or NULL */ #endif @@ -89,10 +89,6 @@ typedef struct GWindowInit { */ typedef enum { GWIN_NORMAL, GWIN_MAXIMIZE, GWIN_MINIMIZE } GWindowMinMax; -#ifdef __cplusplus -extern "C" { -#endif - /*------------------------------------------------- * Window Manager functions *-------------------------------------------------*/ @@ -122,286 +118,463 @@ extern "C" { * Functions that affect all windows *-------------------------------------------------*/ +/** + * @brief Clear a GWindowInit structure to all zero's + * @note This function is provided just to prevent problems + * on operating systems where using memset() causes issues + * in the users application. + * + * @param[in] pwi The GWindowInit structure to clear + * + * @api + */ +void gwinClearInit(GWindowInit *pwi); + +/** + * @brief Set the default foreground color for all new GWIN windows + * + * @param[in] clr The color to be set + * + * @api + */ +void gwinSetDefaultColor(color_t clr); + +/** + * @brief Get the default foreground color for all new GWIN windows + * + * @return The current default color for all new GWIN windows + * + * @api + */ +color_t gwinGetDefaultColor(void); + +/** + * @brief Set the default background color for all new GWIN windows + * + * @param[in] bgclr The background color + * + * @api + */ +void gwinSetDefaultBgColor(color_t bgclr); + +/** + * @brief Get the default background color for all new GWIN windows + * + * @return The current default background color for all new GWIN windows + * + * @api + */ +color_t gwinGetDefaultBgColor(void); + +#if GDISP_NEED_TEXT || defined(__DOXYGEN__) /** - * @brief Clear a GWindowInit structure to all zero's - * @note This function is provided just to prevent problems - * on operating systems where using memset() causes issues - * in the users application. + * @brief Set the default font for all new GWIN windows * - * @param[in] pwi The GWindowInit structure to clear + * @param[in] font The new font to be set * * @api */ - void gwinClearInit(GWindowInit *pwi); + void gwinSetDefaultFont(font_t font); /** - * @brief Set the default foreground color for all new GWIN windows + * @brief Get the current default font * - * @param[in] clr The color to be set + * @return The current default font * * @api */ - void gwinSetDefaultColor(color_t clr); - - /** - * @brief Get the default foreground color for all new GWIN windows - * - * @return The current default color for all new GWIN windows - * - * @api - */ - color_t gwinGetDefaultColor(void); - - /** - * @brief Set the default background color for all new GWIN windows - * - * @param[in] bgclr The background color - * - * @api - */ - void gwinSetDefaultBgColor(color_t bgclr); - - /** - * @brief Get the default background color for all new GWIN windows - * - * @return The current default background color for all new GWIN windows - * - * @api - */ - color_t gwinGetDefaultBgColor(void); - - #if GDISP_NEED_TEXT || defined(__DOXYGEN__) - /** - * @brief Set the default font for all new GWIN windows - * - * @param[in] font The new font to be set - * - * @api - */ - void gwinSetDefaultFont(font_t font); - - /** - * @brief Get the current default font - * - * @return The current default font - * - * @api - */ - font_t gwinGetDefaultFont(void); - #endif + font_t gwinGetDefaultFont(void); +#endif /*------------------------------------------------- - * Base functions - *-------------------------------------------------*/ +* Base functions +*-------------------------------------------------*/ +/** + * @brief Create a basic window. + * @return NULL if there is no resultant drawing area, otherwise a window handle. + * + * @param[in] g The GDisplay to display this window on + * @param[in] pgw The window structure to initialize. If this is NULL the structure is dynamically allocated. + * @param[in] pInit How to initialise the window + * + * @note The drawing color and the background color get set to the current defaults. If you haven't called + * @p gwinSetDefaultColor() or @p gwinSetDefaultBgColor() then these are GFX_WHITE and GFX_BLACK respectively. + * @note The font gets set to the current default font. If you haven't called @p gwinSetDefaultFont() then there + * is no default font and text drawing operations will no nothing. + * @note A basic window does not save the drawing state. It is not automatically redrawn if the window is moved or + * its visibility state is changed. + * + * @api + */ +GHandle gwinGWindowCreate(GDisplay *g, GWindowObject *pgw, const GWindowInit *pInit); +#define gwinWindowCreate(pgw, pInit) gwinGWindowCreate(GDISP, pgw, pInit); + +/** + * @brief Destroy a window (of any type). Releases any dynamically allocated memory. + * + * @param[in] gh The window handle + * + * @api + */ +void gwinDestroy(GHandle gh); + +/** + * @brief Get the real class name of the GHandle + * @details Returns a string describing the object class. + * + * @param[in] gh The window + * + * @return A string describing the object class. + * + * @api + */ +const char* gwinGetClassName(GHandle gh); + +/** + * @brief Get an ID that uniquely describes the class of the GHandle + * + * @param[in] gh The window + * + * @api + */ +#define gwinGetClassID(gh) ((void *)((gh)->vmt)) + +/** + * @brief Get the X coordinate of the window + * @details Returns the X coordinate of the origin of the window. + * The coordinate is relative to the physical screen zero point. + * + * @param[in] gh The window + * + * @api + */ +#define gwinGetScreenX(gh) ((gh)->x) + +/** + * @brief Get the Y coordinate of the window + * @details Returns the Y coordinate of the origin of the window. + * The coordinate is relative to the physical screen zero point. + * + * @param[in] gh The window + * + * @api + */ +#define gwinGetScreenY(gh) ((gh)->y) + +/** + * @brief Get the width of the window + * + * @param[in] gh The window + * + * @api + */ +#define gwinGetWidth(gh) ((gh)->width) + +/** + * @brief Get the height of the window + * + * @param[in] gh The window + * + * @api + */ +#define gwinGetHeight(gh) ((gh)->height) + +/** + * @brief Set foreground color + * @details Set the color which will be used to draw + * + * @param[in] gh The window + * @param[in] clr The color to be set + * + * @api + */ +#define gwinSetColor(gh, clr) (gh)->color = (clr) + +/** + * @brief Set background color + * @details Set the color which will be used as background + * @note gwinClear() must be called to set the background color + * + * @param[in] gh The window + * @param[in] bgclr The background color + * + * @api + */ +#define gwinSetBgColor(gh, bgclr) (gh)->bgcolor = (bgclr) + +/** + * @brief Get the foreground color of a window + * + * @param[in] gh The window + * + * @api + */ +#define gwinGetColor(gh) (gh)->color + +/** + * @brief Get the background color of a window + * + * @param[in] gh The window + * + * @api + */ +#define gwinGetBgColor(gh) (gh)->bgcolor + +/** + * @brief Sets whether a window is visible or not + * + * @param[in] gh The window + * @param[in] visible Whether the window should be visible or not + * + * @note When a window is marked as not visible, drawing operations + * on the window do nothing. + * @note When a window is marked as visible, it is not automatically + * redrawn as many window types don't remember their drawing state. + * Widgets such as Buttons, Sliders etc will be redrawn. + * @note If there is no window manager in use, when a window is marked + * as not visible, nothing is done to remove the window from the screen. + * When there is a window manager, it is up to the window manager to + * handle what happens. + * @note Even when you mark a window as visible, it may still not be displayed + * if it's parent is invisible. When the parent becomes visible this child + * will automatically be shown because it is already marked as visible. + * + * @api + */ +void gwinSetVisible(GHandle gh, gBool visible); + +/** + * @brief Makes a widget become visible + * + * @param[in] gh The window handle + * + * @api + */ +#define gwinShow(gh) gwinSetVisible(gh, gTrue) + +/** + * @brief Makes a widget become invisible + * + * @param[in] gh The window handle + * + * @api + */ +#define gwinHide(gh) gwinSetVisible(gh, gFalse) + +/** + * @brief Gets the visibility of a window + * @return gTrue if visible + * + * @note It is possible for a child to be marked as visible by @p gwinSetVisible() + * but for this call to return gFalse if one of its parents are not visible. + * + * @param[in] gh The window + * + * @api + */ +gBool gwinGetVisible(GHandle gh); + +/** + * @brief Enable or disable a window + * + * @param[in] gh The window handle + * @param[in] enabled Enable or disable the window + * + * @note The window is automatically redrawn if it supports self-redrawing. + * @note Even when you mark a window as enabled, it may still remain disabled + * if it's parent is disabled. When the parent becomes enabled this child + * will automatically be enabled because it is already marked as enabled. + * + * @api + */ +void gwinSetEnabled(GHandle gh, gBool enabled); + +/** + * @brief Enables a widget + * + * @param[in] gh The window handle + * + * @api + */ +#define gwinEnable(gh) gwinSetEnabled(gh, gTrue) + +/** + * @brief Disables a widget + * + * @param[in] gh The window handle + * + * @api + */ +#define gwinDisable(gh) gwinSetEnabled(gh, gFalse) + +/** + * @brief Gets the enabled state of a window + * @return gTrue if enabled + * + * @note It is possible for a child to be marked as enabled by @p gwinSetEnabled() + * but for this call to return gFalse if one of its parents are not enabled. + * + * @param[in] gh The window + * + * @api + */ +gBool gwinGetEnabled(GHandle gh); + +/** + * @brief Move a window + * + * @param[in] gh The window + * @param[in] x, y The new position (screen relative) for this window + * + * @note The final window position may not be the requested position. Windows + * are clipped to the screen area and the window manager may also affect the position. + * @note The window is redrawn if it is visible. See the comments in @p gwinSetVisible() + * with regard to what can be redrawn and what can't. + * @note It is up to the window manager to determine what happens with the screen area + * uncovered by moving the window. When there is no window manager, nothing + * is done with the uncovered area. + * + * @api + */ +void gwinMove(GHandle gh, coord_t x, coord_t y); + +/** + * @brief Resize a window + * + * @param[in] gh The window + * @param[in] width, height The new size of the window + * + * @note The final window size may not be the requested size. Windows + * are clipped to the screen area and the window manager may also affect the size. + * @note The window is redrawn if it is visible. See the comments in @p gwinSetVisible() + * with regard to what can be redrawn and what can't. + * @note It is up to the window manager to determine what happens with any screen area + * uncovered by resizing the window. When there is no window manager, nothing + * is done with the uncovered area. + * + * @api + */ +void gwinResize(GHandle gh, coord_t width, coord_t height); + +/** + * @brief Redraw a window + * + * @param[in] gh The window + * + * @note This is normally never required as windows and widgets will redraw as required. + * Note that some windows are incapable of redrawing themselves as they don't save + * their drawing state. + * + * @api + */ +void gwinRedraw(GHandle gh); + +#if GWIN_NEED_WINDOWMANAGER || defined (__DOXYGEN__) /** - * @brief Create a basic window. - * @return NULL if there is no resultant drawing area, otherwise a window handle. + * @brief Redraw a display * - * @param[in] g The GDisplay to display this window on - * @param[in] pgw The window structure to initialize. If this is NULL the structure is dynamically allocated. - * @param[in] pInit How to initialise the window + * @param[in] g The display to redraw. Passing NULL will redraw all displays. + * @param[in] preserve Should the redraw try to preserve existing screen data for those + * windows that can't redraw themselves? * - * @note The drawing color and the background color get set to the current defaults. If you haven't called - * @p gwinSetDefaultColor() or @p gwinSetDefaultBgColor() then these are GFX_WHITE and GFX_BLACK respectively. - * @note The font gets set to the current default font. If you haven't called @p gwinSetDefaultFont() then there - * is no default font and text drawing operations will no nothing. - * @note A basic window does not save the drawing state. It is not automatically redrawn if the window is moved or - * its visibility state is changed. + * @note This is normally never required as windows and widgets will redraw as required. + * @note Some windows are incapable of redrawing themselves as they don't save + * their drawing state. + * @note This does not clear the background - just redraws the gwin windows (where possible) * * @api */ - GHandle gwinGWindowCreate(GDisplay *g, GWindowObject *pgw, const GWindowInit *pInit); - #define gwinWindowCreate(pgw, pInit) gwinGWindowCreate(GDISP, pgw, pInit); + void gwinRedrawDisplay(GDisplay *g, gBool preserve); /** - * @brief Destroy a window (of any type). Releases any dynamically allocated memory. + * @brief Minimize, Maximize or Restore a window + * @pre GWIN_NEED_WINDOWMANAGER must be GFXON + * + * @param[in] gh The window + * @param[in] minmax The new minimized/maximized state + * + * @note The final window state may not be the requested state. Window Managers + * do not need to implement changing the minmax state. If there is no + * window manager this call is ignored. + * @note The window is redrawn if it is changed. See the comments in @p gwinSetVisible() + * with regard to what can be redrawn and what can't. + * @note It is up to the window manager to determine what happens with any screen area + * uncovered by resizing the window. + * @note When a window is minimised it may be asked to draw the window or the window + * manager may draw the minimised window. + * + * @api + */ + void gwinSetMinMax(GHandle gh, GWindowMinMax minmax); + + /** + * @brief Get the Minimized/Maximized state of a window + * @pre GWIN_NEED_WINDOWMANAGER must be GFXON + * + * @param[in] gh The window + * + * @return GWIN_NORMAL, GWIN_MAXIMIZE or GWIN_MINIMIZE + * + * @api + */ + GWindowMinMax gwinGetMinMax(GHandle gh); + + /** + * @brief Raise a window to the top of the z-order + * @pre GWIN_NEED_WINDOWMANAGER must be GFXON + * + * @param[in] gh The window + * + * @note The window z-order is only supported by some window managers. See the comments + * in @p gwinSetVisible() with regard to what can be redrawn and what can't. + * + * @api + */ + void gwinRaise(GHandle gh); + + /** + * @brief Get the next window in the z-order + * @return The next window or NULL if no more windows + * + * @param[in] gh The previous window or NULL to get the first window + * + * @note This returns the next window in the system from top to bottom. + * @note Where there are parent child relationships, this ignores them + * and will list all windows in the system. There is no defined + * order between children of siblings and they can in fact be mixed + * in order. The only relationship honored is that parents will be + * listed before their children. + * + * @api + */ + GHandle gwinGetNextWindow(GHandle gh); + + /** + * @brief Set a window or widget to flash * * @param[in] gh The window handle - * - * @api - */ - void gwinDestroy(GHandle gh); - - /** - * @brief Get the real class name of the GHandle - * @details Returns a string describing the object class. - * - * @param[in] gh The window - * - * @return A string describing the object class. - * - * @api - */ - const char* gwinGetClassName(GHandle gh); - - /** - * @brief Get an ID that uniquely describes the class of the GHandle - * - * @param[in] gh The window - * - * @api - */ - #define gwinGetClassID(gh) ((void *)((gh)->vmt)) - - /** - * @brief Get the X coordinate of the window - * @details Returns the X coordinate of the origin of the window. - * The coordinate is relative to the physical screen zero point. - * - * @param[in] gh The window - * - * @api - */ - #define gwinGetScreenX(gh) ((gh)->x) - - /** - * @brief Get the Y coordinate of the window - * @details Returns the Y coordinate of the origin of the window. - * The coordinate is relative to the physical screen zero point. - * - * @param[in] gh The window - * - * @api - */ - #define gwinGetScreenY(gh) ((gh)->y) - - /** - * @brief Get the width of the window - * - * @param[in] gh The window - * - * @api - */ - #define gwinGetWidth(gh) ((gh)->width) - - /** - * @brief Get the height of the window - * - * @param[in] gh The window - * - * @api - */ - #define gwinGetHeight(gh) ((gh)->height) - - /** - * @brief Set foreground color - * @details Set the color which will be used to draw - * - * @param[in] gh The window - * @param[in] clr The color to be set - * - * @api - */ - #define gwinSetColor(gh, clr) (gh)->color = (clr) - - /** - * @brief Set background color - * @details Set the color which will be used as background - * @note gwinClear() must be called to set the background color - * - * @param[in] gh The window - * @param[in] bgclr The background color - * - * @api - */ - #define gwinSetBgColor(gh, bgclr) (gh)->bgcolor = (bgclr) - - /** - * @brief Get the foreground color of a window - * - * @param[in] gh The window - * - * @api - */ - #define gwinGetColor(gh) (gh)->color - - /** - * @brief Get the background color of a window - * - * @param[in] gh The window - * - * @api - */ - #define gwinGetBgColor(gh) (gh)->bgcolor - - /** - * @brief Sets whether a window is visible or not - * - * @param[in] gh The window - * @param[in] visible Whether the window should be visible or not - * - * @note When a window is marked as not visible, drawing operations - * on the window do nothing. - * @note When a window is marked as visible, it is not automatically - * redrawn as many window types don't remember their drawing state. - * Widgets such as Buttons, Sliders etc will be redrawn. - * @note If there is no window manager in use, when a window is marked - * as not visible, nothing is done to remove the window from the screen. - * When there is a window manager, it is up to the window manager to - * handle what happens. - * @note Even when you mark a window as visible, it may still not be displayed - * if it's parent is invisible. When the parent becomes visible this child - * will automatically be shown because it is already marked as visible. - * - * @api - */ - void gwinSetVisible(GHandle gh, bool_t visible); - - /** - * @brief Makes a widget become visible - * - * @param[in] gh The window handle - * - * @api - */ - #define gwinShow(gh) gwinSetVisible(gh, TRUE) - - /** - * @brief Makes a widget become invisible - * - * @param[in] gh The window handle - * - * @api - */ - #define gwinHide(gh) gwinSetVisible(gh, FALSE) - - /** - * @brief Gets the visibility of a window - * @return TRUE if visible - * - * @note It is possible for a child to be marked as visible by @p gwinSetVisible() - * but for this call to return FALSE if one of its parents are not visible. - * - * @param[in] gh The window - * - * @api - */ - bool_t gwinGetVisible(GHandle gh); - - /** - * @brief Enable or disable a window - * - * @param[in] gh The window handle - * @param[in] enabled Enable or disable the window + * @param[in] flash Enable or disable the flashing of the window * * @note The window is automatically redrawn if it supports self-redrawing. - * @note Even when you mark a window as enabled, it may still remain disabled - * if it's parent is disabled. When the parent becomes enabled this child - * will automatically be enabled because it is already marked as enabled. + * @note When a window is set to flash, its appearance changes in some + * way every flash period (GWIN_FLASHING_PERIOD). How its appearance + * changes depends on the draw for each window/widget. + * + * @pre Requires GWIN_NEED_FLASHING to be GFXON * * @api */ - void gwinSetEnabled(GHandle gh, bool_t enabled); + void gwinSetFlashing(GHandle gh, gBool flash); /** - * @brief Enables a widget + * @brief Enables flashing of a window or widget * * @param[in] gh The window handle * * @api */ - #define gwinEnable(gh) gwinSetEnabled(gh, TRUE) + #define gwinFlash(gh) gwinSetFlashing(gh, gTrue) /** * @brief Disables a widget @@ -410,690 +583,509 @@ extern "C" { * * @api */ - #define gwinDisable(gh) gwinSetEnabled(gh, FALSE) + #define gwinNoFlash(gh) gwinSetFlashing(gh, gFalse) +#endif +#if GDISP_NEED_TEXT || defined(__DOXYGEN__) /** - * @brief Gets the enabled state of a window - * @return TRUE if enabled - * - * @note It is possible for a child to be marked as enabled by @p gwinSetEnabled() - * but for this call to return FALSE if one of its parents are not enabled. - * - * @param[in] gh The window - * - * @api - */ - bool_t gwinGetEnabled(GHandle gh); - - /** - * @brief Move a window - * - * @param[in] gh The window - * @param[in] x, y The new position (screen relative) for this window - * - * @note The final window position may not be the requested position. Windows - * are clipped to the screen area and the window manager may also affect the position. - * @note The window is redrawn if it is visible. See the comments in @p gwinSetVisible() - * with regard to what can be redrawn and what can't. - * @note It is up to the window manager to determine what happens with the screen area - * uncovered by moving the window. When there is no window manager, nothing - * is done with the uncovered area. - * - * @api - */ - void gwinMove(GHandle gh, coord_t x, coord_t y); - - /** - * @brief Resize a window - * - * @param[in] gh The window - * @param[in] width, height The new size of the window - * - * @note The final window size may not be the requested size. Windows - * are clipped to the screen area and the window manager may also affect the size. - * @note The window is redrawn if it is visible. See the comments in @p gwinSetVisible() - * with regard to what can be redrawn and what can't. - * @note It is up to the window manager to determine what happens with any screen area - * uncovered by resizing the window. When there is no window manager, nothing - * is done with the uncovered area. - * - * @api - */ - void gwinResize(GHandle gh, coord_t width, coord_t height); - - /** - * @brief Redraw a window - * - * @param[in] gh The window - * - * @note This is normally never required as windows and widgets will redraw as required. - * Note that some windows are incapable of redrawing themselves as they don't save - * their drawing state. - * - * @api - */ - void gwinRedraw(GHandle gh); - - #if GWIN_NEED_WINDOWMANAGER || defined (__DOXYGEN__) - /** - * @brief Redraw a display - * - * @param[in] g The display to redraw. Passing NULL will redraw all displays. - * @param[in] preserve Should the redraw try to preserve existing screen data for those - * windows that can't redraw themselves? - * - * @note This is normally never required as windows and widgets will redraw as required. - * @note Some windows are incapable of redrawing themselves as they don't save - * their drawing state. - * @note This does not clear the background - just redraws the gwin windows (where possible) - * - * @api - */ - void gwinRedrawDisplay(GDisplay *g, bool_t preserve); - - /** - * @brief Minimize, Maximize or Restore a window - * @pre GWIN_NEED_WINDOWMANAGER must be GFXON - * - * @param[in] gh The window - * @param[in] minmax The new minimized/maximized state - * - * @note The final window state may not be the requested state. Window Managers - * do not need to implement changing the minmax state. If there is no - * window manager this call is ignored. - * @note The window is redrawn if it is changed. See the comments in @p gwinSetVisible() - * with regard to what can be redrawn and what can't. - * @note It is up to the window manager to determine what happens with any screen area - * uncovered by resizing the window. - * @note When a window is minimised it may be asked to draw the window or the window - * manager may draw the minimised window. - * - * @api - */ - void gwinSetMinMax(GHandle gh, GWindowMinMax minmax); - - /** - * @brief Get the Minimized/Maximized state of a window - * @pre GWIN_NEED_WINDOWMANAGER must be GFXON - * - * @param[in] gh The window - * - * @return GWIN_NORMAL, GWIN_MAXIMIZE or GWIN_MINIMIZE - * - * @api - */ - GWindowMinMax gwinGetMinMax(GHandle gh); - - /** - * @brief Raise a window to the top of the z-order - * @pre GWIN_NEED_WINDOWMANAGER must be GFXON - * - * @param[in] gh The window - * - * @note The window z-order is only supported by some window managers. See the comments - * in @p gwinSetVisible() with regard to what can be redrawn and what can't. - * - * @api - */ - void gwinRaise(GHandle gh); - - /** - * @brief Get the next window in the z-order - * @return The next window or NULL if no more windows - * - * @param[in] gh The previous window or NULL to get the first window - * - * @note This returns the next window in the system from top to bottom. - * @note Where there are parent child relationships, this ignores them - * and will list all windows in the system. There is no defined - * order between children of siblings and they can in fact be mixed - * in order. The only relationship honored is that parents will be - * listed before their children. - * - * @api - */ - GHandle gwinGetNextWindow(GHandle gh); - - /** - * @brief Set a window or widget to flash - * - * @param[in] gh The window handle - * @param[in] flash Enable or disable the flashing of the window - * - * @note The window is automatically redrawn if it supports self-redrawing. - * @note When a window is set to flash, its appearance changes in some - * way every flash period (GWIN_FLASHING_PERIOD). How its appearance - * changes depends on the draw for each window/widget. - * - * @pre Requires GWIN_NEED_FLASHING to be GFXON - * - * @api - */ - void gwinSetFlashing(GHandle gh, bool_t flash); - - /** - * @brief Enables flashing of a window or widget - * - * @param[in] gh The window handle - * - * @api - */ - #define gwinFlash(gh) gwinSetFlashing(gh, TRUE) - - /** - * @brief Disables a widget - * - * @param[in] gh The window handle - * - * @api - */ - #define gwinNoFlash(gh) gwinSetFlashing(gh, FALSE) - #endif - - #if GDISP_NEED_TEXT || defined(__DOXYGEN__) - /** - * @brief Set the current font for this window. - * - * @param[in] gh The window handle - * @param[in] font The font to use for text functions - * - * @api - */ - void gwinSetFont(GHandle gh, font_t font); - #endif - -/*------------------------------------------------- - * Drawing functions - *-------------------------------------------------*/ - - /** - * @brief Clear the window - * @note Uses the current background color to clear the window + * @brief Set the current font for this window. * * @param[in] gh The window handle + * @param[in] font The font to use for text functions * * @api */ - void gwinClear(GHandle gh); - - /** - * @brief Set a pixel in the window - * @note Uses the current foreground color to set the pixel - * @note May leave GDISP clipping to this window's dimensions - * - * @param[in] gh The window handle - * @param[in] x,y The coordinates of the pixel - * - * @api - */ - void gwinDrawPixel(GHandle gh, coord_t x, coord_t y); - - /** - * @brief Draw a line in the window - * @note Uses the current foreground color to draw the line - * @note May leave GDISP clipping to this window's dimensions - * - * @param[in] gh The window handle - * @param[in] x0,y0 The start position - * @param[in] x1,y1 The end position - * - * @api - */ - void gwinDrawLine(GHandle gh, coord_t x0, coord_t y0, coord_t x1, coord_t y1); - - /** - * @brief Draw a box in the window - * @note Uses the current foreground color to draw the box - * @note May leave GDISP clipping to this window's dimensions - * - * @param[in] gh The window handle - * @param[in] x,y The start position - * @param[in] cx,cy The size of the box (outside dimensions) - * - * @api - */ - void gwinDrawBox(GHandle gh, coord_t x, coord_t y, coord_t cx, coord_t cy); - - /** - * @brief Fill an rectangular area in the window - * @note Uses the current foreground color to fill the box - * @note May leave GDISP clipping to this window's dimensions - * - * @param[in] gh The window handle - * @param[in] x,y The start position - * @param[in] cx,cy The size of the box (outside dimensions) - * - * @api - */ - void gwinFillArea(GHandle gh, coord_t x, coord_t y, coord_t cx, coord_t cy); - - /** - * @brief Fill an area in the window using the supplied bitmap. - * @details The bitmap is in the pixel format specified by the low level driver - * @note If GDISP_NEED_ASYNC is defined then the buffer must be static - * or at least retained until this call has finished the blit. You can - * tell when all graphics drawing is finished by @p gdispIsBusy() going FALSE. - * @note May leave GDISP clipping to this window's dimensions - * - * @param[in] gh The window handle - * @param[in] x, y The start filled area - * @param[in] cx, cy The width and height to be filled - * @param[in] srcx, srcy The bitmap position to start the fill from - * @param[in] srccx The width of a line in the bitmap. - * @param[in] buffer The pixels to use to fill the area. - * - * @api - */ - void gwinBlitArea(GHandle gh, coord_t x, coord_t y, coord_t cx, coord_t cy, coord_t srcx, coord_t srcy, coord_t srccx, const pixel_t *buffer); - -/*------------------------------------------------- - * Circle, ellipse, arc and arc-sectors functions - *-------------------------------------------------*/ - - #if GDISP_NEED_CIRCLE || defined(__DOXYGEN__) - /** - * @brief Draw a circle in the window. - * @note Uses the current foreground color to draw the circle - * @note May leave GDISP clipping to this window's dimensions - * - * @param[in] gh The window handle - * @param[in] x, y The center of the circle - * @param[in] radius The radius of the circle - * - * @api - */ - void gwinDrawCircle(GHandle gh, coord_t x, coord_t y, coord_t radius); - - /** - * @brief Draw a filled circle in the window. - * @note Uses the current foreground color to draw the filled circle - * @note May leave GDISP clipping to this window's dimensions - * - * @param[in] gh The window handle - * @param[in] x, y The center of the circle - * @param[in] radius The radius of the circle - * - * @api - */ - void gwinFillCircle(GHandle gh, coord_t x, coord_t y, coord_t radius); - #endif - - #if GDISP_NEED_DUALCIRCLE || defined(__DOXYGEN__) - /** - * @brief Draw two filled circles with the same centre in the window. - * @note Uses the current foreground color to draw the inner circle - * @note Uses the current background color to draw the outer circle - * @note May leave GDISP clipping to this window's dimensions - * @pre GDISP_NEED_DUALCIRCLE must be GFXON in your gfxconf.h - * - * @param[in] gh The window handle - * @param[in] x,y The center of the circle - * @param[in] radius1 The radius of the larger circle - * @param[in] radius2 The radius of the smaller circle - * - * @api - */ - void gwinFillDualCircle(GHandle gh, coord_t x, coord_t y, coord_t radius1, coord_t radius2); - #endif - - #if GDISP_NEED_ELLIPSE || defined(__DOXYGEN__) - /** - * @brief Draw an ellipse. - * @note Uses the current foreground color to draw the ellipse - * @note May leave GDISP clipping to this window's dimensions - * - * @param[in] gh The window handle - * @param[in] x,y The center of the ellipse - * @param[in] a,b The dimensions of the ellipse - * - * @api - */ - void gwinDrawEllipse(GHandle gh, coord_t x, coord_t y, coord_t a, coord_t b); - - /** - * @brief Draw an filled ellipse. - * @note Uses the current foreground color to draw the filled ellipse - * @note May leave GDISP clipping to this window's dimensions - * - * @param[in] gh The window handle - * @param[in] x,y The center of the ellipse - * @param[in] a,b The dimensions of the ellipse - * - * @api - */ - void gwinFillEllipse(GHandle gh, coord_t x, coord_t y, coord_t a, coord_t b); - #endif - - #if GDISP_NEED_ARC || defined(__DOXYGEN__) - /* - * @brief Draw an arc in the window. - * @note Uses the current foreground color to draw the arc - * @note May leave GDISP clipping to this window's dimensions - * - * @param[in] gh The window handle - * @param[in] x,y The center point - * @param[in] radius The radius of the arc - * @param[in] start The start angle (0 to 360) - * @param[in] end The end angle (0 to 360) - * - * @api - */ - void gwinDrawArc(GHandle gh, coord_t x, coord_t y, coord_t radius, coord_t startangle, coord_t endangle); - - /* - * @brief Draw a filled arc in the window. - * @note Uses the current foreground color to draw the filled arc - * @note May leave GDISP clipping to this window's dimensions - * - * @param[in] gh The window handle - * @param[in] x,y The center point - * @param[in] radius The radius of the arc - * @param[in] start The start angle (0 to 360) - * @param[in] end The end angle (0 to 360) - * - * @api - */ - void gwinFillArc(GHandle gh, coord_t x, coord_t y, coord_t radius, coord_t startangle, coord_t endangle); - - /* - * @brief Draw a thick arc in the window. - * @note Uses the current foreground color to draw the thick arc - * @note May leave GDISP clipping to this window's dimensions - * - * @param[in] gh The window handle - * @param[in] x,y The center point - * @param[in] startradius The inner radius of the thick arc - * @param[in] endradius The outer radius of the thick arc - * @param[in] startangle The start angle (0 to 360) - * @param[in] endangle The end angle (0 to 360) - * - * @api - */ - void gwinDrawThickArc(GHandle gh, coord_t x, coord_t y, coord_t startradius, coord_t endradius, coord_t startangle, coord_t endangle); - #endif - - #if GDISP_NEED_ARCSECTORS || defined(__DOXYGEN__) - /* - * @brief Draw a selection of 45 degree arcs of a circle in the window. - * @note Uses the current foreground color to draw the arc sector - * @note May leave GDISP clipping to this window's dimensions - * - * @param[in] gh The window handle - * @param[in] x,y The center of the circle - * @param[in] radius The radius of the circle - * @param[in] sectors Bits determine which sectors are drawn. - * Bits go anti-clockwise from the 0 degree mark (y = 0, x is positive), as follows: - * bit 0 - upper right right ----- - * bit 1 - upper upper right /2 1\ - * bit 2 - upper upper left /3 0\ - * bit 3 - upper left left \4 7/ - * bit 4 - lower left left \5 6/ - * bit 5 - lower lower left ----- - * bit 6 - lower lower right - * bit 7 - lower left left - * - * @api - */ - void gwinDrawArcSectors(GHandle gh, coord_t x, coord_t y, coord_t radius, uint8_t sectors); - - /* - * @brief Draw a filled selection of 45 degree arcs of a circle in the window. - * @note Uses the current foreground color to draw the arc sector - * @note May leave GDISP clipping to this window's dimensions - * - * @param[in] gh The window handle - * @param[in] x,y The center of the circle - * @param[in] radius The radius of the circle - * @param[in] sectors Bits determine which sectors are drawn. - * Bits go anti-clockwise from the 0 degree mark (y = 0, x is positive), as follows: - * bit 0 - upper right right ----- - * bit 1 - upper upper right /2 1\ - * bit 2 - upper upper left /3 0\ - * bit 3 - upper left left \4 7/ - * bit 4 - lower left left \5 6/ - * bit 5 - lower lower left ----- - * bit 6 - lower lower right - * bit 7 - lower left left - * - * @api - */ - void gwinFillArcSectors(GHandle gh, coord_t x, coord_t y, coord_t radius, uint8_t sectors); - #endif - -/*------------------------------------------------- - * Pixel read-back functions - *-------------------------------------------------*/ - - #if GDISP_NEED_PIXELREAD || defined(__DOXYGEN__) - /** - * @brief Get the color of a pixel in the window. - * @return The color of the pixel. - * @note May leave GDISP clipping to this window's dimensions - * - * @param[in] gh The window handle - * @param[in] x,y The position in the window - * - * @api - */ - color_t gwinGetPixelColor(GHandle gh, coord_t x, coord_t y); - #endif - -/*------------------------------------------------- - * Text functions - *-------------------------------------------------*/ - - #if GDISP_NEED_TEXT || defined(__DOXYGEN__) - /** - * @brief Draw a text character at the specified position in the window. - * @pre The font must have been set. - * @note Uses the current foreground color to draw the character - * @note May leave GDISP clipping to this window's dimensions - * - * @param[in] gh The window handle - * @param[in] x,y The position for the text - * @param[in] c The character to draw - * - * @api - */ - void gwinDrawChar(GHandle gh, coord_t x, coord_t y, char c); - - /** - * @brief Draw a text character with a filled background at the specified position in the window. - * @pre The font must have been set. - * @note Uses the current foreground color to draw the character and fills the background using the background drawing color - * @note May leave GDISP clipping to this window's dimensions - * - * @param[in] gh The window handle - * @param[in] x,y The position for the text - * @param[in] c The character to draw - * - * @api - */ - void gwinFillChar(GHandle gh, coord_t x, coord_t y, char c); - - /** - * @brief Draw a text string in the window - * @pre The font must have been set. - * @note Uses the current foreground color to draw the character - * @note May leave GDISP clipping to this window's dimensions - * - * @param[in] gh The window handle - * @param[in] x,y The position for the text - * @param[in] str The string to draw - * - * @api - */ - void gwinDrawString(GHandle gh, coord_t x, coord_t y, const char *str); - - /** - * @brief Draw a text string with a filled background in the window - * @pre The font must have been set. - * @note Uses the current foreground color to draw the character and fills the background using the background drawing color - * @note May leave GDISP clipping to this window's dimensions - * - * @param[in] gh The window handle - * @param[in] x,y The position for the text - * @param[in] str The string to draw - * - * @api - */ - void gwinFillString(GHandle gh, coord_t x, coord_t y, const char *str); - - /** - * @brief Draw a text string verticly centered within the specified box. - * @pre The font must have been set. - * @note Uses the current foreground color to draw the character. - * @note The specified box does not need to align with the window box - * @note May leave GDISP clipping to this window's dimensions - * - * @param[in] gh The window handle - * @param[in] x,y The position for the text (need to define top-right or base-line - check code) - * @param[in] cx,cy The width and height of the box - * @param[in] str The string to draw - * @param[in] justify Justify the text left, center or right within the box - * - * @api - */ - void gwinDrawStringBox(GHandle gh, coord_t x, coord_t y, coord_t cx, coord_t cy, const char* str, justify_t justify); - - /** - * @brief Draw a text string verticly centered within the specified filled box. - * @pre The font must have been set. - * @note Uses the current foreground color to draw the character and fills the background using the background drawing color - * @note The entire box is filled. Note this box does not need to align with the window box - * @note May leave GDISP clipping to this window's dimensions - * - * @param[in] gh The window handle - * @param[in] x,y The position for the text (need to define top-right or base-line - check code) - * @param[in] cx,cy The width and height of the box - * @param[in] str The string to draw - * @param[in] justify Justify the text left, center or right within the box - * - * @api - */ - void gwinFillStringBox(GHandle gh, coord_t x, coord_t y, coord_t cx, coord_t cy, const char* str, justify_t justify); - #endif - -/*------------------------------------------------- - * Polygon functions - *-------------------------------------------------*/ - - #if GDISP_NEED_CONVEX_POLYGON || defined(__DOXYGEN__) - /** - * @brief Draw an enclosed polygon (convex, non-convex or complex). - * - * @note Uses the current foreground color. - * - * @param[in] gh The window handle - * @param[in] tx, ty Transform all points in pntarray by tx, ty - * @param[in] pntarray An array of points - * @param[in] cnt The number of points in the array - * - * @api - */ - void gwinDrawPoly(GHandle gh, coord_t tx, coord_t ty, const point *pntarray, unsigned cnt); - - /** - * @brief Fill a convex polygon - * @details Doesn't handle non-convex or complex polygons. - * - * @note Uses the current foreground color. - * - * @param[in] gh The window handle - * @param[in] tx, ty Transform all points in pntarray by tx, ty - * @param[in] pntarray An array of points - * @param[in] cnt The number of points in the array - * - * @note Convex polygons are those that have no internal angles. That is; - * you can draw a line from any point on the polygon to any other point - * on the polygon without it going outside the polygon. In our case we generalise - * this a little by saying that an infinite horizontal line (at any y value) will cross - * no more than two edges on the polygon. Some non-convex polygons do fit this criteria - * and can therefore be drawn. - * @note This routine is designed to be very efficient with even simple display hardware. - * - * @api - */ - void gwinFillConvexPoly(GHandle gh, coord_t tx, coord_t ty, const point *pntarray, unsigned cnt); - - /** - * @brief Draw a thick line in the window - * @details The line thickness is specified in pixels. The line ends can - * be selected to be either flat or round. - * @note Uses gdispGFillConvexPoly() internally to perform the drawing. - * @note Uses the current foreground color to draw the line - * - * @param[in] gh The window handle - * @param[in] x0,y0 The start position - * @param[in] x1,y1 The end position - * @param[in] width The width of the line - * @param[in] round Use round ends for the line - * - * @api - */ - void gwinDrawThickLine(GHandle gh, coord_t x0, coord_t y0, coord_t x1, coord_t y1, coord_t width, bool_t round); - #endif - -/*------------------------------------------------- - * Image functions - *-------------------------------------------------*/ - - #if GDISP_NEED_IMAGE || defined(__DOXYGEN__) - /** - * @brief Draw the image - * @return GDISP_IMAGE_ERR_OK (0) on success or an error code. - * - * @param[in] gh The window handle - * @param[in] img The image structure - * @param[in] x,y The window location to draw the image - * @param[in] cx,cy The area on the screen to draw - * @param[in] sx,sy The image position to start drawing at - * - * @pre gdispImageOpen() must have returned successfully. - * - * @note If sx,sy + cx,cy is outside the image boundaries the area outside the image - * is simply not drawn. - * @note If @p gdispImageCache() has been called first for this frame, this routine will draw using a - * fast blit from the cached frame. If not, it reads the input and decodes it as it - * is drawing. This may be significantly slower than if the image has been cached (but - * uses a lot less RAM) - * - * @api - */ - gdispImageError gwinDrawImage(GHandle gh, gdispImage *img, coord_t x, coord_t y, coord_t cx, coord_t cy, coord_t sx, coord_t sy); - #endif - -#ifdef __cplusplus -} + void gwinSetFont(GHandle gh, font_t font); #endif /*------------------------------------------------- - * Additional functionality - *-------------------------------------------------*/ +* Drawing functions +*-------------------------------------------------*/ - /* Include widgets */ - #if GWIN_NEED_WIDGET || defined(__DOXYGEN__) - #include "gwin_widget.h" - #endif +/** + * @brief Clear the window + * @note Uses the current background color to clear the window + * + * @param[in] gh The window handle + * + * @api + */ +void gwinClear(GHandle gh); - /* Include containers */ - #if GWIN_NEED_CONTAINERS || defined(__DOXYGEN__) - #include "gwin_container.h" - #endif +/** + * @brief Set a pixel in the window + * @note Uses the current foreground color to set the pixel + * @note May leave GDISP clipping to this window's dimensions + * + * @param[in] gh The window handle + * @param[in] x,y The coordinates of the pixel + * + * @api + */ +void gwinDrawPixel(GHandle gh, coord_t x, coord_t y); - /* Include vanilla window objects */ - #if GWIN_NEED_CONSOLE || defined(__DOXYGEN__) - #include "gwin_console.h" - #endif - #if GWIN_NEED_GRAPH || defined(__DOXYGEN__) - #include "gwin_graph.h" - #endif - #if GWIN_NEED_IMAGE || defined(__DOXYGEN__) - #include "gwin_image.h" - #endif - #if GWIN_NEED_GL3D || defined(__DOXYGEN__) - #include "gwin_gl3d.h" - #endif +/** + * @brief Draw a line in the window + * @note Uses the current foreground color to draw the line + * @note May leave GDISP clipping to this window's dimensions + * + * @param[in] gh The window handle + * @param[in] x0,y0 The start position + * @param[in] x1,y1 The end position + * + * @api + */ +void gwinDrawLine(GHandle gh, coord_t x0, coord_t y0, coord_t x1, coord_t y1); + +/** + * @brief Draw a box in the window + * @note Uses the current foreground color to draw the box + * @note May leave GDISP clipping to this window's dimensions + * + * @param[in] gh The window handle + * @param[in] x,y The start position + * @param[in] cx,cy The size of the box (outside dimensions) + * + * @api + */ +void gwinDrawBox(GHandle gh, coord_t x, coord_t y, coord_t cx, coord_t cy); + +/** + * @brief Fill an rectangular area in the window + * @note Uses the current foreground color to fill the box + * @note May leave GDISP clipping to this window's dimensions + * + * @param[in] gh The window handle + * @param[in] x,y The start position + * @param[in] cx,cy The size of the box (outside dimensions) + * + * @api + */ +void gwinFillArea(GHandle gh, coord_t x, coord_t y, coord_t cx, coord_t cy); + +/** + * @brief Fill an area in the window using the supplied bitmap. + * @details The bitmap is in the pixel format specified by the low level driver + * @note If GDISP_NEED_ASYNC is defined then the buffer must be static + * or at least retained until this call has finished the blit. You can + * tell when all graphics drawing is finished by @p gdispIsBusy() going gFalse. + * @note May leave GDISP clipping to this window's dimensions + * + * @param[in] gh The window handle + * @param[in] x, y The start filled area + * @param[in] cx, cy The width and height to be filled + * @param[in] srcx, srcy The bitmap position to start the fill from + * @param[in] srccx The width of a line in the bitmap. + * @param[in] buffer The pixels to use to fill the area. + * + * @api + */ +void gwinBlitArea(GHandle gh, coord_t x, coord_t y, coord_t cx, coord_t cy, coord_t srcx, coord_t srcy, coord_t srccx, const pixel_t *buffer); + +/*------------------------------------------------- +* Circle, ellipse, arc and arc-sectors functions +*-------------------------------------------------*/ + +#if GDISP_NEED_CIRCLE || defined(__DOXYGEN__) + /** + * @brief Draw a circle in the window. + * @note Uses the current foreground color to draw the circle + * @note May leave GDISP clipping to this window's dimensions + * + * @param[in] gh The window handle + * @param[in] x, y The center of the circle + * @param[in] radius The radius of the circle + * + * @api + */ + void gwinDrawCircle(GHandle gh, coord_t x, coord_t y, coord_t radius); + + /** + * @brief Draw a filled circle in the window. + * @note Uses the current foreground color to draw the filled circle + * @note May leave GDISP clipping to this window's dimensions + * + * @param[in] gh The window handle + * @param[in] x, y The center of the circle + * @param[in] radius The radius of the circle + * + * @api + */ + void gwinFillCircle(GHandle gh, coord_t x, coord_t y, coord_t radius); +#endif + +#if GDISP_NEED_DUALCIRCLE || defined(__DOXYGEN__) + /** + * @brief Draw two filled circles with the same centre in the window. + * @note Uses the current foreground color to draw the inner circle + * @note Uses the current background color to draw the outer circle + * @note May leave GDISP clipping to this window's dimensions + * @pre GDISP_NEED_DUALCIRCLE must be GFXON in your gfxconf.h + * + * @param[in] gh The window handle + * @param[in] x,y The center of the circle + * @param[in] radius1 The radius of the larger circle + * @param[in] radius2 The radius of the smaller circle + * + * @api + */ + void gwinFillDualCircle(GHandle gh, coord_t x, coord_t y, coord_t radius1, coord_t radius2); +#endif + +#if GDISP_NEED_ELLIPSE || defined(__DOXYGEN__) + /** + * @brief Draw an ellipse. + * @note Uses the current foreground color to draw the ellipse + * @note May leave GDISP clipping to this window's dimensions + * + * @param[in] gh The window handle + * @param[in] x,y The center of the ellipse + * @param[in] a,b The dimensions of the ellipse + * + * @api + */ + void gwinDrawEllipse(GHandle gh, coord_t x, coord_t y, coord_t a, coord_t b); + + /** + * @brief Draw an filled ellipse. + * @note Uses the current foreground color to draw the filled ellipse + * @note May leave GDISP clipping to this window's dimensions + * + * @param[in] gh The window handle + * @param[in] x,y The center of the ellipse + * @param[in] a,b The dimensions of the ellipse + * + * @api + */ + void gwinFillEllipse(GHandle gh, coord_t x, coord_t y, coord_t a, coord_t b); +#endif + +#if GDISP_NEED_ARC || defined(__DOXYGEN__) + /* + * @brief Draw an arc in the window. + * @note Uses the current foreground color to draw the arc + * @note May leave GDISP clipping to this window's dimensions + * + * @param[in] gh The window handle + * @param[in] x,y The center point + * @param[in] radius The radius of the arc + * @param[in] start The start angle (0 to 360) + * @param[in] end The end angle (0 to 360) + * + * @api + */ + void gwinDrawArc(GHandle gh, coord_t x, coord_t y, coord_t radius, coord_t startangle, coord_t endangle); + + /* + * @brief Draw a filled arc in the window. + * @note Uses the current foreground color to draw the filled arc + * @note May leave GDISP clipping to this window's dimensions + * + * @param[in] gh The window handle + * @param[in] x,y The center point + * @param[in] radius The radius of the arc + * @param[in] start The start angle (0 to 360) + * @param[in] end The end angle (0 to 360) + * + * @api + */ + void gwinFillArc(GHandle gh, coord_t x, coord_t y, coord_t radius, coord_t startangle, coord_t endangle); + + /* + * @brief Draw a thick arc in the window. + * @note Uses the current foreground color to draw the thick arc + * @note May leave GDISP clipping to this window's dimensions + * + * @param[in] gh The window handle + * @param[in] x,y The center point + * @param[in] startradius The inner radius of the thick arc + * @param[in] endradius The outer radius of the thick arc + * @param[in] startangle The start angle (0 to 360) + * @param[in] endangle The end angle (0 to 360) + * + * @api + */ + void gwinDrawThickArc(GHandle gh, coord_t x, coord_t y, coord_t startradius, coord_t endradius, coord_t startangle, coord_t endangle); +#endif + +#if GDISP_NEED_ARCSECTORS || defined(__DOXYGEN__) + /* + * @brief Draw a selection of 45 degree arcs of a circle in the window. + * @note Uses the current foreground color to draw the arc sector + * @note May leave GDISP clipping to this window's dimensions + * + * @param[in] gh The window handle + * @param[in] x,y The center of the circle + * @param[in] radius The radius of the circle + * @param[in] sectors Bits determine which sectors are drawn. + * Bits go anti-clockwise from the 0 degree mark (y = 0, x is positive), as follows: + * bit 0 - upper right right ----- + * bit 1 - upper upper right /2 1\ + * bit 2 - upper upper left /3 0\ + * bit 3 - upper left left \4 7/ + * bit 4 - lower left left \5 6/ + * bit 5 - lower lower left ----- + * bit 6 - lower lower right + * bit 7 - lower left left + * + * @api + */ + void gwinDrawArcSectors(GHandle gh, coord_t x, coord_t y, coord_t radius, uint8_t sectors); + + /* + * @brief Draw a filled selection of 45 degree arcs of a circle in the window. + * @note Uses the current foreground color to draw the arc sector + * @note May leave GDISP clipping to this window's dimensions + * + * @param[in] gh The window handle + * @param[in] x,y The center of the circle + * @param[in] radius The radius of the circle + * @param[in] sectors Bits determine which sectors are drawn. + * Bits go anti-clockwise from the 0 degree mark (y = 0, x is positive), as follows: + * bit 0 - upper right right ----- + * bit 1 - upper upper right /2 1\ + * bit 2 - upper upper left /3 0\ + * bit 3 - upper left left \4 7/ + * bit 4 - lower left left \5 6/ + * bit 5 - lower lower left ----- + * bit 6 - lower lower right + * bit 7 - lower left left + * + * @api + */ + void gwinFillArcSectors(GHandle gh, coord_t x, coord_t y, coord_t radius, uint8_t sectors); +#endif + +/*------------------------------------------------- +* Pixel read-back functions +*-------------------------------------------------*/ + +#if GDISP_NEED_PIXELREAD || defined(__DOXYGEN__) + /** + * @brief Get the color of a pixel in the window. + * @return The color of the pixel. + * @note May leave GDISP clipping to this window's dimensions + * + * @param[in] gh The window handle + * @param[in] x,y The position in the window + * + * @api + */ + color_t gwinGetPixelColor(GHandle gh, coord_t x, coord_t y); +#endif + +/*------------------------------------------------- +* Text functions +*-------------------------------------------------*/ + +#if GDISP_NEED_TEXT || defined(__DOXYGEN__) + /** + * @brief Draw a text character at the specified position in the window. + * @pre The font must have been set. + * @note Uses the current foreground color to draw the character + * @note May leave GDISP clipping to this window's dimensions + * + * @param[in] gh The window handle + * @param[in] x,y The position for the text + * @param[in] c The character to draw + * + * @api + */ + void gwinDrawChar(GHandle gh, coord_t x, coord_t y, char c); + + /** + * @brief Draw a text character with a filled background at the specified position in the window. + * @pre The font must have been set. + * @note Uses the current foreground color to draw the character and fills the background using the background drawing color + * @note May leave GDISP clipping to this window's dimensions + * + * @param[in] gh The window handle + * @param[in] x,y The position for the text + * @param[in] c The character to draw + * + * @api + */ + void gwinFillChar(GHandle gh, coord_t x, coord_t y, char c); + + /** + * @brief Draw a text string in the window + * @pre The font must have been set. + * @note Uses the current foreground color to draw the character + * @note May leave GDISP clipping to this window's dimensions + * + * @param[in] gh The window handle + * @param[in] x,y The position for the text + * @param[in] str The string to draw + * + * @api + */ + void gwinDrawString(GHandle gh, coord_t x, coord_t y, const char *str); + + /** + * @brief Draw a text string with a filled background in the window + * @pre The font must have been set. + * @note Uses the current foreground color to draw the character and fills the background using the background drawing color + * @note May leave GDISP clipping to this window's dimensions + * + * @param[in] gh The window handle + * @param[in] x,y The position for the text + * @param[in] str The string to draw + * + * @api + */ + void gwinFillString(GHandle gh, coord_t x, coord_t y, const char *str); + + /** + * @brief Draw a text string verticly centered within the specified box. + * @pre The font must have been set. + * @note Uses the current foreground color to draw the character. + * @note The specified box does not need to align with the window box + * @note May leave GDISP clipping to this window's dimensions + * + * @param[in] gh The window handle + * @param[in] x,y The position for the text (need to define top-right or base-line - check code) + * @param[in] cx,cy The width and height of the box + * @param[in] str The string to draw + * @param[in] justify Justify the text left, center or right within the box + * + * @api + */ + void gwinDrawStringBox(GHandle gh, coord_t x, coord_t y, coord_t cx, coord_t cy, const char* str, justify_t justify); + + /** + * @brief Draw a text string verticly centered within the specified filled box. + * @pre The font must have been set. + * @note Uses the current foreground color to draw the character and fills the background using the background drawing color + * @note The entire box is filled. Note this box does not need to align with the window box + * @note May leave GDISP clipping to this window's dimensions + * + * @param[in] gh The window handle + * @param[in] x,y The position for the text (need to define top-right or base-line - check code) + * @param[in] cx,cy The width and height of the box + * @param[in] str The string to draw + * @param[in] justify Justify the text left, center or right within the box + * + * @api + */ + void gwinFillStringBox(GHandle gh, coord_t x, coord_t y, coord_t cx, coord_t cy, const char* str, justify_t justify); +#endif + +/*------------------------------------------------- +* Polygon functions +*-------------------------------------------------*/ + +#if GDISP_NEED_CONVEX_POLYGON || defined(__DOXYGEN__) + /** + * @brief Draw an enclosed polygon (convex, non-convex or complex). + * + * @note Uses the current foreground color. + * + * @param[in] gh The window handle + * @param[in] tx, ty Transform all points in pntarray by tx, ty + * @param[in] pntarray An array of points + * @param[in] cnt The number of points in the array + * + * @api + */ + void gwinDrawPoly(GHandle gh, coord_t tx, coord_t ty, const point *pntarray, unsigned cnt); + + /** + * @brief Fill a convex polygon + * @details Doesn't handle non-convex or complex polygons. + * + * @note Uses the current foreground color. + * + * @param[in] gh The window handle + * @param[in] tx, ty Transform all points in pntarray by tx, ty + * @param[in] pntarray An array of points + * @param[in] cnt The number of points in the array + * + * @note Convex polygons are those that have no internal angles. That is; + * you can draw a line from any point on the polygon to any other point + * on the polygon without it going outside the polygon. In our case we generalise + * this a little by saying that an infinite horizontal line (at any y value) will cross + * no more than two edges on the polygon. Some non-convex polygons do fit this criteria + * and can therefore be drawn. + * @note This routine is designed to be very efficient with even simple display hardware. + * + * @api + */ + void gwinFillConvexPoly(GHandle gh, coord_t tx, coord_t ty, const point *pntarray, unsigned cnt); + + /** + * @brief Draw a thick line in the window + * @details The line thickness is specified in pixels. The line ends can + * be selected to be either flat or round. + * @note Uses gdispGFillConvexPoly() internally to perform the drawing. + * @note Uses the current foreground color to draw the line + * + * @param[in] gh The window handle + * @param[in] x0,y0 The start position + * @param[in] x1,y1 The end position + * @param[in] width The width of the line + * @param[in] round Use round ends for the line + * + * @api + */ + void gwinDrawThickLine(GHandle gh, coord_t x0, coord_t y0, coord_t x1, coord_t y1, coord_t width, gBool round); +#endif + +/*------------------------------------------------- +* Image functions +*-------------------------------------------------*/ + +#if GDISP_NEED_IMAGE || defined(__DOXYGEN__) + /** + * @brief Draw the image + * @return GDISP_IMAGE_ERR_OK (0) on success or an error code. + * + * @param[in] gh The window handle + * @param[in] img The image structure + * @param[in] x,y The window location to draw the image + * @param[in] cx,cy The area on the screen to draw + * @param[in] sx,sy The image position to start drawing at + * + * @pre gdispImageOpen() must have returned successfully. + * + * @note If sx,sy + cx,cy is outside the image boundaries the area outside the image + * is simply not drawn. + * @note If @p gdispImageCache() has been called first for this frame, this routine will draw using a + * fast blit from the cached frame. If not, it reads the input and decodes it as it + * is drawing. This may be significantly slower than if the image has been cached (but + * uses a lot less RAM) + * + * @api + */ + gdispImageError gwinDrawImage(GHandle gh, gdispImage *img, coord_t x, coord_t y, coord_t cx, coord_t cy, coord_t sx, coord_t sy); +#endif + +/*------------------------------------------------- +* Additional functionality +*-------------------------------------------------*/ + +/* Include widgets */ +#if GWIN_NEED_WIDGET || defined(__DOXYGEN__) + #include "gwin_widget.h" +#endif + +/* Include containers */ +#if GWIN_NEED_CONTAINERS || defined(__DOXYGEN__) + #include "gwin_container.h" +#endif + +/* Include vanilla window objects */ +#if GWIN_NEED_CONSOLE || defined(__DOXYGEN__) + #include "gwin_console.h" +#endif +#if GWIN_NEED_GRAPH || defined(__DOXYGEN__) + #include "gwin_graph.h" +#endif +#if GWIN_NEED_IMAGE || defined(__DOXYGEN__) + #include "gwin_image.h" +#endif +#if GWIN_NEED_GL3D || defined(__DOXYGEN__) + #include "gwin_gl3d.h" +#endif #endif /* GFX_USE_GWIN */ diff --git a/src/gwin/gwin_button.c b/src/gwin/gwin_button.c index 8b3a2b6b..618c78b2 100644 --- a/src/gwin/gwin_button.c +++ b/src/gwin/gwin_button.c @@ -145,11 +145,11 @@ GHandle gwinGButtonCreate(GDisplay *g, GButtonObject *gw, const GWidgetInit *pIn return (GHandle)gw; } -bool_t gwinButtonIsPressed(GHandle gh) { +gBool gwinButtonIsPressed(GHandle gh) { if (gh->vmt != (gwinVMT *)&buttonVMT) - return FALSE; + return gFalse; - return (gh->flags & GBUTTON_FLG_PRESSED) ? TRUE : FALSE; + return (gh->flags & GBUTTON_FLG_PRESSED) ? gTrue : gFalse; } /*---------------------------------------------------------- diff --git a/src/gwin/gwin_button.h b/src/gwin/gwin_button.h index ba3bc354..ebbd88cb 100644 --- a/src/gwin/gwin_button.h +++ b/src/gwin/gwin_button.h @@ -58,10 +58,6 @@ typedef struct GButtonObject { #endif } GButtonObject; -#ifdef __cplusplus -extern "C" { -#endif - /** * @brief Create a button widget. * @return NULL if there is no resultant drawing area, otherwise a window handle. @@ -87,13 +83,13 @@ GHandle gwinGButtonCreate(GDisplay *g, GButtonObject *gb, const GWidgetInit *pIn /** * @brief Is the button current pressed - * @return TRUE if the button is pressed + * @return gTrue if the button is pressed * * @param[in] gh The window handle (must be a button widget) * * @api */ -bool_t gwinButtonIsPressed(GHandle gh); +gBool gwinButtonIsPressed(GHandle gh); /** * @defgroup Renderings_Button Renderings @@ -222,10 +218,6 @@ void gwinButtonDraw_Normal(GWidgetObject *gw, void *param); #endif /** @} */ -#ifdef __cplusplus -} -#endif - #endif /* _GWIN_BUTTON_H */ /** @} */ diff --git a/src/gwin/gwin_checkbox.c b/src/gwin/gwin_checkbox.c index 1b3d395a..21d2ba86 100644 --- a/src/gwin/gwin_checkbox.c +++ b/src/gwin/gwin_checkbox.c @@ -33,7 +33,7 @@ static void SendCheckboxEvent(GWidgetObject *gw) { continue; pce->type = GEVENT_GWIN_CHECKBOX; pce->gwin = &gw->g; - pce->isChecked = (gw->g.flags & GCHECKBOX_FLG_CHECKED) ? TRUE : FALSE; + pce->isChecked = (gw->g.flags & GCHECKBOX_FLG_CHECKED) ? gTrue : gFalse; #if GWIN_WIDGET_TAGS pce->tag = gw->tag; #endif @@ -139,7 +139,7 @@ GHandle gwinGCheckboxCreate(GDisplay *g, GCheckboxObject *gb, const GWidgetInit return (GHandle)gb; } -void gwinCheckboxCheck(GHandle gh, bool_t isChecked) { +void gwinCheckboxCheck(GHandle gh, gBool isChecked) { if (gh->vmt != (gwinVMT *)&checkboxVMT) return; @@ -154,11 +154,11 @@ void gwinCheckboxCheck(GHandle gh, bool_t isChecked) { SendCheckboxEvent((GWidgetObject *)gh); } -bool_t gwinCheckboxIsChecked(GHandle gh) { +gBool gwinCheckboxIsChecked(GHandle gh) { if (gh->vmt != (gwinVMT *)&checkboxVMT) - return FALSE; + return gFalse; - return (gh->flags & GCHECKBOX_FLG_CHECKED) ? TRUE : FALSE; + return (gh->flags & GCHECKBOX_FLG_CHECKED) ? gTrue : gFalse; } /*---------------------------------------------------------- @@ -242,7 +242,7 @@ void gwinCheckboxDraw_CheckOnRight(GWidgetObject *gw, void *param) { #if GWIN_NEED_FLASHING // Flash the on and off state. - pcol = _gwinGetFlashedColor(gw, pcol, TRUE); + pcol = _gwinGetFlashedColor(gw, pcol, gTrue); #endif gdispGFillStringBox(gw->g.display, gw->g.x, gw->g.y, gw->g.width-1, gw->g.height-1, gw->text, gw->g.font, pcol->text, pcol->fill, justifyCenter); @@ -263,7 +263,7 @@ void gwinCheckboxDraw_CheckOnRight(GWidgetObject *gw, void *param) { #if GWIN_NEED_FLASHING // Flash the on and off state. - pcol = _gwinGetFlashedColor(gw, pcol, TRUE); + pcol = _gwinGetFlashedColor(gw, pcol, gTrue); #endif /* Fill the box blended from variants of the fill color */ diff --git a/src/gwin/gwin_checkbox.h b/src/gwin/gwin_checkbox.h index 2fba95c1..ebab833d 100644 --- a/src/gwin/gwin_checkbox.h +++ b/src/gwin/gwin_checkbox.h @@ -42,7 +42,7 @@ typedef struct GEventGWinCheckbox { #if GWIN_WIDGET_TAGS WidgetTag tag; // The checkbox tag #endif - bool_t isChecked; // Is the checkbox currently checked or unchecked? + gBool isChecked; // Is the checkbox currently checked or unchecked? } GEventGWinCheckbox; /** @@ -61,10 +61,6 @@ typedef struct GCheckboxObject { #endif } GCheckboxObject; -#ifdef __cplusplus -extern "C" { -#endif - /** * @brief Create a checkbox window. * @return NULL if there is no resultant drawing area, otherwise a window handle. @@ -92,21 +88,21 @@ GHandle gwinGCheckboxCreate(GDisplay *g, GCheckboxObject *gb, const GWidgetInit * @brief Set the state of a checkbox * * @param[in] gh The window handle (must be a checkbox window) - * @param[in] isChecked TRUE to set the check, FALSE to uncheck. + * @param[in] isChecked gTrue to set the check, gFalse to uncheck. * * @api */ -void gwinCheckboxCheck(GHandle gh, bool_t isChecked); +void gwinCheckboxCheck(GHandle gh, gBool isChecked); /** * @brief Get the state of a checkbox - * @return TRUE if the checkbox is currently checked + * @return gTrue if the checkbox is currently checked * * @param[in] gh The window handle (must be a checkbox window) * * @api */ -bool_t gwinCheckboxIsChecked(GHandle gh); +gBool gwinCheckboxIsChecked(GHandle gh); /** * @defgroup Renderings_Checkbox Renderings @@ -156,10 +152,6 @@ void gwinCheckboxDraw_CheckOnRight(GWidgetObject *gw, void *param); void gwinCheckboxDraw_Button(GWidgetObject *gw, void *param); /** @} */ -#ifdef __cplusplus -} -#endif - #endif /* _GWIN_CHECKBOX_H */ /** @} */ diff --git a/src/gwin/gwin_class.h b/src/gwin/gwin_class.h index 4b173e3c..c161c0f6 100644 --- a/src/gwin/gwin_class.h +++ b/src/gwin/gwin_class.h @@ -154,7 +154,7 @@ typedef struct gwinVMT { typedef struct gwmVMT { void (*Init) (void); /**< The window manager has just been set as the current window manager */ void (*DeInit) (void); /**< The window manager has just been removed as the current window manager */ - bool_t (*Add) (GHandle gh, const GWindowInit *pInit); /**< A window has been added */ + gBool (*Add) (GHandle gh, const GWindowInit *pInit); /**< A window has been added */ void (*Delete) (GHandle gh); /**< A window has been deleted */ void (*Redraw) (GHandle gh); /**< A window needs to be redraw (or undrawn) */ void (*Size) (GHandle gh, coord_t w, coord_t h); /**< A window wants to be resized */ @@ -168,14 +168,10 @@ typedef struct gwinVMT { * @brief The current window manager */ extern GWindowManager *_GWINwm; - extern bool_t _gwinFlashState; + extern gBool _gwinFlashState; #endif -#ifdef __cplusplus -extern "C" { -#endif - /** * @brief Initialise (and allocate if necessary) the base GWIN object * @@ -220,7 +216,7 @@ typedef enum GRedrawMethod { REDRAW_WAIT, REDRAW_NOWAIT, REDRAW_INSESSION } GRed * @note This call will attempt to flush any pending redraws * in the system. The doWait parameter tells this call * how to handle someone already holding the drawing lock. - * If doWait is TRUE it waits to obtain the lock. If FALSE + * If doWait is gTrue it waits to obtain the lock. If gFalse * and the drawing lock is free then the redraw is done * immediately. If the drawing lock was taken it will postpone the flush * on the basis that someone else will do it for us later. @@ -231,13 +227,13 @@ void _gwinFlushRedraws(GRedrawMethod how); /** * @brief Obtain a drawing session - * @return TRUE if the drawing session was obtained, FALSE if the window is not visible + * @return gTrue if the drawing session was obtained, gFalse if the window is not visible * * @param[in] gh The window * * @note This function blocks until a drawing session is available if the window is visible */ -bool_t _gwinDrawStart(GHandle gh); +gBool _gwinDrawStart(GHandle gh); /** * @brief Release a drawing session @@ -261,12 +257,12 @@ void _gwinDestroy(GHandle gh, GRedrawMethod how); /** * @brief Add a window to the window manager and set its position and size - * @return TRUE if successful + * @return gTrue if successful * * @param[in] gh The window * @param[in] pInit The window init structure */ -bool_t _gwinWMAdd(GHandle gh, const GWindowInit *pInit); +gBool _gwinWMAdd(GHandle gh, const GWindowInit *pInit); #if GWIN_NEED_WIDGET || defined(__DOXYGEN__) /** @@ -391,7 +387,7 @@ bool_t _gwinWMAdd(GHandle gh, const GWindowInit *pInit); * @param[in] flashOffState Whether the off-state should be flashed as well. If false, only the * pressed color set is flashed. */ - const GColorSet *_gwinGetFlashedColor(GWidgetObject *gw, const GColorSet *pcol, bool_t flashOffState); + const GColorSet *_gwinGetFlashedColor(GWidgetObject *gw, const GColorSet *pcol, gBool flashOffState); #endif #else #define _gwinFixFocus(gh) @@ -446,10 +442,6 @@ bool_t _gwinWMAdd(GHandle gh, const GWindowInit *pInit); #endif -#ifdef __cplusplus -} -#endif - #endif /* GFX_USE_GWIN */ #endif /* _CLASS_GWIN_H */ diff --git a/src/gwin/gwin_console.c b/src/gwin/gwin_console.c index 2d99b153..7bd0780e 100644 --- a/src/gwin/gwin_console.c +++ b/src/gwin/gwin_console.c @@ -79,7 +79,7 @@ #if GWIN_CONSOLE_ESCSEQ // Convert escape sequences to attributes - static bool_t ESCtoAttr(char c, uint8_t *pattr) { + static gBool ESCtoAttr(char c, uint8_t *pattr) { uint8_t attr; attr = pattr[0]; @@ -105,12 +105,12 @@ attr &= ~ESC_BOLD; break; default: - return FALSE; + return gFalse; } if (attr == pattr[0]) - return FALSE; + return gFalse; pattr[0] = attr; - return TRUE; + return gTrue; } static color_t ESCPrintColor(GConsoleObject *gcw) { @@ -348,7 +348,7 @@ GHandle gwinGConsoleCreate(GDisplay *g, GConsoleObject *gc, const GWindowInit *p #if GWIN_CONSOLE_USE_HISTORY gc->buffer = 0; #if GWIN_CONSOLE_HISTORY_ATCREATE - gwinConsoleSetBuffer(&gc->g, TRUE); + gwinConsoleSetBuffer(&gc->g, gTrue); #endif #endif @@ -376,11 +376,11 @@ GHandle gwinGConsoleCreate(GDisplay *g, GConsoleObject *gc, const GWindowInit *p #endif #if GWIN_CONSOLE_USE_HISTORY - bool_t gwinConsoleSetBuffer(GHandle gh, bool_t onoff) { + gBool gwinConsoleSetBuffer(GHandle gh, gBool onoff) { #define gcw ((GConsoleObject *)gh) if (gh->vmt != &consoleVMT) - return FALSE; + return gFalse; // Do we want the buffer turned off? if (!onoff) { @@ -388,12 +388,12 @@ GHandle gwinGConsoleCreate(GDisplay *g, GConsoleObject *gc, const GWindowInit *p gfxFree(gcw->buffer); gcw->buffer = 0; } - return FALSE; + return gFalse; } // Is the buffer already on? if (gcw->buffer) - return TRUE; + return gTrue; // Get the number of characters that fit in the x direction #if GWIN_CONSOLE_HISTORY_AVERAGING @@ -408,12 +408,12 @@ GHandle gwinGConsoleCreate(GDisplay *g, GConsoleObject *gc, const GWindowInit *p // Allocate the buffer if (!(gcw->buffer = gfxAlloc(gcw->bufsize))) - return FALSE; + return gFalse; // All good! gh->flags &= ~GCONSOLE_FLG_OVERRUN; gcw->bufpos = 0; - return TRUE; + return gTrue; #undef gcw } @@ -676,7 +676,7 @@ void gwinPrintf(GHandle gh, const char *fmt, ...) { va_list ap; char *p, *s, c, filler; int i, precision, width; - bool_t is_long, left_align; + gBool is_long, left_align; long l; #if GWIN_CONSOLE_USE_FLOAT float f; @@ -689,7 +689,7 @@ void gwinPrintf(GHandle gh, const char *fmt, ...) { return; va_start(ap, fmt); - while (TRUE) { + while (gTrue) { c = *fmt++; if (c == 0) { va_end(ap); @@ -702,10 +702,10 @@ void gwinPrintf(GHandle gh, const char *fmt, ...) { p = tmpbuf; s = tmpbuf; - left_align = FALSE; + left_align = gFalse; if (*fmt == '-') { fmt++; - left_align = TRUE; + left_align = gTrue; } filler = ' '; if (*fmt == '0') { @@ -714,7 +714,7 @@ void gwinPrintf(GHandle gh, const char *fmt, ...) { } width = 0; - while (TRUE) { + while (gTrue) { c = *fmt++; if (c >= '0' && c <= '9') c -= '0'; @@ -726,7 +726,7 @@ void gwinPrintf(GHandle gh, const char *fmt, ...) { } precision = 0; if (c == '.') { - while (TRUE) { + while (gTrue) { c = *fmt++; if (c >= '0' && c <= '9') c -= '0'; @@ -739,7 +739,7 @@ void gwinPrintf(GHandle gh, const char *fmt, ...) { } /* Long modifier.*/ if (c == 'l' || c == 'L') { - is_long = TRUE; + is_long = gTrue; if (*fmt) c = *fmt++; } @@ -808,7 +808,7 @@ void gwinPrintf(GHandle gh, const char *fmt, ...) { i = (int)(p - s); if ((width -= i) < 0) width = 0; - if (left_align == FALSE) + if (!left_align) width = -width; if (width < 0) { if (*s == '-' && filler == '0') { diff --git a/src/gwin/gwin_console.h b/src/gwin/gwin_console.h index fcfca35e..208ab16b 100644 --- a/src/gwin/gwin_console.h +++ b/src/gwin/gwin_console.h @@ -54,10 +54,6 @@ typedef struct GConsoleObject { } GConsoleObject; -#ifdef __cplusplus -extern "C" { -#endif - /** * @brief Create a console window. * @details A console window allows text to be written. @@ -102,15 +98,15 @@ GHandle gwinGConsoleCreate(GDisplay *g, GConsoleObject *gc, const GWindowInit *p * @pre GWIN_CONSOLE_USE_HISTORY must be set to GFXON in your gfxconf.h * * @param[in] gh The window handle (must be a console window) - * @param[in] onoff If TRUE a buffer is allocated to maintain console text - * when the console is obscured or invisible. If FALSE, then + * @param[in] onoff If gTrue a buffer is allocated to maintain console text + * when the console is obscured or invisible. If gFalse, then * any existing buffer is deallocated. * @note When the history buffer is turned on, scrolling is implemented using the * history buffer. * - * @return TRUE if the history buffer is now turned on. + * @return gTrue if the history buffer is now turned on. */ - bool_t gwinConsoleSetBuffer(GHandle gh, bool_t onoff); + gBool gwinConsoleSetBuffer(GHandle gh, gBool onoff); #endif /** @@ -172,9 +168,5 @@ void gwinPutCharArray(GHandle gh, const char *str, size_t n); */ void gwinPrintf(GHandle gh, const char *fmt, ...); -#ifdef __cplusplus -} -#endif - #endif /* _GWIN_CONSOLE_H */ /** @} */ diff --git a/src/gwin/gwin_container.h b/src/gwin/gwin_container.h index 9020c73e..a4a3afa2 100644 --- a/src/gwin/gwin_container.h +++ b/src/gwin/gwin_container.h @@ -46,10 +46,6 @@ typedef GWidgetObject GContainerObject; * won't support it even with special flags. */ -#ifdef __cplusplus -extern "C" { -#endif - /** * @brief Get the first child window * @@ -182,10 +178,6 @@ void gwinContainerDraw_Transparent(GWidgetObject *gw, void *param); /** @} */ -#ifdef __cplusplus -} -#endif - /* Include extra container types */ #if GWIN_NEED_FRAME || defined(__DOXYGEN__) #include "gwin_frame.h" diff --git a/src/gwin/gwin_frame.h b/src/gwin/gwin_frame.h index 06488321..7d60773c 100644 --- a/src/gwin/gwin_frame.h +++ b/src/gwin/gwin_frame.h @@ -50,10 +50,6 @@ typedef GContainerObject GFrameObject; -#ifdef __cplusplus -extern "C" { -#endif - /** * @brief Create a frame widget * @@ -138,10 +134,6 @@ void gwinFrameDraw_Transparent(GWidgetObject *gw, void *param); #endif /* GDISP_NEED_IMAGE */ /** @} */ -#ifdef __cplusplus -} -#endif - #endif /* _GWIN_FRAME_H */ /** @} */ diff --git a/src/gwin/gwin_gl3d.c b/src/gwin/gwin_gl3d.c index c9db1a3b..4c3f0f7f 100644 --- a/src/gwin/gwin_gl3d.c +++ b/src/gwin/gwin_gl3d.c @@ -35,7 +35,7 @@ static const gwinVMT gl3dVMT = { 0, // The after-clear routine }; -static bool_t haveGLwindow = FALSE; +static gBool haveGLwindow = gFalse; GHandle gwinGGL3DCreate(GDisplay *g, GGL3DObject *gl, const GWindowInit *pInit) { ZBuffer * zb; @@ -71,7 +71,7 @@ GHandle gwinGGL3DCreate(GDisplay *g, GGL3DObject *gl, const GWindowInit *pInit) glViewport(0, 0, gl->g.width, gl->g.height); - haveGLwindow = TRUE; + haveGLwindow = gTrue; gwinSetVisible((GHandle)gl, pInit->show); return (GHandle)gl; } @@ -79,7 +79,7 @@ GHandle gwinGGL3DCreate(GDisplay *g, GGL3DObject *gl, const GWindowInit *pInit) static void gl3dDestroy(GWindowObject *gh) { (void) gh; glClose(); - haveGLwindow = FALSE; + haveGLwindow = gFalse; } static void gl3dRedraw(GWindowObject *gh) { diff --git a/src/gwin/gwin_gl3d.h b/src/gwin/gwin_gl3d.h index 5dbfa893..205e681c 100644 --- a/src/gwin/gwin_gl3d.h +++ b/src/gwin/gwin_gl3d.h @@ -38,10 +38,6 @@ typedef struct GGL3DObject { /* External declarations. */ /*===========================================================================*/ -#ifdef __cplusplus -extern "C" { -#endif - /** * @brief Create a gl3d window. * @return NULL if there is no resultant drawing area, otherwise a window handle. @@ -64,10 +60,6 @@ GHandle gwinGGL3DCreate(GDisplay *g, GGL3DObject *gg, const GWindowInit *pInit); /* Include the gl interface */ #include "../../3rdparty/tinygl-0.4-ugfx/include/GL/gl.h" -#ifdef __cplusplus -} -#endif - #endif /* _GWIN_GL3D_H */ /** @} */ diff --git a/src/gwin/gwin_graph.h b/src/gwin/gwin_graph.h index 76059a6f..7c893d5b 100644 --- a/src/gwin/gwin_graph.h +++ b/src/gwin/gwin_graph.h @@ -85,10 +85,6 @@ typedef struct GGraphObject { /* External declarations. */ /*===========================================================================*/ -#ifdef __cplusplus -extern "C" { -#endif - /** * @brief Create a graph window. * @return NULL if there is no resultant drawing area, otherwise a window handle. @@ -180,10 +176,6 @@ void gwinGraphDrawPoint(GHandle gh, coord_t x, coord_t y); */ void gwinGraphDrawPoints(GHandle gh, const point *points, unsigned count); -#ifdef __cplusplus -} -#endif - #endif /* _GWIN_GRAPH_H */ /** @} */ diff --git a/src/gwin/gwin_image.c b/src/gwin/gwin_image.c index 855eecc9..a4cc5028 100644 --- a/src/gwin/gwin_image.c +++ b/src/gwin/gwin_image.c @@ -108,7 +108,7 @@ static void ImageRedraw(GHandle gh) { // Fall through default: // Start the timer to draw the next frame of the animation - gtimerStart(&gw->timer, ImageTimer, (void*)gh, FALSE, delay); + gtimerStart(&gw->timer, ImageTimer, (void*)gh, gFalse, delay); break; } #endif @@ -139,20 +139,20 @@ GHandle gwinGImageCreate(GDisplay *g, GImageObject *gobj, GWindowInit *pInit) { return (GHandle)gobj; } -bool_t gwinImageOpenGFile(GHandle gh, GFILE *f) { +gBool gwinImageOpenGFile(GHandle gh, GFILE *f) { // is it a valid handle? if (gh->vmt != (gwinVMT *)&imageVMT) - return FALSE; + return gFalse; if (gdispImageIsOpen(&gw->image)) gdispImageClose(&gw->image); if ((gdispImageOpenGFile(&gw->image, f) & GDISP_IMAGE_ERR_UNRECOVERABLE)) - return FALSE; + return gFalse; _gwinUpdate(gh); - return TRUE; + return gTrue; } gdispImageError gwinImageCache(GHandle gh) { diff --git a/src/gwin/gwin_image.h b/src/gwin/gwin_image.h index b45629ee..2cf00761 100644 --- a/src/gwin/gwin_image.h +++ b/src/gwin/gwin_image.h @@ -40,10 +40,6 @@ typedef struct GImageObject { #endif } GImageObject; -#ifdef __cplusplus -extern "C" { -#endif - /** * @brief Create an image widget. * @details Display's a picture. @@ -63,18 +59,18 @@ GHandle gwinGImageCreate(GDisplay *g, GImageObject *widget, GWindowInit *pInit); /** * @brief Opens the image using a GFILE - * @return TRUE if the image can be opened + * @return gTrue if the image can be opened * * @param[in] gh The widget (must be an image widget) * @param[in] f The open (for reading) GFILE to use * * @api */ -bool_t gwinImageOpenGFile(GHandle gh, GFILE *f); +gBool gwinImageOpenGFile(GHandle gh, GFILE *f); /** * @brief Opens the image using the specified filename - * @return TRUE if the open succeeds + * @return gTrue if the open succeeds * * @param[in] gh The widget (must be an image widget) * @param[in] filename The filename to open @@ -87,7 +83,7 @@ bool_t gwinImageOpenGFile(GHandle gh, GFILE *f); * @brief Sets the input routines that support reading the image from memory * in RAM or flash. * @pre GFILE_NEED_MEMFS must be GFXON - * @return TRUE if the IO open function succeeds + * @return gTrue if the IO open function succeeds * * @param[in] gh The widget (must be an image widget) * @param[in] ptr A pointer to the image in RAM or Flash @@ -98,7 +94,7 @@ bool_t gwinImageOpenGFile(GHandle gh, GFILE *f); /** * @brief Sets the input routines that support reading the image from a BaseFileStream (eg. an SD-Card). - * @return TRUE if the IO open function succeeds + * @return gTrue if the IO open function succeeds * @pre GFILE_NEED_CHIBIOSFS and GFX_USE_OS_CHIBIOS must be GFXON * * @param[in] gh The widget (must be an image widget) @@ -120,10 +116,6 @@ bool_t gwinImageOpenGFile(GHandle gh, GFILE *f); */ gdispImageError gwinImageCache(GHandle gh); -#ifdef __cplusplus -} -#endif - #endif // _GWIN_IMAGE_H /** @} */ diff --git a/src/gwin/gwin_keyboard.h b/src/gwin/gwin_keyboard.h index f98d6570..0f4185ab 100644 --- a/src/gwin/gwin_keyboard.h +++ b/src/gwin/gwin_keyboard.h @@ -64,10 +64,6 @@ typedef struct GKeyboardObject { uint32_t key; } GKeyboardObject; -#ifdef __cplusplus -extern "C" { -#endif - /** * @brief Create a keyboard widget. * @return NULL if there is no resultant drawing area, otherwise a window handle. @@ -138,9 +134,5 @@ void gwinKeyboardDraw_Normal(GWidgetObject *gw, void *param); /** @} */ -#ifdef __cplusplus -} -#endif - #endif /* _GWIN_KEYBOARD_H */ /** @} */ diff --git a/src/gwin/gwin_label.c b/src/gwin/gwin_label.c index e6e31eec..b522768a 100644 --- a/src/gwin/gwin_label.c +++ b/src/gwin/gwin_label.c @@ -105,7 +105,7 @@ GHandle gwinGLabelCreate(GDisplay *g, GLabelObject *widget, GWidgetInit *pInit) return (GHandle)widget; } -void gwinLabelSetBorder(GHandle gh, bool_t border) { +void gwinLabelSetBorder(GHandle gh, gBool border) { // is it a valid handle? if (gh->vmt != (gwinVMT *)&labelVMT) return; diff --git a/src/gwin/gwin_label.h b/src/gwin/gwin_label.h index 66c4d97d..77bf5364 100644 --- a/src/gwin/gwin_label.h +++ b/src/gwin/gwin_label.h @@ -53,10 +53,6 @@ typedef struct GLabelObject { #endif } GLabelObject; -#ifdef __cplusplus -extern "C" { -#endif - /** * @brief Create a label widget. * @details A label widget is a simple window which has a static text. @@ -80,7 +76,7 @@ GHandle gwinGLabelCreate(GDisplay *g, GLabelObject *widget, GWidgetInit *pInit); * * @api */ -void gwinLabelSetBorder(GHandle gh, bool_t border); +void gwinLabelSetBorder(GHandle gh, gBool border); #if GWIN_LABEL_ATTRIBUTE || defined(__DOXYGEN__) /** @@ -159,9 +155,5 @@ void gwinLabelDrawJustifiedCenter(GWidgetObject *gw, void *param); /** @} */ -#ifdef __cplusplus -} -#endif - #endif // _GWIN_LABEL_H /** @} */ diff --git a/src/gwin/gwin_list.c b/src/gwin/gwin_list.c index 5866603c..a14da805 100644 --- a/src/gwin/gwin_list.c +++ b/src/gwin/gwin_list.c @@ -297,7 +297,7 @@ static const gwidgetVMT listVMT = { #endif }; -GHandle gwinGListCreate(GDisplay *g, GListObject* gobj, GWidgetInit* pInit, bool_t multiselect) { +GHandle gwinGListCreate(GDisplay *g, GListObject* gobj, GWidgetInit* pInit, gBool multiselect) { if (!(gobj = (GListObject *)_gwidgetCreate(g, &gobj->w, pInit, &listVMT))) return 0; @@ -315,7 +315,7 @@ GHandle gwinGListCreate(GDisplay *g, GListObject* gobj, GWidgetInit* pInit, bool return (GHandle)gobj; } -void gwinListEnableRender(GHandle gh, bool_t ena) { +void gwinListEnableRender(GHandle gh, gBool ena) { // is it a valid handle? if (gh->vmt != (gwinVMT *)&listVMT) return; @@ -348,7 +348,7 @@ void gwinListSetScroll(GHandle gh, scroll_t flag) { } } -int gwinListAddItem(GHandle gh, const char* text, bool_t useAlloc) { +int gwinListAddItem(GHandle gh, const char* text, gBool useAlloc) { ListItem *newItem; // is it a valid handle? @@ -391,7 +391,7 @@ int gwinListAddItem(GHandle gh, const char* text, bool_t useAlloc) { return gh2obj->cnt-1; } -void gwinListItemSetText(GHandle gh, int item, const char* text, bool_t useAlloc) { +void gwinListItemSetText(GHandle gh, int item, const char* text, gBool useAlloc) { const gfxQueueASyncItem *qi; int i; ListItem *newItem; @@ -578,23 +578,23 @@ uint16_t gwinListItemGetParam(GHandle gh, int item) { return 0; } -bool_t gwinListItemIsSelected(GHandle gh, int item) { +gBool gwinListItemIsSelected(GHandle gh, int item) { const gfxQueueASyncItem * qi; int i; // is it a valid handle? if (gh->vmt != (gwinVMT *)&listVMT) - return FALSE; + return gFalse; // watch out for an invalid item if (item < 0 || item > (gh2obj->cnt) - 1) - return FALSE; + return gFalse; for(qi = gfxQueueASyncPeek(&gh2obj->list_head), i = 0; qi; qi = gfxQueueASyncNext(qi), i++) { if (i == item) - return (qi2li->flags & GLIST_FLG_SELECTED) ? TRUE : FALSE; + return (qi2li->flags & GLIST_FLG_SELECTED) ? gTrue : gFalse; } - return FALSE; + return gFalse; } int gwinListItemCount(GHandle gh) { @@ -617,7 +617,7 @@ const char* gwinListGetSelectedText(GHandle gh) { return gwinListItemGetText(gh, gwinListGetSelected(gh)); } -void gwinListSetSelected(GHandle gh, int item, bool_t doSelect) { +void gwinListSetSelected(GHandle gh, int item, gBool doSelect) { const gfxQueueASyncItem * qi; int i; diff --git a/src/gwin/gwin_list.h b/src/gwin/gwin_list.h index 041bbb68..9bd7075d 100644 --- a/src/gwin/gwin_list.h +++ b/src/gwin/gwin_list.h @@ -104,11 +104,6 @@ typedef struct ListItem { #endif } ListItem; - -#ifdef __cplusplus -extern "C" { -#endif - /** * @brief Create a list widget * @@ -127,13 +122,13 @@ extern "C" { * @param[in] g The GDisplay to display this window on * @param[in] widget The GListObject structure to initialize. If this is NULL, the structure is dynamically allocated. * @param[in] pInit The initialization parameters to use - * @param[in] multiselect If TRUE the list is multi-select instead of single-select. + * @param[in] multiselect If gTrue the list is multi-select instead of single-select. * * @return NULL if there is no resulting drawing area, otherwise a window handle. * * @api */ -GHandle gwinGListCreate(GDisplay *g, GListObject *widget, GWidgetInit *pInit, bool_t multiselect); +GHandle gwinGListCreate(GDisplay *g, GListObject *widget, GWidgetInit *pInit, gBool multiselect); #define gwinListCreate(w, pInit, m) gwinGListCreate(GDISP, w, pInit, m) /** @@ -144,11 +139,11 @@ GHandle gwinGListCreate(GDisplay *g, GListObject *widget, GWidgetInit *pInit, bo * by temporarely disabling the render using this function. * * @param[in] gh The widget handle (must be a list handle) - * @param[in] ena TRUE or FALSE + * @param[in] ena gTrue or gFalse * * @api */ -void gwinListEnableRender(GHandle gh, bool_t ena); +void gwinListEnableRender(GHandle gh, gBool ena); /** * @brief Change the behaviour of the scroll bar @@ -170,13 +165,13 @@ void gwinListSetScroll(GHandle gh, scroll_t flag); * * @param[in] gh The widget handle (must be a list handle) * @param[in] text The string which shall be displayed in the list afterwards - * @param[in] useAlloc If set to TRUE, the string will be dynamically allocated. A static buffer must be passed otherwise + * @param[in] useAlloc If set to gTrue, the string will be dynamically allocated. A static buffer must be passed otherwise * * @return The current ID of the item. The ID might change if you remove items from the middle of the list * * @api */ -int gwinListAddItem(GHandle gh, const char* text, bool_t useAlloc); +int gwinListAddItem(GHandle gh, const char* text, gBool useAlloc); /** * @brief Set the custom parameter of an item with a given ID @@ -184,11 +179,11 @@ int gwinListAddItem(GHandle gh, const char* text, bool_t useAlloc); * @param[in] gh The widget handle (must be a list handle) * @param[in] item The item ID * @param[in] text The text to replace the existing text - * @param[in] useAlloc If set to TRUE, the string will be dynamically allocated. A static buffer must be passed otherwise + * @param[in] useAlloc If set to gTrue, the string will be dynamically allocated. A static buffer must be passed otherwise * * @api */ -void gwinListItemSetText(GHandle gh, int item, const char* text, bool_t useAlloc); +void gwinListItemSetText(GHandle gh, int item, const char* text, gBool useAlloc); /** * @brief Get the name behind an item with a given ID @@ -273,11 +268,11 @@ int gwinListItemCount(GHandle gh); * @param[in] gh The widget handle (must be a list handle) * @param[in] item The item ID * - * @return TRUE if the item is selected, FALSE otherwise + * @return gTrue if the item is selected, gFalse otherwise * * @api */ -bool_t gwinListItemIsSelected(GHandle gh, int item); +gBool gwinListItemIsSelected(GHandle gh, int item); /** * @brief Get the ID of the selected item @@ -312,7 +307,7 @@ const char* gwinListGetSelectedText(GHandle gh); * * @param[in] gh The widget handle (must be a list handle) * @param[in] item The item ID - * @param[in] doSelect TRUE to select the item or FALSE to deselect the item + * @param[in] doSelect gTrue to select the item or gFalse to deselect the item * * @note Changing the selection using this api call will NOT send the list selection * change event. @@ -323,7 +318,7 @@ const char* gwinListGetSelectedText(GHandle gh); * are selected, even in single-select mode. * @api */ -void gwinListSetSelected(GHandle gh, int item, bool_t doSelect); +void gwinListSetSelected(GHandle gh, int item, gBool doSelect); /** * @brief Scroll the list so the specified item is in view @@ -396,10 +391,6 @@ void gwinListDefaultDraw(GWidgetObject* gw, void* param); /** @} */ -#ifdef __cplusplus -} -#endif - #endif // _GWIN_LIST_H /** @} */ diff --git a/src/gwin/gwin_progressbar.c b/src/gwin/gwin_progressbar.c index ce11934f..23d1b4c7 100644 --- a/src/gwin/gwin_progressbar.c +++ b/src/gwin/gwin_progressbar.c @@ -201,7 +201,7 @@ void gwinProgressbarDecrement(GHandle gh) { if (gh->vmt != (gwinVMT *)&progressbarVMT) return; - gtimerStart(&gsw->gt, _progressbarCallback, gh, TRUE, delay); + gtimerStart(&gsw->gt, _progressbarCallback, gh, gTrue, delay); #undef gsw } diff --git a/src/gwin/gwin_progressbar.h b/src/gwin/gwin_progressbar.h index 95feaf4a..aa4deb2d 100644 --- a/src/gwin/gwin_progressbar.h +++ b/src/gwin/gwin_progressbar.h @@ -36,10 +36,6 @@ typedef struct GProgressbarObject { #endif } GProgressbarObject; -#ifdef __cplusplus -extern "C" { -#endif - /** * @brief Create a progressbar window. * @return NULL if there is no resultant drawing area, otherwise a window handle. @@ -221,9 +217,5 @@ void gwinProgressbarDraw_Std(GWidgetObject *gw, void *param); #endif /* GDISP_NEED_IMAGE */ /** @} */ -#ifdef __cplusplus -} -#endif - #endif /* _GWIN_PROGRESSBAR_H */ /** @} */ diff --git a/src/gwin/gwin_radio.c b/src/gwin/gwin_radio.c index 8e0b4e64..d3747762 100644 --- a/src/gwin/gwin_radio.c +++ b/src/gwin/gwin_radio.c @@ -154,11 +154,11 @@ void gwinRadioPress(GHandle gh) { SendRadioEvent((GWidgetObject *)gh); } -bool_t gwinRadioIsPressed(GHandle gh) { +gBool gwinRadioIsPressed(GHandle gh) { if (gh->vmt != (gwinVMT *)&radioVMT) - return FALSE; + return gFalse; - return (gh->flags & GRADIO_FLG_PRESSED) ? TRUE : FALSE; + return (gh->flags & GRADIO_FLG_PRESSED) ? gTrue : gFalse; } GHandle gwinRadioGetActive(uint16_t group) { @@ -224,7 +224,7 @@ void gwinRadioDraw_Radio(GWidgetObject *gw, void *param) { #if GWIN_NEED_FLASHING // Flash only the on state. - pcol = _gwinGetFlashedColor(gw, pcol, FALSE); + pcol = _gwinGetFlashedColor(gw, pcol, gFalse); #endif gdispGFillStringBox(gw->g.display, gw->g.x, gw->g.y, gw->g.width-1, gw->g.height-1, gw->text, gw->g.font, pcol->text, pcol->fill, justifyCenter); @@ -243,7 +243,7 @@ void gwinRadioDraw_Radio(GWidgetObject *gw, void *param) { #if GWIN_NEED_FLASHING // Flash only the on state. - pcol = _gwinGetFlashedColor(gw, pcol, FALSE); + pcol = _gwinGetFlashedColor(gw, pcol, gFalse); #endif if ((gw->g.flags & GRADIO_FLG_PRESSED)) { diff --git a/src/gwin/gwin_radio.h b/src/gwin/gwin_radio.h index 514620c1..2328f95c 100644 --- a/src/gwin/gwin_radio.h +++ b/src/gwin/gwin_radio.h @@ -65,10 +65,6 @@ typedef struct GRadioObject { uint16_t group; } GRadioObject; -#ifdef __cplusplus -extern "C" { -#endif - /** * @brief Create a radio widget. * @return NULL if there is no resultant drawing area, otherwise a window handle. @@ -106,13 +102,13 @@ void gwinRadioPress(GHandle gh); /** * @brief Is the radio button currently pressed - * @return TRUE if the button is pressed + * @return gTrue if the button is pressed * * @param[in] gh The window handle (must be a radio widget) * * @api */ -bool_t gwinRadioIsPressed(GHandle gh); +gBool gwinRadioIsPressed(GHandle gh); /** * @brief Find the currently pressed radio button in the specified group @@ -177,9 +173,5 @@ void gwinRadioDraw_Button(GWidgetObject *gw, void *param); void gwinRadioDraw_Tab(GWidgetObject *gw, void *param); /** @} */ -#ifdef __cplusplus -} -#endif - #endif /* _GWIN_RADIO_H */ /** @} */ diff --git a/src/gwin/gwin_slider.c b/src/gwin/gwin_slider.c index d2e671b1..d3316bc2 100644 --- a/src/gwin/gwin_slider.c +++ b/src/gwin/gwin_slider.c @@ -326,7 +326,7 @@ void gwinSliderSetPosition(GHandle gh, int pos) { #undef gsw } -void gwinSliderSendExtendedEvents(GHandle gh, bool_t enabled) { +void gwinSliderSendExtendedEvents(GHandle gh, gBool enabled) { if (gh->vmt != (gwinVMT *)&sliderVMT) return; diff --git a/src/gwin/gwin_slider.h b/src/gwin/gwin_slider.h index c388417d..588a39e8 100644 --- a/src/gwin/gwin_slider.h +++ b/src/gwin/gwin_slider.h @@ -69,10 +69,6 @@ typedef struct GSliderObject { int pos; } GSliderObject; -#ifdef __cplusplus -extern "C" { -#endif - /** * @brief Create a slider window. * @return NULL if there is no resultant drawing area, otherwise a window handle. @@ -143,14 +139,14 @@ void gwinSliderSetPosition(GHandle gh, int pos); * @brief Should the slider send extended events. * * @param[in] gh The window handle (must be a slider window) - * @param[in] enabled TRUE to enable extended events, FALSE to disable them + * @param[in] enabled gTrue to enable extended events, gFalse to disable them * * @note The slider by default will only send slider events with an action of GSLIDER_EVENT_SET. * This call can be used to enable other slider action's to be sent as events * * @api */ -void gwinSliderSendExtendedEvents(GHandle gh, bool_t enabled); +void gwinSliderSendExtendedEvents(GHandle gh, gBool enabled); /** * @defgroup Renderings_Slider Renderings @@ -199,9 +195,5 @@ void gwinSliderDraw_Image(GWidgetObject *gw, void *param); #endif /* GDISP_NEED_IMAGE */ /** @} */ -#ifdef __cplusplus -} -#endif - #endif /* _GWIN_SLIDER_H */ /** @} */ diff --git a/src/gwin/gwin_tabset.c b/src/gwin/gwin_tabset.c index 0bb18c18..43718391 100644 --- a/src/gwin/gwin_tabset.c +++ b/src/gwin/gwin_tabset.c @@ -108,7 +108,7 @@ static const gcontainerVMT tabpageVMT = { 0, // A child has been deleted (optional) }; -void gwinTabsetSetTitle(GHandle gh, const char *title, bool_t useAlloc) { +void gwinTabsetSetTitle(GHandle gh, const char *title, gBool useAlloc) { if (gh->vmt != (gwinVMT *)&tabpageVMT) return; @@ -305,7 +305,7 @@ GHandle gwinGTabsetCreate(GDisplay *g, GTabsetObject *fo, GWidgetInit *pInit, ui // API calls /////////////////////////////////////////////////////////////////////////////////////////////////// -GHandle gwinTabsetAddTab(GHandle gh, const char *title, bool_t useAlloc) { +GHandle gwinTabsetAddTab(GHandle gh, const char *title, gBool useAlloc) { GWidgetInit wi; if (gh->vmt != (gwinVMT *)&tabsetVMT) diff --git a/src/gwin/gwin_tabset.h b/src/gwin/gwin_tabset.h index 90d9eb3b..8c07c7d2 100644 --- a/src/gwin/gwin_tabset.h +++ b/src/gwin/gwin_tabset.h @@ -60,10 +60,6 @@ typedef struct GTabsetObject { coord_t border_top; } GTabsetObject; -#ifdef __cplusplus -extern "C" { -#endif - /** * @brief Create a tabset widget * @@ -89,11 +85,11 @@ GHandle gwinGTabsetCreate(GDisplay *g, GTabsetObject *fo, GWidgetInit *pInit, ui * * @param[in] gh The tabset handle * @param[in] title The text to set. This must be a constant string unless useAlloc is set. - * @param[in] useAlloc If TRUE the string specified will be copied into dynamically allocated memory. + * @param[in] useAlloc If gTrue the string specified will be copied into dynamically allocated memory. * * @api */ -GHandle gwinTabsetAddTab(GHandle gh, const char *title, bool_t useAlloc); +GHandle gwinTabsetAddTab(GHandle gh, const char *title, gBool useAlloc); /** * @brief Delete a tab-page. @@ -144,14 +140,14 @@ GHandle gwinTabsetGetTabByTitle(GHandle gh, const char *title); * * @param[in] gh The tab-page handle (NB: Use the page handle NOT the tabset handle) * @param[in] title The text to set. This must be a constant string unless useAlloc is set. - * @param[in] useAlloc If TRUE the string specified will be copied into dynamically allocated memory. + * @param[in] useAlloc If gTrue the string specified will be copied into dynamically allocated memory. * * @note This function should be used to change the text associated with a tab-page * rather than @p gwinSetText(). * * @api */ -void gwinTabsetSetTitle(GHandle gh, const char *title, bool_t useAlloc); +void gwinTabsetSetTitle(GHandle gh, const char *title, gBool useAlloc); /** * @brief Get the title of a tab-page. @@ -232,10 +228,6 @@ void gwinTabsetDraw_Transparent(GWidgetObject *gw, void *param); #endif /* GDISP_NEED_IMAGE */ /** @} */ -#ifdef __cplusplus -} -#endif - #endif /* _GWIN_TABSET_H */ /** @} */ diff --git a/src/gwin/gwin_textedit.c b/src/gwin/gwin_textedit.c index 61c28c66..1cc168f1 100644 --- a/src/gwin/gwin_textedit.c +++ b/src/gwin/gwin_textedit.c @@ -53,7 +53,7 @@ static void TextEditRemoveChar(GHandle gh) { gh2obj->w.text = p; } -static bool_t TextEditAddChars(GHandle gh, unsigned cnt) { +static gBool TextEditAddChars(GHandle gh, unsigned cnt) { char *p; const char *q; unsigned sz; @@ -65,21 +65,21 @@ static bool_t TextEditAddChars(GHandle gh, unsigned cnt) { if (!(gh->flags & GWIN_FLG_ALLOCTXT)) { if (!(p = gfxAlloc(sz+cnt))) - return FALSE; + return gFalse; memcpy(p, gh2obj->w.text, pos); memcpy(p+pos+cnt, gh2obj->w.text+pos, sz-pos); gh->flags |= GWIN_FLG_ALLOCTXT; gh2obj->w.text = p; } else { if (!(p = gfxRealloc((char *)gh2obj->w.text, sz, sz+cnt))) - return FALSE; + return gFalse; gh2obj->w.text = p; q = p+pos; p += sz; while(--p >= q) p[cnt] = p[0]; } - return TRUE; + return gTrue; } // Function that allows to set the cursor to any position in the string diff --git a/src/gwin/gwin_textedit.h b/src/gwin/gwin_textedit.h index 0fdcc843..ea501caa 100644 --- a/src/gwin/gwin_textedit.h +++ b/src/gwin/gwin_textedit.h @@ -40,10 +40,6 @@ typedef struct GTexteditObject { uint16_t cursorPos; } GTexteditObject; -#ifdef __cplusplus -extern "C" { -#endif - /** * @brief Create a TextEdit widget * @details A TextEdit widget is a rectangular box which allows the user to input data through a keyboard. @@ -116,9 +112,5 @@ void gwinTexteditDefaultDraw(GWidgetObject* gw, void* param); /** @} */ -#ifdef __cplusplus -} -#endif - #endif // _GWIN_TEXTEDIT_H /** @} */ diff --git a/src/gwin/gwin_widget.c b/src/gwin/gwin_widget.c index 38b4e236..d4865935 100644 --- a/src/gwin/gwin_widget.c +++ b/src/gwin/gwin_widget.c @@ -238,12 +238,12 @@ static void gwidgetEvent(void *param, GEvent *pe) { return _widgetInFocus; } - bool_t gwinSetFocus(GHandle gh) { + gBool gwinSetFocus(GHandle gh) { GHandle oldFocus; // Do we already have the focus? if (gh == _widgetInFocus) - return TRUE; + return gTrue; // The new window must be NULLL or a visible enabled widget with a keyboard handler if (!gh || ((gh->flags & (GWIN_FLG_WIDGET|GWIN_FLG_ENABLED|GWIN_FLG_SYSENABLED|GWIN_FLG_VISIBLE|GWIN_FLG_SYSVISIBLE)) == (GWIN_FLG_WIDGET|GWIN_FLG_ENABLED|GWIN_FLG_SYSENABLED|GWIN_FLG_VISIBLE|GWIN_FLG_SYSVISIBLE) @@ -253,20 +253,20 @@ static void gwidgetEvent(void *param, GEvent *pe) { _widgetInFocus = gh; if (oldFocus) _gwinUpdate(oldFocus); if (gh) _gwinUpdate(gh); - return TRUE; + return gTrue; } - return FALSE; + return gFalse; } void _gwinMoveFocus(void) { GHandle gh; - bool_t looponce; + gBool looponce; // Find a new focus window (one may or may not exist). - looponce = FALSE; + looponce = gFalse; for(gh = gwinGetNextWindow(_widgetInFocus); ; gh = gwinGetNextWindow(gh)) { if (!gh && !looponce) { - looponce = TRUE; + looponce = gTrue; gh = gwinGetNextWindow(0); } if (gwinSetFocus(gh)) @@ -494,7 +494,7 @@ void gwinWidgetClearInit(GWidgetInit *pwi) { *p++ = 0; } -void gwinSetDefaultStyle(const GWidgetStyle *pstyle, bool_t updateAll) { +void gwinSetDefaultStyle(const GWidgetStyle *pstyle, gBool updateAll) { if (!pstyle) pstyle = &BlackWidgetStyle; @@ -521,7 +521,7 @@ const GWidgetStyle *gwinGetDefaultStyle(void) { return defaultStyle; } -void gwinSetText(GHandle gh, const char *text, bool_t useAlloc) { +void gwinSetText(GHandle gh, const char *text, gBool useAlloc) { if (!(gh->flags & GWIN_FLG_WIDGET)) return; @@ -595,12 +595,12 @@ const char *gwinGetText(GHandle gh) { return gw->text; } -bool_t gwinIsWidget(GHandle gh) { +gBool gwinIsWidget(GHandle gh) { if (gh->flags & GWIN_FLG_WIDGET) { - return TRUE; + return gTrue; } - return FALSE; + return gFalse; } void gwinSetStyle(GHandle gh, const GWidgetStyle *pstyle) { @@ -630,39 +630,39 @@ void gwinSetCustomDraw(GHandle gh, CustomWidgetDrawFunction fn, void *param) { _gwinUpdate(gh); } -bool_t gwinAttachListener(GListener *pl) { +gBool gwinAttachListener(GListener *pl) { return geventAttachSource(pl, GWIDGET_SOURCE, 0); } #if GFX_USE_GINPUT && GINPUT_NEED_MOUSE - bool_t DEPRECATED("This call can now be removed. Attaching the mouse to GWIN is now automatic.") gwinAttachMouse(uint16_t instance) { + gBool DEPRECATED("This call can now be removed. Attaching the mouse to GWIN is now automatic.") gwinAttachMouse(uint16_t instance) { // This is now a NULL event because we automatically attach to all mice in the system. (void) instance; - return TRUE; + return gTrue; } #endif #if GFX_USE_GINPUT && GINPUT_NEED_TOGGLE - bool_t gwinAttachToggle(GHandle gh, uint16_t role, uint16_t instance) { + gBool gwinAttachToggle(GHandle gh, uint16_t role, uint16_t instance) { GSourceHandle gsh; uint16_t oi; // Is this a widget if (!(gh->flags & GWIN_FLG_WIDGET)) - return FALSE; + return gFalse; // Is the role valid if (role >= wvmt->toggleroles) - return FALSE; + return gFalse; // Is this a valid device if (!(gsh = ginputGetToggle(instance))) - return FALSE; + return gFalse; // Is this already done? oi = wvmt->ToggleGet(gw, role); if (instance == oi) - return TRUE; + return gTrue; // Remove the old instance if (oi != GWIDGET_NO_INSTANCE) { @@ -676,16 +676,16 @@ bool_t gwinAttachListener(GListener *pl) { return geventAttachSource(&gl, gsh, GLISTEN_TOGGLE_ON|GLISTEN_TOGGLE_OFF); } - bool_t gwinDetachToggle(GHandle gh, uint16_t role) { + gBool gwinDetachToggle(GHandle gh, uint16_t role) { uint16_t oi; // Is this a widget if (!(gh->flags & GWIN_FLG_WIDGET)) - return FALSE; + return gFalse; // Is the role valid if (role >= ((gwidgetVMT *)gh->vmt)->toggleroles) - return FALSE; + return gFalse; oi = ((gwidgetVMT *)gh->vmt)->ToggleGet(gw, role); @@ -695,31 +695,31 @@ bool_t gwinAttachListener(GListener *pl) { if (!FindToggleUser(oi)) geventDetachSource(&gl, ginputGetToggle(oi)); } - return TRUE; + return gTrue; } #endif #if GFX_USE_GINPUT && GINPUT_NEED_DIAL - bool_t gwinAttachDial(GHandle gh, uint16_t role, uint16_t instance) { + gBool gwinAttachDial(GHandle gh, uint16_t role, uint16_t instance) { GSourceHandle gsh; uint16_t oi; if (!(gh->flags & GWIN_FLG_WIDGET)) - return FALSE; + return gFalse; // Is the role valid if (role >= wvmt->dialroles) - return FALSE; + return gFalse; // Is this a valid device if (!(gsh = ginputGetDial(instance))) - return FALSE; + return gFalse; // Is this already done? oi = wvmt->DialGet(gw, role); if (instance == oi) - return TRUE; + return gTrue; // Remove the old instance if (oi != GWIDGET_NO_INSTANCE) { diff --git a/src/gwin/gwin_widget.h b/src/gwin/gwin_widget.h index 58c71b16..c74eb877 100644 --- a/src/gwin/gwin_widget.h +++ b/src/gwin/gwin_widget.h @@ -90,7 +90,7 @@ typedef uint16_t WidgetTag; * to clear it. * @note The text element must be static string (not stack allocated). If you want to use * a dynamic string (eg a stack allocated string) use NULL for this member and then call - * @p gwinSetText() with useAlloc set to TRUE. + * @p gwinSetText() with useAlloc set to gTrue. * * @{ */ @@ -168,10 +168,6 @@ typedef struct GEventGWin { #define GEVENT_GWIN_CTRL_FIRST (GEVENT_GWIN_FIRST+0x40) /** @} */ -#ifdef __cplusplus -extern "C" { -#endif - /** * @brief Clear a GWidgetInit structure to all zero's * @note This function is provided just to prevent problems @@ -188,7 +184,7 @@ void gwinWidgetClearInit(GWidgetInit *pwi); * @brief Set the default style for widgets created hereafter. * * @param[in] pstyle The default style. Passing NULL uses the system compiled style. - * @param[in] updateAll If TRUE then all existing widgets that are using the current default style + * @param[in] updateAll If gTrue then all existing widgets that are using the current default style * will be updated to use this new style. Widgets that have custom styles different * from the default style will not be updated. * @@ -196,7 +192,7 @@ void gwinWidgetClearInit(GWidgetInit *pwi); * * @api */ -void gwinSetDefaultStyle(const GWidgetStyle *pstyle, bool_t updateAll); +void gwinSetDefaultStyle(const GWidgetStyle *pstyle, gBool updateAll); /** * @brief Get the current default style. @@ -212,14 +208,14 @@ const GWidgetStyle *gwinGetDefaultStyle(void); * * @param[in] gh The widget handle * @param[in] text The text to set. This must be a constant string unless useAlloc is set. - * @param[in] useAlloc If TRUE the string specified will be copied into dynamically allocated memory. + * @param[in] useAlloc If gTrue the string specified will be copied into dynamically allocated memory. * * @note The widget is automatically redrawn * @note Non-widgets will ignore this call. * * @api */ -void gwinSetText(GHandle gh, const char *text, bool_t useAlloc); +void gwinSetText(GHandle gh, const char *text, gBool useAlloc); /** * @brief Get the text of a widget. @@ -254,11 +250,11 @@ const char *gwinGetText(GHandle gh); * * @param[in] gh The handle to check. * - * @return TRUE if the passed handle is a widget handle. FALSE otherwise. + * @return gTrue if the passed handle is a widget handle. gFalse otherwise. * * @api */ -bool_t gwinIsWidget(GHandle gh); +gBool gwinIsWidget(GHandle gh); #if GWIN_WIDGET_TAGS || defined(__DOXYGEN__) /** @@ -328,22 +324,22 @@ void gwinSetCustomDraw(GHandle gh, CustomWidgetDrawFunction fn, void *param); /** * @brief Attach a Listener to listen for widget events - * @return TRUE on success + * @return gTrue on success * * @param[in] pl The listener * * @api */ -bool_t gwinAttachListener(GListener *pl); +gBool gwinAttachListener(GListener *pl); #if (GFX_USE_GINPUT && GINPUT_NEED_MOUSE) || defined(__DOXYGEN__) - bool_t DEPRECATED("This call can now be removed. Attaching the mouse to GWIN is now automatic.") gwinAttachMouse(uint16_t instance); + gBool DEPRECATED("This call can now be removed. Attaching the mouse to GWIN is now automatic.") gwinAttachMouse(uint16_t instance); #endif #if (GFX_USE_GINPUT && GINPUT_NEED_TOGGLE) || defined(__DOXYGEN__) /** * @brief Attach a toggle to a widget - * @return TRUE on success + * @return gTrue on success * * @param[in] gh The widget handle * @param[in] role The function the toggle will perform for the widget @@ -351,31 +347,31 @@ bool_t gwinAttachListener(GListener *pl); * * @note See the documentation on the specific widget to see the possible * values for the role parameter. If it is out of range, this function - * will return FALSE + * will return gFalse * * @api */ - bool_t gwinAttachToggle(GHandle gh, uint16_t role, uint16_t instance); + gBool gwinAttachToggle(GHandle gh, uint16_t role, uint16_t instance); /** * @brief Detach a toggle from a widget - * @return TRUE on success + * @return gTrue on success * * @param[in] gh The widget handle * @param[in] role The function the toggle will perform for the widget * * @note See the documentation on the specific widget to see the possible * values for the role parameter. If it is out of range, this function - * will return FALSE + * will return gFalse * * @api */ - bool_t gwinDetachToggle(GHandle gh, uint16_t role); + gBool gwinDetachToggle(GHandle gh, uint16_t role); #endif #if (GFX_USE_GINPUT && GINPUT_NEED_DIAL) || defined(__DOXYGEN__) /** * @brief Attach a toggle to a widget - * @return TRUE on success + * @return gTrue on success * * @param[in] gh The widget handle * @param[in] role The function the dial will perform for the widget @@ -383,17 +379,17 @@ bool_t gwinAttachListener(GListener *pl); * * @note See the documentation on the specific widget to see the possible * values for the role parameter. If it is out of range, this function - * will return FALSE + * will return gFalse * * @api */ - bool_t gwinAttachDial(GHandle gh, uint16_t role, uint16_t instance); + gBool gwinAttachDial(GHandle gh, uint16_t role, uint16_t instance); #endif #if (GFX_USE_GINPUT && GINPUT_NEED_KEYBOARD) || GWIN_NEED_KEYBOARD || defined(__DOXYGEN__) /** * @brief Set the keyboard focus to a specific window - * @return Returns TRUE if the focus could be set to that window + * @return Returns gTrue if the focus could be set to that window * * @param[in] gh The window * @@ -402,7 +398,7 @@ bool_t gwinAttachListener(GListener *pl); * * @api */ - bool_t gwinSetFocus(GHandle gh); + gBool gwinSetFocus(GHandle gh); /** * @brief Get the widget that is currently in focus @@ -417,11 +413,7 @@ bool_t gwinAttachListener(GListener *pl); GHandle gwinGetFocus(void); #else #define gwinGetFocus() (0) - #define gwinSetFocus(gh) (FALSE) -#endif - -#ifdef __cplusplus -} + #define gwinSetFocus(gh) (gFalse) #endif /* Include extra widget types */ diff --git a/src/gwin/gwin_wm.c b/src/gwin/gwin_wm.c index 7f251a70..6761180f 100644 --- a/src/gwin/gwin_wm.c +++ b/src/gwin/gwin_wm.c @@ -34,11 +34,11 @@ gfxMutexDestroy(&gmutex); } - bool_t _gwinWMAdd(GHandle gh, const GWindowInit *pInit) { + gBool _gwinWMAdd(GHandle gh, const GWindowInit *pInit) { gh->x = gh->y = gh->width = gh->height = 0; gwinMove(gh, pInit->x, pInit->y); gwinResize(gh, pInit->width, pInit->height); - return TRUE; + return gTrue; } void _gwinFlushRedraws(GRedrawMethod how) { @@ -83,12 +83,12 @@ gh->flags &= ~(GWIN_FLG_NEEDREDRAW|GWIN_FLG_BGREDRAW); } - bool_t _gwinDrawStart(GHandle gh) { + gBool _gwinDrawStart(GHandle gh) { if (!(gh->flags & GWIN_FLG_SYSVISIBLE)) - return FALSE; + return gFalse; getLock(gh); - return TRUE; + return gTrue; } void _gwinDrawEnd(GHandle gh) { @@ -96,7 +96,7 @@ exitLock(gh); } - void gwinSetVisible(GHandle gh, bool_t visible) { + void gwinSetVisible(GHandle gh, gBool visible) { if (visible) { if (!(gh->flags & GWIN_FLG_VISIBLE)) { gh->flags |= (GWIN_FLG_VISIBLE|GWIN_FLG_SYSVISIBLE|GWIN_FLG_BGREDRAW); @@ -111,7 +111,7 @@ } } - void gwinSetEnabled(GHandle gh, bool_t enabled) { + void gwinSetEnabled(GHandle gh, gBool enabled) { if (enabled) { if (!(gh->flags & GWIN_FLG_ENABLED)) { gh->flags |= (GWIN_FLG_ENABLED|GWIN_FLG_SYSENABLED); @@ -161,7 +161,7 @@ // The default window manager extern const GWindowManager GNullWindowManager; GWindowManager * _GWINwm; -bool_t _gwinFlashState; +gBool _gwinFlashState; static gfxSem gwinsem; static gfxQueueASync _GWINList; #if GWIN_NEED_FLASHING @@ -190,7 +190,7 @@ void _gwmInit(void) #endif #if !GWIN_REDRAW_IMMEDIATE gtimerInit(&RedrawTimer); - gtimerStart(&RedrawTimer, RedrawTimerFn, 0, TRUE, TIME_INFINITE); + gtimerStart(&RedrawTimer, RedrawTimerFn, 0, gTrue, TIME_INFINITE); #endif _GWINwm = (GWindowManager *)&GNullWindowManager; _GWINwm->vmt->Init(); @@ -366,11 +366,11 @@ void _gwinUpdate(GHandle gh) { } #endif -bool_t _gwinDrawStart(GHandle gh) { +gBool _gwinDrawStart(GHandle gh) { // This test should occur inside the lock. We do this // here as well as an early out (more efficient). if (!(gh->flags & GWIN_FLG_SYSVISIBLE)) - return FALSE; + return gFalse; // Obtain the drawing lock gfxSemWait(&gwinsem, TIME_INFINITE); @@ -378,14 +378,14 @@ bool_t _gwinDrawStart(GHandle gh) { // Re-test visibility as we may have waited a while if (!(gh->flags & GWIN_FLG_SYSVISIBLE)) { _gwinDrawEnd(gh); - return FALSE; + return gFalse; } // OK - we are ready to draw. #if GDISP_NEED_CLIP gdispGSetClip(gh->display, gh->x, gh->y, gh->width, gh->height); #endif - return TRUE; + return gTrue; } void _gwinDrawEnd(GHandle gh) { @@ -401,19 +401,19 @@ void _gwinDrawEnd(GHandle gh) { gfxSemSignal(&gwinsem); } -bool_t _gwinWMAdd(GHandle gh, const GWindowInit *pInit) { +gBool _gwinWMAdd(GHandle gh, const GWindowInit *pInit) { #if GWIN_NEED_CONTAINERS // Save the parent gh->parent = pInit->parent; // Ensure the display is consistent with any parents if (gh->parent && (!(gh->parent->flags & GWIN_FLG_CONTAINER) || gh->display != gh->parent->display)) - return FALSE; + return gFalse; #endif // Add to the window manager if (!_GWINwm->vmt->Add(gh, pInit)) - return FALSE; + return gFalse; #if GWIN_NEED_CONTAINERS // Notify the parent it has been added @@ -421,7 +421,7 @@ bool_t _gwinWMAdd(GHandle gh, const GWindowInit *pInit) { ((gcontainerVMT *)gh->parent->vmt)->NotifyAdd(gh->parent, gh); #endif - return TRUE; + return gTrue; } void gwinSetWindowManager(struct GWindowManager *gwm) { @@ -448,7 +448,7 @@ void gwinRedraw(GHandle gh) { } #if GWIN_NEED_CONTAINERS - void gwinSetVisible(GHandle gh, bool_t visible) { + void gwinSetVisible(GHandle gh, gBool visible) { if (visible) { // Mark us as visible gh->flags |= GWIN_FLG_VISIBLE; @@ -463,7 +463,7 @@ void gwinRedraw(GHandle gh) { TriggerRedraw(); } #else - void gwinSetVisible(GHandle gh, bool_t visible) { + void gwinSetVisible(GHandle gh, gBool visible) { if (visible) { if (!(gh->flags & GWIN_FLG_VISIBLE)) { gh->flags |= (GWIN_FLG_VISIBLE|GWIN_FLG_SYSVISIBLE|GWIN_FLG_NEEDREDRAW|GWIN_FLG_BGREDRAW); @@ -491,7 +491,7 @@ void gwinRedraw(GHandle gh) { #if GWIN_NEED_CONTAINERS // These two sub-functions set/clear system enable recursively. - void gwinSetEnabled(GHandle gh, bool_t enabled) { + void gwinSetEnabled(GHandle gh, gBool enabled) { if (enabled) { // Mark us as enabled gh->flags |= GWIN_FLG_ENABLED; @@ -530,7 +530,7 @@ void gwinRedraw(GHandle gh) { } } #else - void gwinSetEnabled(GHandle gh, bool_t enabled) { + void gwinSetEnabled(GHandle gh, gBool enabled) { if (enabled) { if (!(gh->flags & GWIN_FLG_ENABLED)) { gh->flags |= (GWIN_FLG_ENABLED|GWIN_FLG_SYSENABLED); @@ -577,7 +577,7 @@ GWindowMinMax gwinGetMinMax(GHandle gh) { return GWIN_NORMAL; } -void gwinRedrawDisplay(GDisplay *g, bool_t preserve) { +void gwinRedrawDisplay(GDisplay *g, gBool preserve) { GHandle gh; for(gh = gwinGetNextWindow(0); gh; gh = gwinGetNextWindow(gh)) { @@ -631,7 +631,7 @@ GHandle gwinGetNextWindow(GHandle gh) { gtimerStop(&FlashTimer); } - void gwinSetFlashing(GHandle gh, bool_t flash) { + void gwinSetFlashing(GHandle gh, gBool flash) { // Start flashing? if (flash) { @@ -642,9 +642,9 @@ GHandle gwinGetNextWindow(GHandle gh) { RedrawPending |= DOREDRAW_FLASHRUNNING; // Ensure we start the timer with flash bit on - _gwinFlashState = FALSE; + _gwinFlashState = gFalse; FlashTimerFn(0); // First flash - gtimerStart(&FlashTimer, FlashTimerFn, 0, TRUE, GWIN_FLASHING_PERIOD); // Subsequent flashes + gtimerStart(&FlashTimer, FlashTimerFn, 0, gTrue, GWIN_FLASHING_PERIOD); // Subsequent flashes } // Stop flashing? @@ -656,7 +656,7 @@ GHandle gwinGetNextWindow(GHandle gh) { } #if GWIN_NEED_WIDGET - const GColorSet *_gwinGetFlashedColor(GWidgetObject *gw, const GColorSet *pcol, bool_t flashOffState) { + const GColorSet *_gwinGetFlashedColor(GWidgetObject *gw, const GColorSet *pcol, gBool flashOffState) { // Does the flashing state affect the current colors? if ((gw->g.flags & GWIN_FLG_FLASHING) && _gwinFlashState) { @@ -688,7 +688,7 @@ GHandle gwinGetNextWindow(GHandle gh) { static void WM_Init(void); static void WM_DeInit(void); -static bool_t WM_Add(GHandle gh, const GWindowInit *pInit); +static gBool WM_Add(GHandle gh, const GWindowInit *pInit); static void WM_Delete(GHandle gh); static void WM_Redraw(GHandle gh); static void WM_Size(GHandle gh, coord_t w, coord_t h); @@ -726,7 +726,7 @@ static void WM_DeInit(void) { // A full window manager would remove any borders etc } -static bool_t WM_Add(GHandle gh, const GWindowInit *pInit) { +static gBool WM_Add(GHandle gh, const GWindowInit *pInit) { // Note the window will not currently be marked as visible // Put it on the end of the queue @@ -737,7 +737,7 @@ static bool_t WM_Add(GHandle gh, const GWindowInit *pInit) { gh->x = gh->y = 0; WM_Move(gh, pInit->x, pInit->y); WM_Size(gh, pInit->width, pInit->height); - return TRUE; + return gTrue; } static void WM_Delete(GHandle gh) { @@ -860,7 +860,7 @@ static void WM_Size(GHandle gh, coord_t w, coord_t h) { } else { // We need to make this window invisible and ensure that has been drawn - gwinSetVisible(gh, FALSE); + gwinSetVisible(gh, gFalse); _gwinFlushRedraws(REDRAW_WAIT); // Resize @@ -878,7 +878,7 @@ static void WM_Size(GHandle gh, coord_t w, coord_t h) { #endif // Mark it visible again in its new location - gwinSetVisible(gh, TRUE); + gwinSetVisible(gh, gTrue); } } else { gh->width = w; gh->height = h; @@ -941,7 +941,7 @@ static void WM_Move(GHandle gh, coord_t x, coord_t y) { // Clear the old area and then redraw if ((gh->flags & GWIN_FLG_SYSVISIBLE)) { // We need to make this window invisible and ensure that has been drawn - gwinSetVisible(gh, FALSE); + gwinSetVisible(gh, gFalse); _gwinFlushRedraws(REDRAW_WAIT); // Do the move @@ -959,7 +959,7 @@ static void WM_Move(GHandle gh, coord_t x, coord_t y) { } #endif - gwinSetVisible(gh, TRUE); + gwinSetVisible(gh, gTrue); } else { u = gh->x; gh->x = x; v = gh->y; gh->y = y; @@ -996,13 +996,13 @@ static void WM_Raise(GHandle gh) { if ((gh->flags & GWIN_FLG_CONTAINER)) { GHandle gx; GHandle child; - bool_t restart; + gBool restart; // Raise the children too // Note: Children can also have their own children so after each move we have to start again. for (gx = gwinGetNextWindow(0); gx; gx = gwinGetNextWindow(gx)) { if ((gx->flags & GWIN_FLG_CONTAINER)) { - restart = FALSE; + restart = gFalse; for (child = gwinGetNextWindow(0); child && child != gx; child = gwinGetNextWindow(child)) { if (child->parent == gx) { // Oops - this child is behind its parent. Move it to the front. @@ -1012,7 +1012,7 @@ static void WM_Raise(GHandle gh) { // Restart at the front of the list for this parent container as we have moved this child // to the end of the list. We also need to restart everything once this container is done. child = 0; - restart = TRUE; + restart = gTrue; } } if (restart)