aboutsummaryrefslogtreecommitdiff
path: root/drivers/gpio/src/lib.rs
blob: 31a04b1fc874e2ead38768a91c12efdcc49b3f0c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#![no_std]

use ral_registers::register;

#[allow(non_snake_case)]
#[repr(C)]
pub struct RegisterBlock {
    pub DR: u32,
    pub GDIR: u32,
    pub PSR: u32,
    pub ICR1: u32,
    pub ICR2: u32,
    pub IMR: u32,
    pub ISR: u32,
    pub EDGE_SEL: u32,
    _reserved0: [u8; 0x64],
    pub DR_SET: u32,
    pub DR_CLEAR: u32,
    pub DR_TOGGLE: u32,
}

pub type GPIO = ral_registers::Instance<RegisterBlock>;

register!(pub DR<u32> RW []);
register!(pub GDIR<u32> RW []);
register!(pub PSR<u32> RO []);
register!(pub ICR1<u32> RW []);
register!(pub ICR2<u32> RW []);
register!(pub IMR<u32> RW []);
register!(pub ISR<u32> RW []);
register!(pub EDGE_SEL<u32> RW []);
register!(pub DR_SET<u32> WO []);
register!(pub DR_CLEAR<u32> WO []);
register!(pub DR_TOGGLE<u32> WO []);