Subversion Repositories HomeAutomation

Rev

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

Rev 1420 Rev 1502
Line 105... Line 105...
105
    }
105
    }
106
#endif  
106
#endif  
107
    ///Initialize hardware
107
    ///Initialize hardware
108
    uint8_t index = 0;
108
    uint8_t index = 0;
109
#ifdef  act_output_CH0      
109
#ifdef  act_output_CH0
-
 
110
#if act_output_CH0PCA95xxIO==0
110
        gpio_set_statement(chnValue[index],act_output_CH0);
111
        gpio_set_statement(chnValue[index],act_output_CH0);
111
        gpio_set_out(act_output_CH0);
112
        gpio_set_out(act_output_CH0);
-
 
113
#else
-
 
114
        Pca95xx_set_statement(chnValue[index],act_output_CH0);
-
 
115
        Pca95xx_set_out(act_output_CH0);
-
 
116
#endif
112
        index++;
117
        index++;
113
#endif
118
#endif
114
#ifdef  act_output_CH1
119
#ifdef  act_output_CH1
-
 
120
#if act_output_CH1PCA95xxIO==0
115
        gpio_set_statement(chnValue[index],act_output_CH1);
121
        gpio_set_statement(chnValue[index],act_output_CH1);
116
        gpio_set_out(act_output_CH1);
122
        gpio_set_out(act_output_CH1);
-
 
123
#else
-
 
124
        Pca95xx_set_statement(chnValue[index],act_output_CH1);
-
 
125
        Pca95xx_set_out(act_output_CH1);
-
 
126
#endif
117
        index++;
127
        index++;
118
#endif
128
#endif
119
#ifdef  act_output_CH2
129
#ifdef  act_output_CH2
-
 
130
#if act_output_CH2PCA95xxIO==0
120
        gpio_set_statement(chnValue[index],act_output_CH2);
131
        gpio_set_statement(chnValue[index],act_output_CH2);
121
        gpio_set_out(act_output_CH2);
132
        gpio_set_out(act_output_CH2);
-
 
133
#else
-
 
134
        Pca95xx_set_statement(chnValue[index],act_output_CH2);
-
 
135
        Pca95xx_set_out(act_output_CH2);
-
 
136
#endif
122
        index++;
137
        index++;
123
#endif
138
#endif
124
#ifdef  act_output_CH3
139
#ifdef  act_output_CH3
-
 
140
#if act_output_CH3PCA95xxIO==0
125
        gpio_set_statement(chnValue[index],act_output_CH3);
141
        gpio_set_statement(chnValue[index],act_output_CH3);
126
        gpio_set_out(act_output_CH3);
142
        gpio_set_out(act_output_CH3);
-
 
143
#else
-
 
144
        Pca95xx_set_statement(chnValue[index],act_output_CH3);
-
 
145
        Pca95xx_set_out(act_output_CH3);
-
 
146
#endif
-
 
147
        index++;
-
 
148
#endif
-
 
149
#ifdef  act_output_CH4
-
 
150
#if act_output_CH4PCA95xxIO==0
-
 
151
        gpio_set_statement(chnValue[index],act_output_CH4);
-
 
152
        gpio_set_out(act_output_CH4);
-
 
153
#else
-
 
154
        Pca95xx_set_statement(chnValue[index],act_output_CH4);
-
 
155
        Pca95xx_set_out(act_output_CH4);
-
 
156
#endif
127
        index++;
157
        index++;
128
#endif
158
#endif
129
#ifdef  act_output_CH4
-
 
130
        gpio_set_statement(chnValue[index],act_output_CH4);
-
 
131
        gpio_set_out(act_output_CH4);
-
 
132
        index++;
-
 
133
#endif
-
 
134
#ifdef  act_output_CH5
159
#ifdef  act_output_CH5
-
 
160
#if act_output_CH5PCA95xxIO==0
135
        gpio_set_statement(chnValue[index],act_output_CH5);
161
        gpio_set_statement(chnValue[index],act_output_CH5);
136
        gpio_set_out(act_output_CH5);
162
        gpio_set_out(act_output_CH5);
-
 
163
#else
-
 
164
        Pca95xx_set_statement(chnValue[index],act_output_CH5);
-
 
165
        Pca95xx_set_out(act_output_CH5);
-
 
166
#endif
137
        index++;
167
        index++;
138
#endif
168
#endif
139
#ifdef  act_output_CH6
169
#ifdef  act_output_CH6
-
 
170
#if act_output_CH6PCA95xxIO==0
140
        gpio_set_statement(chnValue[index],act_output_CH6);
171
        gpio_set_statement(chnValue[index],act_output_CH6);
141
        gpio_set_out(act_output_CH6);
172
        gpio_set_out(act_output_CH6);
-
 
