forked from mcauser/micropython_eeprom
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support of Microchip AT24C32 and support of single chip for `EEPR…
…OM` class [Description] Adds support of: 1. Microchip AT24C32 (4 KiB) 2. Support of single chip setup for `EEPROM` class when single chip has address is 0x57 so entire set of chips (1 chip in our case) addresses are not started from 0x50. Example: ```python from eeprom_i2c import EEPROM, T24C32 eeprom = PROM(machine.I2C(0), T24C32) ``` Improves tests implementation by adding dependency injection of `EEPROM` object used during testing with support of old use case when object had not been provided for testing. Example (for AT24C32 connected to I2C0 of my Raspberry Pi Pico W) when we creating instance of `EEPROM` and then passing it to `full_test` and also providing proper block size for this chip: ```python import machine from eeprom_i2c import EEPROM, T24C32 from eep_i2c import full_test def get_eep(): return EEPROM(machine.I2C(0), T24C32) def main(): print("App started") print("Running tests") eep = get_eep() full_test(eep, block_size=32) print("App finished") if __name__ == "__main__": main() ``` [Motivation] Have DS3231 with soldered AT24C32 chip and want to use both RTC and EEPROM. In my case AT24C32 has 0x57 as it's address and `EEPROM` class refused to work with this setup. [Testing] Executed `full_test` from `eep_i2c` against AT24C32 (with address 0x57) connected to my Raspberry Pi Pico W. Test code: ```python import machine from eeprom_i2c import EEPROM, T24C32 from eep_i2c import full_test def get_eep(): return EEPROM(machine.I2C(0), T24C32) def main(): print("App started") print("Running tests") eep = get_eep() full_test(eep, block_size=32) print("App finished") if __name__ == "__main__": main() ```
- Loading branch information
1 parent
9d77347
commit f84eb5c
Showing
4 changed files
with
29 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters