File tree Expand file tree Collapse file tree 2 files changed +24
-2
lines changed
port/nordic/nrf5x/src/hal Expand file tree Collapse file tree 2 files changed +24
-2
lines changed Original file line number Diff line number Diff line change @@ -109,3 +109,25 @@ pub const I2C_Device = struct {
109109 };
110110 }
111111};
112+
113+ ///
114+ /// Implementation of a time device
115+ ///
116+ pub const ClockDevice = struct {
117+ pub fn clock_device (td : * ClockDevice ) Clock_Device {
118+ _ = td ;
119+ return Clock_Device {
120+ .ptr = undefined ,
121+ .vtable = & vtable ,
122+ };
123+ }
124+ const vtable = Clock_Device.VTable {
125+ .get_time_since_boot = get_time_since_boot_fn ,
126+ };
127+
128+ fn get_time_since_boot_fn (td : * anyopaque ) time.Absolute {
129+ _ = td ;
130+ const t = hal .time .get_time_since_boot ().to_us ();
131+ return @enumFromInt (t );
132+ }
133+ };
Original file line number Diff line number Diff line change @@ -148,7 +148,7 @@ pub const UART = enum(u1) {
148148 .nrf52840 = > regs .PSEL .TXD .write (.{
149149 .PIN = pin .index (),
150150 .PORT = pin .port (),
151- .CONNECT = @enumFromInt ( 0 ), // 0 means connected lol
151+ .CONNECT = .Connected ,
152152 }),
153153 }
154154 }
@@ -160,7 +160,7 @@ pub const UART = enum(u1) {
160160 .nrf52840 = > regs .PSEL .RXD .write (.{
161161 .PIN = pin .index (),
162162 .PORT = pin .port (),
163- .CONNECT = @enumFromInt ( 0 ), // 0 means connected lol
163+ .CONNECT = .Connected ,
164164 }),
165165 }
166166 }
You can’t perform that action at this time.
0 commit comments