Jump to content

ivan47

Members
  • Posts

    35
  • Joined

  • Last visited

Everything posted by ivan47

  1. This is my gfxconf.h file: #ifndef _GFXCONF_H #define _GFXCONF_H /* The operating system to use. One of these must be defined - preferably in your Makefile */ //#define GFX_USE_OS_CHIBIOS TRUE //#define GFX_USE_OS_WIN32 FALSE //#define GFX_USE_OS_LINUX FALSE //#define GFX_USE_OS_OSX FALSE #define GFX_USE_OS_RAW32 TRUE #define GOS_RAW_HEAP_SIZE 512 // #define INTERRUPTS_OFF() optional_code // #define INTERRUPTS_ON() optional_code /* GFX sub-systems to turn on */ #define GFX_USE_GDISP TRUE #define GFX_USE_GWIN TRUE // #define GFX_USE_GINPUT TRUE // #define GFX_USE_GEVENT TRUE #define GFX_USE_GTIMER TRUE #define GFX_USE_GQUEUE TRUE // /* Features for the GDISP sub-system. */ #define GDISP_NEED_VALIDATION TRUE #define GDISP_NEED_CLIP TRUE #define GDISP_NEED_CIRCLE TRUE #define GDISP_NEED_ELLIPSE TRUE #define GDISP_NEED_ARC TRUE #define GDISP_NEED_CONVEX_POLYGON TRUE #define GDISP_NEED_TEXT TRUE //u slucaju koristenja nekog fonta treba ga promijeniti u TRUE #define GDISP_NEED_ANTIALIAS FALSE #define GDISP_NEED_UTF8 FALSE #define GDISP_NEED_TEXT_KERNING FALSE #define GDISP_INCLUDE_FONT_UI1 FALSE #define GDISP_INCLUDE_FONT_LARGENUMBERS FALSE #define GDISP_INCLUDE_FONT_DEJAVUSANS10 FALSE #define GDISP_INCLUDE_FONT_DEJAVUSANS12 TRUE #define GDISP_INCLUDE_FONT_DEJAVUSANS16 FALSE #define GDISP_INCLUDE_FONT_DEJAVUSANS20 TRUE #define GDISP_INCLUDE_FONT_DEJAVUSANS24 FALSE #define GDISP_INCLUDE_FONT_DEJAVUSANS32 FALSE #define GDISP_INCLUDE_FONT_DEJAVUSANSBOLD12 FALSE #define GDISP_INCLUDE_FONT_FIXED_10X20 TRUE #define GDISP_INCLUDE_FONT_FIXED_7X14 TRUE #define GDISP_INCLUDE_FONT_FIXED_5X8 TRUE #define GDISP_INCLUDE_FONT_DEJAVUSANS12_AA FALSE #define GDISP_INCLUDE_FONT_DEJAVUSANS16_AA FALSE #define GDISP_INCLUDE_FONT_DEJAVUSANS20_AA FALSE #define GDISP_INCLUDE_FONT_DEJAVUSANS24_AA FALSE #define GDISP_INCLUDE_FONT_DEJAVUSANS32_AA FALSE #define GDISP_INCLUDE_FONT_DEJAVUSANSBOLD12_AA FALSE #define GDISP_INCLUDE_USER_FONTS FALSE #define GDISP_NEED_CONTROL TRUE // #define GDISP_NEED_MULTITHREAD TRUE// #define GDISP_USE_DMA FALSE /* GDISP fonts to include */ #define GDISP_INCLUDE_FONT_UI2 TRUE /* Features for the GWIN subsystem. */ #define GWIN_NEED_WINDOWMANAGER FALSE #define GWIN_NEED_WIDGET TRUE // #define GWIN_NEED_BUTTON TRUE // #define GWIN_NEED_FRAME FALSE /* Features for the GINPUT subsystem. */ #define GINPUT_NEED_MOUSE TRUE //#define GINPUT_NEED_TOGGLE TRUE #endif /* _GFXCONF_H */
  2. Okay, I finaly got some time so I did what inmarket said, I defined GOS_RAW_HEAP_SIZE to 512, but nothing changed.
  3. Okay, I'll do that when I find some time... Exams just started so...
  4. Did anyone figured out what is wrong ?
  5. No worry, I'll work on my "primitive menu libraries" until then.
  6. Sorry guys. I had some problems. My Internet provider is doing lousy job providing Internet, so I couldn't upload a file online. Anyway here's the link: http://www.mediafire.com/download/er4f5 ... ILI9341.7z It is whole Keil project but like I said, user modified files are located in \01-STM32F4xx_Keil_CMSIS_uGFX\User.
  7. I realized I didn't paste the link... I will paste it ass soon as I establish connection with my Cloud server
  8. This is link to my Keil 5 project. All user modified files (defines.h, gfxconf.h, gmouse_lld_ADS7843_board.h etc.) are located in \01-STM32F4xx_Keil_CMSIS_uGFX\User. I'm using STM32F4 Discovery board (it uses 8 MHz external crystal), ILI9341 display controller with SPI interface, XPT2046 touch screen controller (also uses SPI). I'm using Tilens libraries to send data over SPI and for initialize (makes life easier). Pin descriptions are in defines.h : #define ILI9341_CS_CLK RCC_AHB1Periph_GPIOC #define ILI9341_CS_PORT GPIOC #define ILI9341_CS_PIN GPIO_Pin_2 /* WRX or DC pin */ #define ILI9341_WRX_CLK RCC_AHB1Periph_GPIOD #define ILI9341_WRX_PORT GPIOD #define ILI9341_WRX_PIN GPIO_Pin_7 /* RST pin */ #define ILI9341_RST_CLK RCC_AHB1Periph_GPIOD #define ILI9341_RST_PORT GPIOD #define ILI9341_RST_PIN GPIO_Pin_6 #define TM_SPI3_PRESCALER SPI_BaudRatePrescaler_2 ///////////////////// #define XPT2046_CS_PORT GPIOB #define XPT2046_CS_PIN GPIO_Pin_12 #define XPT2046_PENIRQ_PORT GPIOB #define XPT2046_PENIRQ_PIN GPIO_Pin_11 #define XPT2046_SPI SPI2 #define XPT2046_SPI_PINS TM_SPI_PinsPack_2 #define TM_SPI4_PRESCALER SPI_BaudRatePrescaler_128
  9. I did that, otherwise my local variables wouldn't be in scope. But it didn't help with hardfault. Is it possible that my implementation of driver functions could be causing this ?
  10. Okay, I was unable to do my project for short time. Today I did what inmarket said, but I'm not sure what does this mean. http://www.mediafire.com/view/f4ix7wy1i ... Stack3.jpg
  11. So I trace program to the point before HardFault function. It enters the gfxYield() and executes function to the _longjmp(current->cxt, 1); and jumps to the HardFault. I'm not sure why because the programs enters and executes gfxYield() few times before that. http://www.mediafire.com/view/r5t8r635t ... Stack2.jpg But there are no variables in scope (at least my debugger says it).
  12. Okay. I'm using Keil uVision 5 as my IDE. I'm using STM32F4 Discovery board and I use ILI9341 320x240 display and 4-wire resistive touchscreen which is controlled by the XPT2046. The communication between ILI9341 and XPT2046 is done using SPI interface on my STM32 board. I'm not sure if this is it, but this is link to screenshoot of Call Stack prior to HardFault: http://www.mediafire.com/view/ccku1gc4a ... lStack.jpg Sorry, but I'm not sure if Keil can generate some text file with Call Stack.
  13. Hey. So, just like before, I get the uGfx logo for short period and then it enters the "calibration mode" (Blue screen with crosshair), but nothing happens. I trace the program and realized it enters Hard Fault routine while running gfxInit when it gets to around 506th line in ginput_mouse.c . If I define GINPUT_TOUCH_STARTRAW in gfxconf.h true, program draws the button and XPT2046 sends some data (i know that because I put function to print the data to USART every time program enters XPT2046_GetCoordinates() ), but nothing happens.
  14. Also, could someone explain me importance of these two functions: systemticks_t gfxSystemTicks(void); systemticks_t gfxMillisecondsToTicks(delaytime_t ms);
  15. Me again. I tried the other day to get button example (from the wiki site) working but no luck. This is my main.c: /* Include core modules */ #include "stm32f4xx.h" /* Include my libraries here */ #include "defines.h" #include "tm_stm32f4_delay.h" //Credits go to Tilen Majerle #include "tm_stm32f4_disco.h" //Credits go to Tilen Majerle #include "tm_stm32f4_spi.h" //Credits go to Tilen Majerle #include "tm_stm32f4_ili9341.h" //Credits go to Tilen Majerle #include "tm_stm32f4_fonts.h" //Credits go to Tilen Majerle #include "tm_stm32f4_usart.h" //Credits go to Tilen Majerle #include "XPT2046.h" #include "gfx.h" #include //#ifdef HSE_VALUE // #undef HSE_VALUE // #define HSE_VALUE ((uint32_t) 8000000) //#endif /* Private function prototypes -----------------------------------------------*/ systemticks_t gfxSystemTicks(void); systemticks_t gfxMillisecondsToTicks(delaytime_t ms); systemticks_t gfxSystemTicks(void) { return SysTick->VAL; } systemticks_t gfxMillisecondsToTicks(delaytime_t ms) { return ms; } coord_t i, j; coord_t width, height; ////////////// static GListener gl; static GHandle ghButton1; static void createWidgets(void) { GWidgetInit wi; // Apply some default values for GWIN gwinWidgetClearInit(&wi); wi.g.show = TRUE; // Apply the button parameters wi.g.width = 100; wi.g.height = 30; wi.g.y = 10; wi.g.x = 10; wi.text = "Push Button"; // Create the actual button ghButton1 = gwinButtonCreate(NULL, &wi); } ////////////// int main(void) { GEvent* pe; font_t font = gdispOpenFont("DejaVuSans12"); font_t font1 = gdispOpenFont("fixed_10x20"); font_t font2 = gdispOpenFont("fixed_7x14"); font_t font3 = gdispOpenFont("fixed_5x8 "); /* Initialize system */ //SystemInit(); /*Initialize USART for debugging*/ TM_USART_Init(USART1, TM_USART_PinsPack_2, 9600); /* Put string to USART */ TM_USART_Puts(USART1, "Hello world\n\r"); //Debug // Initialize delay TM_DELAY_Init(); //gfxSleepMilliseconds(1000); gfxInit(); TM_USART_Puts(USART1, "Hello world\n\r"); //Debug // Set the widget defaults gwinSetDefaultFont(gdispOpenFont("UI2")); gwinSetDefaultStyle(&WhiteWidgetStyle, FALSE); gdispClear(White); // Attach the mouse input gwinAttachMouse(0); // create the widget createWidgets(); // We want to listen for widget events geventListenerInit(&gl); gwinAttachListener(&gl); gdispDrawString(100,100,"Hello1", font, Green); while(1) { // Get an Event pe = geventEventWait(&gl, TIME_INFINITE); switch(pe->type) { case GEVENT_GWIN_BUTTON: if (((GEventGWinButton*)pe)->gwin == ghButton1) { // Our button has been pressed gdispDrawString(60,60,"Hello", font, Green); } break; default: break; } } } This is my gfxconf.h : #ifndef _GFXCONF_H #define _GFXCONF_H /* The operating system to use. One of these must be defined - preferably in your Makefile */ //#define GFX_USE_OS_CHIBIOS TRUE //#define GFX_USE_OS_WIN32 FALSE //#define GFX_USE_OS_LINUX FALSE //#define GFX_USE_OS_OSX FALSE #define GFX_USE_OS_RAW32 TRUE /* GFX sub-systems to turn on */ #define GFX_USE_GDISP TRUE #define GFX_USE_GWIN TRUE // #define GFX_USE_GINPUT TRUE // #define GFX_USE_GEVENT TRUE #define GFX_USE_GTIMER TRUE #define GFX_USE_GQUEUE FALSE /* Features for the GDISP sub-system. */ #define GDISP_NEED_VALIDATION TRUE #define GDISP_NEED_CLIP TRUE #define GDISP_NEED_CIRCLE TRUE #define GDISP_NEED_ELLIPSE TRUE #define GDISP_NEED_ARC TRUE #define GDISP_NEED_CONVEX_POLYGON TRUE #define GDISP_NEED_TEXT TRUE //u slucaju koristenja nekog fonta treba ga promijeniti u TRUE #define GDISP_NEED_ANTIALIAS FALSE #define GDISP_NEED_UTF8 FALSE #define GDISP_NEED_TEXT_KERNING FALSE #define GDISP_INCLUDE_FONT_UI1 FALSE #define GDISP_INCLUDE_FONT_LARGENUMBERS FALSE #define GDISP_INCLUDE_FONT_DEJAVUSANS10 FALSE #define GDISP_INCLUDE_FONT_DEJAVUSANS12 TRUE #define GDISP_INCLUDE_FONT_DEJAVUSANS16 FALSE #define GDISP_INCLUDE_FONT_DEJAVUSANS20 TRUE #define GDISP_INCLUDE_FONT_DEJAVUSANS24 FALSE #define GDISP_INCLUDE_FONT_DEJAVUSANS32 FALSE #define GDISP_INCLUDE_FONT_DEJAVUSANSBOLD12 FALSE #define GDISP_INCLUDE_FONT_FIXED_10X20 TRUE #define GDISP_INCLUDE_FONT_FIXED_7X14 TRUE #define GDISP_INCLUDE_FONT_FIXED_5X8 TRUE #define GDISP_INCLUDE_FONT_DEJAVUSANS12_AA FALSE #define GDISP_INCLUDE_FONT_DEJAVUSANS16_AA FALSE #define GDISP_INCLUDE_FONT_DEJAVUSANS20_AA FALSE #define GDISP_INCLUDE_FONT_DEJAVUSANS24_AA FALSE #define GDISP_INCLUDE_FONT_DEJAVUSANS32_AA FALSE #define GDISP_INCLUDE_FONT_DEJAVUSANSBOLD12_AA FALSE #define GDISP_INCLUDE_USER_FONTS FALSE #define GDISP_NEED_CONTROL TRUE // #define GDISP_NEED_MULTITHREAD TRUE// #define GDISP_USE_DMA FALSE /* GDISP fonts to include */ #define GDISP_INCLUDE_FONT_UI2 TRUE #define GQUEUE_NEED_ASYNC FALSE /* Features for the GWIN subsystem. */ #define GWIN_NEED_WINDOWMANAGER FALSE #define GWIN_NEED_WIDGET TRUE // #define GWIN_NEED_BUTTON TRUE // #define GWIN_BUTTON_LAZY_RELEASE TRUE // #define GWIN_NEED_FRAME FALSE /* Features for the GINPUT subsystem. */ #define GINPUT_NEED_MOUSE TRUE #define GINPUT_TOUCH_STARTRAW FALSE #define GINPUT_TOUCH_NOTOUCH FALSE #define GINPUT_TOUCH_NOCALIBRATE FALSE #define GINPUT_TOUCH_NOCALIBRATE_GUI TRUE #define GINPUT_MOUSE_POLL_PERIOD 100 // #define GINPUT_MOUSE_CLICK_TIME 300 #define GINPUT_TOUCH_CXTCLICK_TIME 700 #define GINPUT_TOUCH_USER_CALIBRATION_LOAD FALSE #define GINPUT_TOUCH_USER_CALIBRATION_SAVE FALSE #define GINPUT_NEED_TOGGLE FALSE #endif /* _GFXCONF_H */
  16. Thanks GunterO, I'll try that when I get the chance
  17. Okay, the question is pretty dumb. Why do you have to define which OS do you use. For example: /* The operating system to use. One of these must be defined - preferably in your Makefile */ //#define GFX_USE_OS_CHIBIOS TRUE //#define GFX_USE_OS_WIN32 FALSE //#define GFX_USE_OS_LINUX FALSE //#define GFX_USE_OS_OSX FALSE #define GFX_USE_OS_RAW32 TRUE I already read the GOS article on wiki page. If someone coul explain me, the dumb way preferably. I was also wondering, I want to make my application modular, that is I want to use STDperiph library for bare-metal applications, but if I want to implement FreeRTOS in the same application, could I do that without some major modification in my conf file ?
  18. Okay. I "manualy" defined M_PI and I included stdio.h in my main.c file. That took care of those problems, I also included some other modules in my project (there were some linker errors ). Then I modified my main file and it looks like this: systemticks_t gfxSystemTicks(void); systemticks_t gfxMillisecondsToTicks(delaytime_t ms); systemticks_t gfxSystemTicks(void) { return SysTick->VAL; } systemticks_t gfxMillisecondsToTicks(delaytime_t ms) { return ms; } coord_t i, j; coord_t width, height; ////////////// static GListener gl; static GHandle ghButton1; static void createWidgets(void) { GWidgetInit wi; // Apply some default values for GWIN gwinWidgetClearInit(&wi); wi.g.show = TRUE; // Apply the button parameters wi.g.width = 100; wi.g.height = 30; wi.g.y = 10; wi.g.x = 10; wi.text = "Push Button"; // Create the actual button ghButton1 = gwinButtonCreate(NULL, &wi); } ////////////// int main(void) { GEvent* pe; font_t font = gdispOpenFont("DejaVuSans12"); font_t font1 = gdispOpenFont("fixed_10x20"); font_t font2 = gdispOpenFont("fixed_7x14"); font_t font3 = gdispOpenFont("fixed_5x8 "); /* Initialize system */ //SystemInit(); /*Initialize USART for debugging*/ TM_USART_Init(USART1, TM_USART_PinsPack_2, 9600); /* Put string to USART */ TM_USART_Puts(USART1, "Hello world\n\r"); //Debug // Initialize delay TM_DELAY_Init(); //gfxSleepMilliseconds(1000); gfxInit(); TM_USART_Puts(USART1, "Hello world\n\r"); //Debug // Set the widget defaults gwinSetDefaultFont(gdispOpenFont("UI2")); gwinSetDefaultStyle(&WhiteWidgetStyle, FALSE); gdispClear(White); // Attach the mouse input gwinAttachMouse(0); // create the widget createWidgets(); // We want to listen for widget events geventListenerInit(&gl); gwinAttachListener(&gl); gdispDrawString(100,100,"Hello", font, Green); while(1) { // Get an Event pe = geventEventWait(&gl, TIME_INFINITE); switch(pe->type) { case GEVENT_GWIN_BUTTON: if (((GEventGWinButton*)pe)->gwin == ghButton1) { // Our button has been pressed gdispDrawString(60,60,"Hello", font, Green); } break; default: break; } } } Now the application enters the "calibration mode" (Blue screen with crosshair), but nothing happens. I trace the program and realized it enters Hard Fault routine while running gfxInit when it gets to around 506th line in ginput_mouse.c . // Wait for the mouse to be pressed while(!(m->r.buttons & GINPUT_MOUSE_BTN_LEFT)) gfxSleepMilliseconds(CALIBRATION_POLL_PERIOD); Anyone have an idea what am I doing wrong. I left link to whole project in Keil. http://www.mediafire.com/download/6ewrh ... ILI9341.7z Help!
  19. Hello. So I finally got some free time and I implemented functions to gmouse_lld_ADS7843.h file. Now I want to make programe that will create some buttons on my 320x240 screen (again, I'm using Keil 5, Standard Peripheral libraries (RAW32 application) ). By pressing buttons something should happen (toggle LEDs...). But I got this errors: Build target 'STM32F4-Discovery USB' assembling startup_stm32f40_41xxx.s... compiling main.c... ..\XPT2046\XPT2046.h(14): warning: #1295-D: Deprecated declaration XPT2046_Init - give arg types extern void XPT2046_Init(); ..\XPT2046\XPT2046.h(15): warning: #1-D: last line of file ends without a newline extern void XPT2046_GetCoordinates(uint8_t* tx, uint8_t* rx); .\User\gfxconf.h(85): warning: #47-D: incompatible redefinition of macro "GDISP_INCLUDE_FONT_UI2" (declared at line 61) #define GDISP_INCLUDE_FONT_UI2 TRUE User\main.c(61): warning: #68-D: integer conversion resulted in a change of sign wi.g.show = TRUE; User\main.c(71): error: #20: identifier "NULL" is undefined ghButton1 = gwinButtonCreate(NULL, &wi); User\main.c(53): warning: #177-D: variable "gl" was declared but never referenced static GListener gl; User\main.c(54): warning: #550-D: variable "ghButton1" was set but never used static GHandle ghButton1; User\main.c(56): warning: #177-D: function "createWidgets" was declared but never referenced static void createWidgets(void) { User\main.c: 7 warnings, 1 error compiling gdisp.c... .\User\gfxconf.h(85): warning: #47-D: incompatible redefinition of macro "GDISP_INCLUDE_FONT_UI2" (declared at line 61) #define GDISP_INCLUDE_FONT_UI2 TRUE ..\00-uGFX\src/gdriver/gdriver.h(90): warning: #83-D: type qualifier specified more than once typedef const struct GDriverVMT const GDriverVMTList[1]; C:\Users\Ivan47\Desktop\ILI9341\00-uGFX\src\gdisp\gdisp.c(586): warning: #83-D: type qualifier specified more than once extern const GDISPVMT const GDISPVMT_OnlyOne[1]; C:\Users\Ivan47\Desktop\ILI9341\00-uGFX\src\gdisp\gdisp.c(607): warning: #68-D: integer conversion resulted in a change of sign initDone = TRUE; C:\Users\Ivan47\Desktop\ILI9341\00-uGFX\src\gdisp\gdisp.c(1729): error: #20: identifier "M_PI" is undefined sedge = round(radius * ((sbit & 0x99) ? sin(start*M_PI/180) : cos(start*M_PI/180))); C:\Users\Ivan47\Desktop\ILI9341\00-uGFX\src\gdisp\gdisp.c(1856): error: #20: identifier "M_PI" is undefined sxb = FP2FIXED(radius*cos(start*M_PI/180)); sy = -round(radius*sin(start*M_PI/180)); C:\Users\Ivan47\Desktop\ILI9341\00-uGFX\src\gdisp\gdisp.c(2675): warning: #767-D: conversion from pointer to smaller integer switch ((orientation_t) value) { C:\Users\Ivan47\Desktop\ILI9341\00-uGFX\src\gdisp\gdisp.c(3260): warning: #188-D: enumerated type mixed with another type mf_render_aligned(font, x, y, justify, str, 0, drawcharglyph, g); C:\Users\Ivan47\Desktop\ILI9341\00-uGFX\src\gdisp\gdisp.c(3298): warning: #188-D: enumerated type mixed with another type mf_render_aligned(font, x, y, justify, str, 0, fillcharglyph, g); C:\Users\Ivan47\Desktop\ILI9341\00-uGFX\src\gdisp\gdisp.c: 7 warnings, 2 errors ".\Targets\STM32F4_Discovery\project.axf" - 3 Error(s), 14 Warning(s). Target not created. Build Time Elapsed: 00:00:11 So, there is undefined identifier NULL (probably my mistake), and two errors concerning M_PI. There are also some questions about gmouse_lld_ADS7843_board.h file: What does getpin_pressed(GMouse* m) do, and do I necessarily need to implement it ? What does aquire_bus(GMouse* m) and release_bus(GMouse* m) do (also, do I need to implement them)? I can send link to whole project.
  20. Yes, I'm aware of that. I was wonderng if someone (possibly someone who has already worked with ADS7843) could explain me how to "extract" coordinates from the data I get from ADS7843, that is how to write function read_value.
  21. What is uint16_t port argument in function?
  22. So my LCD module has built in touchscreen with XPT2046 module (I've read it's compatible with ADS7843). I've connected it to my Discovery board using SPI interface (using TM's library). And it works (at least I think it works). There are few things that bothers me. I don't know how to interpret the data coming from XPT2046 (I wanna know the relation between binary data coming from SPI port to actual point on 240x320 screen, I'm trying to write function to print coordinates to "USART debug port"). I'm using Standard Peripheral Drivers. These are my functions: void XPT2046_Init(){ TM_GPIO_Init(XPT2046_CS_PORT, XPT2046_CS_PIN, TM_GPIO_Mode_OUT, TM_GPIO_OType_PP, TM_GPIO_PuPd_NOPULL, TM_GPIO_Speed_Medium); GPIO_SetBits(XPT2046_CS_PORT, XPT2046_CS_PIN); TM_SPI_Init(XPT2046_SPI, XPT2046_SPI_PINS); } //Test function void XPT2046_GetCoordinates(){ uint8_t datay[2]; uint8_t datax[2]; GPIO_ResetBits(XPT2046_CS_PORT, XPT2046_CS_PIN); TM_SPI_Send(XPT2046_SPI, 0x90); //you will get back data which you can ignore //Wait for busy TM_SPI_ReadMulti(XPT2046_SPI, datay, 0x00, 2); //receive 2 bytes, send 0x00 dummy bytes, 2 bytes TM_SPI_Send(XPT2046_SPI, 0xD0); //you will get back data which you can ignore //Wait for busy TM_SPI_ReadMulti(XPT2046_SPI, datax, 0x00, 2); //receive 2 bytes, send 0x00 dummy bytes, 2 bytes GPIO_SetBits(XPT2046_CS_PORT, XPT2046_CS_PIN); /*Debugging purposes*/ TM_USART_Puts(USART1,(char*) datay); TM_USART_Puts(USART1,"\n\r"); TM_USART_Puts(USART1,(char*) datax); TM_USART_Puts(USART1,"\n\r"); } DOUT(MISO) - PB14 DIN(MOSI) - PB15 CLK - PB13 CS - PB12 Also I would like to import these function to board.h file so I can use touchscreen with my uGFX project. I opened ginput_lld_mouse_board_st_stm32f4_discovery.h file that is written using ChibiOS functions (I don't use it in my project, I use raw32), and I don't understand some functions, for example: static inline uint16_t read_value(GMouse* m, uint16_t port) { static uint8_t txbuf[3] = {0}; static uint8_t rxbuf[3] = {0}; (void) m; txbuf[0] = port; spiExchange(&SPID2, 3, txbuf, rxbuf); return ((uint16_t)rxbuf[1] << 5) | (rxbuf[2] >> 3); } I'd like to implement my own code (using Standard Peripheral Drivers) here.
  23. Guys, thank you very much. You saved me a lot of time.
×
×
  • Create New...