Rev 2125 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2125 | Rev 2132 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | #include <inttypes.h> |
1 | #include <inttypes.h> |
2 | #include <avr/io.h> |
2 | #include <avr/io.h> |
3 | #include <avr/interrupt.h> |
3 | #include <avr/interrupt.h> |
- | 4 | #include <avr/wdt.h> |
|
4 | #include "eeprom.h" |
5 | #include "eeprom.h" |
5 | #include "analog.h" |
6 | #include "analog.h" |
6 | #include "controlMixer.h" |
7 | #include "controlMixer.h" |
Line 7... | Line 8... | ||
7 | 8 | ||
Line 147... | Line 148... | ||
147 | 148 | ||
148 | // ----------------------------------------------------------------------- |
149 | // ----------------------------------------------------------------------- |
149 | void delay_ms(uint16_t w) { |
150 | void delay_ms(uint16_t w) { |
150 | uint16_t t_stop = setDelay(w); |
151 | uint16_t t_stop = setDelay(w); |
151 | while (!checkDelay(t_stop)) |
152 | while (!checkDelay(t_stop)) |
152 | ; |
153 | wdt_reset(); |
Line 153... | Line 154... | ||
153 | } |
154 | } |
154 | 155 | ||
155 | // ----------------------------------------------------------------------- |
156 | // ----------------------------------------------------------------------- |
156 | void delay_ms_with_adc_measurement(uint16_t w, uint8_t stop) { |
157 | void delay_ms_with_adc_measurement(uint16_t w, uint8_t stop) { |
157 | uint16_t t_stop; |
158 | uint16_t t_stop; |
- | 159 | t_stop = setDelay(w); |
|
158 | t_stop = setDelay(w); |
160 | while (!checkDelay(t_stop)) { |
159 | while (!checkDelay(t_stop)) { |
161 | wdt_reset(); |
160 | if (analogDataReady) { |
162 | if (analogDataReady) { |
161 | analog_update(); |
163 | analog_update(); |
162 | startAnalogConversionCycle(); |
164 | startAnalogConversionCycle(); |
163 | } |
165 | } |
164 | } |
166 | } |
165 | if (stop) { |
167 | if (stop) { |
166 | // Wait for new samples to get prepared but do not restart AD conversion after that! |
168 | // Wait for new samples to get prepared but do not restart AD conversion after that! |
167 | // Caller MUST to that. |
169 | // Caller MUST to that. |
168 | while (!analogDataReady); |
170 | if (!analogDataReady) wdt_reset(); |
Line 169... | Line 171... | ||
169 | } |
171 | } |
170 | } |
172 | } |