Commit Graph

6 Commits

Author SHA1 Message Date
Damien George
b4cc68e4a4 stmhal/led: Refactor LED to use mp_hal_pin_output() init function.
As part of this patch the MICROPY_HW_LED_OTYPE setting is removed because
it is now unused (all boards anyway had this as OUTPUT_PP).
2016-10-18 14:43:05 +11: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
Paul Sokolovsky
97a0846af9 stmhal/diskio: Introduce MICROPY_HW_HAS_FLASH setting.
To allow to reuse stmhal/diskio for ports which don't have flash but have
other storage devices.
2016-02-06 15:07:01 +02:00
Damien George
a8a4b01af6 stmhal: Add PWM capability for LED(3) and LED(4) on pyboards.
USB CDC no longer needs TIM3 (which was originally used for LED(4) PWM)
and so TIM3 has been freed for general purpose use by the user.  Hence
LED(4) lost its PWM capabilities.

This patch reinstates the PWM capabilities using a semi-generic piece
of code which allows to configure a timer and PWM channel to use for any
LED.  But the PWM capability is only configured if the LED is set to an
intensity between 1 and 254 (ie only when needed).  In that case the
relevant timer is configured for PWM.  It's up to the user to make sure
the timers are not used if PWM is active.

This patch also makes sure that PWM LEDs are turned off using standard
GPIO when calling led.off() or led.intensity(0), instead of just setting
the PWM counter to zero.
2016-01-29 22:44:43 +00:00
Damien George
f7c4f9a640 stmhal: For SPI config, use HW_SPIx_SCK instead of HW_ENABLE_SPIx.
Previously, SPI was configured by a board defining MICROPY_HW_ENABLE_SPIx
to 0 or 1.  Now, the board should define MICROPY_HW_SPIx_SCK, MISO, MOSI
and NSS.  This makes it the same as how I2C is configured.
2015-12-12 15:02:02 +00:00
Damien George
e9a684d741 stmhal: Add board config files for PYBv1.1 and PYBLITEv1.0. 2015-12-02 12:47:09 +00:00