EEPROM: replace exception with warning for unsupported chips.

pull/13/head
Peter Hinch 2021-04-25 12:16:02 +01:00
rodzic 36f67b7b54
commit 2792ab31d3
3 zmienionych plików z 10 dodań i 2 usunięć

Wyświetl plik

@ -86,6 +86,14 @@ It is likely that other chips with 4096 byte blocks will work but I am unlikely
to be able to support hardware I don't possess. Users should check datasheets
for compatibility.
### 1.4.1 Chips tested by users
If you have success with other chips please raise an issue and I will update
this doc.
CAT24C256LI-G I2C EEPROM 32KiB tested by
[Julien Phalip](https://github.com/peterhinch/micropython_eeprom/issues/6#issuecomment-825801065).
## 1.5 Performance
FRAM is truly byte-addressable: its speed is limited only by the speed of the

Wyświetl plik

@ -21,7 +21,7 @@ class EEPROM(BlockDevice):
def __init__(self, i2c, chip_size=T24C512, verbose=True, block_size=9):
self._i2c = i2c
if chip_size not in (T24C64, T24C128, T24C256, T24C512):
raise RuntimeError('Invalid chip size', chip_size)
print('Warning: possible unsupported chip. Size:', chip_size)
nchips = self.scan(verbose, chip_size) # No. of EEPROM chips
super().__init__(block_size, nchips, chip_size)
self._i2c_addr = 0 # I2C address of current chip

Wyświetl plik

@ -30,7 +30,7 @@ class EEPROM(BlockDevice):
def __init__(self, spi, cspins, size=128, verbose=True, block_size=9):
# args: virtual block size in bits, no. of chips, bytes in each chip
if size not in (128, 256):
raise ValueError('Valid sizes are 128 or 256')
print('Warning: possible unsupported chip. Size:', size)
super().__init__(block_size, len(cspins), size * 1024)
self._stm = size == 256
self._spi = spi