[riot-notifications] [RIOT-OS/RIOT] Driver for AT24CXXX EEPROM (#11929)

fabian18 notifications at github.com
Mon Jul 29 23:21:21 CEST 2019


fabian18 commented on this pull request.



> + */
+enum {
+    AT24CXXX_DEV_ADDR_00    = (0x50),   //A1 = 0, A0 = 0
+    AT24CXXX_DEV_ADDR_01    = (0x51),   //A1 = 0, A0 = 1
+    AT24CXXX_DEV_ADDR_10    = (0x52),   //A1 = 1, A0 = 0
+    AT24CXXX_DEV_ADDR_11    = (0x53)    //A1 = 1, A0 = 1
+};
+
+/**
+ * @brief struct that holds initialization parameters
+ */
+typedef struct at24cxxx_params {
+    i2c_t i2c;                      /**< I2C bus number */
+    uint8_t dev_addr;               /**< I2C device address */
+    gpio_t pin_wp;                  /**< write protect pin */
+    at24cxxx_dev_type_t dev_type;   /**< device type */

I thought having functions that evaluate device attributes by a device type would be better, than having a member for every device attribute. But you are right, so far it is just a single attribute, the EEPROM size. If this driver could work with other EEPROMs too, the address length and write cycle delay may also differ. Would it then still be better to have a member for every device specific attribute?

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/11929#discussion_r308443200
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190729/4116f834/attachment-0001.htm>


More information about the notifications mailing list