Subversion Repositories HomeAutomation

Rev

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

Rev 277 Rev 282
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-31 14:04:02 +0100 (Wed, 31 Jan 2007) $
7
 * Last changed:    $LastChangedDate: 2007-02-03 16:58:13 +0100 (Sat, 03 Feb 2007) $
8
 * By:              $LastChangedBy: johboh $
8
 * By:              $LastChangedBy: johboh $
9
 * Revision:        $Revision: 277 $
9
 * Revision:        $Revision: 282 $
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
 
-
 
51
   
49
 
52
 
50
 
53
    while(1)
51
    while(1)
54
    {
52
    {
55
        static TICK t = 0;
53
        static TICK t = 0;
56
        static TICK temperature = 0;
54
        static TICK temperature = 0;
57
        static BYTE lastTemperature = TEMPERATURE_INSIDE;
55
        static BYTE lastTemperature = TEMPERATURE_INSIDE;
58
        static signed int angle = 90;
56
        static signed char angle = 70;
59
        static TICK blinds = 0;
57
        static TICK blinds = 0;
60
       
58
       
61
        if ((tickGet()-t)>TICK_SECOND)
59
        if ((tickGet()-t)>TICK_SECOND)
62
        {
60
        {
63
            LED0_IO=~LED0_IO;
61
            LED0_IO=~LED0_IO;
Line 65... Line 63...
65
        }
63
        }
66
 
64
 
67
        #ifdef USE_BLINDS
65
        #ifdef USE_BLINDS
68
        if ((tickGet()-blinds)>2*TICK_SECOND)
66
        if ((tickGet()-blinds)>2*TICK_SECOND)
69
        {
67
        {
70
            angle = (angle>0?-45:45);
68
            angle = (angle>0?-70:70);
71
            blindsTurn(angle);
69
            blindsTurn(angle);
72
            blinds = tickGet();
70
            blinds = tickGet();
73
        }
71
        }
74
        #endif
72
        #endif
75
 
73