Jump to content

uweng14

Members
  • Content Count

    3
  • Joined

  • Last visited

About uweng14

  • Rank
    Newbie

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Hi Tectu, I am able to get the LCD to display now. It was a wiring issue. thanks for the help David
  2. Hello, I've upgraded to the latest ugfx version, and I am seeing some compilation errors. 1) there is an undefined variable "ld" within src\gwin\button.c in the the following code gdispFillArea(gw->g.x, gw->g.y, ld, ld, gw->pstyle->background); 2) there is no definition for "gfxQueueASyncInit", which seems like there is some missing header files for gwm.c under src/gwin Any help would be appreciated to get the new ugfx running thanks, David
  3. Hi Tectu, I've posted on the old chibios forum, here is the link to that post. http://forum.chibios.org/phpbb/viewtopi ... =11&t=1308 So I've tested all the suggestions you recommanded last time. But unfortunately I still can't get it to work. I am using the ARMCM4-STM32F407-DISCOVERY board. One question about PAL_STM32_OSPEED_HIGHEST,if I were to not use this macro. Do I replace it with something else or just leave it blank? here is my current gdisp_lld_board.h I've added an extra spi command that sends the 0x70 starting bit to start the spi communication before read and writes. The distributor example code had this line which I could not find it anywhere else in the driver code. #ifndef GDISP_LLD_BOARD_H #define GDISP_LLD_BOARD_H #define SET_RST palSetPad(GPIOB, 8); #define CLR_RST palClearPad(GPIOB, 8); // Peripherial Clock 42MHz SPI2 SPI3 // Peripherial Clock 84MHz SPI1 SPI1 SPI2/3 //#define SPI_BaudRatePrescaler_2 ((uint16_t)0x0000) // 42 MHz 21 MHZ //#define SPI_BaudRatePrescaler_4 ((uint16_t)0x0008) // 21 MHz 10.5 MHz //#define SPI_BaudRatePrescaler_8 ((uint16_t)0x0010) // 10.5 MHz 5.25 MHz //#define SPI_BaudRatePrescaler_16 ((uint16_t)0x0018) // 5.25 MHz 2.626 MHz //#define SPI_BaudRatePrescaler_32 ((uint16_t)0x0020) // 2.626 MHz 1.3125 MHz //#define SPI_BaudRatePrescaler_64 ((uint16_t)0x0028) // 1.3125 MHz 656.25 KHz //#define SPI_BaudRatePrescaler_128 ((uint16_t)0x0030) // 656.25 KHz 328.125 KHz //#define SPI_BaudRatePrescaler_256 ((uint16_t)0x0038) // 328.125 KHz 164.06 KHz /* * * 10.5MHz, CPHA=1, CPOL=0, MSb first, 16 - bits * */ static const SPIConfig spi2cfg1 = { NULL, /* HW dependent part.*/ GPIOB, 12, SPI_CR1_DFF | SPI_CR1_CPHA | SPI_CR1_BR_0 }; static inline void gdisp_lld_init_board(void) { palSetPadMode(GPIOB, 13, PAL_MODE_ALTERNATE(5) ); /* New SCK. */ palSetPadMode(GPIOB, 14, PAL_MODE_ALTERNATE(5) ); /* New MISO. */ palSetPadMode(GPIOB, 15, PAL_MODE_ALTERNATE(5) ); /* New MOSI. */ palSetPadMode(GPIOB, 12, PAL_MODE_OUTPUT_PUSHPULL); /* New CS. */ //palSetPad(GPIOB, 12); palSetPad(GPIOB, 8); spiStart(&SPID2, &spi2cfg1); } static inline void gdisp_lld_reset_pin(bool_t state) { if (state) { palSetPad(GPIOB, 8); } else { palClearPad(GPIOB, 8); } } static inline void acquire_bus(void) { spiAcquireBus(&SPID2); } static inline void release_bus(void) { spiReleaseBus(&SPID2); } static inline void gdisp_lld_write_index(uint16_t data) { //palClearPad(GPIOB, 12); spiSelect(&SPID2); static uint8_t txbuf[1] = {0}; txbuf[0] = 0x70 | 0x00 | 0x00; while((SPI2->SR & SPI_SR_TXE) == 0); spiSend(&SPID2, 1, txbuf); while(((SPI2->SR & SPI_SR_TXE) == 0) || ((SPI2->SR & SPI_SR_BSY) != 0)); txbuf[0] = data & 0xFF; while((SPI2->SR & SPI_SR_TXE) == 0); spiSend(&SPID2, 1, txbuf); while(((SPI2->SR & SPI_SR_TXE) == 0) || ((SPI2->SR & SPI_SR_BSY) != 0)); //txbuf[0] = data >> 8; //txbuf[1] = data & 0xFF; //palSetPad(GPIOB, 12); spiUnselect(&SPID2); } static inline void gdisp_lld_write_data(uint16_t data) { //palClearPad(GPIOB, 12); spiSelect(&SPID2); static uint8_t txbuf[2] = {0}; //txbuf[0] = data; txbuf[0] = 0x70 | 0x00 | 0x02; txbuf[1] = 0x70 | 0x00 | 0x02; while((SPI2->SR & SPI_SR_TXE) == 0); spiSend(&SPID2, 1, txbuf); while(((SPI2->SR & SPI_SR_TXE) == 0) || ((SPI2->SR & SPI_SR_BSY) != 0)); txbuf[0] = (data >> 8); txbuf[1] = (data & 0xFF); while((SPI2->SR & SPI_SR_TXE) == 0); spiSend(&SPID2, 2, txbuf); while(((SPI2->SR & SPI_SR_TXE) == 0) || ((SPI2->SR & SPI_SR_BSY) != 0)); //palSetPad(GPIOB, 12); spiUnselect(&SPID2); } static inline uint16_t gdisp_lld_read_data(void) { //palClearPad(GPIOB, 12); spiSelect(&SPID2); static uint8_t txbuf[1] = {0}; txbuf[0] = 0x70 | 0x01 | 0x02; while((SPI2->SR & SPI_SR_TXE) == 0); spiSend(&SPID2, 1, txbuf); while(((SPI2->SR & SPI_SR_TXE) == 0) || ((SPI2->SR & SPI_SR_BSY) != 0)); static uint8_t rxbuf[3] = {0}; spiReceive(&SPID2, 3, rxbuf); while(((SPI2->SR & SPI_SR_TXE) == 0) || ((SPI2->SR & SPI_SR_BSY) != 0)); //palSetPad(GPIOB, 12); spiUnselect(&SPID2); static uint16_t value = 0; value = rxbuf[1] << 8 | rxbuf[2]; //test_println((char*)value); return value; } /* if not available, just ignore the argument and return */ static inline uint16_t gdisp_lld_backlight(uint8_t percentage) { //pwmEnableChannel(&PWMD4, 1, percentage); } #endif /* GDISP_LLD_BOARD_H */ /** @} */ gfxconf.h /** * This file has a different license to the rest of the GFX system. * You can copy, modify and distribute this file as you see fit. * You do not need to publish your source modifications to this file. * The only thing you are not permitted to do is to relicense it * under a different license. */ /** * Copy this file into your project directory and rename it as gfxconf.h * Edit your copy to turn on the GFX features you want to use. */ #ifndef _GFXCONF_H #define _GFXCONF_H #define GFX_USE_OS_CHIBIOS TRUE /* GFX subsystems to turn on */ #define GFX_USE_GDISP TRUE #define GFX_USE_TDISP FALSE #define GFX_USE_GWIN FALSE #define GFX_USE_GEVENT FALSE #define GFX_USE_GTIMER FALSE #define GFX_USE_GINPUT FALSE #define GFX_USE_GADC FALSE #define GFX_USE_GAUDIN FALSE #define GFX_USE_GAUDOUT FALSE #define GFX_USE_GMISC FALSE /* Features for the GDISP subsystem */ #define GDISP_NEED_VALIDATION TRUE #define GDISP_NEED_CLIP TRUE #define GDISP_NEED_TEXT TRUE #define GDISP_NEED_CIRCLE TRUE #define GDISP_NEED_ELLIPSE TRUE #define GDISP_NEED_ARC FALSE #define GDISP_NEED_CONVEX_POLYGON FALSE #define GDISP_NEED_SCROLL FALSE #define GDISP_NEED_PIXELREAD FALSE #define GDISP_NEED_CONTROL FALSE #define GDISP_NEED_QUERY FALSE #define GDISP_NEED_IMAGE FALSE #define GDISP_NEED_MULTITHREAD FALSE #define GDISP_NEED_ASYNC FALSE #define GDISP_NEED_MSGAPI FALSE /* GDISP - builtin fonts */ #define GDISP_INCLUDE_FONT_SMALL FALSE #define GDISP_INCLUDE_FONT_LARGER FALSE #define GDISP_INCLUDE_FONT_UI1 FALSE #define GDISP_INCLUDE_FONT_UI2 TRUE #define GDISP_INCLUDE_FONT_LARGENUMBERS FALSE /* GDISP image decoders */ #define GDISP_NEED_IMAGE_NATIVE FALSE #define GDISP_NEED_IMAGE_GIF FALSE #define GDISP_NEED_IMAGE_BMP FALSE #define GDISP_NEED_IMAGE_JPG FALSE #define GDISP_NEED_IMAGE_PNG FALSE #define GDISP_NEED_IMAGE_ACCOUNTING FALSE /* Optional image support that can be turned off */ /* #define GDISP_NEED_IMAGE_BMP_1 TRUE #define GDISP_NEED_IMAGE_BMP_4 TRUE #define GDISP_NEED_IMAGE_BMP_4_RLE TRUE #define GDISP_NEED_IMAGE_BMP_8 TRUE #define GDISP_NEED_IMAGE_BMP_8_RLE TRUE #define GDISP_NEED_IMAGE_BMP_16 TRUE #define GDISP_NEED_IMAGE_BMP_24 TRUE #define GDISP_NEED_IMAGE_BMP_32 TRUE */ /* Features for the TDISP subsystem. */ #define TDISP_NEED_MULTITHREAD FALSE /* Features for the GWIN subsystem. */ #define GWIN_NEED_BUTTON FALSE #define GWIN_NEED_CONSOLE FALSE #define GWIN_NEED_GRAPH FALSE #define GWIN_NEED_SLIDER FALSE /* Features for the GEVENT subsystem. */ #define GEVENT_ASSERT_NO_RESOURCE FALSE /* Features for the GTIMER subsystem. */ /* NONE */ /* Features for the GINPUT subsystem. */ #define GINPUT_NEED_MOUSE FALSE #define GINPUT_NEED_KEYBOARD FALSE #define GINPUT_NEED_TOGGLE FALSE #define GINPUT_NEED_DIAL FALSE /* Features for the GADC subsystem. */ /* NONE */ /* Features for the GAUDIN subsystem. */ /* NONE */ /* Features for the GAUDOUT subsystem. */ /* NONE */ /* Features for the GMISC subsystem. */ #define GMISC_NEED_ARRAYOPS FALSE /* Optional Parameters for various subsystems */ /* #define GDISP_MAX_FONT_HEIGHT 16 #define GEVENT_MAXIMUM_SIZE 32 #define GEVENT_MAX_SOURCE_LISTENERS 32 #define GTIMER_THREAD_WORKAREA_SIZE 512 #define GADC_MAX_LOWSPEED_DEVICES 4 #define GWIN_BUTTON_LAZY_RELEASE FALSE */ /* Optional Low Level Driver Definitions */ #define GDISP_USE__BOARD TRUE #define GDISP_SCREEN_WIDTH 320 #define GDISP_SCREEN_HEIGHT 240 #define GDISP_USE_FSMC #define GDISP_USE_GPIO #define TDISP_COLUMNS 16 #define TDISP_ROWS 2 #define GDISP_THREAD_CHIBIOS TRUE #endif /* _GFXCONF_H */ Thanks a lot, David
×
×
  • Create New...