kopia lustrzana https://github.com/peterhinch/micropython_eeprom
Merge branch 'peterhinch:master' into master
commit
640af0f1bf
|
@ -22,9 +22,12 @@ The driver has the following attributes:
|
|||
|
||||
As of Jan 2024 this driver has been updated to fix a bug where the device page
|
||||
size was less than 256. A further aim was to make the driver more generic, with
|
||||
a better chance of working with other SPI EEPROM chips. The constructor has
|
||||
a high chance of working with other SPI EEPROM chips. The constructor has
|
||||
additional optional args to support this.
|
||||
|
||||
On Pyboard D soft SPI should be used pending resolution of
|
||||
[this PR](https://github.com/micropython/micropython/pull/13549).
|
||||
|
||||
Code samples assume one or more Microchip devices. If using the STM chip the
|
||||
SPI baudrate should be 5MHz and the chip size must be specified to the `EEPROM`
|
||||
constructor, e.g.:
|
||||
|
|
|
@ -24,16 +24,16 @@ def get_eep(stm):
|
|||
if stm:
|
||||
if ESP8266:
|
||||
spi = SoftSPI(baudrate=5_000_000, sck=Pin(4), miso=Pin(0), mosi=Pin(2))
|
||||
else: # Pyboard. 1.22.1 hard SPI seems to have a read bug
|
||||
else: # Pyboard. See https://github.com/micropython/micropython/pull/13549
|
||||
# spi = SPI(2, baudrate=5_000_000)
|
||||
spi = SoftSPI(baudrate=5_000_000, sck=Pin('Y6'), miso=Pin('Y7'), mosi=Pin('Y8'))
|
||||
spi = SoftSPI(baudrate=5_000_000, sck=Pin("Y6"), miso=Pin("Y7"), mosi=Pin("Y8"))
|
||||
eep = EEPROM(spi, cspins, 256)
|
||||
else:
|
||||
if ESP8266:
|
||||
spi = SoftSPI(baudrate=20_000_000, sck=Pin(4), miso=Pin(0), mosi=Pin(2))
|
||||
else:
|
||||
# spi = SPI(2, baudrate=20_000_000)
|
||||
spi = SoftSPI(baudrate=20_000_000, sck=Pin('Y6'), miso=Pin('Y7'), mosi=Pin('Y8'))
|
||||
spi = SoftSPI(baudrate=20_000_000, sck=Pin("Y6"), miso=Pin("Y7"), mosi=Pin("Y8"))
|
||||
eep = EEPROM(spi, cspins, 128)
|
||||
print("Instantiated EEPROM")
|
||||
return eep
|
||||
|
|
Ładowanie…
Reference in New Issue