From da8c9f54f1ad3167513fc467cc0d1d52aa43197c Mon Sep 17 00:00:00 2001 From: Peter Hinch Date: Fri, 29 Oct 2021 18:42:21 +0100 Subject: [PATCH] fram_spi.py: Correct code comments. --- fram/fram_spi.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/fram/fram_spi.py b/fram/fram_spi.py index 756e7bb..e1ef49d 100644 --- a/fram/fram_spi.py +++ b/fram/fram_spi.py @@ -91,7 +91,8 @@ class FRAM(BlockDevice): #cs(1) # Given an address, set current chip select and address buffer. - # Return the number of bytes that can be processed in the current chip. + # Return the number of bytes that can be processed in the current page. + # Use of 256 byte pages may be unnecessary for FRAM but cost is minimal. def _getaddr(self, addr, nbytes): if addr >= self._a_bytes: raise RuntimeError("FRAM Address is out of range") @@ -101,7 +102,7 @@ class FRAM(BlockDevice): mvp[1] = la >> 16 mvp[2] = (la >> 8) & 0xff mvp[3] = la & 0xff - pe = (addr & ~0xff) + 0x100 # byte 0 of next chip + pe = (addr & ~0xff) + 0x100 # byte 0 of next page return min(nbytes, pe - la) # Interface to bdevice @@ -111,7 +112,7 @@ class FRAM(BlockDevice): mvp = self._mvp start = 0 # Offset into buf. while nbytes > 0: - npage = self._getaddr(addr, nbytes) # No of bytes that fit on current chip + npage = self._getaddr(addr, nbytes) # No of bytes that fit on current page cs = self._ccs if read: mvp[0] = _READ