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
- Host: GitHub
- URL: https://github.com/ziteh/stm32-oop-lib
- Owner: ziteh
- License: lgpl-2.1
- Archived: true
- Created: 2021-10-03T02:42:38.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2023-04-02T11:57:08.000Z (about 3 years ago)
- Last Synced: 2025-05-06T06:08:20.844Z (about 1 year ago)
- Topics: libopencm3, nucleo-board, stm32, stm32f103
- Language: C++
- Homepage:
- Size: 122 KB
- Stars: 4
- Watchers: 3
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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)