Commit Graph

157 Commits

Author SHA1 Message Date
Damien George a8f5d15fc6 stmhal: Update help and comments re gpio changing to Pin. 2014-04-18 22:48:59 +01:00
Damien George c66d86c5ce stmhal: Big cleanup; merge gpio into Pin; make names consistent.
This is an attempt to clean up the Micro Python API on the pyboard.
Gpio functionality is now in the Pin object, which seems more natural.
Constants for MODE and PULL are now in pyb.Pin.  Names of some
classes have been adjusted to conform to CamelCase.  Other
miscellaneous changes and clean up here and there.
2014-04-18 22:38:09 +01:00
Damien George 906d383850 stmhal: Remove non-ascii character from include file. 2014-04-18 16:17:40 +01:00
Damien George 5b65f0c7d3 py: Rename USE_COMPUTED_GOTOS to USE_COMPUTED_GOTO and enable on stmhal.
On stmhal, computed gotos make the binary about 1k bigger, but makes it
run faster, and we have the room, so why not.  All tests pass on
pyboard using computed gotos.
2014-04-17 23:24:13 +01:00
Damien George d0f9f6cd3f py: Fix pfenv_print_strn to return correct number of chars printed.
With this fix, all tests in tests/basics pass on pyboard.
2014-04-17 18:58:09 +01:00
Damien George d553be5982 build: Simplify build directory layout by putting all headers in genhdr.
Any generated headers go in $(BUILD)/genhdr/, and are #included as
'genhdr/xxx.h'.
2014-04-17 18:03:27 +01:00
Damien George 2d1f865d16 Merge branch 'relocatable-build-dir' of github.com:lurch/micropython into lurch-relocatable-build-dir 2014-04-17 17:44:52 +01:00
Damien George 5f82b50324 Merge branch 'master' of github.com:micropython/micropython 2014-04-17 17:11:58 +01:00
Damien George fb06bfc11c stmhal: Clean up fatality indications; remove long-obsolete malloc0.c. 2014-04-17 17:04:15 +01:00
Damien George d7a4b69039 stmhal: Change VID to 0xf055=FOSS, and PID to a random number.
Needs a better solution.
2014-04-17 01:09:32 +01:00
Damien George b08f9212e2 Merge pull request #500 from dhylands/fix-sdcard-removed
Fix to allow usbd_msc_storage.c to compile when MICROPY_HW_HAS_SDCARD is...
2014-04-17 00:23:43 +01:00
Damien George 89831d0289 stmhal: Add more math functions.
Taken straight from musl and newlib.  License seems compatible with MIT.
2014-04-17 00:13:13 +01:00
Damien George efc22e376f stmhal: Fix 64-byte USB packet bug properly.
A 64-byte packet is now followed by a 0-byte packet if there is nothing
more to send.  This flushes the USB endpoint.
2014-04-17 00:12:07 +01:00
Damien George 28817725fc stmhal: Replace magic number 3 with CDC_IN_EP define. 2014-04-16 23:17:29 +01:00
Damien George 6d983539bc stmhal: Improve flash storage cache management.
Internal flash used for the filesystem is now written (from the cache)
only after a 5s delay, or when a file is closed, or when the drive is
unmounted from the host.  This delay means that multiple writes can
accumulate in the cache, and leads to less writes to the flash, making
it last longer.

It's implemented by a high-priority interrupt that takes care of flash
erase and write, and flushing the cache.

This is still only an interim solution for the flash filesystem.  It
eventually needs to be replaced with something that uses less RAM for
the cache, something that can use more of the flash, and something that
does proper wear levelling.
2014-04-16 23:08:36 +01:00
Andrew Scheller 70a7d7a943 build directory can now be renamed
The autogenerated header files have been moved about, and an extra
include dir has been added, which means you can give a custom
BUILD=newbuilddir option to make, and everything "just works"

