From c118d00383ac9d77ea9cb75d8181cf267af6b8ba Mon Sep 17 00:00:00 2001 From: Markus Hitter Date: Sat, 1 Aug 2015 16:06:33 +0200 Subject: [PATCH] ARM: get clock.c in. No code changes neccessary. This code in ifclock(clock_flag_1s) in clock.c should give a nice, accurate clock: static uint8_t minutes = 0, seconds = 0; seconds++; if ( ! (seconds % 60)) { seconds = 0; minutes++; } sersendf_P(PSTR("%su:"), minutes); if (seconds < 10) serial_writechar('0'); sersendf_P(PSTR("%su\n"), seconds); Current sizes are: SIZES ARM... lpc1114 FLASH : 4440 bytes 14% RAM : 200 bytes 5% EEPROM : 0 bytes 0% --- Makefile-ARM | 2 +- clock.c | 6 ++++++ mendel.c | 4 ++-- timer-arm.c | 3 ++- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/Makefile-ARM b/Makefile-ARM index dd735f0..2d0a6ac 100644 --- a/Makefile-ARM +++ b/Makefile-ARM @@ -98,7 +98,7 @@ TARGET = $(PROGRAM).hex # Until the generic ARM port is completed, we'd have to wrap all sources # in #ifdef __AVR__. To avoid this, build only a selection for now: SOURCES = mendel.c cpu.c serial.c sermsg.c sersendf.c delay.c -SOURCES += gcode_parse.c gcode_process.c pinio.c timer.c +SOURCES += gcode_parse.c gcode_process.c pinio.c timer.c clock.c ifeq ($(MCU), lpc1114) SOURCES += cmsis-system_lpc11xx.c endif diff --git a/clock.c b/clock.c index 02c8f8d..e003ec7 100644 --- a/clock.c +++ b/clock.c @@ -71,7 +71,11 @@ void clock_tick(void) { called from clock_10ms(), do not call directly */ static void clock_250ms(void) { + #ifndef __ARMEL_NOTYET__ if (heaters_all_zero()) { + #else + if (1) { + #endif /* __ARMEL_NOTYET__, ! __ARMEL_NOTYET__ */ if (psu_timeout > (30 * 4)) { power_off(); } @@ -114,7 +118,9 @@ static void clock_10ms(void) { // reset watchdog wd_reset(); + #ifndef __ARMEL_NOTYET__ temp_sensor_tick(); + #endif /* __ARMEL_NOTYET__ */ ifclock(clock_flag_250ms) { clock_250ms(); diff --git a/mendel.c b/mendel.c index 05e3a22..dc972e6 100644 --- a/mendel.c +++ b/mendel.c @@ -44,8 +44,8 @@ #include "analog.h" #endif /* __ARMEL_NOTYET__ */ #include "pinio.h" -#ifndef __ARMEL_NOTYET__ #include "clock.h" +#ifndef __ARMEL_NOTYET__ #include "intercom.h" #include "spi.h" #include "sd.h" @@ -222,8 +222,8 @@ int main (void) #endif /* CANNED_CYCLE */ } + #endif /* __ARMEL_NOTYET__ */ clock(); - #endif /* __ARMEL_NOTYET__ */ } } diff --git a/timer-arm.c b/timer-arm.c index 39158ca..3c88df0 100644 --- a/timer-arm.c +++ b/timer-arm.c @@ -8,6 +8,7 @@ #if defined TEACUP_C_INCLUDE && defined __ARMEL__ #include "cmsis-core_cm0.h" +#include "clock.h" /** Timer initialisation. @@ -53,8 +54,8 @@ void timer_init() { */ void SysTick_Handler(void) { - #ifndef __ARMEL_NOTYET__ clock_tick(); + #ifndef __ARMEL_NOTYET__ dda_clock(); #endif /* __ARMEL_NOTYET__ */ }