Skip to content

Commit 4508df1

Browse files
omeh-aIvan-Velickovic
authored andcommitted
Updated GPIO to use Managed arraylist and use sddf class (?)
Signed-off-by: Lesley Rossouw <lesley.rossouw@unsw.edu.au>
1 parent 5e9e354 commit 4508df1

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

src/gpio.zig renamed to src/sddf/gpio.zig

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ const log = @import("../log.zig");
66
const sddf = @import("sddf.zig");
77

88
const fmt = sddf.fmt;
9+
const assert = std.debug.assert;
910

1011
const Allocator = std.mem.Allocator;
1112

@@ -17,14 +18,16 @@ const Channel = SystemDescription.Channel;
1718

1819
const ConfigResources = data.Resources;
1920

21+
const SystemError = sddf.SystemError;
22+
2023
pub const Gpio = struct {
2124
allocator: Allocator,
2225
sdf: *SystemDescription,
2326
driver: *Pd,
2427
device: *dtb.Node,
2528
device_res: ConfigResources.Device,
26-
clients: std.ArrayList(Client),
27-
client_configs: std.ArrayList(ConfigResources.Gpio.Client),
29+
clients: std.array_list.Managed(Client),
30+
client_configs: std.array_list.Managed(ConfigResources.Gpio.Client),
2831
connected: bool = false,
2932
serialised: bool = false,
3033

@@ -54,8 +57,8 @@ pub const Gpio = struct {
5457
.driver = driver,
5558
.device = device,
5659
.device_res = std.mem.zeroInit(ConfigResources.Device, .{}),
57-
.clients = std.ArrayList(Client).init(allocator),
58-
.client_configs = std.ArrayList(ConfigResources.Gpio.Client).init(allocator),
60+
.clients = std.array_list.Managed(Client).init(allocator),
61+
.client_configs = std.array_list.Managed(ConfigResources.Gpio.Client).init(allocator),
5962
};
6063
}
6164

@@ -132,7 +135,7 @@ pub const Gpio = struct {
132135
// The driver must be passive
133136
assert(system.driver.passive.?);
134137

135-
try createDriver(system.sdf, system.driver, system.device, .gpio, &system.device_res);
138+
try sddf.createDriver(system.sdf, system.driver, system.device, .gpio, &system.device_res);
136139

137140
// For each client...
138141
for (system.clients.items, 0..) |client, i| {

src/sddf/sddf.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ pub const Net = @import("net.zig").Net;
1111
pub const Lwip = @import("net.zig").Lwip;
1212
pub const Gpu = @import("gpu.zig").Gpu;
1313
pub const Serial = @import("serial.zig").Serial;
14-
pub const Gpio = @import("gpio.zig").I2c;
14+
pub const Gpio = @import("gpio.zig").Gpio;
1515

1616
const fs = std.fs;
1717
const assert = std.debug.assert;

0 commit comments

Comments
 (0)