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.
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.
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.
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
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.
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
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.
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).
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.