Also tidied up the way the different Makefiles build their include-
directory flags
2014-04-16 22:16:28 +01:00
Dave Hylands e553ff2f75 Fix to allow usbd_msc_storage.c to compile when MICROPY_HW_HAS_SDCARD isn't defined. 2014-04-16 10:01:17 -07:00
Damien George f6be480bda stmhal: Add pyb.have_cdc function to check if USB CDC device is enabled. 2014-04-16 15:52:50 +01:00
Damien George 9388a90842 stmhal: Fix USB CDC buffer overrun error.
Need to wait for the low-level USB driver to send the data over the USB
in-endpoint before the buffer can be used again.  This patch adds a
check for this.
2014-04-16 15:51:27 +01:00
Damien George bda2f70964 Merge pull request #498 from lurch/create-headers-from-files
Auto-generate the stmhal/pybcdc_inf header file from static files
2014-04-16 10:54:16 +01:00
Damien George 1381146382 stmhal: Fix C bindings of I2C.read/write. 2014-04-16 10:43:03 +01:00
Andrew Scheller 1452221aca Auto-generate the stmhal/pybcdc_inf header file from static files
The USB VID&PID are automatically extracted from usbd_desc_cdc_msc.c
and inserted into pybcdc_inf.template, ensuring that the same USB
IDs get used everywhere
2014-04-16 02:41:26 +01:00
Damien George 2822d4e6ce stmhal: Add I2C functions for pure master read/write. 2014-04-16 00:27:14 +01:00
Damien George d5323f07ff Merge pull request #496 from dhylands/fix-debug-usart
Fix call to enable pyb_usart_global_debug.
2014-04-15 21:25:27 +01:00
Dave Hylands 00adf67179 Fix call to enable pyb_usart_global_debug. 2014-04-15 12:20:31 -07:00
Damien George 9699ea6a2f stmhal: Fix USB MSC so that it unmounts correctly on Mac OS X.
Mac OS X sends a SCSI command to remove the medium when it unmounts a
drive.  If this command is not honoured, then OS X will automatically
remount the drive, making it impossible to eject.  This patch disables
the USB MSC when the right SCSI command is sent.
2014-04-15 19:56:32 +01:00
Damien George 4d7f4eb6a9 stmhal: Add ADC function to read data at a given frequency.
Reads ADC values into a bytearray (or similar) at a fixed rate.  Needs a
better name and improved API.  Also fix up DAC dma function (which also
needs a better name and API).
2014-04-15 19:52:56 +01:00
Damien George e95da5b784 stmhal: Add I2C.scan method, to scan all devices on the bus.
Simple way to find the address of an attached I2C device.
2014-04-15 19:24:13 +01:00
Damien George f6d25ecf7b stmhal: Add simple README.txt to freshly-created filesystem. 2014-04-15 19:20:25 +01:00
Damien George c13d0b3304 stmhal: Wrap skin-named-usarts in PYBV10 #if. 2014-04-15 11:52:47 +01:00
Damien George cce7119a2b stmhal: Work around crazy bug in USB CDC.
Packets of 64 bytes length are not send to the host until the following
packet is sent.  Fixed by never sending packets of 64 bytes length.
2014-04-14 01:46:25 +01:00
Damien George 7e5be0b1b4 stmhal: Improved usart module a bit. 2014-04-14 01:45:58 +01:00
Damien George 6dba016a56 stmhal: Add pyb.wfi() function (calls __WFI). 2014-04-14 01:45:24 +01:00
Damien George 86a03044e3 stmhal: Add stdin/stdout/stderr objects.
Available via sys.std{in,out,err}.  Basic reading and writing supported.
Even sys.stdin.readline!
2014-04-13 19:00:56 +01:00
Damien George 212f89e61a stmhal: Improve USB CDC write function (increase timeout). 2014-04-13 16:39:04 +01:00
Damien George 73496fbbe4 py: Fix up source-line calculation.
Should address issue #475.
2014-04-13 14:51:56 +01:00
Damien George cb861a5c6a stm[hal]: Init mp_sys_path and mp_sys_argv correctly. 2014-04-13 13:19:09 +01:00
Damien George 640e7e4779 Merge pull request #476 from pfalcon/static-sys
Convert sys module to static allocation
2014-04-13 12:52:39 +01:00
Damien George 8a1cab952f py: Fix mp_get_buffer, and use it in more places.
Must use mp_obj_get_type to get the type of an object.  Can't assume
mp_obj_t is castable to mp_obj_base_t.
2014-04-13 12:08:52 +01:00
Damien George 0aab675108 stmhal: Little hack to dump GC allocation table using pyb.info().
Pass a single parameter (doesn't matter what): pyb.info(1), will dump
the GC alloc table.
2014-04-13 11:10:58 +01:00
Paul Sokolovsky 4165cd1c0c stmhal: Update for static mod sys. 2014-04-13 07:02:57 +03:00
Damien George 82c7b1b1d5 stmhal: Put a USB structure in ROM; GC doesn't scan the data segment. 2014-04-12 18:50:20 +01:00
Damien George b96c7c03ca stmhal: Move fatfs volume/partition lookup table to ROM. 2014-04-12 00:51:57 +01:00
Damien George 60427864b1 stmhal: Move I2C objects to ROM. 2014-04-12 00:51:41 +01:00
Damien George 037b3e0e21 Merge pull request #458 from lurch/patch-1
Tweak pybcdc.inf to match recent changes to pybcdc.h
2014-04-10 22:51:48 +01:00
Damien George 3f4898456b stmhal: Add stm module, which contains some constants for the MCU.
Also contains raw memory read/write functions, read8, read16, read32,
write8, write16, write32.  Can now do:

stm.write16(stm.GPIOA + stm.GPIO_BSRRL, 1 << 13)

This turns on the red LED.

With the new constant folding, the above constants for the GPIO address
are actually compiled to constants (and the addition done) at compile
time.  For viper code and inline assembler, this optimisation will make
a big difference.  In the inline assembler, using these constants would
not be possible without this constant folding.
2014-04-10 22:46:40 +01:00
Andrew Scheller fec6f018ee Tweak pybcdc.inf to match recent changes to pybcdc.h 2014-04-10 02:07:55 +01:00
Damien George 7a5f9e94ad stmhal: Make /src/main.py just /main.py; allow SD to be used as root device. 2014-04-09 23:30:34 +01:00
Damien George a5c18f3285 stmhal: Update windows driver; \r\n newlines and addition USB id. 2014-04-09 02:23:24 +01:00
Damien George b99ca2cdde stmhal: Add windows cdc .inf driver to flash filesystem. 2014-04-09 01:16:49 +01:00