173
#else
-
 
174
        Pca95xx_set_statement(chnValue[index],act_output_CH6);
-
 
175
        Pca95xx_set_out(act_output_CH6);
-
 
176
#endif
142
        index++;
177
        index++;
143
#endif
178
#endif
144
#ifdef  act_output_CH7
179
#ifdef  act_output_CH7
-
 
180
#if act_output_CH7PCA95xxIO==0
145
        gpio_set_statement(chnValue[index],act_output_CH7);
181
        gpio_set_statement(chnValue[index],act_output_CH7);
146
        gpio_set_out(act_output_CH7);
182
        gpio_set_out(act_output_CH7);
-
 
183
#else
-
 
184
        Pca95xx_set_statement(chnValue[index],act_output_CH7);
-
 
185
        Pca95xx_set_out(act_output_CH7);
-
 
186
#endif
147
        index++;
187
        index++;
148
#endif
188
#endif
149
    // to use PCINt lib, call this function: (the callback function look as a timer callback function)
189
    // to use PCINt lib, call this function: (the callback function look as a timer callback function)
150
    // Pcint_SetCallbackPin(act_output_PCINT, EXP_C , &act_output_pcint_callback);
190
    // Pcint_SetCallbackPin(act_output_PCINT, EXP_C , &act_output_pcint_callback);
151
 
191
 
Line 180... Line 220...
180
        eeprom_write_byte_crc(EEDATA.ch5, chnValue[index], WITHOUT_CRC);
220
        eeprom_write_byte_crc(EEDATA.ch5, chnValue[index], WITHOUT_CRC);
181
        index++;
221
        index++;
182
#endif
222
#endif
183
#ifdef  act_output_CH6
223
#ifdef  act_output_CH6
184
        eeprom_write_byte_crc(EEDATA.ch6, chnValue[index], WITHOUT_CRC);
224
        eeprom_write_byte_crc(EEDATA.ch6, chnValue[index], WITHOUT_CRC);
185
        index++;
225
        index++;
186
#endif
226
#endif
187
#ifdef  act_output_CH7
227
#ifdef  act_output_CH7
188
        eeprom_write_byte_crc(EEDATA.ch7, chnValue[index], WITHOUT_CRC);
228
        eeprom_write_byte_crc(EEDATA.ch7, chnValue[index], WITHOUT_CRC);
189
        index++;
229
        index++;
190
#endif    
230
#endif    
191
        EEDATA_UPDATE_CRC;
231
        EEDATA_UPDATE_CRC;
192
    }
232
    }
Line 208... Line 248...
208
            index = 0;
248
            index = 0;
