Usage
typedef <GPIOA, 9> somePin; //Define pin PA9 as somePin
After that you can
//Read from that pin
somePin::mode(Mode::INPUT);
int value = somePin::value();
//Set the pin's value
somePin::mode(Mode::OUTPUT);
somePin::high();
somePin::low();
All the possible pin modes and speeds can be found in the
gpio_impl.h inside libs/miosix-kernel/miosix/arch/<your_arch>/common/interfaces-impl
.
Discovery Boards
These are some commonly used pins that you'll need when writing software for discovery boards.
-
STM32F429ZI_DISCO (with screen)
stm32f429zi Red Led PG13 Green Led PG14 User Button PA0
You can find a complete pin usage description here.
-
STM32F407VG_DISCO (no screen)
stm32f407vg Red Led Green Led User Button PA0
Take a look at the f407 datasheet for more.
Miosix Pin Definition
Where are the stm32 pins which are used in miosix? (all paths are referred to /libs/miosix-kernel/miosix
).
-
SD memory:
arch/common/drivers/sd_stm32f2_f4.cpp
D0 D1 D2 D3 CLK CMD PC8 PC9 PC10 PC11 PC12 PD2 -
Serial Ports:
arch/common/drivers/serial_stm32.cpp
USART TX RX CTS RTS 1 PA9 PA0 PA11 PA12 2 PA2 PA3 PA0 PA1 3 PB10 PB11 PB13 PB14 -
Servo:
arch/common/drivers/servo_stm32.cpp
SERVO1 SERVO2 SERVO3 SERVO4 PB6 PB7 PB8 PB9