#include                      //Defines NULL
#include                     //Defines true
#include                      //Defines EXIT_FAILURE
#include "definitions.h"
#include "touch/touch_api_ptc.h"        //SYS function prototypes

extern volatile uint8_t measurement_done_touch; 
void touch_status_display1(void);

int main(void) {
    /* Initialize all modules */
    SYS_Initialize(NULL);
    touch_init();
    while (1) {
        touch_process();
        if (measurement_done_touch == 1) {
            touch_status_display1();
            measurement_done_touch =0;
        }
    }
    /* Execution should not come here during normal operation */
    return ( EXIT_FAILURE);
}
void touch_status_display1()
{
    uint8_t key_status1 = 0;    
    uint8_t  scroller_status1   = 0;
    uint16_t scroller_position1 = 0;    
    key_status1 = get_sensor_state(0) & 0x80;
    if (0u != key_status1) {
        LED_BUTTON_0_Clear();
    } else {
        LED_BUTTON_0_Set();
    }
    key_status1 = get_sensor_state(1) & 0x80;
    if (0u != key_status1) {
        LED_BUTTON_1_Clear();
    } else {
        LED_BUTTON_1_Set();
    }
    scroller_status1   = get_scroller_state(0);
    scroller_position1 = get_scroller_position(0);
    LED_SLIDER_0_Set();
    LED_SLIDER_1_Set();
    LED_SLIDER_2_Set();
    LED_SLIDER_3_Set();
    LED_SLIDER_4_Set();
    LED_SLIDER_5_Set();

    if (0u != scroller_status1) {
        LED_SLIDER_0_Clear();
        if (scroller_position1 > 43) {
            LED_SLIDER_1_Clear();
        }
        if (scroller_position1 > 85) {
            LED_SLIDER_2_Clear();
        }
        if (scroller_position1 > 120) {
            LED_SLIDER_3_Clear();
        }
        if (scroller_position1 > 165) {
            LED_SLIDER_4_Clear();
        }
        if (scroller_position1 > 213) {
            LED_SLIDER_5_Clear();
        }
    }
}