|
42 | 42 | // Header Interface |
43 | 43 | #include "minbasecli_avr.h" |
44 | 44 |
|
45 | | -// Device/Framework Libraries |
46 | | -#if defined(MINBASECLI_USE_MILLIS) |
47 | | - #include <avr/io.h> |
48 | | - #include <avr/interrupt.h> |
49 | | -#endif |
50 | | - |
51 | 45 | // (UART Driver) |
52 | 46 | #include "avr_uart.h" |
53 | 47 |
|
|
63 | 57 |
|
64 | 58 | /*****************************************************************************/ |
65 | 59 |
|
66 | | -/* In-Scope Global Elements */ |
67 | | - |
68 | | -#if defined(MINBASECLI_USE_MILLIS) |
69 | | - volatile uint32_t systick; |
70 | | -#endif |
71 | | - |
72 | | -/*****************************************************************************/ |
73 | | - |
74 | 60 | /* Constructor */ |
75 | 61 |
|
76 | 62 | /** |
@@ -144,59 +130,6 @@ void MINBASECLI_AVR::hal_iface_print(const uint8_t data_byte) |
144 | 130 | _Serial->write(data_byte); |
145 | 131 | } |
146 | 132 |
|
147 | | -/** |
148 | | - * @brief Timer1 setup and initialization to count System Tick. |
149 | | - */ |
150 | | -void MINBASECLI_AVR::hal_millis_init() |
151 | | -{ |
152 | | - #if defined(MINBASECLI_USE_MILLIS) |
153 | | - unsigned long t_overflow; |
154 | | - |
155 | | - // Timer1 clock divisor 8 and clear at overflow |
156 | | - TCCR1B |= (1 << WGM12) | (1 << CS11); |
157 | | - |
158 | | - // Set timer overflow for 1ms |
159 | | - t_overflow = ((F_CPU / 1000) / 8); |
160 | | - OCR1AH = (t_overflow >> 8); |
161 | | - OCR1AL = t_overflow; |
162 | | - |
163 | | - // Enable Timer1 compare match interrupt |
164 | | - TIMSK1 |= (1 << OCIE1A); |
165 | | - |
166 | | - // Enbale Global Interrupts |
167 | | - sei(); |
168 | | - #endif /* defined(MINBASECLI_USE_MILLIS) */ |
169 | | -} |
170 | | - |
171 | | -/** |
172 | | - * @brief Get system-tick in ms (number of ms since system boot). |
173 | | - * @return The number of milliseconds. |
174 | | - */ |
175 | | -uint32_t MINBASECLI_AVR::hal_millis() |
176 | | -{ |
177 | | - #if defined(MINBASECLI_USE_MILLIS) |
178 | | - return systick; |
179 | | - #else |
180 | | - return 0; |
181 | | - #endif /* defined(MINBASECLI_USE_MILLIS) */ |
182 | | -} |
183 | | - |
184 | | -/*****************************************************************************/ |
185 | | - |
186 | | -/* Millis Implementation */ |
187 | | - |
188 | | -#if defined(MINBASECLI_USE_MILLIS) |
189 | | - |
190 | | - /** |
191 | | - * @brief Timer1 Interrupt Service Rutine for System Tick counter. |
192 | | - */ |
193 | | - ISR(TIMER1_COMPA_vect) |
194 | | - { |
195 | | - systick = systick + 1; |
196 | | - } |
197 | | - |
198 | | -#endif /* defined(MINBASECLI_USE_MILLIS) */ |
199 | | - |
200 | 133 | /*****************************************************************************/ |
201 | 134 |
|
202 | 135 | #endif /* defined(__AVR) && !defined(ARDUINO) */ |
0 commit comments