|
|
### Usage
|
|
|
|
|
|
```cpp
|
|
|
typedef <GPIOA, 9> somePin; //Define pin PA9 as somePin
|
|
|
```
|
|
|
After that you can
|
|
|
```cpp
|
|
|
//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](https:/os.mbed.com/platforms/ST-Discovery-F429ZI/).
|
|
|
|
|
|
- STM32F407VG_DISCO (*no screen*)
|
|
|
|
|
|
| stm32f407vg | |
|
|
|
|--------------|---|
|
|
|
| Red Led | |
|
|
|
| Green Led | |
|
|
|
| User Button | PA0 |
|
|
|
|
|
|
Take a look at the f407 [datasheet](http://www.st.com/content/ccc/resource/technical/document/user_manual/70/fe/4a/3f/e7/e1/4f/7d/DM00039084.pdf/files/DM00039084.pdf/jcr:content/translations/en.DM00039084.pdf) 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 | |
|
|
\ No newline at end of file |