[riot-notifications] [RIOT-OS/RIOT] drivers/ltc4150: (Re-)implemented driver for the LTC4150 coulomb counter (#10755)

Marian Buschsieweke notifications at github.com
Wed Jan 16 14:16:47 CET 2019


maribu commented on this pull request.



> +     * @brief External pull on the /POL pin is present
+     */
+    LTC4150_POL_EXT_PULL_UP = 0x02,
+    /**
+     * @brief External pull on the /INT *and* the /POL pin is present
+     */
+    LTC4150_EXT_PULL_UP = LTC4150_INT_EXT_PULL_UP | LTC4150_POL_EXT_PULL_UP,
+};
+
+/**
+ * @brief Enumeration of directions in which the charge can be transferred
+ */
+typedef enum {
+    LTC4150_CHARGE,             /**< The battery is charged */
+    LTC4150_DISCHARGE,          /**< Charge is drawn from the battery */
+} ltc4150_dir_t;

> I think the size difference comes from avoiding `switch ... case` when using bool

Yes, obviously. I should have seen that. I now optimized it by making the switch binary (by making one of the two `case`s the `default`), which reduced the ROM size by `28` bytes on my machine. With that, `enum` and `bool` should now indeed be the same regarding ROM size.

-- 
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/10755#discussion_r248276378
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190116/072bea0f/attachment.html>


More information about the notifications mailing list