#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2017
    Posts
    2
    Rep Power
    0

    C syntax on STM32F769I-DISCO


    I'm using the STM32F769I-DISCO board on ARMmbed as a learning tool.
    This hardware includes a touch sensitive LCD screen
    I have modified a demo program for writing to the screen that was there for this board and run into a stumbling block.
    Its pretty basic but I'm trying to write the actual touch coordinates to the screen
    It had a line that prints these values to a terminal program but I have not been able to figure out the syntax for writing that date to the LCD screen
    It does print to this screen in the location where the touch occurred but x1 y1 instead of the values held

    you can find this here https://developer.mbed.org/users/yaw...demo_custom_1/

    int main(){
    uint16_t x1, y1;
    mainscreen();
    while(1){
    BSP_TS_GetState(&TS_State);
    if(TS_State.touchDetected) { /* One or dual touch have been detected */
    x1 = TS_State.touchX[0]; /* Get X and Y position of the first touch post calibrated */
    y1 = TS_State.touchY[0];
    /* string = " x1" , y1 " ; */

    printf("Touch Detected x=%d y=%d\n\r", x1, y1); /* THIS PRINTS THE TOUCH VALES TO THE TERMINAL */
    if ((x1 > 0 & x1 < 88) & (y1 > 392 & y1 < 480)) {
    clearscreen();
    }
    BSP_LCD_SetBackColor(LCD_COLOR_WHITE);
    BSP_LCD_SetTextColor(LCD_COLOR_MAGENTA);
    BSP_LCD_SetFont(&Font16);
    BSP_LCD_DisplayStringAt(x1, y1, (uint8_t *)"< Touch Detected (x1 y1) ", LEFT_MODE); /* ATTEMPTING HERE TO WRITE THOSE VALUES TO THE LCD SCREEN */
    BSP_LCD_SetTextColor(LCD_COLOR_BLUE);
    BSP_LCD_FillRect(x1, y1, 20, 20);
    /* BSP_LCD_FillRect(0, 380, 100, 100); */
    }
    }
    }
  2. #2
  3. Contributed User
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    Jun 2005
    Posts
    4,470
    Rep Power
    1875
    If you lack a BSP_LCD type function that works like printf, I guess you could try the following.
    Code:
    char buff[100];
    sprintf(buff,"< Touch Detected (%d %d)", x1, y1 );
    BSP_LCD_DisplayStringAt(x1, y1, (uint8_t *)buff, LEFT_MODE);
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2017
    Posts
    2
    Rep Power
    0
    Thanks brother... that did the trick... I had been looking at the buffer thing but wasn't sure how to implement it

IMN logo majestic logo threadwatch logo seochat tools logo