... | ... | @@ -2,15 +2,17 @@ |
|
|
|
|
|
To use a pin in your board you can simply:
|
|
|
```cpp
|
|
|
typedef <GPIOA, 9> somePin; //Define pin PA9 as somePin
|
|
|
typedef miosix::Gpio<GPIOA, 9> somePin; //Define pin PA9 as somePin
|
|
|
```
|
|
|
After that you can
|
|
|
|
|
|
To read from that pin:
|
|
|
```cpp
|
|
|
//Read from that pin
|
|
|
somePin::mode(Mode::INPUT);
|
|
|
int value = somePin::value();
|
|
|
```
|
|
|
|
|
|
//Set the pin's value
|
|
|
To set the pin's logical voltage:
|
|
|
```cpp
|
|
|
somePin::mode(Mode::OUTPUT);
|
|
|
somePin::high();
|
|
|
somePin::low();
|
... | ... | @@ -19,10 +21,10 @@ 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 Pins
|
|
|
These are some commonly used pins that you'll need when writing software for discovery boards.
|
|
|
### Discovery Board Pins
|
|
|
These are some commonly used pins that you'll need when writing software for **Discovery boards**.
|
|
|
|
|
|
- STM32F429ZI_DISCO (*with screen*)
|
|
|
- STM32F429ZI_DISCO
|
|
|
|
|
|
| stm32f429zi | |
|
|
|
|--------------|---|
|
... | ... | @@ -33,7 +35,7 @@ gpio_impl.h inside `libs/miosix-kernel/miosix/arch/<your_arch>/common/interfaces |
|
|
You can find a complete pin usage description
|
|
|
[here](https://os.mbed.com/platforms/ST-Discovery-F429ZI/).
|
|
|
|
|
|
- STM32F407VG_DISCO (*no screen*)
|
|
|
- STM32F407VG_DISCO
|
|
|
|
|
|
| stm32f407vg | |
|
|
|
|--------------|---|
|
... | ... | @@ -41,11 +43,10 @@ You can find a complete pin usage description |
|
|
| Green Led | PD12 |
|
|
|
| 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 Pins
|
|
|
You can find more in the [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.
|
|
|
|
|
|
Where are the stm32 pins which are used in miosix? (all paths are referred to `/libs/miosix-kernel/miosix` ).
|
|
|
### Miosix Used Pins
|
|
|
These are some pins that are used by default from the kernel when running on **STM32 micros** (all paths are referred to `/libs/miosix-kernel/miosix`):
|
|
|
|
|
|
- SD memory: `arch/common/drivers/sd_stm32f2_f4.cpp`
|
|
|
|
... | ... | |