SUServo: apply bit masks to servo memory writes to prevent overflows

Signed-off-by: TPH <thomas.harty@physics.ox.ac.uk>
This commit is contained in:
hartytp 2019-02-07 15:43:18 +00:00 committed by Robert Jördens
parent f6142816b8
commit 0ebff04ad7
1 changed files with 1 additions and 0 deletions

View File

@ -130,6 +130,7 @@ class SUServo:
:param value: Data to be written.
"""
addr |= WE
value &= (1 << COEFF_WIDTH) - 1
value |= (addr >> 8) << COEFF_WIDTH
addr = addr & 0xff
rtio_output((self.channel << 8) | addr, value)