Re: Counter API ambiguity.

Boie, Andrew P



I see you contributed these APIs to Zephyr, can you help us understand the intention with the "count" parameter to count_set_alarm()?


From: Cufi, Carles [mailto:Carles.Cufi@...]
Sent: Friday, September 1, 2017 2:30 AM
To: Michał Kruszewski <mkru@...>; zephyr-devel@...; Tomasz Bursztyka <tomasz.bursztyka@...>; Boie, Andrew P <andrew.p.boie@...>
Subject: RE: [Zephyr-devel] Counter API ambiguity.


Hi Tomasz, Andrew


Do you have any feedback for Michal regarding the issue below?






From: zephyr-devel-bounces@... [mailto:zephyr-devel-bounces@...] On Behalf Of Michal Kruszewski via Zephyr-devel
Sent: 28 August 2017 10:51
To: zephyr-devel@...
Subject: [Zephyr-devel] Counter API ambiguity.


In the counter API we can find following function with its description:



* @brief Set an alarm.

* @param dev Pointer to the device structure for the driver instance.

* @param callback Pointer to the callback function. if this is NULL,

*                 this function unsets the alarm.

* @param count Number of counter ticks.

* @param user_data Pointer to user data.


* @retval 0 If successful.

* @retval -ENOTSUP if the counter was not started yet.

* @retval -ENODEV if the device doesn't support interrupt (e.g. free

*                        running counters).

* @retval Negative errno code if failure.


static inline int counter_set_alarm(struct device *dev,

    counter_callback_t callback,

    u32_t count, void *user_data)


const struct counter_driver_api *api = dev->driver_api;


return api->set_alarm(dev, callback, count, user_data);



Description: * @param count Number of counter ticks is misleading because it is not explicitly defined if it is relative count (relative to current counter value) or absolute counter count value.


Can anyone clarify it and can we make PR to add that information to API so that application developers do not interpret it in wrong way?


Michał Kruszewski


Sent with ProtonMail Secure Email.


Join to automatically receive all group messages.