Rev 1077 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1077 | Rev 1078 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | #include <avr/io.h> |
1 | #include <avr/io.h> |
2 | #include <avr/interrupt.h> |
2 | #include <avr/interrupt.h> |
3 | #include "fc.h" |
3 | #include "fc.h" |
4 | #include "eeprom.h" |
4 | #include "eeprom.h" |
5 | #include "uart.h" |
5 | #include "uart.h" |
- | 6 | #include "main.h" |
|
Line 6... | Line 7... | ||
6 | 7 | ||
Line -... | Line 8... | ||
- | 8 | volatile uint16_t ServoValue = 0; |
|
- | 9 | ||
Line 7... | Line 10... | ||
7 | volatile uint16_t ServoValue = 0; |
10 | #define HEF4017R_ON PORTC |= (1<<PORTC6) |
8 | 11 | #define HEF4017R_OFF PORTC &= ~(1<<PORTC6) |
|
9 | 12 | ||
Line 22... | Line 25... | ||
22 | 25 | ||
23 | // set PD7 as output of the PWM for nick servo |
26 | // set PD7 as output of the PWM for nick servo |
24 | DDRD |=(1<<DDD7); |
27 | DDRD |= (1<<DDD7); |
Line -... | Line 28... | ||
- | 28 | PORTD &= ~(1<<PORTD7); // set PD7 to low |
|
- | 29 | ||
Line 25... | Line 30... | ||
25 | PORTD &= ~(1<<PORTD7); // set PD7 to low |
30 | DDRC |= (1<<DDC6); // set PC6 as output (Reset for HEF4017) |
Line 26... | Line 31... | ||
26 | 31 | PORTC &= ~(1<<PORTC6); // set PC6 to low |
|
27 | 32 | ||
Line 68... | Line 73... | ||
68 | static uint16_t FilterServo = 100; // initial value, after some iterations it becomes the average value of 2 * FCParam.ServoNickControl |
73 | static uint16_t FilterServo = 100; // initial value, after some iterations it becomes the average value of 2 * FCParam.ServoNickControl |
69 | static uint16_t ServoState = 40; // cycle down counter for this ISR |
74 | static uint16_t ServoState = 40; // cycle down counter for this ISR |
Line 70... | Line 75... | ||
70 | 75 | ||
Line 71... | Line -... | ||
71 | #define MULTIPLIER 4 |
- | |
- | 76 | #define MULTIPLIER 4 |
|
72 | 77 | ||
73 | 78 | if(BoardRelease < 99) |
|
74 | 79 | { |
|
75 | switch(ServoState) |
80 | switch(ServoState) |
76 | { |
81 | { |
77 | case 4: |
82 | case 4: |
Line 146... | Line 151... | ||
146 | default: |
151 | default: |
147 | // do nothing |
152 | // do nothing |
148 | break; |
153 | break; |
149 | } |
154 | } |
150 | ServoState--; |
155 | ServoState--; |
- | 156 | } // EOF BoardRelease < 20 |
|
- | 157 | else // output to HEF4014 |
|
- | 158 | { |
|
- | 159 | // code for HEF4014 output must be placed here |
|
- | 160 | } |
|
151 | } |
161 | } |