Subversion Repositories HomeAutomation

Rev

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

Rev 1296 Rev 1307
Line 2... Line 2...
2
#include "sns_Touch.h"
2
#include "sns_Touch.h"
3
point touchBuffer[sns_Touch_BUFFERSIZE];
3
point touchBuffer[sns_Touch_BUFFERSIZE];
4
uint8_t rxbufidx;
4
uint8_t rxbufidx;
5
uint8_t pushStatus;
5
uint8_t pushStatus;
6
point lastValidPoint;
6
point lastValidPoint;
-
 
7
uint8_t timeCnt;
7
 
8
 
8
 
9
 
9
#ifdef sns_Touch_USEEEPROM
10
#ifdef sns_Touch_USEEEPROM
10
#include "sns_Touch_eeprom.h"
11
#include "sns_Touch_eeprom.h"
11
struct eeprom_sns_Touch EEMEM eeprom_sns_Touch =
12
struct eeprom_sns_Touch EEMEM eeprom_sns_Touch =
Line 44... Line 45...
44
   
45
   
45
    rxbufidx = 0;
46
    rxbufidx = 0;
46
    pushStatus = 0;
47
    pushStatus = 0;
47
    lastValidPoint.x=0;
48
    lastValidPoint.x=0;
48
    lastValidPoint.y=0;
49
    lastValidPoint.y=0;
-
 
50
    timeCnt=0;
49
}
51
}
50
 
52
 
51
void sns_Touch_Process(void)
53
void sns_Touch_Process(void)
52
{
54
{
53
   
55
   
54
    if (Timer_Expired(sns_Touch_POLL_TIMER)) {
56
    if (Timer_Expired(sns_Touch_POLL_TIMER)) {
-
 
57
        timeCnt++;
55
        //StdCan_Msg_t txMsg;
58
        //StdCan_Msg_t txMsg;
56
        gpio_set_in(sns_Touch_XPLUS);
59
        gpio_set_in(sns_Touch_XPLUS);
57
        gpio_set_pullup(sns_Touch_XPLUS);   //turn on pullup for x+
60
        gpio_set_pullup(sns_Touch_XPLUS);   //turn on pullup for x+
58
        gpio_set_out(sns_Touch_YPLUS);
61
        gpio_set_out(sns_Touch_YPLUS);
59
        gpio_set_pin(sns_Touch_YPLUS);      //turn on 1 on y+
62
        gpio_set_pin(sns_Touch_YPLUS);      //turn on 1 on y+
Line 125... Line 128...
125
                rxbufidx++;
128
                rxbufidx++;
126
                if (rxbufidx==sns_Touch_BUFFERSIZE)
129
                if (rxbufidx==sns_Touch_BUFFERSIZE)
127
                {
130
                {
128
                    rxbufidx=0;
131
                    rxbufidx=0;
129
                }
132
                }
-
 
133
            }
-
 
134
            if (rxbufidx == 0 || (rxbufidx > 0 && xdiff+ydiff > 10) || timeCnt%sns_Touch_POLL_SEND_RESOLUTION == 0)
130
 
135
            {
131
                StdCan_Msg_t txMsg;
136
                StdCan_Msg_t txMsg;
132
                StdCan_Set_class(txMsg.Header, CAN_MODULE_CLASS_SNS);
137
                StdCan_Set_class(txMsg.Header, CAN_MODULE_CLASS_SNS);
133
                StdCan_Set_direction(txMsg.Header, DIRECTIONFLAG_FROM_OWNER);
138
                StdCan_Set_direction(txMsg.Header, DIRECTIONFLAG_FROM_OWNER);
134
                txMsg.Header.ModuleType = CAN_MODULE_TYPE_SNS_TOUCH;
139
                txMsg.Header.ModuleType = CAN_MODULE_TYPE_SNS_TOUCH;
135
                txMsg.Header.ModuleId = sns_Touch_ID;
140
                txMsg.Header.ModuleId = sns_Touch_ID;