stm32f4
所属分类:编程语言基础
开发工具:Zig
文件大小:0KB
下载次数:0
上传日期:2022-09-15 11:46:36
上 传 者:
sh-1993
说明: STM32F4 HAL,使用Zig编程语言,
(STM32F4 HAL using the Zig Programming Language,)
文件列表:
LICENSE (1071, 2022-09-14)
build.zig (1715, 2022-09-14)
src/ (0, 2022-09-14)
src/main.zig (557, 2022-09-14)
src/reg.zig (3420, 2022-09-14)
src/startup.zig (740, 2022-09-14)
src/stm32f4.ld (3466, 2022-09-14)
src/stm32f411xe.zig (18436, 2022-09-14)
src/vector.zig (1381, 2022-09-14)
# STM32F4 HAL written in Zig
This is a small experiment for writing a Hardware Abstraction Layer in Zig.
For now only the GPIO and RCC works and general register abstraction is given.
There is also a plan to write a good **svd2zig** converter that you can generate the
HAL for any STM32 chip.
I'm happy to receive some feedback on the code structure and software design in general, so feel
free to contact me (Contact info below).
### Example usage
```zig
const board = @import("stm32f411xe.zig");
const Pin = board.Pin;
pub fn main() void {
// Create new pins PA8 and PB8
var pa8: Pin = Pin.new(board.periph.gpioa, 8);
var pb8: Pin = Pin.new(board.periph.gpiob, 8);
// configure the pins in output mode
pa8.make_output();
pb8.make_output();
while (true) {
// Write HIGH on PA8 and LOW on PB8
pa8.write(1);
pb8.write(0);
delay();
// Write LOW on PA8 and HIGH on PB8
pa8.write(0);
pb8.write(1);
delay();
}
}
pub fn delay() void {
var i: u32 = 0;
while (i < 100000) : (i += 1) {
asm volatile ("nop");
}
}
```
### Contact
Feel free to contact me on via E-Mail or Discord.
- Discord: moonraccoon#4788
- E-Mail: [moonxraccoon@protonmail.com](https://github.com/d-mironov/stm32f4.zig/blob/master/mailto:moonxraccoon@protonmail.com)
近期下载者:
相关文件:
收藏者: