1 /* 2 * Copyright (c) 2024 Gergo Vari <work@gergovari.com> 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 #ifndef ZEPHYR_INCLUDE_DRIVERS_MFD_DS3231_H_ 8 #define ZEPHYR_INCLUDE_DRIVERS_MFD_DS3231_H_ 9 10 #include <zephyr/drivers/i2c.h> 11 12 /** 13 * @brief Get specified number of registers from an I2C device 14 * starting at the given register address. 15 * 16 * @param dev ds3231 mfd device 17 * @param start_reg The register address to start at. 18 * @param buf The buffer array pointer to store results in. 19 * @param buf_size The amount of register values to return. 20 * @retval 0 on success 21 * @retval -errno in case of any bus error 22 */ 23 int mfd_ds3231_i2c_get_registers(const struct device *dev, uint8_t start_reg, uint8_t *buf, 24 const size_t buf_size); 25 26 /** 27 * @brief Set a register on an I2C device at the given register address. 28 * 29 * @param dev ds3231 mfd device 30 * @param start_reg The register address to set. 31 * @param buf The value to write to the given address. 32 * @param buf_size The size of the buffer to be written to the given address. 33 * @retval 0 on success 34 * @retval -errno in case of any bus error 35 */ 36 int mfd_ds3231_i2c_set_registers(const struct device *dev, uint8_t start_reg, const uint8_t *buf, 37 const size_t buf_size); 38 39 #endif /* ZEPHYR_INCLUDE_DRIVERS_MFD_DS3231_H_ */ 40