From 3d6f55104b07ed5d04cc3cc8a6df399241c9e32e Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Sun, 22 May 2016 06:53:18 -0700 Subject: [PATCH] coredevice/TCA6424A: convert 'outputs' value to little endian. Closes #437 --- RELEASE_NOTES.rst | 7 +++++++ artiq/coredevice/i2c.py | 7 ++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/RELEASE_NOTES.rst b/RELEASE_NOTES.rst index 12f45629f..6a6269ab6 100644 --- a/RELEASE_NOTES.rst +++ b/RELEASE_NOTES.rst @@ -42,6 +42,13 @@ unreleased [2.x] takes into account the repository revision field. +1.1 (unreleased) +---------------- + +* TCA6424A.set converts the "outputs" value to little-endian before programming + it into the registers. + + 1.0 --- diff --git a/artiq/coredevice/i2c.py b/artiq/coredevice/i2c.py index fb37a2aa6..da3fa6269 100644 --- a/artiq/coredevice/i2c.py +++ b/artiq/coredevice/i2c.py @@ -108,5 +108,10 @@ class TCA6424A: A bit set to 1 means the TTL is an output. """ + outputs_le = ( + ((outputs & 0xff0000) >> 16) | + (outputs & 0x00ff00) | + (outputs & 0x0000ff) << 16) + self._write24(0x8c, 0) # set all directions to output - self._write24(0x84, outputs) # set levels + self._write24(0x84, outputs_le) # set levels