Premier TD presentiel

Dependencies:   mbed BSP_DISCO_F746NG

main.cpp

Committer:
valentin__
Date:
2020-11-04
Revision:
2:3070bad3789b
Parent:
1:80d2a1719d10

File content as of revision 2:3070bad3789b:

#include "mbed.h"
#include "stm32746g_discovery_lcd.h"
#include "stm32746g_discovery_ts.h"
#include "fonctions.h"

int main()
{

    uint16_t x;
    uint8_t temps = 700;
    int NumeroPage = 0;


    BSP_LCD_Init(); //Initialisation LCD
    BSP_LCD_LayerDefaultInit(LTDC_ACTIVE_LAYER, LCD_FB_START_ADDRESS);
    BSP_LCD_SelectLayer(LTDC_ACTIVE_LAYER);

    TS_StateTypeDef TS_State;
    BSP_TS_Init(BSP_LCD_GetXSize(), BSP_LCD_GetYSize()); // Initialisation de la fonction tactile
    AfficherPage(0);
    while (1) {
        
        BSP_TS_GetState(&TS_State);
        
        if (TS_State.touchEventId [0] == TOUCH_EVENT_PRESS_DOWN ) {  
            
            //LaisseAppuyer = true;
            x = TS_State.touchX[0];
            //y = TS_State.touchY[0];

            if (x<= 237) {
                NumeroPage = NumeroPage - 1;
                TS_State.touchEventId [0] = 0;
                //LaisseAppuyer = false;

            } else if (x > 237){
                NumeroPage =NumeroPage +1;
                TS_State.touchEventId [0] = 0;
                //LaisseAppuyer = false;
            }
            AfficherPage(NumeroPage);
            HAL_Delay(temps);
        }
    
    }
}