Commit Graph

38 Commits

Author SHA1 Message Date
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
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
fb06bfc11c stmhal: Clean up fatality indications; remove long-obsolete malloc0.c. 2014-04-17 17:04:15 +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
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
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
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
902d9552c5 Replace some Makefile commands with variables in py/mkenv.mk 2014-04-07 01:35:45 +01:00
Damien George
a12be917a4 stmhal: Add timer module; move servo PWM from TIM2 to TIM5.
As per issue #257, servo is better on TIM5 because TIM2 is connected to
more GPIO.
2014-04-02 15:09:36 +01:00
Damien George
09d207785c stmhal: Unify naming of HW config; make SD detect configurable.
All board config macros now begin with MICROPY_HW_.

Renamed PYBv10 to PYBV10, since macros should be all uppercase.

Made SDCARD_DETECT configurable in mpconfigport.h, so that the SD
detect pin can be easily configured.
2014-03-30 12:30:35 +01:00
Damien George
038df43183 stmhal: Implement selector for USB device mode; improve boot up.
Can now choose at boot up whether the USB device is CDC+MSC or CDC+HID.
Choice is made by an option in boot.py, with default being CDC+MSC.
HID+MSC is not currently supported, but should be easy to implement.

Boot up now has ability to change the reset mode: hold down USR switch
while booting and LEDs will count from 1 to 7 to indicate the boot mode.
Release USR when correct mode is selected.  Current modes are 1 (normal
boot), 2 (safe mode), 3 (reset FS mode).
2014-03-30 00:00:15 +00:00
Damien George
c9fd6645b0 stmhal: Factor out stdio and readline to separate files.
Adds readline_init() to clear readline history on soft reset.  Addresses
issue #387.
2014-03-29 14:20:05 +00:00
Damien George
6cfda3084d stmhal: Add I2C support; change accel driver to use new I2C. 2014-03-25 23:26:14 +00:00
Damien George
caac542b23 Proper support for registering builtin modules in ROM.
Comes with some refactoring of code and renaming of files.  All modules
are now named mod*.[ch].
2014-03-25 14:18:18 +00:00
Dave Hylands
1403298a65 stmhal - fixed up adc stuff
Added support for the ADC channels and mappings to make_pins.py

I'm not sure if the hal properly deals with the channel 16/18 differences
between the 40x and 42x. It seems to deal with it partially. This particular
aspect will need testing on a 42x or 43x.
2014-03-24 11:16:35 -07:00
Damien George
b13492f8ad stmhal: Add DAC driver. 2014-03-24 15:15:33 +00:00
Damien George
5fd2ebbbdd stmhal: Update help function. 2014-03-24 11:27:56 +00:00
Damien George
02fa035800 stmhal: Add input() and pyb.input() functions. 2014-03-22 23:53:50 +00:00
Damien George
626f6b8133 stmhal: Add servo driver. 2014-03-22 15:52:33 +00:00
Damien George
d311655655 stmhal: Add time module with sleep function. 2014-03-22 15:06:29 +00:00
Damien George
ad7b84a7b9 stmhal: Add os module with a few basic functions. 2014-03-22 14:56:32 +00:00
Damien George
684164a8cf stmhal: Add PYBv10 config; add RNG support. 2014-03-22 13:41:02 +00:00
Damien George
fb25c2d95f stmhal: USB CDC and MSC device work together. 2014-03-22 12:32:54 +00:00
Damien George
8913c04831 stmhal: Add support for USB MSC device.
This gives a functioning, independent MSC device.
2014-03-21 23:32:01 +00:00
Damien George
f78d9b1a72 stmhal: Add accelerometer driver; fix bug with LFN. 2014-03-20 23:33:30 +00:00
Damien George
494600bc99 stmhal: Add lcd.c to Makefile, and init LCD in main. 2014-03-19 13:12:30 +00:00
Damien George
b92d3e1fde stmhal: Add fatfs support, working with flash and SD card. 2014-03-17 14:04:19 +00:00
Damien George
9e5ea4d768 stmhal: Add flash write support and flash storage driver. 2014-03-17 13:31:35 +00:00
Damien George
fb431bf556 stmhal: Add SD card support.
Just low-level read/write support.  No filesystem yet.
2014-03-17 13:03:41 +00:00
Damien George
8b96af6907 stmhal: Get RTC working. 2014-03-15 12:54:48 +00:00
Damien George
e285511a23 stmhal: Get USB CDC REPL working.
New USB HAL is quite a bit improved over previous one.  Now has better
callbacks and flow control.

REPL over USB CDC now works as before, except for soft-reset (since USB
driver uses malloc...).
2014-03-15 11:52:29 +00:00
Dave Hylands
ca5444e6cd stmhal - add pin mapping, gpio, exti, usrsw 2014-03-14 23:41:28 -07:00
Damien George
b30c02afa0 stmhal: Get USB enumerating a CDC device.
Enumerates CDC device over USB, but doesn't transmit/receive yet.
2014-03-14 00:30:37 +00:00
Dave Hylands
ef39f2d9ca Cleanup systick for stmhal 2014-03-13 14:40:49 -07:00
Dave Hylands
f14b92b9e1 REPl working on UART6 with STMHAL 2014-03-12 18:15:55 -07:00
Damien George
4ef1dbcbf6 stmhal: Get SysTick and HSE working. 2014-03-12 21:59:33 +00:00
Dave Hylands
dd38d90724 Initial checkin with STM HAL
This compiles and links, but hasn't been tested on a board
yet and even if it was run, it doesn't currently do anything.
2014-03-11 23:55:41 -07:00