Subversion Repositories HomeAutomation

Rev

Rev 1290 | Rev 1293 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed

Rev 1290 Rev 1292
Line 56... Line 56...
56
F4: Klar
56
F4: Klar
57
F5: Klar
57
F5: Klar
58
F6: Klar
58
F6: Klar
59
F7: Klar
59
F7: Klar
60
F8: Klar? (kontrollera funktion)
60
F8: Klar? (kontrollera funktion)
61
F9:
61
F9: Klar
62
*/
62
*/
63
 
63
 
64
/*
64
/*
65
Touch gesture parser
65
Touch gesture parser
66
Implementation of 'A new gesture recognition algorithm and segmentation
66
Implementation of 'A new gesture recognition algorithm and segmentation
Line 74... Line 74...
74
To fix:
74
To fix:
75
Break out to a driver file
75
Break out to a driver file
76
*/
76
*/
77
gesture parseBuffer(point *buffer, uint8_t startIndex, uint8_t endIndex)
77
gesture parseBuffer(point *buffer, uint8_t startIndex, uint8_t endIndex)
78
{
78
{
79
    int16_t f1_k = 0, f3_tmp = 0, f4_tmp = 0, f5_tmp = 0, f9_tmp = 0;
79
    int16_t f1_k = 0, f3_tmp = 0, f4_tmp = 0, f5_tmp = 0;
80
    uint8_t f7_tmp = 0, f7_sign = 0, f1_sign = 0, f3_yref = 0, xMin, xMax, yMin, yMax;
80
    uint8_t f7_tmp = 0, f7_sign = 0, f1_sign = 0, f3_yref = 0, xMin, xMax, yMin, yMax, f9_tmp;
81
    gesture functionData;
81
    gesture functionData;
82
    functionData.f1=0;
82
    functionData.f1=0;
83
    functionData.f7=0;
83
    functionData.f7=0;
84
   
84
   
85
    /* Function 6 indicates the sign value of the y coordinates of the last point minus y coordinates of the first point */
85
    /* Function 6 indicates the sign value of the y coordinates of the last point minus y coordinates of the first point */
Line 122... Line 122...
122
        if (buffer[i].x > min(buffer[startIndex].x, buffer[endIndex].x) && buffer[i].x < max(buffer[startIndex].x, buffer[endIndex].x))
122
        if (buffer[i].x > min(buffer[startIndex].x, buffer[endIndex].x) && buffer[i].x < max(buffer[startIndex].x, buffer[endIndex].x))
123
        {
123
        {
124
            f3_tmp += f3_yref - (buffer[i].y + buffer[i-1].y)/2;
124
            f3_tmp += f3_yref - (buffer[i].y + buffer[i-1].y)/2;
125
        }
125
        }
126
       
126
       
127
        /* find min an max of x and y */
127
        /* find min and max of x and y */
128
        if (xMin > buffer[i].x)
128
        if (xMin > buffer[i].x)
129
        {
129
        {
130
            xMin = buffer[i].x;
130
            xMin = buffer[i].x;
131
        }
131
        }
132
        if (xMax < buffer[i].x)
132
        if (xMax < buffer[i].x)
Line 197... Line 197...
197
        functionData.f3 = CAN_MODULE_ENUM_TOUCH_GESTURE_F3_M;
197
        functionData.f3 = CAN_MODULE_ENUM_TOUCH_GESTURE_F3_M;
198
    }
198
    }
199
       
199
       
200
    /* Function 9 represents the sign value of the multiplication of x coordinates of the first point and the last point
200
    /* Function 9 represents the sign value of the multiplication of x coordinates of the first point and the last point
201
    minus the mediate value of x coordinates of all the points */
201
    minus the mediate value of x coordinates of all the points */
202
    f9_tmp = ((buffer[startIndex].x - (xMax+xMin)/2)*(buffer[endIndex].x - (xMax+xMin)/2));
202
    //f9_tmp = ((buffer[startIndex].x - (xMax+xMin)/2)*(buffer[endIndex].x - (xMax+xMin)/2));
-
 
203
   
-
 
204
    f9_tmp = ((buffer[startIndex].x - (xMax+xMin)/2 > 0) ^ (buffer[endIndex].x - (xMax+xMin)/2 > 0));
-
 
205
   
203
    functionData.f9 = CAN_MODULE_ENUM_TOUCH_GESTURE_F9_M;
206
    functionData.f9 = CAN_MODULE_ENUM_TOUCH_GESTURE_F9_M;
204
    if (f9_tmp > 0)
207
    if (!f9_tmp)
205
    {
208
    {
206
        functionData.f9 = CAN_MODULE_ENUM_TOUCH_GESTURE_F9_P;
209
        functionData.f9 = CAN_MODULE_ENUM_TOUCH_GESTURE_F9_P;
207
    }
210
    }
208
   
211
   
209
    /* Function 5 checks the sign value of the sum of the x coordinates of all the points that constitute strokes
212
    /* Function 5 checks the sign value of the sum of the x coordinates of all the points that constitute strokes