summaryrefslogtreecommitdiff
path: root/teensy
AgeCommit message (Collapse)Author
2015-08-03stmhal: Factor GPIO clock enable logic into mp_hal_gpio_clock_enable.Damien George
Extracted GPIO clock enable logic into mp_hal_gpio_clock_enable and called from anyplace which might need to use GPIO functions on ports other than A-D. Thanks to Dave Hylands for the patch.
2015-05-13teensy: Add readinto and readlines qstrs.Damien George
2015-04-16py: Overhaul and simplify printf/pfenv mechanism.Damien George
Previous to this patch the printing mechanism was a bit of a tangled mess. This patch attempts to consolidate printing into one interface. All (non-debug) printing now uses the mp_print* family of functions, mainly mp_printf. All these functions take an mp_print_t structure as their first argument, and this structure defines the printing backend through the "print_strn" function of said structure. Printing from the uPy core can reach the platform-defined print code via two paths: either through mp_sys_stdout_obj (defined pert port) in conjunction with mp_stream_write; or through the mp_plat_print structure which uses the MP_PLAT_PRINT_STRN macro to define how string are printed on the platform. The former is only used when MICROPY_PY_IO is defined. With this new scheme printing is generally more efficient (less layers to go through, less arguments to pass), and, given an mp_print_t* structure, one can call mp_print_str for efficiency instead of mp_printf("%s", ...). Code size is also reduced by around 200 bytes on Thumb2 archs.
2015-04-05teensy: Fix function prototype.Paul Sokolovsky
2015-04-05string0.c: Move from stmhal/ to lib/.Paul Sokolovsky
2015-02-13stmhal: Make pybstdio usable by other ports, and use it.Damien George
Now all ports can use pybstdio.c to provide sys.stdin/stdout/stderr, so long as they implement mp_hal_stdin_* and mp_hal_stdout_* functions.
2015-02-04fix type errorLi lin
2015-01-29py: Change vstr_null_terminate -> vstr_null_terminated_str, returns str.Damien George
2015-01-28py: Change vstr so that it doesn't null terminate buffer by default.Damien George
This cleans up vstr so that it's a pure "variable buffer", and the user can decide whether they need to add a terminating null byte. In most places where vstr is used, the vstr did not need to be null terminated and so this patch saves code size, a tiny bit of RAM, and makes vstr usage more efficient. When null termination is needed it must be done explicitly using vstr_null_terminate.
2015-01-12teensy: Update for readline module moved to lib/.Paul Sokolovsky
2015-01-09py: Disable stack checking by default; enable on most ports.Damien George
2015-01-07stmhal: Collect all root pointers together in 1 place.Damien George
A GC in stmhal port now only scans true root pointers, not entire BSS. This reduces base GC time from 1700ms to 900ms.
2015-01-07py: Put all global state together in state structures.Damien George
This patch consolidates all global variables in py/ core into one place, in a global structure. Root pointers are all located together to make GC tracing easier and more efficient.
2015-01-01teensy: Prefix includes with py/; remove need for -I../py.Damien George
2014-12-27Makefiles: Support py/*.h includes per #1022.Paul Sokolovsky
2014-12-08modsys: Add sys.print_exception(exc, file=sys.stdout) function.Paul Sokolovsky
The function is modeled after traceback.print_exception(), but unbloated, and put into existing module to save overhead on adding another module. Compliant traceback.print_exception() is intended to be implemented in micropython-lib in terms of sys.print_exception(). This change required refactoring mp_obj_print_exception() to take pfenv_t interface arguments. Addresses #751.
2014-11-29Use MP_DEFINE_CONST_DICT macro to define module dicts.Damien George
This is just a clean-up of the code. Generated code is exactly the same.
2014-11-27stmhal: Reduce coupling between USB driver and readline.Damien George
This makes it easier to re-use readline.c and pyexec.c from stmhal in other ports.
2014-11-17ports: Define mp_off_t.Paul Sokolovsky
2014-10-29Add -Wpointer-arith flag to prevent problems with pointer arithmetic on void*stijn
2014-10-21stmhal: Overhaul UART class to use read/write, and improve it.v1.3.4Damien George
UART object now uses a stream-like interface: read, readall, readline, readinto, readchar, write, writechar. Timeouts are configured when the UART object is initialised, using timeout and timeout_char keyword args. The object includes optional read buffering, using interrupts. You can set the buffer size dynamically using read_buf_len keyword arg. A size of 0 disables buffering.
2014-09-29stmhal: Fix edge case for timer PWM of 100%.Damien George
Also improve precision of calculating PWM percent in integer mode. Also update teensy with edge case fix.
2014-09-29Merge pull request #881 from dhylands/elapsedDamien George
Added pyb.elapsed_millis and pyb.elapsed_micros
2014-09-29Merge pull request #880 from dhylands/irq-alignDamien George
teensy: Enable 8-byte stack alignment for IRQ Handlers.
2014-09-28Added pyb.elapsed_millis and pyb.elapsed_microsDave Hylands
tested using: stmhal: https://github.com/dhylands/upy-examples/blob/master/elapsed.py teensy: https://github.com/dhylands/upy-examples/blob/master/teensy/elapsed.py
2014-09-28teensy: Enable 8-byte stack alignment for IRQ Handlers.Dave Hylands
2014-09-27Fix timer overflow code.Dave Hylands
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.
2014-09-25stmhal, timer: Factor code to compute PWM percent; improve 32bit case.Damien George
Also do the same for teensy timer code.
2014-09-23Add pulse_width_percent to teensy.Dave Hylands
Fix stmhal and teensy print routines to report actual prescaler an period. Fix teensy build to use soft-float Add USE_ARDUINO_TOOLCHAIN option to teensy build
2014-09-19Add Timer support (PWM, OC, IC) for stmhal and teensyDave Hylands
2014-09-15py: Move definition of mp_sys_exit to core.Damien George
sys.exit always raises SystemExit so doesn't need a special implementation for each port. If C exit() is really needed, use the standard os._exit function. Also initialise mp_sys_path and mp_sys_argv in teensy port.
2014-08-30Update teensy README.md fileDave Hylands
Thanks to Artur Wroblewski for some suggested changes. I also added the TIPs section at the end while I was updating.
2014-08-25teensy: Fix multiple definition of irq functions.Damien George
2014-08-25stmhal: Use MP_OBJ_NEW_SMALL_INT directly in pyb.micros/millis.Damien George
Also some whitespace cleanup.
2014-08-25Add save/restore_irqDave Hylands
Factored irq functions into a separate file.
2014-08-25stmhal: Make enable_irq and disable_irq inline functions.Damien George
These functions are generally 1 machine instruction, and are used in critical code, so makes sense to have them inline. Also leave these functions uninverted (ie 0 means enable, 1 means disable) and provide macro constants if you really need to distinguish the states. This makes for smaller code as well (combined with inlining). Applied to teensy port as well.
2014-08-25Add save/restore_irqDave Hylands
Factored irq functions into a separate file.
2014-08-24py: Fix bug where GC collected native/viper/asm function data.Damien George
Because (for Thumb) a function pointer has the LSB set, pointers to dynamic functions in RAM (eg native, viper or asm functions) were not being traced by the GC. This patch is a comprehensive fix for this. Addresses issue #820.
2014-08-16teensy/README.md (corrected typo)Dan Peirce
2014-08-16modified: teensy/README.mdDan Peirce
Updated teensy/README.md to reflect change in build process (teensyduino is no longer required for build).
2014-08-08stmhal/teensy: Use _ instead of - in source file names.Damien George
Trying to move towards consistency, let's use _ exclusively in names of source files (eg .c, .h, .csv).
2014-08-07Add support for selecting pin alternate functions from python.Dave Hylands
Converts generted pins to use qstrs instead of string pointers. This patch also adds the following functions: pyb.Pin.names() pyb.Pin.af_list() pyb.Pin.gpio() dir(pyb.Pin.board) and dir(pyb.Pin.cpu) also produce useful results. pyb.Pin now takes kw args. pyb.Pin.__str__ now prints more useful information about the pin configuration. I found the following functions in my boot.py to be useful: ```python def pins(): for pin_name in dir(pyb.Pin.board): pin = pyb.Pin(pin_name) print('{:10s} {:s}'.format(pin_name, str(pin))) def af(): for pin_name in dir(pyb.Pin.board): pin = pyb.Pin(pin_name) print('{:10s} {:s}'.format(pin_name, str(pin.af_list()))) ```
2014-08-04Follow rename of readline_init to readline_init0 on teensyDave Hylands
2014-08-04Merge branch 'master' of github.com:micropython/micropythonDamien George
2014-08-04Put call to qstr_init and mp_init_emergency_exc_buf in mp_init.Damien George
qstr_init is always called exactly before mp_init, so makes sense to just have mp_init call it. Similarly with mp_init_emergency_exception_buf. Doing this makes the ports simpler and less error prone (ie they can no longer forget to call these).
2014-08-03Updated teensys usb.c and switched to using usb.h from stmhal.Dave Hylands
Removed the local usb.h from teensey directory and now uses the usb.h from the stmhal directory. Fixed the deploy target to use abspath.
2014-08-02Fix teensy to work with the latest tree.Dave Hylands
2014-07-14Add core files and use same toolchain as stmhalDave Hylands
2014-07-14Fix teensy to build on latest tree.Dave Hylands
Put #include of mpconfig.h before misc.h Replace uses of ARRAY_SIZE with MP_ARRAY_SIZE
2014-07-03lexer: Convert type (u)int to mp_(u)int_t.Damien George