From 39296b40d49b4b6b9373a80de67e017e540f1408 Mon Sep 17 00:00:00 2001 From: Dave Hylands Date: Fri, 26 Sep 2014 09:04:05 -0700 Subject: Fix timer overflow code. Teensy doesn't need to worry about overflows since all of its timers are only 16-bit. For PWM, the pulse width needs to be able to vary from 0..period+1 (pulse-width == period+1 corresponds to 100% PWM) I couldn't test the 0xffffffff cases since we can't currently get a period that big in python. With a prescaler of 0, that corresponds to a freq of 0.039 (i.e. cycle every 25.56 seconds), and we can't set that using freq or period. I also tested both stmhal and teensy with floats disabled, which required a few other code changes to compile. --- extmod/moductypes.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'extmod') diff --git a/extmod/moductypes.c b/extmod/moductypes.c index 73a8db7cc..3e35ed682 100644 --- a/extmod/moductypes.c +++ b/extmod/moductypes.c @@ -309,10 +309,12 @@ STATIC mp_obj_t get_aligned(uint val_type, void *p, mp_int_t index) { case UINT64: case INT64: return mp_obj_new_int_from_ll(((int64_t*)p)[index]); + #if MICROPY_PY_BUILTINS_FLOAT case FLOAT32: return mp_obj_new_float(((float*)p)[index]); case FLOAT64: return mp_obj_new_float(((double*)p)[index]); + #endif default: assert(0); return MP_OBJ_NULL; -- cgit v1.2.3