An open API service indexing awesome lists of open source software.

https://github.com/ziteh/stm32-oop-lib

STM32 OOP library
https://github.com/ziteh/stm32-oop-lib

libopencm3 nucleo-board stm32 stm32f103

Last synced: about 1 year ago
JSON representation

STM32 OOP library

Awesome Lists containing this project

README

          

# STM32 OOP Library

***Legacy***

The basic OOP library of STM32.

# Features / 功能
- GPIO

> Only tested on STM32F103RB (NUCLEO-F103RB board).
> 僅在 STM32F103RB (NUCLEO-F103RB 開發板) 上進行過測試。

# Usage / 用法

All the code in this library are inside namespace `stm32_oop_lib`.
The following example may ellipsis `stm32_oop_lib::` or `using namespace stm32_oop_lib;`.


此函式庫的所有程式碼都在命名空間 `stm32_oop_lib` 之中。
以下的範例可能會省略 `stm32_oop_lib::` 或 `using namespace stm32_oop_lib;`。

## GPIO

### LED Blink Example/ LED 閃爍範例
```cpp
// main.cc

#include
#include

void delay(int value);

int main(void)
{
rcc_periph_clock_enable(RCC_GPIOA);

stm32_oop_lib::GPIO led(stm32_oop_lib::UserLED,
stm32_oop_lib::OutputPushPull);

while (1)
{
led.Toggle();
delay(200000);
}

return 0;
}

void delay(int value)
{
while (value--)
{
__asm__("nop");
}
}
```

# Dependency / 依賴

- [libopencm3/libopencm3: Open source ARM Cortex-M microcontroller library](https://github.com/libopencm3/libopencm3)