Rev 1607 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
927 | hbuss | 1 | #include <inttypes.h> |
2 | #include "main.h" |
||
3 | |||
1610 | FredericG | 4 | #define PHOTO_MODE_DELAY 2000/10 |
5 | #define PHOTO_MODE_TRIGGER_TIME 1000/10 |
||
6 | #define PHOTO_MODE_TRIGGER_PERIOD 4000/10 |
||
7 | |||
927 | hbuss | 8 | uint16_t LED1_Timing = 0; |
9 | uint16_t LED2_Timing = 0; |
||
10 | unsigned char J16Blinkcount = 0, J16Mask = 1; |
||
11 | unsigned char J17Blinkcount = 0, J17Mask = 1; |
||
12 | |||
1610 | FredericG | 13 | uint8_t PhotoModeDelayCounter ; |
14 | uint16_t PhotoModelCounter; |
||
15 | |||
16 | |||
17 | |||
18 | |||
927 | hbuss | 19 | // initializes the LED control outputs J16, J17 |
20 | void LED_Init(void) |
||
21 | { |
||
1554 | FredericG | 22 | // set PC2 & PC3 as output (control of J16 & J17) |
23 | DDRC |= (1<<DDC2)|(1<<DDC3); |
||
24 | J16_OFF; |
||
25 | J17_OFF; |
||
26 | J16Blinkcount = 0; J16Mask = 128; |
||
27 | J17Blinkcount = 0; J17Mask = 128; |
||
927 | hbuss | 28 | } |
29 | |||
30 | // called in UpdateMotors() every 2ms |
||
31 | void LED_Update(void) |
||
32 | { |
||
1554 | FredericG | 33 | static char delay = 0; |
1607 | FredericG | 34 | |
1554 | FredericG | 35 | if(!delay--) // 10ms Intervall |
36 | { |
||
37 | delay = 4; |
||
1254 | killagreg | 38 | |
1607 | FredericG | 39 | if (Parameter_J16Timing < 10) |
1554 | FredericG | 40 | { |
1610 | FredericG | 41 | // Low: select camera 1 |
1607 | FredericG | 42 | J16_OFF; |
43 | J17_OFF; |
||
1554 | FredericG | 44 | } |
1607 | FredericG | 45 | else if (Parameter_J16Timing < 180) |
46 | { |
||
1610 | FredericG | 47 | // Middle: select camera 2, no trigger |
1607 | FredericG | 48 | J16_ON; |
49 | J17_OFF; |
||
1610 | FredericG | 50 | PhotoModeDelayCounter = PHOTO_MODE_DELAY; |
51 | PhotoModelCounter = 0; |
||
1607 | FredericG | 52 | } |
1554 | FredericG | 53 | else |
54 | { |
||
1610 | FredericG | 55 | // High: select camera 2 and trigger |
1607 | FredericG | 56 | J16_ON; |
1610 | FredericG | 57 | |
58 | if (PhotoModeDelayCounter) |
||
59 | { |
||
60 | // Not in photo-mode (yet) |
||
61 | PhotoModeDelayCounter--; |
||
62 | J17_ON; |
||
63 | } |
||
64 | else |
||
65 | { |
||
66 | PhotoModelCounter++; |
||
67 | |||
68 | // In photo-mode |
||
69 | if (PhotoModelCounter < PHOTO_MODE_TRIGGER_TIME) |
||
70 | { |
||
71 | J17_ON; |
||
72 | } |
||
73 | else if (PhotoModelCounter < PHOTO_MODE_TRIGGER_PERIOD-PHOTO_MODE_TRIGGER_TIME) |
||
74 | { |
||
75 | J17_OFF; |
||
76 | } |
||
77 | else |
||
78 | { |
||
79 | PhotoModelCounter = 0; |
||
80 | } |
||
81 | } |
||
82 | |||
1554 | FredericG | 83 | } |
84 | } |
||
927 | hbuss | 85 | } |