date | version | author | Remark |
---|---|---|---|
2016-08-27 | 1.0 | Roland van Straten | initial port |
2016-12-10 | 1.1 | Roland van Straten | Use UART Pin definitions |
2018-06-24 | 1.2 | Roland van Straten | updated to latest micropython |
CLICKER2 is a STM32F407VGT6
based board that features two module connectors, two switches, two LEDs, and a single cell Li-Ion battery charger.
More information: mikroe clicker2 website
Following assumes that the path to micropython
local repository is at $HOME/workspace/
.
$ cd $HOME/workspace/micropython/ports/stm32/boards
$ git clone https://github.com/rolandvs/CLICKER2.git
$ cd ..
$ make BOARD=CLICKER2
Added directories:
stm32/boards/CLICKER2/
with all board specific filesstm32/boards/CLICKER2/docs/
with additional informationstm32/boards/CLICKER2/modules/
with a board support package that could be frozen
There is a single patch needed to micropython to add an additional memory segment to the internal /flash
drive.
- In the
ports/stm32/flashbdev.c
there is an extra segment of Flash memory available. This has been changed in a configurable item using#define MICROPY_HW_FLASH_EXTRA (1)
in thempconfigboard.h
. In theflashbdev.c
replacing#if (0)
by#if defined(MICROPY_HW_FLASH_EXTRA)
.
Board Label | CPU Pin | Description |
---|---|---|
LD1 | PE12 | LED 1 (left), active low |
LD2 | PE15 | LED 2 (right), active low |
SW | PE0 | PYB switch, active low |
T2 | PE0 | left switch, active low |
T3 | PA10 | right switch, active low |
SENSEL | PB12 | select the battery measurement circuit, active low |
VSENSE | PC5 | the battery voltage ADC channel, scaled 1/3 of battery voltage |
FAULT | PC6 | status of the FAULT pin, active low |
BATSTAT | PD4 | status of the CHARGE pin, active low |
A small BSP package is placed in ports/stm32/boards/CLICKER2/modules/
and can be used like:
import bsp
clicker2 = bsp.BSP()
Some code to exercise the functions is executed through execfile('bsp.py')
.
The functions are:
The battery voltage will return the voltage measured at the battery using a voltage divider.
batval = clicker2.ReadBatteryVoltage()
print("Battery voltage is: {:4.2f}.".format(batval))
This reads the two status pins /CHARGE
and /FAULT
of the power supply and returns them.
charge, fault = clicker2.ReadChargerStatus()
Returns True
if charging.
charge = clicker2.IsChargerActive()
Returns True
if power supply generates a fault signal.
charge = clicker2.IsFaultActive()
Return True
if button is pressed.
SW1 = clicker2.IsButton1Pressed()
SW2 = clicker2.IsButton2Pressed()