kopia lustrzana https://github.com/peterhinch/micropython_eeprom
EEPROM: replace exception with warning for unsupported chips.
rodzic
36f67b7b54
commit
2792ab31d3
|
@ -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
|
to be able to support hardware I don't possess. Users should check datasheets
|
||||||
for compatibility.
|
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
|
## 1.5 Performance
|
||||||
|
|
||||||
FRAM is truly byte-addressable: its speed is limited only by the speed of the
|
FRAM is truly byte-addressable: its speed is limited only by the speed of the
|
||||||
|
|
|
@ -21,7 +21,7 @@ class EEPROM(BlockDevice):
|
||||||
def __init__(self, i2c, chip_size=T24C512, verbose=True, block_size=9):
|
def __init__(self, i2c, chip_size=T24C512, verbose=True, block_size=9):
|
||||||
self._i2c = i2c
|
self._i2c = i2c
|
||||||
if chip_size not in (T24C64, T24C128, T24C256, T24C512):
|
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
|
nchips = self.scan(verbose, chip_size) # No. of EEPROM chips
|
||||||
super().__init__(block_size, nchips, chip_size)
|
super().__init__(block_size, nchips, chip_size)
|
||||||
self._i2c_addr = 0 # I2C address of current chip
|
self._i2c_addr = 0 # I2C address of current chip
|
||||||
|
|
|
@ -30,7 +30,7 @@ class EEPROM(BlockDevice):
|
||||||
def __init__(self, spi, cspins, size=128, verbose=True, block_size=9):
|
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
|
# args: virtual block size in bits, no. of chips, bytes in each chip
|
||||||
if size not in (128, 256):
|
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)
|
super().__init__(block_size, len(cspins), size * 1024)
|
||||||
self._stm = size == 256
|
self._stm = size == 256
|
||||||
self._spi = spi
|
self._spi = spi
|
||||||
|
|
Ładowanie…
Reference in New Issue