13 lines
354 B
Mojo
Generated
13 lines
354 B
Mojo
Generated
from std.memory.alloc import unsafe_alloc
|
|
|
|
|
|
def main():
|
|
# Stage a single encoder reading in a scratch buffer.
|
|
# BUG: allocate, write the value, read it back, then release it.
|
|
var ptr = unsafe_alloc(1)
|
|
ptr.unsafe_write(copy=99)
|
|
var value = ptr[]
|
|
print("Encoder count:", value)
|
|
ptr.unsafe_deinit_pointee()
|
|
ptr.unsafe_free()
|