25 lines
717 B
Zig
25 lines
717 B
Zig
|
const flipperzero = @import("flipperzero.zig");
|
||
|
const c = flipperzero.c;
|
||
|
|
||
|
pub fn FuriMessageQueue(comptime T: type) type {
|
||
|
return extern struct {
|
||
|
const Self = @This();
|
||
|
|
||
|
pub fn create(msg_count: u32) *Self {
|
||
|
return @ptrCast(c.furi_message_queue_alloc(msg_count, @sizeOf(T)));
|
||
|
}
|
||
|
|
||
|
pub fn destroy(self: *Self) void {
|
||
|
c.furi_message_queue_free(self);
|
||
|
}
|
||
|
|
||
|
pub fn get(self: *Self, msg_ptr: *T, timeout: u32) void {
|
||
|
_ = c.furi_message_queue_get(self, msg_ptr, timeout);
|
||
|
}
|
||
|
|
||
|
pub fn put(self: *Self, msg_ptr: *const T, timeout: u32) void {
|
||
|
_ = c.furi_message_queue_put(self, msg_ptr, timeout);
|
||
|
}
|
||
|
};
|
||
|
}
|