[riot-notifications] [RIOT-OS/RIOT] drivers/at24cxxx: MTD wrapper for at24cxxx (#14110)

benpicco notifications at github.com
Mon May 25 20:51:12 CEST 2020


@benpicco commented on this pull request.



> +    assert(PARAMS(mtd));
+    int init = at24cxxx_init(DEV(mtd), PARAMS(mtd));
+    if (init != AT24CXXX_OK) {
+        return init;
+    }
+    mtd->page_size = DEV(mtd)->params.page_size;
+    mtd->pages_per_sector = 1;
+    mtd->sector_count = DEV(mtd)->params.eeprom_size /
+                        DEV(mtd)->params.page_size;
+    return 0;
+}
+
+static int _mtd_at24cxxx_read(mtd_dev_t *mtd, void *dest, uint32_t addr,
+                              uint32_t size)
+{
+    return at24cxxx_read(DEV(mtd), addr, dest, size) == AT24CXXX_OK ? 0 : -EIO;

I was hoping clever LTO could throw out the wrapper functions if we just pass on the return values, but I did not try this.

-- 
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/14110#discussion_r430046673
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20200525/44dda840/attachment.htm>


More information about the notifications mailing list