Subversion Repositories HomeAutomation

Rev

Rev 276 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed

Rev 276 Rev 277
Line 2... Line 2...
2
 *
2
 *
3
 *                  Main application
3
 *                  Main application
4
 *
4
 *
5
 *********************************************************************
5
 *********************************************************************
6
 * FileName:        $HeadURL: https://svn.auml.se/svn/HomeAutomation/trunk/EmbeddedSoftware/PIC/canTemp/Source/Main.c $
6
 * FileName:        $HeadURL: https://svn.auml.se/svn/HomeAutomation/trunk/EmbeddedSoftware/PIC/canTemp/Source/Main.c $
7
 * Last changed:    $LastChangedDate: 2007-01-30 12:53:25 +0100 (Tue, 30 Jan 2007) $
7
 * Last changed:    $LastChangedDate: 2007-01-31 14:04:02 +0100 (Wed, 31 Jan 2007) $
8
 * By:              $LastChangedBy: johboh $
8
 * By:              $LastChangedBy: johboh $
9
 * Revision:        $Revision: 276 $
9
 * Revision:        $Revision: 277 $
10
 ********************************************************************/
10
 ********************************************************************/
11
 
11
 
12
 
12
 
13
#include <compiler.h>
13
#include <compiler.h>
14
#include <stackTasks.h>
14
#include <stackTasks.h>
Line 44... Line 44...
44
    #endif
44
    #endif
45
 
45
 
46
    #ifdef USE_BLINDS
46
    #ifdef USE_BLINDS
47
        blindsInit();
47
        blindsInit();
48
    #endif
48
    #endif
-
 
49
 
-
 
50
 
49
 
51
   
50
 
52
 
51
    while(1)
53
    while(1)
52
    {
54
    {
53
        static TICK t = 0;
55
        static TICK t = 0;
54
        static TICK temperature = 0;
56
        static TICK temperature = 0;
55
        static BYTE lastTemperature = TEMPERATURE_INSIDE;
57
        static BYTE lastTemperature = TEMPERATURE_INSIDE;
56
 
-
 
-
 
58
        static signed int angle = 90;
57
        static TICK blinds = 0;
59
        static TICK blinds = 0;
58
       
60
       
59
        if ((tickGet()-t)>TICK_SECOND)
61
        if ((tickGet()-t)>TICK_SECOND)
60
        {
62
        {
61
            LED0_IO=~LED0_IO;
63
            LED0_IO=~LED0_IO;
62
            t = tickGet();
64
            t = tickGet();
63
        }
65
        }
64
 
66
 
-
 
67
        #ifdef USE_BLINDS
65
        if ((tickGet()-blinds)>2*TICK_SECOND)
68
        if ((tickGet()-blinds)>2*TICK_SECOND)
66
        {
69
        {
-
 
70
            angle = (angle>0?-45:45);
67
            //blindsTurn(MIDDLE,3000);
71
            blindsTurn(angle);
68
            blinds = tickGet();
72
            blinds = tickGet();
69
        }
73
        }
70
   
74
        #endif
71
 
75
 
72
 
76
 
73
        #ifdef USE_ADC
77
        #ifdef USE_ADC
74
        if ((tickGet()-temperature)>TICK_SECOND*2) // Each 2 second, read temperature.
78
        if ((tickGet()-temperature)>TICK_SECOND*2) // Each 2 second, read temperature.
75
        {
79
        {