Commit Graph

889 Commits

Author SHA1 Message Date
Stefan Hölzl
c8332a5463 stmhal: Add board definition files for Olimex STM32-E407. 2016-06-06 10:21:02 +01:00
Tobias Badertscher
1191ec6a14 stmhal/uart.c: Fix wrong baudrate calculation for stm32l4 series. 2016-06-03 14:24:59 +01:00
Peter Hinch
641300dccb stmhal/dac: DAC deinit() method added. 2016-05-31 13:10:35 +03:00
Paul Sokolovsky
2503b59592 stmhal/moduos: getcwd(): Use mp_obj_new_exception_arg1().
Argument types were converted, but old function call of
mp_obj_new_exception_msg_varg() remained.
2016-05-29 20:04:32 +03:00
Damien George
4b37e775ea extmod/machine_i2c: Redo mp_hal_pin macros to use open_drain and od_low.
mp_hal_pin_config_od is renamed mp_hal_pin_open_drain, and mp_hal_pin_low
is mp_hal_pin_od_low.
2016-05-26 17:06:40 +01:00
Damien George
3e03d1b87e stmhal: Support frozen packages using .mpy files.
See issue #1814.
2016-05-23 13:29:56 +01:00
Damien George
87981fc517 stmhal/sdcard: Allow to do unaligned read-from/write-to SD card.
For example, the following code now works with a file on the SD card:

    f = open('test', 'rb') # test must be 1024 bytes or more in size
    f.seek(511)
    f.read(513)

Also works for writing.

Fixes issue #1863.
2016-05-13 14:45:40 +01:00
Damien George
1e388079f9 stmhal/i2c: Expose I2CHandle3 for use by custom C code.
If custom C code uses the I2C busses then it needs access to these
structures for i2c_init().
2016-05-13 11:23:32 +01:00
Damien George
1dc2862a83 stmhal/led: Allow LEDs to be in PWM mode with TIM1 and channels 1-4.
This allows PYBv3 to use PWM for LED(1) and LED(2).
2016-05-13 11:01:21 +01:00
Damien George
79a38a7a43 stmhal: For network drivers, convert to use MP_Exxx errno symbols. 2016-05-10 23:45:33 +01:00
Damien George
5ab98d5c41 stmhal: Convert to use internal errno symbols; enable uerrno module. 2016-05-10 23:30:39 +01:00
Tobias Badertscher
b924f649cd stmhal: Fix clock configuration for STM32L476-discovery; also add I2C2. 2016-05-10 09:20:30 +01:00
Henrik Sölver
c4587e2426 stmhal/can: Allow to get existing CAN obj if constructed without args.
Initialisation of CAN objects should now behave as other peripheral
objects.

