[riot-notifications] [RIOT-OS/RIOT] driver_lis2dh12: functionality extension (#15871)

benpicco notifications at github.com
Fri Jan 29 14:19:03 CET 2021


@benpicco commented on this pull request.



> +/**
+ * @brief   Read the FIFO source register
+ *
+ * @param[in] dev       device descriptor
+ * @param[out] data     register values
+ *
+ * @return  LIS2DH12_OK on success
+ */
+int lis2dh12_read_fifo_src(const lis2dh12_t *dev, uint8_t *data);
+
+/**
+ * @brief   Read the FIFO data
+ *
+ * @param[in] dev       device descriptor
+ * @param[out] data     FIFO data
+ * @param[in] number    amount of FIFO data to be read

The user shouldn't have to interpret register values, that's the task of the driver.
Instead of having two API functions

 - get number of fifo events
 - read n events from fifo

we could just have

 - read up to n events from fifo, return number of events read (`min(n, FIFO_SRC_REG)`)

Is there any case where you would want to know the number of events in the fifo without also reading out the events?


-- 
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/15871#discussion_r566814603
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20210129/03c6076d/attachment-0001.htm>


More information about the notifications mailing list