Merge branch 'peterhinch:master' into master

pull/24/head
Abel Deuring 2024-02-03 20:14:06 +01:00 zatwierdzone przez GitHub
commit 640af0f1bf
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: B5690EEEBB952194
2 zmienionych plików z 7 dodań i 4 usunięć

Wyświetl plik

@ -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 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 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. 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 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` SPI baudrate should be 5MHz and the chip size must be specified to the `EEPROM`
constructor, e.g.: constructor, e.g.:

Wyświetl plik

@ -24,16 +24,16 @@ def get_eep(stm):
if stm: if stm:
if ESP8266: if ESP8266:
spi = SoftSPI(baudrate=5_000_000, sck=Pin(4), miso=Pin(0), mosi=Pin(2)) 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 = 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) eep = EEPROM(spi, cspins, 256)
else: else:
if ESP8266: if ESP8266:
spi = SoftSPI(baudrate=20_000_000, sck=Pin(4), miso=Pin(0), mosi=Pin(2)) spi = SoftSPI(baudrate=20_000_000, sck=Pin(4), miso=Pin(0), mosi=Pin(2))
else: else:
# spi = SPI(2, baudrate=20_000_000) # 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) eep = EEPROM(spi, cspins, 128)
print("Instantiated EEPROM") print("Instantiated EEPROM")
return eep return eep