Fixes issue #2001.
2016-05-08 12:47:33 +01:00
Damien George
88153dc56a stmhal/sdcard: Fix initialisation of DMA TX so that writes work.
Addresses issue #2034.
2016-05-06 10:53:25 +01:00
Dave Hylands
cbbeb786d7 stmhal/dma: Fix builds for boards with an F4 or F7 but no DAC. 2016-05-06 09:57:33 +01:00
Damien George
08d3d5d9ab stmhal: For LIMIFROG board, add early-init function to get to DFU mode. 2016-05-05 17:00:30 +01:00
Tobias Badertscher
770f169e63 stmhal: Add board files for LIMIFROG board. 2016-05-05 17:00:16 +01:00
Damien George
05d1664981 stmhal/dma: Make DAC DMA descriptors conditional on having a DAC. 2016-05-05 15:34:01 +01:00
Tobias Badertscher
0f846e563c stmhal: L4: Add support for machine.sleep on STM32L4 MCUs.
Also raise an exception for machine.freq and machine.deepsleep on this
MCU, since they are not yet implemented.
2016-05-05 15:28:55 +01:00
Tobias Badertscher
7441ba7749 stmhal: L4: Make CCM/DTCM RAM start-up conditional on MCU type. 2016-05-05 15:19:33 +01:00
Tobias Badertscher
adaaf439b0 stmhal: L4: Adapt startup code, clock configuration and interrupts. 2016-05-05 15:14:42 +01:00
Tobias Badertscher
e64032d6fd stmhal: L4: Adapt DMA to be able to support STM32L4 MCU series.
The main thing is to change the DMA code in a way that the structure
DMA_Stream_TypeDef (which is similar to DMA_Channel_TypeDef on stm32l4)
is no longer used outside of dma.c, as this structure only exists for the
F4 series.  Therefore I introduced a new structure (dma_descr_t) which
handles all DMA specific stuff for configuration.  Further the periphery
(spi, i2c, sdcard, dac) does not need to know the internals of the dma.
2016-05-05 14:51:20 +01:00
Damien George
70ff7350e7 stmhal, cc3200: Change i2c.scan() method to scan addresses 0x08-0x77.
A standard I2C address is 7 bits but addresses 0b0000xxx and 0b1111xxx
are reserved.  The scan() method is changed to reflect this, along with
the docs.
2016-05-02 11:15:36 +01:00
Damien George
12c61ddddd stmhal/accel: Raise an exception if the accel couldn't be initialised.
On PYBLITEv1.0 there is no accelerometer and in this case the Accel()
constructor should not silently succeed.
2016-04-29 15:43:15 +01:00
Damien George
a63542387d extmod, stmhal: Fix typo of macro that detects if float is enabled. 2016-04-26 12:47:24 +01:00
Colin Hogben
104aa26271 cc3200, stmhal, teensy: Use pyhelp_print_obj function.
Update the help() implementations in the cc3200, stmhal and teensy
ports to use the pyhelp_print_obj function.
2016-04-25 18:54:59 +03:00
Damien George
624738ca64 extmod/machine_i2c: Allow mp_hal_pin_obj_t to be any type, not a ptr. 2016-04-22 09:56:02 +01:00
Tobias Badertscher
495da15611 stmhal: L4: Add support for external interrupts/events.
The L4 MCU supports 40 Events/IRQs lines of the type configurable and
direct.  But this L4 port only supports configurable line types which are
already supported by uPy.  For details see page 330 of RM0351, Rev 1.

The USB_FS_WAKUP event is a direct type and there is no support for it.
2016-04-21 13:11:37 +01:00
Tobias Badertscher
067fb2da14 stmhal: L4: Modify flash.c and storage.c to support L4 MCU.
The way to lookup the flash sector now uses a much simpler table for
all MCUs.
2016-04-21 13:03:38 +01:00
Tobias Badertscher
dda1a41205 stmhal: L4: Modify mphalport to support L4 MCU.
__GPIOI_CLK_ENABLE is defined in hal/l4/inc/Legacy/stm32_hal_legacy.h
as __HAL_RCC_GPIOI_CLK_ENABLE, and that latter macro is not defined
anywhere else (because the L4 does not have port GPIOI).  So the test
for GPIOI is needed, along with the test for the CLK_ENABLE macro.
2016-04-21 12:23:28 +01:00
Paul Sokolovsky
098f3e2862 stmhal: Update Makefile dependencies. 2016-04-19 11:54:07 +03:00
Damien George
5e247a5192 stmhal: Fix machine.unique_id() function to work for all MCUs. 2016-04-17 12:18:50 +01:00
Tobias Badertscher
31f5dc065a stmhal: L4: Modify timer.c to support L4 MCU. 2016-04-17 12:16:13 +01:00
Tobias Badertscher
432465b167 stmhal: L4: Modify rtc.c to support L4 MCU. 2016-04-17 12:08:07 +01:00
Damien George
aed1da913b stmhal: L4: Modify usbd_conf.c to support L4 MCU.
Original patch was authored by Tobias Badertscher / @tobbad, but it was
reworked to split UART edits from USB edits.
2016-04-17 12:02:26 +01:00
Damien George
53521152a8 stmhal: L4: Modify uart.c to support L4 MCU.
L4 does not have UART6, and has similar registers to the F7.