209
            if (rxMsg->Length == 2) {
249
            if (rxMsg->Length == 2) {
210
    #ifdef  act_output_CH0
250
    #ifdef  act_output_CH0
211
                if (rxMsg->Data[0] == 0) {
251
                if (rxMsg->Data[0] == 0) {
212
                    chnValue[index] = rxMsg->Data[1];
252
                    chnValue[index] = rxMsg->Data[1];
-
 
253
    #if act_output_CH0PCA95xxIO==0
213
                    gpio_set_statement(chnValue[index],act_output_CH0);
254
                    gpio_set_statement(chnValue[index],act_output_CH0);
-
 
255
    #else
-
 
256
                    Pca95xx_set_statement(chnValue[index],act_output_CH0);
-
 
257
    #endif
214
                }              
258
                }
215
                index++;
259
                index++;
216
    #endif
260
    #endif
217
    #ifdef  act_output_CH1
261
    #ifdef  act_output_CH1
218
                if (rxMsg->Data[0] == 1) {
262
                if (rxMsg->Data[0] == 1) {
219
                    chnValue[index] = rxMsg->Data[1];
263
                    chnValue[index] = rxMsg->Data[1];
-
 
264
    #if act_output_CH1PCA95xxIO==0
220
                    gpio_set_statement(chnValue[index],act_output_CH1);
265
                    gpio_set_statement(chnValue[index],act_output_CH1);
-
 
266
    #else
-
 
267
                    Pca95xx_set_statement(chnValue[index],act_output_CH1);
-
 
268
    #endif
221
                }              
269
                }
222
                index++;
270
                index++;
223
    #endif
271
    #endif
224
    #ifdef  act_output_CH2
272
    #ifdef  act_output_CH2
225
                if (rxMsg->Data[0] == 2) {
273
                if (rxMsg->Data[0] == 2) {
226
                    chnValue[index] = rxMsg->Data[1];
274
                    chnValue[index] = rxMsg->Data[1];
-
 
275
    #if act_output_CH2PCA95xxIO==0
227
                    gpio_set_statement(chnValue[index],act_output_CH2);
276
                    gpio_set_statement(chnValue[index],act_output_CH2);
-
 
277
    #else
-
 
278
                    Pca95xx_set_statement(chnValue[index],act_output_CH2);
-
 
279
    #endif
228
                }              
280
                }
229
                index++;
281
                index++;
230
    #endif
282
    #endif
231
    #ifdef  act_output_CH3
283
    #ifdef  act_output_CH3
232
                if (rxMsg->Data[0] == 3) {
284
                if (rxMsg->Data[0] == 3) {
233
                    chnValue[index] = rxMsg->Data[1];
285
                    chnValue[index] = rxMsg->Data[1];
-
 
286
    #if act_output_CH3PCA95xxIO==0
234
                    gpio_set_statement(chnValue[index],act_output_CH3);
287
                    gpio_set_statement(chnValue[index],act_output_CH3);
-
 
288
    #else
-
 
289
                    Pca95xx_set_statement(chnValue[index],act_output_CH3);
-
 
290
    #endif
235
                }              
291
                }
236
                index++;
292
                index++;
237
    #endif
293
    #endif
238
    #ifdef  act_output_CH4
294
    #ifdef  act_output_CH4
239
                if (rxMsg->Data[0] == 4) {
295
                if (rxMsg->Data[0] == 4) {
240
                    chnValue[index] = rxMsg->Data[1];
296
                    chnValue[index] = rxMsg->Data[1];
-
 
297
    #if act_output_CH4PCA95xxIO==0
241
                    gpio_set_statement(chnValue[index],act_output_CH4);
298
                    gpio_set_statement(chnValue[index],act_output_CH4);
-
 
299
    #else
-
 
300
                    Pca95xx_set_statement(chnValue[index],act_output_CH4);
-
 
301
    #endif
242
                }              
302
                }
243
                index++;
303
                index++;
244
    #endif
304
    #endif
245
    #ifdef  act_output_CH5
305
    #ifdef  act_output_CH5
246
                if (rxMsg->Data[0] == 5) {
306
                if (rxMsg->Data[0] == 5) {
247
                    chnValue[index] = rxMsg->Data[1];
307
                    chnValue[index] = rxMsg->Data[1];
-
 
308
    #if act_output_CH5PCA95xxIO==0
248
                    gpio_set_statement(chnValue[index],act_output_CH5);
309
                    gpio_set_statement(chnValue[index],act_output_CH5);
-
 
310
    #else
-
 
311
                    Pca95xx_set_statement(chnValue[index],act_output_CH5);
-
 
312
    #endif
249
                }              
313
                }
250
                index++;
314
                index++;
251
    #endif
315
    #endif
252
    #ifdef  act_output_CH6
316
    #ifdef  act_output_CH6
253
                if (rxMsg->Data[0] == 6) {
317
                if (rxMsg->Data[0] == 6) {
254
                    chnValue[index] = rxMsg->Data[1];
318
                    chnValue[index] = rxMsg->Data[1];
-
 
319
    #if act_output_CH6PCA95xxIO==0
255
                    gpio_set_statement(chnValue[index],act_output_CH6);
320
                    gpio_set_statement(chnValue[index],act_output_CH6);
-
 
321
    #else
-
 
322
                    Pca95xx_set_statement(chnValue[index],act_output_CH6);
-
 
323
    #endif
256
                }              
324
                }
257
                index++;
325
                index++;
258
    #endif
326
    #endif
259
    #ifdef  act_output_CH7
327
    #ifdef  act_output_CH7
260
                if (rxMsg->Data[0] == 7) {
328
                if (rxMsg->Data[0] == 7) {
261
                    chnValue[index] = rxMsg->Data[1];
329
                    chnValue[index] = rxMsg->Data[1];
-
 
330
    #if act_output_CH7PCA95xxIO==0
262
                    gpio_set_statement(chnValue[index],act_output_CH7);
331
                    gpio_set_statement(chnValue[index],act_output_CH7);
-
 
332
    #else
-
 
333
                    Pca95xx_set_statement(chnValue[index],act_output_CH7);
-
 
334
    #endif
263
                }              
335
                }
264
                index++;
336
                index++;
265
    #endif    
337
    #endif    
266
                Timer_SetTimeout(act_output_STORE_VALUE_TIMEOUT, act_output_STORE_VALUE_TIMEOUT_TIME_S*1000, TimerTypeOneShot, 0);
338
                Timer_SetTimeout(act_output_STORE_VALUE_TIMEOUT, act_output_STORE_VALUE_TIMEOUT_TIME_S*1000, TimerTypeOneShot, 0);
267
                StdCan_Set_direction(rxMsg->Header, DIRECTIONFLAG_FROM_OWNER);
339
                StdCan_Set_direction(rxMsg->Header, DIRECTIONFLAG_FROM_OWNER);