Commit Graph

616 Commits

Author SHA1 Message Date
Dave Hylands c3e37a0cde stmhal: Automatically re-enable IRQs on the USB REPL.
This allows errors to be seen and prevents hanging
the board from doing: pyb.disable_irq()
2015-04-29 08:27:38 +01:00
Damien George b7a4f15b34 mp-readline: Save "prompt" string in readline state. 2015-04-29 00:32:35 +01:00
Damien George 95f53461c2 py: Replace py-version.sh with makeversionhdr.py, written in Python.
Also rename py-version.h to mpversion.h for consistency with mpconfig.h.
2015-04-28 23:52:36 +01:00
Dave Hylands fdcb3b7ebb stmhal: Actually disable unhandled timer interrupts. 2015-04-28 00:17:05 -07:00
Dave Hylands fd787c5e4e stmhal: Reset the timer counter to zero after changing the auto reload.
Because if the counter is above the new value of the auto-reload register
then it may be a long time until the timer wraps around.
2015-04-22 23:31:56 +01:00
Damien George d8837cea6f stmhal: Implement os.uname() to get details of OS and hardware. 2015-04-21 14:51:49 +00:00
Damien George f35b5d28db stmhal/pyexec.c: Make raw REPL mode 8-bit clean. 2015-04-19 21:30:49 +01:00
Damien George 404b68da88 stmhal: Provide ADC capabilities for F401 and F411 MCUs.
Simply needed to define which pins have which ADC channel on them.
2015-04-18 22:39:06 +01:00
Damien George b42a5050fb stmhal: Add support for STM32F411 MCU. 2015-04-18 22:15:59 +01:00
Damien George 3e592531eb stmhal: For flash storage use same params for F407 as F405. 2015-04-18 22:08:16 +01:00
Damien George 90e6d0c2ac stmhal: Add support for Espruino Pico board.
To build:

make BOARD=ESPRUINO_PICO

To deploy: short the BOOT0/BTN contact on the back of the board (eg by
drawing over it with a graphite pencil), then hold down BTN while
inserting the board into the USB port.  The board should then enter DFU
mode, and the firmware can be downloaded using:

make BOARD=ESPRUINO_PICO deploy
2015-04-18 21:40:59 +01:00
Damien George e4b4e5aa31 stmhal: Add stm32f401.ld for linking F401 targets. 2015-04-18 21:40:59 +01:00
Damien George 0435e76250 stmhal: Make ld and af files configurable within Makefile.
Each board now needs an mpconfigboard.mk file which defines AF_FILE and
LD_FILE.

Also moved stm32f405.ld to boards/ directory to keep things organised.
2015-04-18 21:40:59 +01:00
Damien George 03ec6e4d01 stmhal: Add stm32f401_af.csv, for AF definitions of F401 MCUs. 2015-04-18 21:40:59 +01:00
Damien George 9253e7bdf7 stmhal: Rename stm32f4xx_af.csv to stm32f405_af.csv.
Since this file is only valid for F405 MCUs, not generic F4xx.
2015-04-18 21:40:59 +01:00
Damien George 6be0bbb886 stmhal: Add support for flash filesystem on F401 MCUs.
It uses a 16k cache buffer and so the filesystem size is limited.
2015-04-18 21:40:59 +01:00
Damien George 5a11086d64 stmhal: Allow extint.c to compile without USB HS support. 2015-04-18 21:40:59 +01:00
Damien George d15fe5a6b3 stmhal: Make I2C busses and their pins configurable in mpconfigboard.h. 2015-04-18 21:40:59 +01:00
Damien George 8892f71dd0 stmhal: Exclude code for UARTs that don't exist in hardware. 2015-04-18 21:40:58 +01:00
Damien George 73f1a49137 stmhal: Exclude USB HS code when USB HS mode not enabled. 2015-04-18 21:40:58 +01:00
Damien George c92c7a69fd stmhal: Exclude code for those timers that don't exist in the hardware. 2015-04-18 21:40:58 +01:00
Damien George 7d6595fd18 stmhal: Make LCD initialiser use board pin names instead of cpu names. 2015-04-18 21:40:58 +01:00
Damien George 50ea86fe8b stmhal: For pins, define macros mapping board names to cpu names. 2015-04-18 21:40:58 +01:00
Damien George 2e5704d101 stmhal: Make a HW config option for LED4 being controlled by PWM. 2015-04-18 21:40:58 +01:00
Damien George 8bdbc20e74 stmhal: Make HSE PLL parameters configurable per board. 2015-04-18 21:40:58 +01:00
Henrik e3cd154317 stmhal: Add support for sending and receiving CAN RTR messages. 2015-04-18 14:53:00 +01:00
Damien George 2764a8ee8d stmhal: Remove std.h. It's not needed anymore. 2015-04-18 14:28:39 +01:00
Damien George 7d5e34287c stmhal: Allow sending CAN messages with timeout=0.
Thanks to Henrik Sölver for this patch.
2015-04-16 23:52:43 +01:00
blmorris 4c45921349 stmhal: Use new %q format to print qstr's in a few more places.
Saves 68 bytes.
2015-04-16 22:30:00 +01:00
Damien George 7f9d1d6ab9 py: Overhaul and simplify printf/pfenv mechanism.
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-16 14:30:16 +00:00
Damien George b1f68685ec stmhal: In USB HID driver, make polling interval configurable.
When setting usb_mode to "HID", hid config object now has
polling-interval (in ms) as the 4th element.  It mmust now be a 5-tuple
of the form:

