summaryrefslogtreecommitdiff
path: root/stmhal/modpyb.c
AgeCommit message (Collapse)Author
2017-05-06stmhal: Convert all module and method tables to use MP_ROM macros.Damien George
2017-03-02stmhal/modpyb: Use utime ticks ms/us functions instead of custom ones.Damien George
2017-03-02stmhal: Rename sys_tick ticks/delay functions to corresp. mp_hal ones.Damien George
The renames are: HAL_Delay -> mp_hal_delay_ms sys_tick_udelay -> mp_hal_delay_us sys_tick_get_microseconds -> mp_hal_ticks_us And mp_hal_ticks_ms is added to provide the full set of timing functions. Also, a separate HAL_Delay function is added which differs slightly from mp_hal_delay_ms and is intended for use only by the ST HAL functions.
2017-02-06stmhal: Add pyb.fault_debug() function, to control hard-fault behaviour.Damien George
This new function controls what happens on a hard-fault: - debugging disabled: board will do a reset - debugging enabled: board will print registers and stack and flash LEDs The default is disabled, ie to do a reset. This is different to previous behaviour which flashed the LEDs and waited indefinitely.
2017-01-27stmhal: Convert to use VFS sub-system and new ooFatFs component.Damien George
This patch makes the following configuration changes: - MICROPY_FSUSERMOUNT is disabled, removing old mounting infrastructure - MICROPY_VFS is enabled, giving new VFS sub-system - MICROPY_VFS_FAT is enabled, giving uos.VfsFat type - MICROPY_FATFS_OO is enabled, to use new ooFatFs lib, R0.12b User facing API should be almost unchanged. Most notable changes are removal of os.mkfs (use os.VfsFat.mkfs instead) and pyb.mount doesn't allow unmounting by passing None as the device.
2016-10-21py: Be more specific with MP_DECLARE_CONST_FUN_OBJ macros.Damien George
In order to have more fine-grained control over how builtin functions are constructed, the MP_DECLARE_CONST_FUN_OBJ macros are made more specific, with suffix of _0, _1, _2, _3, _VAR, _VAR_BETEEN or _KW. These names now match the MP_DEFINE_CONST_FUN_OBJ macros.
2016-10-14stmhal/modutime: Refactor to use extmod/utime_mphal.c.Paul Sokolovsky
This includes making sure that utime_mphal's sleep_ms() and sleep_us() don't sleep on negative arguments.
2016-09-22all: Remove 'name' member from mp_obj_module_t struct.Damien George
One can instead lookup __name__ in the modules dict to get the value.
2016-02-10stmhal: Expose flash and SD card as proper objects with block protocol.Damien George
You can now create (singleton) objects representing the flash and SD card, using: flash = pyb.Flash() sdcard = pyb.SDCard() These objects provide the block protocol.
2016-02-10extmod/fsusermount: Introduce separate mkfs() function.Paul Sokolovsky
Per the previously discussed plan. mount() still stays backward-compatible, and new mkfs() is rought and takes more args than needed. But is a step in a forward direction.
2015-12-22stmhal: Add pyb.irq_stats() to get statistics about IRQ calls.Damien George
Adds a lot of code, makes IRQs a bit less efficient, but is very useful for debugging. Usage: pyb.irq_stats() returns a memory view that can be read and written, eg: list(pyb.irq_stats()) pyb.irq_stats()[0] pyb.irq_stats()[0] = 0 The patch provides general IRQ_ENTER() and IRQ_EXIT() macros that can be modified to provide further IRQ statistics if desired.
2015-11-25extmod: Move fsusermount.c from stmhal for cross-port reuse.Paul Sokolovsky
2015-11-09lib/pyexec: Move header pyexec.h from stmhal directory.Damien George
2015-10-19stmhal: Implement os.dupterm (was pyb.repl_uart).Damien George
pyb.repl_uart still exists but points to os.dupterm.
2015-10-19stmhal: Add sleep_{ms,us} and ticks_{ms,us,cpu,diff} to time module.Damien George
pyb module still has pyb.delay and pyb.udelay, but these now point to time.sleep_ms and time.sleep_us respectively.
2015-10-19stmhal: Early version of machine module for stmhal.Dave Hylands
2015-08-07stamhal: Add definitions for MCU_SERIES_F4 and MCU_SERIES_F7Dave Hylands
2015-08-05stmhal: Enable SPI support for F7 MCUs.Dave Hylands
2015-08-05stmhal: Enable I2C support for F7 MCUs.Dave Hylands
2015-07-30stmhal: Add STM32F7DISC and associated changes.Dave Hylands
2015-07-30stmhal: Replace #include "stm32f4xx_hal.h" with #include STM32_HAL_H.Dave Hylands
2015-03-22stmhal: Correctly clear wake-up flag before entering standby mode.Damien George
2015-03-22stmhal: Put flash in deep power-down mode when entering stop mode.Damien George
This can get PYBv1.0 stop current down to around 290uA.
2015-03-04stmhal: Make os.sync use disk_ioctl exclusively; reuse os.sync in pyb.Damien George
2015-03-04stmhal: Include fatfs headers using lib/fatfs prefix.Damien George
This helps make files reusable across other ports.
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-13stmhal: Add Python-configurable USB HID mode.Damien George
Different HID modes can be configured in Python. You can either use predefined mouse or keyboard, or write your own report descriptor.
2015-01-21stmhal: Add support for FEZ Cerb40 II board from ghielectronics.com.Dave Hylands
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-01stmhal: Prefix includes with py/; remove need for -I../py.Damien George
2014-12-27stmhal: Add ability to mount custom block device.Damien George
2014-12-08stmhal: Enhance pyb.freq to configure bus (AHB, APB1, APB2) freqs.Damien George
This is useful if you need precise control over the speed of peripherals (eg SPI clock).
2014-11-30stmhal: Make pyb.[u]delay use systick with IRQs, busy loop otherwise.Damien George
pyb.delay and pyb.udelay now use systick if IRQs are enabled, otherwise they use a busy loop. Thus they work correctly when IRQs are disabled. The busy loop is computed from the current CPU frequency, so works no matter the CPU frequency.
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-02stmhal: Improve pyb.freq to allow 8 and 16MHz (not usable with USB).Damien George
Also restrict higher frequencies to have a VCO_OUT frequency below 432MHz, as specified in the datasheet. Docs improved to list allowed frequencies, and explain about USB stability.
2014-10-22Add pyb.hard_reset, and make sys.exit() or raise SystemExit do a soft reset.Dave Hylands
2014-10-09stmhal: Add pyb.stop() and pyb.standby() functions.Damien George
2014-10-05stmhal: Use mp_uint_t where appropriate.Damien George
Found these by compiling stmhal with mp_uint_t of type uint32_t instead of unsigned int. This actually makes a difference to the code, but just a curiosity.
2014-10-05stmhal: Add config option to disable/enable CAN driver.Damien George
2014-10-04stmhal: Allow pyb.freq() function to change SYSCLK frequency.Damien George
Eg pyb.freq(120000000) sets the CPU to 120MHz. The frequency can be set at any point in the code, and can be changed as many times as you like. Note that any active timers will need to be reconfigured after a freq change. Valid range is 24MHz to 168MHz (but not all freqs are supported). The code maintains a 48MHz clock for the USB at all times and it's possible to change the frequency at a USB REPL and keep the REPL alive (well, most of the time it stays, sometimes it resets the USB for some reason). Note that USB does not work with pyb.freq of 24MHz.
2014-10-02stmhal: Add basic CAN bus support.Damien George
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-08-25stmhal: Use MP_OBJ_NEW_SMALL_INT directly in pyb.micros/millis.Damien George
Also some whitespace cleanup.
2014-08-25Add support for pyb.micros() by using the systick timer.Dave Hylands
I also removed trailing spaces from modpyb.c which affected a couple of lines technically not part of this patch. Tested using: https://github.com/dhylands/upy-examples/blob/master/micros_test.py which eventually fails due to wraparound issues (I could fix the test to compensate but didn't bother)
2014-08-25Add save/restore_irqDave Hylands
Factored irq functions into a separate file.
2014-08-16stmhal: In safe mode, still mount SD card and present as MSD over USB.Damien George
It's still "safe" because no scripts are run. Remove the SD card if you want to access the internal flash filesystem. Addresses issue #616. Also: remove obsolete pyb.source_dir setting, and reset pyb.main and pyb.usb_mode settings on soft-reset.
2014-07-31stmhal: Change 0:/ and 1:/ to /flash and /sd; add CWD support.Damien George
Some important changes to the way the file system is structured on the pyboard: 1. 0: and 1: drive names are now replaced with POSIX inspired directories, namely /flash and /sd. 2. Filesystem now supports the notion of a current working directory. Supports the standard Python way of manipulating it: os.chdir and os.getcwd. 3. On boot up, current directory is /flash if no SD inserted, else /sd if SD inserted. Then runs boot.py and main.py from the current dir. This is the same as the old behaviour, but is much more consistent and flexible (eg you can os.chdir in boot.py to change where main.py is run from). 4. sys.path (for import) is now set to '' (current dir), plus /flash and /flash/lib, and then /sd and /sd/lib if SD inserted. This, along with CWD, means that import now works properly. You can import a file from the current directory. 5. os.listdir is fixed to return just the basename, not the full path. See issue #537 for background and discussion.
2014-07-31stmhal: Add USB_VCP class/object, for direct USB VCP control.Damien George
Before, pyb.stdin/pyb.stdout allowed some kind of access to the USB VCP device, but it was basic access. This patch adds a proper USB_VCP class and object with much more control over the USB VCP device. Create an object with pyb.USB_VCP(), then use this object as if it were a UART object. It has send, recv, read, write, and other methods. send and recv allow a timeout to be specified. Addresses issue 774.
2014-07-20stmhal: Fix REPL printing by cooking output sent to stdout_obj.Damien George
Recent changes to builtin print meant that print was printing to the mp_sys_stdout_obj, which was sending data raw to the USB CDC device. The data should be cooked so that \n turns into \r\n.
2014-07-03Rename machine_(u)int_t to mp_(u)int_t.Damien George
See discussion in issue #50.