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 | * Functions for controlling blinds |
3 | * Functions for controlling blinds |
| 4 | * |
4 | * |
| 5 | ********************************************************************* |
5 | ********************************************************************* |
| 6 | * FileName: $HeadURL: https://svn.auml.se/svn/HomeAutomation/trunk/EmbeddedSoftware/PIC/canTemp/Source/blinds.c $ |
6 | * FileName: $HeadURL: https://svn.auml.se/svn/HomeAutomation/trunk/EmbeddedSoftware/PIC/canTemp/Source/blinds.c $ |
| 7 | * Last changed: $LastChangedDate: 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: |
9 | * Revision: $Revision: 282 $ |
| 10 | ********************************************************************/ |
10 | ********************************************************************/ |
| 11 | #include <blinds.h> |
11 | #include <blinds.h> |
| 12 | 12 | ||
| 13 | #ifdef USE_BLINDS |
13 | #ifdef USE_BLINDS |
| 14 | 14 | ||
| Line 42... | Line 42... | ||
| 42 | * Output: none. |
42 | * Output: none. |
| 43 | * Pre-conditions: none |
43 | * Pre-conditions: none |
| 44 | * Affects: none. |
44 | * Affects: none. |
| 45 | * Depends: none. |
45 | * Depends: none. |
| 46 | */ |
46 | */ |
| 47 | void blindsTurn(signed |
47 | void blindsTurn(signed char angle) |
| 48 | { |
48 | { |
| 49 | // 65536-TIME/0,0000001 |
49 | // 65536-TIME/0,0000001 |
| 50 | // -90 0.5 ms = 60536 (5000) |
50 | // -90 0.5 ms = 60536 (5000) |
| 51 | // 0 1.5 ms = 50536 (15000) |
51 | // 0 1.5 ms = 50536 (15000) |
| 52 | // 90 2.5 ms = 40536 (25000) |
52 | // 90 2.5 ms = 40536 (25000) |
| 53 | 53 | ||
| 54 | if (angle<-90) timerVal=60536; |
54 | if (angle<-90) timerVal=60536; |
| 55 | else if (angle>90) timerVal=40536; |
55 | else if (angle>90) timerVal=40536; |
| 56 | else |
56 | else |
| 57 | { |
57 | { |
| 58 | timerVal=60536-( |
58 | timerVal=60536-(unsigned int)((90+(signed int)angle)*111.111); |
| 59 | } |
59 | } |
| 60 | } |
60 | } |
| 61 | 61 | ||
| 62 | 62 | ||
| 63 | /* |
63 | /* |