(subclass, protocol, max_packet_len, polling_interval, report_desc)

The mouse and keyboard defaults have polling interval at 8ms.
2015-04-13 16:59:05 +01:00
Damien George 7a6dbaa89b stmhal: Make LED object print LED(x) for consistency with constructor. 2015-04-11 21:50:53 +01:00
Paul Sokolovsky 3a84c8b58d string0.c: Move from stmhal/ to lib/. 2015-04-05 21:57:55 +03:00
Damien George 7e758b1cf8 stmhal, qemu-arm: Enable sys.maxsize attribute. 2015-04-04 22:04:53 +01:00
Damien George 40fc01f406 stmhal: Enable new str.splitlines() method. 2015-04-04 16:02:23 +01:00
Daniel Campora 7b19e99edd lib: Update FatFs to R0.11.
There are lots of cosmetic changes, but this release brings a  very
important bug fix:
 - Fixed f_unlink() does not remove cluster chain of the file.

With R0.10c if you try to write a file that is too large to fit in the
free space of the drive, the operation fails, you delete the incomplete
file, and it seems to be erased, but the space is not really freed,
because any subsequent write operations fail because the drive is
"still" full. The only way to recover from this is by formatting the
drive. I can confirm that R0.11 fixes the problem.
2015-03-29 22:12:14 +01:00
Damien George dfad7f471a stmhal: Optimise ADC.read_timed() so that it can sample up to 750kHz. 2015-03-23 22:36:51 +00:00
Damien George 8657342973 stmhal: Correctly clear wake-up flag before entering standby mode. 2015-03-22 21:52:20 +00:00
Damien George cfe623ae3e stmhal: Expose all PYBv1.0 pins, include SD and USB pins.
To have proper low power mode, need to configure all unused pins in
input mode, so need to have them available.
2015-03-22 17:57:09 +00:00
Damien George f44ace11fb stmhal: Put flash in deep power-down mode when entering stop mode.
This can get PYBv1.0 stop current down to around 290uA.
2015-03-22 17:55:50 +00:00
Dave Hylands 49d8e5ebaa stmhal: Fix a bug related to unhandled channel interrupts.
This also cleans up spurious interrupts which happen at timer
initilaization time.
2015-03-20 23:40:50 +00:00
stijn 3cc17c69ff py: Allow retrieving a function's __name__.
Disabled by default.  Enabled on unix and stmhal ports.
2015-03-20 23:13:32 +00:00
Damien George 7674da8057 stmhal: Remove some unnecessary declarations, purely for cleanup. 2015-03-20 22:27:34 +00:00
Paul Sokolovsky 0ef01d0a75 py: Implement core of OrderedDict type.
Given that there's already support for "fixed table" maps, which are
essentially ordered maps, the implementation of OrderedDict just extends
"fixed table" maps by adding an "is ordered" flag and add/remove
operations, and reuses 95% of objdict code, just making methods tolerant
to both dict and OrderedDict.

Some things are missing so far, like CPython-compatible repr and comparison.

OrderedDict is Disabled by default; enabled on unix and stmhal ports.
2015-03-20 17:26:10 +00:00
Damien George 49fe6dc89a stmhal: Add config option to use LSE/LSI for RTC.
Most boards (except the pyboard) don't have a 32kHz crystal so they
should use the LSI for the RTC.
2015-03-16 22:54:44 +00:00
Damien George dac79324b5 stmhal: Add rtc.wakeup method, to set wakeup timer.
This allows to wake from low-power modes at a regular interval.

This method is preliminary, pending testing and API overhaul.
2015-03-15 17:15:55 +00:00
Damien George 42e0c59308 py: Add MICROPY_COMP_{DOUBLE,TRIPLE}_TUPLE_ASSIGN config options.
These allow to fine-tune the compiler to select whether it optimises
tuple assignments of the form a, b = c, d and a, b, c = d, e, f.
Sensible defaults are provided.
2015-03-14 13:11:35 +00:00
Damien George ac4f6b804f stmhal: Fix adc.read_timed so buffer store respects element size.
Addresses issue #1154.
2015-03-13 22:11:50 +00:00
Dave Hylands b4c9a25eab stmhal: Add support for quadrature encoder mode to pyb.TimerChannel. 2015-03-09 13:23:14 +00:00
Damien George 48ef64a729 stmhal: Make os.sync use disk_ioctl exclusively; reuse os.sync in pyb. 2015-03-04 20:38:28 +00:00