Original patch was authored by Tobias Badertscher / @tobbad, but it was
reworked to split UART edits from USB edits.
2016-04-17 12:01:05 +01:00
Tobias Badertscher
d49a547064 stmhal: L4: Modify adc.c to add support for STM32L4 series. 2016-04-16 23:02:36 +01:00
Tobias Badertscher
69f26c68c9 stmhal: L4: Add line to Makefile for building L4 series. 2016-04-16 22:14:12 +01:00
Tobias Badertscher
0b6e28c999 stmhal: L4: Add board definition files for STM32L476DISC. 2016-04-16 22:11:02 +01:00
Damien George
e943a407f2 stmhal: Update HALCOMMITS due to change to hal. 2016-04-16 22:00:49 +01:00
Tobias Badertscher
d4c3349957 stmhal: L4: Adapt UART HAL to avoid 64-bit integer division.
64-bit integer division brings a dependency on library functions. It is
avoided here by dividing fck and baud by a common divisior.  The error
is the better (1/(2*0x300)) as with 64 bit division (1/(0x300)).
2016-04-16 21:54:19 +01:00
Tobias Badertscher
f4942db044 stmhal: L4: Add basic STM32L4xx HAL files.
These files come from STM32Cube_FW_L4_V1.3.0, with Windows line endings
converted to unix.  Only basic HAL files are added.  In addition the QSPI
support is included to support later external QSPI flash as mass storage.
2016-04-16 21:51:40 +01:00
Tobias Badertscher
2ba6677775 stmhal: L4: Add CMSIS files to support STM32L476. 2016-04-16 21:41:52 +01:00
Damien George
040373e4c4 stmhal: For frozen bytecode generation, add dependency of qstr file. 2016-04-16 13:20:02 +01:00
Jan Čapek
d76c65f599 py: Add rules for automated extraction of qstrs from sources.
- add template rule that converts a specified source file into a qstring file

- add special rule for generating a central header that contains all
  extracted/autogenerated strings - defined by QSTR_DEFS_COLLECTED
  variable. Each platform appends a list of sources that may contain
  qstrings into a new build variable: SRC_QSTR. Any autogenerated
  prerequisities are should be appened to SRC_QSTR_AUTO_DEPS variable.

- remove most qstrings from py/qstrdefs, keep only qstrings that
  contain special characters - these cannot be easily detected in the
  sources without additional annotations

- remove most manual qstrdefs, use qstrdef autogen for: py, cc3200,
  stmhal, teensy, unix, windows, pic16bit:

   - remove all micropython generic qstrdefs except for the special strings that contain special characters (e.g. /,+,<,> etc.)
   - remove all port specific qstrdefs except for special strings
   - append sources for qstr generation in platform makefiles (SRC_QSTR)
2016-04-16 13:18:09 +01:00
Paul Sokolovsky
9b0714b24c py: Declare help, input, open builtins in core.
These are *defined* per-port, but why redeclare them again and again.
2016-04-15 00:07:56 +03:00
Damien George
733db525e2 stmhal: Add Makefile option FROZEN_MPY_DIR to support frozen bytecode. 2016-04-13 16:07:47 +01:00
Damien George
0a2e9650f5 py: Add ability to have frozen persistent bytecode from .mpy files.
The config variable MICROPY_MODULE_FROZEN is now made of two separate
parts: MICROPY_MODULE_FROZEN_STR and MICROPY_MODULE_FROZEN_MPY.  This
allows to have none, either or both of frozen strings and frozen mpy
files (aka frozen bytecode).
2016-04-13 16:07:47 +01:00
Peter Hinch
22cbcd55f0 stmhal: Properly handle RTS/CTS flow control for buf/unbuf transfers.
Fixes issues #1912 and #1913.  UART documentation is also updated.
2016-04-13 08:42:32 +01:00
Damien George
67a327cb9b stmhal: Enable framebuf module. 2016-04-12 14:06:54 +01:00