Created
September 9, 2019 10:12
-
-
Save shamiao/725f65b88348f16d17b394ba34f83a53 to your computer and use it in GitHub Desktop.
gd32vf103-example-raw_pointer_gpio_test_1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#![no_std] | |
#![no_main] | |
extern crate panic_halt; | |
use riscv_rt::entry; | |
#[entry] | |
fn main() -> ! { | |
let gpioa_ctl0 = 0x4001_0800_usize as *mut u32; | |
let gpioa_bop = 0x4001_0810_usize as *mut u32; | |
let gpioa_bc = 0x4001_0814_usize as *mut u32; | |
let rcu_apb2en = 0x4002_1018_usize as *mut u32; | |
unsafe { | |
*rcu_apb2en = 0x00000004_u32; | |
*gpioa_ctl0 = 0x34444334_u32; | |
*gpioa_bop = 0b00000000_00000000_00000000_10000010_u32; | |
*gpioa_bc = 0b00000000_00000000_00000000_00000100_u32; | |
} | |
loop { | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment