On Wed, May 10, 2017 at 10:30 PM, Rob Gaddi
wrote:
> Sorry, but I'm just too proud of this.
>
> Given that you have:
>
> class RegisterLayout(ctypes.Structure):
> ...yadayadayada...
>
> You can then:
>
> fh = os.open('/dev/devicethingy', os.O_RDWR)
> mm = mmap.mmap(fh, ctypes.sizeof(Regi
Sorry, but I'm just too proud of this.
Given that you have:
class RegisterLayout(ctypes.Structure):
...yadayadayada...
You can then:
fh = os.open('/dev/devicethingy', os.O_RDWR)
mm = mmap.mmap(fh, ctypes.sizeof(RegisterLayout))
registers = RegisterLayout.from_buffer(mm)
And it jus