Skip to content
Browse files

clock.c: introduce clock().

This simplifies calls to clock_10ms() a bit and saves 18 bytes
binary size.
  • Loading branch information...
1 parent 97a663a commit f06b013179d1a946b71d33376a5f0e8ea25a1a0b @Traumflug Traumflug committed Sep 2, 2012
Showing with 17 additions and 12 deletions.
  1. +12 −1 clock.c
  2. +1 −0 clock.h
  3. +2 −5 dda_queue.c
  4. +1 −3 gcode_process.c
  5. +1 −3 mendel.c
View
13 clock.c
@@ -65,7 +65,7 @@ void clock_250ms() {
/*! do stuff every 10 milliseconds
- call from ifclock(CLOCK_FLAG_10MS) in busy loops
+ called from clock(), do not call directly
*/
void clock_10ms() {
// reset watchdog
@@ -78,3 +78,14 @@ void clock_10ms() {
}
}
+/*! do reoccuring stuff
+
+ call it occasionally in busy loops
+*/
+void clock() {
+ ifclock(clock_flag_10ms) {
+ clock_10ms();
+ }
+}
+
+
View
1 clock.h
@@ -3,5 +3,6 @@
void clock_250ms(void);
void clock_10ms(void);
+void clock(void);
#endif /* _CLOCK_H */
View
7 dda_queue.c
@@ -198,9 +198,6 @@ void queue_flush() {
/// wait for queue to empty
void queue_wait() {
- for (;queue_empty() == 0;) {
- ifclock(clock_flag_10ms) {
- clock_10ms();
- }
- }
+ while (queue_empty() == 0)
+ clock();
}
View
4 gcode_process.c
@@ -155,9 +155,7 @@ void process_gcode_command() {
// delay
if (next_target.seen_P) {
for (;next_target.P > 0;next_target.P--) {
- ifclock(clock_flag_10ms) {
- clock_10ms();
- }
+ clock();
delay_ms(1);
}
}
View
4 mendel.c
@@ -323,8 +323,6 @@ int main (void)
gcode_parse_char(c);
}
- ifclock(clock_flag_10ms) {
- clock_10ms();
- }
+ clock();
}
}

0 comments on commit f06b013

Please sign in to comment.
Something went wrong with that request. Please try again.