summaryrefslogtreecommitdiff
path: root/extmod
AgeCommit message (Collapse)Author
2017-04-21extmod/moductypes: Fix bigint handling for 32-bit ports.Paul Sokolovsky
2017-04-15extmod/machine_signal: Rename "inverted" arg to "invert", it's shorter.Damien George
A shorter name takes less code size, less room in scripts and is faster to type at the REPL. Tests and HW-API examples are updated to reflect the change.
2017-04-11extmod/machine_signal: Support all Pin's arguments to the constructor.Paul Sokolovsky
This implements the orginal idea is that Signal is a subclass of Pin, and thus can accept all the same argument as Pin, and additionally, "inverted" param. On the practical side, it allows to avoid many enclosed parenses for a typical declararion, e.g. for Zephyr: Signal(Pin(("GPIO_0", 1))). Of course, passing a Pin to Signal constructor is still supported and is the most generic form (e.g. Unix port will only support such form, as it doesn't have "builtin" Pins), what's introduces here is just practical readability optimization. "value" kwarg is treated as applying to a Signal (i.e. accounts for possible inversion).
2017-04-04extmod/modframebuf: Make monochrome bitmap formats start with MONO_.Peter Hinch
MONO_xxx is much easier to read if you're not familiar with the code. MVLSB is deprecated but kept for backwards compatibility, for the time being. This patch also updates the associated docs and tests.
2017-03-31all: Use full path name when including mp-readline/timeutils/netutils.Damien George
This follows the pattern of how all other headers are now included, and makes it explicit where the header file comes from. This patch also removes -I options from Makefile's that specify the mp-readline/timeutils/ netutils directories, which are no longer needed.
2017-03-29modutimeq: Add peektime() function (provisional).Jan Pochyla
Allows to get event time for a head item in the queue. The usecase if waiting for the next event *OR* I/O completion. I/O completion may happen before event triggers, and then wait should continue for the remaining event time (or I/O completion may schedule another earlier event altogether). The new function has a strongly provisional status - it may be converted to e.g. peek() function returning all of the event fields, not just time.
2017-03-29extmod: Update for changes to mp_obj_str_get_data.Damien George
2017-03-29extmod/moduselect: Update to use size_t for array accessor.Damien George
2017-03-29extmod/vfs_fat: Fix calculation of total blocks in statvfs.Damien George
2017-03-26extmod/modlwip: Use mp_obj_str_get_str instead of mp_obj_str_get_data.Damien George
2017-03-22extmod/utime_mphal: Don't exit/enter the GIL in generic sleep functions.Damien George
GIL behaviour should be handled by the port. And ports probably want to define sleep_us so that it doesn't release the GIL, to improve timing accuracy.
2017-03-20extmod/modframebuf: Add support for monochrome horizontal format.Peter Hinch
MHLSB and MHMSB formats are added to the framebuf module, which have 8 adjacent horizontal pixels represented in a single byte.
2017-03-14py: Allow lexer to raise exceptions during construction.Damien George
This patch refactors the error handling in the lexer, to simplify it (ie reduce code size). A long time ago, when the lexer/parser/compiler were first written, the lexer and parser were designed so they didn't use exceptions (ie nlr) to report errors but rather returned an error code. Over time that has gradually changed, the parser in particular has more and more ways of raising exceptions. Also, the lexer never really handled all errors without raising, eg there were some memory errors which could raise an exception (and in these rare cases one would get a fatal nlr-not-handled fault). This patch accepts the fact that the lexer can raise exceptions in some cases and allows it to raise exceptions to handle all its errors, which are for the most part just out-of-memory errors during construction of the lexer. This makes the lexer a bit simpler, and also the persistent code stuff is simplified. What this means for users of the lexer is that calls to it must be wrapped in a nlr handler. But all uses of the lexer already have such an nlr handler for the parser (and compiler) so that doesn't put any extra burden on the callers.
2017-03-13extmod/vfs: Rewrite path lookup algo to support relative paths from root.Damien George
For example, if the current directory is the root dir then this patch allows one to do uos.listdir('mnt'), where 'mnt' is a valid mount point. Previous to this patch such a thing would not work, on needed to do uos.listdir('/mnt') instead.
2017-03-13extmod/vfs_fat: Allow to compile with MICROPY_VFS_FAT disabled.Damien George
Some ports may want to compile with generic MICROPY_VFS support but without the VfsFat class. This patch allows such a thing.
2017-03-10extmod/vfs_fat: Remove obsolete and unused str/len members.Damien George
2017-03-07extmod/modutimeq: Make scheduling fair (round-robin).Paul Sokolovsky
By adding back monotonically increasing field in addition to time field. As heapsort is not stable, without this, among entried added and readded at the same time instant, some might be always selected, and some might never be selected, leading to scheduling starvation.
2017-02-24extmod/modurandom: Use mp_raise_ValueError().Paul Sokolovsky
For the standard unix x86_64 build, this saves 11 bytes on object file level, but no difference in executable size due to (bloaty) code alignment.
2017-02-16py: Add iter_buf to getiter type method.Damien George
Allows to iterate over the following without allocating on the heap: - tuple - list - string, bytes - bytearray, array - dict (not dict.keys, dict.values, dict.items) - set, frozenset Allows to call the following without heap memory: - all, any, min, max, sum TODO: still need to allocate stack memory in bytecode for iter_buf.
2017-02-15extmod/modlwip: Add my copyright.Paul Sokolovsky
Per: $ git log modlwip.c |grep ^Auth | sort | uniq -c 9 Author: Damien George 2 Author: Galen Hazelwood 43 Author: Paul Sokolovsky
2017-02-13extmod/vfs: Allow to stat the root directory.Damien George
os.stat('/') now works and returns a mostly-empty tuple. Really all that is useful is the mode which tells that it's a directory.
2017-02-09extmod/vfs: Raise OSError(EEXIST) on attempt to mkdir a mount point.Damien George
2017-02-09extmod/vfs: Allow to mount a block device, not just a VFS object.Damien George
If the mounted object doesn't have a "mount" method then assume it's a block device and try to detect the filesystem. Since we currently only support FAT filesystems, the behaviour is to just try and create a VfsFat object automatically, using the given block device.
2017-02-08extmod/machine_signal: Implement Signal .on() and .off() methods.Paul Sokolovsky
Each method asserts and deasserts signal respectively. They are equivalent to .value(1) and .value(0) but conceptually simpler (and may help to avoid confusion with inverted signals, where "asserted" state means logical 0 output).
2017-02-06extmod/machine_spi: Remove EVENT_POLL_HOOK from soft-SPI transfer func.Damien George
SPI needs to be fast, and calling the EVENT_POLL_HOOK every byte makes it unusable for ports that need to do non-trivial work in the EVENT_POLL_HOOK call. And individual SPI transfers should be short enough in time that EVENT_POLL_HOOK doesn't need to be called. If something like this proves to be needed in practice then we will need to introduce separate event hook macros, one for "slow" loops (eg select/poll) and one for "fast" loops (eg software I2C, SPI).
2017-02-05extmod/machine_pulse: Make time_pulse_us() not throw exceptions.Paul Sokolovsky
machine.time_pulse_us() is intended to provide very fine timing, including while working with signal bursts, where each transition is tracked in row. Throwing and handling an exception may take too much time and "signal loss". So instead, in case of a timeout, just return negative value. Cases of timeout while waiting for initial signal stabilization, and during actual timing, are recognized. The documentation is updated accordingly, and rewritten somewhat to clarify the function behavior.
2017-01-30extmod/vfs_fat.c: Use explicit include path for timeutils.h.Andrew Gatt
2017-01-30extmod/vfs_reader: Fix use of NLR by popping context.Damien George
2017-01-30extmod/vfs_fat: Remove unused function fat_vfs_listdir.Damien George
2017-01-30extmod/vfs_fat: Remove unused fatfs_builtin_open function.Damien George
2017-01-30extmod: Merge old fsusermount.h header into vfs.h and vfs_fat.h.Damien George
vfs.h is for generic VFS declarations, and vfs_fat.h is for VfsFat specific things.
2017-01-30extmod/vfs_fat: Remove MICROPY_FATFS_OO config option.Damien George
Everyone should now be using the new ooFatFs library. The old one is no longer supported and will be removed.
2017-01-30extmod: Remove MICROPY_FSUSERMOUNT and related files.Damien George
Replaced by MICROPY_VFS and the VFS sub-system.
2017-01-30extmod/vfs_fat: Remove MICROPY_FSUSERMOUNT_ADHOC config option.Damien George
2017-01-30extmod/vfs_fat: Remove MICROPY_READER_FATFS component.Damien George
2017-01-30extmod/vfs: Expose lookup_path_raw as mp_vfs_lookup_path.Damien George
It can be useful for low-level lookup of paths by ports.
2017-01-30extmod/vfs_fat: Update to use FF_DIR instead of DIR.Damien George
2017-01-29extmod/machine_signal: Implement "signal" abstraction for machine module.Paul Sokolovsky
A signal is like a pin, but ca also be inverted (active low). As such, it abstracts properties of various physical devices, like LEDs, buttons, relays, buzzers, etc. To instantiate a Signal: pin = machine.Pin(...) signal = machine.Signal(pin, inverted=True) signal has the same .value() and __call__() methods as a pin.
2017-01-27extmod/vfs_fat: Use SECSIZE macro to determine FatFs sector size.Damien George
2017-01-27extmod/vfs: Expose mp_vfs_mount_t type.Damien George
It should only be used for low-level things and with caution, for example putting mounted VFS data in ROM or the static data section.
2017-01-27extmod/modlwip: Add socket.readinto() method.Damien George
2017-01-27extmod/vfs: Add ability for VFS sub-system to import using VfsFat.Damien George
2017-01-27extmod/vfs_fat: Rework to support new generic VFS sub-system.Damien George
The VfsFat object can now be mounted by the generic VFS sub-system.
2017-01-27extmod: Add generic VFS sub-system.Damien George
This provides mp_vfs_XXX functions (eg mount, open, listdir) which are agnostic to the underlying filesystem type, and just require an object with the relevant filesystem-like methods (eg .mount, .open, .listidr) which can then be mounted. These mp_vfs_XXX functions would typically be used by a port to implement the "uos" module, and mp_vfs_open would be the builtin open function. This feature is controlled by MICROPY_VFS, disabled by default.
2017-01-27extmod: Rename vfs_fat_file.h to vfs_fat.h.Damien George
And move declaration of mp_fat_vfs_type to this file.
2017-01-27extmod/vfs_fat: Rework so it can optionally use OO version of FatFS.Damien George
If MICROPY_VFS_FAT is enabled by a port then the port must switch to using MICROPY_FATFS_OO. Otherwise a port can continue to use the FatFs code without any changes.
2017-01-25extmod/modframebuf: Add GS4_HMSB format.Oleg Korsak
2017-01-23extmod/modframebuf: Clip pixels drawn by line method.Damien George
2017-01-08extmod/modframebuf: optimize fill_rect subroutine callOleg Korsak
2017-01-04all: Consistently update signatures of .make_new and .call methods.Paul Sokolovsky
Otherwise, they serve reoccurring source of copy-paste mistakes and breaking nanbox build.