Lines Matching +full:device +full:- +full:chemistry

5  * SPDX-License-Identifier: Apache-2.0
29 #include <zephyr/device.h>
41 /** Used to cutoff the battery from the system - useful for storage/shipping of devices */
45 /** Whether the battery underlying the fuel-gauge is cut off from charge */
65 /** Absolute state of charge (percent, 0-100) - expressed as % of design capacity */
67 /** Relative state of charge (percent, 0-100) - expressed as % of full charge capacity */
101 /** Chemistry (1 byte length + 4 bytes data) */
107 * Reserved to demark downstream custom properties - use this value as the actual value may
207 typedef int (*fuel_gauge_get_property_t)(const struct device *dev, fuel_gauge_prop_t prop,
216 typedef int (*fuel_gauge_set_property_t)(const struct device *dev, fuel_gauge_prop_t prop,
225 typedef int (*fuel_gauge_get_buffer_property_t)(const struct device *dev,
235 typedef int (*fuel_gauge_battery_cutoff_t)(const struct device *dev);
241 * Note: Historically this API allowed drivers to implement a custom multi-get/set property
253 * @brief Fetch a battery fuel-gauge property
255 * @param dev Pointer to the battery fuel-gauge device
256 * @param prop Type of property to be fetched from device
258 * fuel gauge device.
261 __syscall int fuel_gauge_get_prop(const struct device *dev, fuel_gauge_prop_t prop,
264 static inline int z_impl_fuel_gauge_get_prop(const struct device *dev, fuel_gauge_prop_t prop, in z_impl_fuel_gauge_get_prop()
267 const struct fuel_gauge_driver_api *api = (const struct fuel_gauge_driver_api *)dev->api; in z_impl_fuel_gauge_get_prop()
269 if (api->get_property == NULL) { in z_impl_fuel_gauge_get_prop()
270 return -ENOSYS; in z_impl_fuel_gauge_get_prop()
273 return api->get_property(dev, prop, val); in z_impl_fuel_gauge_get_prop()
277 * @brief Fetch multiple battery fuel-gauge properties. The default implementation is the same as
281 * @param dev Pointer to the battery fuel-gauge device
282 * @param props Array of the type of property to be fetched from device, each index corresponds
285 * the fuel gauge device. The vals array is not permuted.
291 __syscall int fuel_gauge_get_props(const struct device *dev, const fuel_gauge_prop_t *props,
293 static inline int z_impl_fuel_gauge_get_props(const struct device *dev, in z_impl_fuel_gauge_get_props()
297 const struct fuel_gauge_driver_api *api = (const struct fuel_gauge_driver_api *)dev->api; in z_impl_fuel_gauge_get_props()
300 int ret = api->get_property(dev, props[i], vals + i); in z_impl_fuel_gauge_get_props()
311 * @brief Set a battery fuel-gauge property
313 * @param dev Pointer to the battery fuel-gauge device
319 __syscall int fuel_gauge_set_prop(const struct device *dev, fuel_gauge_prop_t prop,
322 static inline int z_impl_fuel_gauge_set_prop(const struct device *dev, fuel_gauge_prop_t prop, in z_impl_fuel_gauge_set_prop()
325 const struct fuel_gauge_driver_api *api = (const struct fuel_gauge_driver_api *)dev->api; in z_impl_fuel_gauge_set_prop()
327 if (api->set_property == NULL) { in z_impl_fuel_gauge_set_prop()
328 return -ENOSYS; in z_impl_fuel_gauge_set_prop()
331 return api->set_property(dev, prop, val); in z_impl_fuel_gauge_set_prop()
334 * @brief Set a battery fuel-gauge property
336 * @param dev Pointer to the battery fuel-gauge device
340 * the fuel gauge device. The vals array is not permuted.
345 __syscall int fuel_gauge_set_props(const struct device *dev, const fuel_gauge_prop_t *props,
348 static inline int z_impl_fuel_gauge_set_props(const struct device *dev, in z_impl_fuel_gauge_set_props()
364 * @brief Fetch a battery fuel-gauge buffer property
366 * @param dev Pointer to the battery fuel-gauge device
367 * @param prop_type Type of property to be fetched from device
374 __syscall int fuel_gauge_get_buffer_prop(const struct device *dev, fuel_gauge_prop_t prop_type,
377 static inline int z_impl_fuel_gauge_get_buffer_prop(const struct device *dev, in z_impl_fuel_gauge_get_buffer_prop()
381 const struct fuel_gauge_driver_api *api = (const struct fuel_gauge_driver_api *)dev->api; in z_impl_fuel_gauge_get_buffer_prop()
383 if (api->get_buffer_property == NULL) { in z_impl_fuel_gauge_get_buffer_prop()
384 return -ENOSYS; in z_impl_fuel_gauge_get_buffer_prop()
387 return api->get_buffer_property(dev, prop_type, dst, dst_len); in z_impl_fuel_gauge_get_buffer_prop()
393 * @param dev Pointer to the battery fuel-gauge device
398 __syscall int fuel_gauge_battery_cutoff(const struct device *dev);
400 static inline int z_impl_fuel_gauge_battery_cutoff(const struct device *dev) in z_impl_fuel_gauge_battery_cutoff()
402 const struct fuel_gauge_driver_api *api = (const struct fuel_gauge_driver_api *)dev->api; in z_impl_fuel_gauge_battery_cutoff()
404 if (api->battery_cutoff == NULL) { in z_impl_fuel_gauge_battery_cutoff()
405 return -ENOSYS; in z_impl_fuel_gauge_battery_cutoff()
408 return api->battery_cutoff(dev); in z_impl_fuel_gauge_battery_cutoff()