1 #ifndef RTCIF_H 2 #define RTCIF_H 3 4 #ifdef __cplusplus 5 extern "C" { 6 #endif 7 8 /* ===== System include ===== */ 9 #include "aos/hal/i2c.h" 10 #include "aos/kernel.h" 11 #include "rx8130ce.h" 12 #include <stdio.h> 13 #include <stdlib.h> 14 #include <string.h> 15 16 /********************************************************* 17 * @fun rtc_i2c_init 18 * @breif rtc i2c initialization 19 * @param i2c:the pointer for i2c configuration 20 * @rtn 0 : on success, EIO : error 21 *********************************************************/ 22 int rtc_i2c_init(i2c_dev_t *i2c); 23 24 /********************************************************* 25 * @fun rtc_i2c_write 26 * @param[in] i2c the i2c device 27 * @param[in] dev_addr device address 28 * @param[in] reg_addr register address 29 * @param[in] reg_num register num 30 * @param[in] data i2c master send data 31 * @param[in] size i2c master send data size 32 * @param[in] timeout timeout in milisecond, set this value to 33 *HAL_WAIT_FOREVER if you want to wait forever 34 * 35 * @rtn 0 : on success, EIO : error 36 *********************************************************/ 37 int rtc_i2c_write(i2c_dev_t *i2c, uint16_t dev_addr, uint16_t reg_addr, 38 uint16_t reg_num, const uint8_t *data, uint16_t size, 39 uint32_t timeout); 40 41 /********************************************************* 42 * @fun rtc_i2c_read 43 * 44 * @param[in] i2c the i2c device 45 * @param[in] dev_addr device address 46 * @param[in] reg_addr register address 47 * @param[in] reg_num register number 48 * @param[out] data i2c master send data 49 * @param[in] size i2c master send data size 50 * @param[in] timeout timeout in milisecond, set this value to 51 *HAL_WAIT_FOREVER if you want to wait forever 52 * 53 * @rtn 0 : on success, EIO : error 54 *********************************************************/ 55 int32_t rtc_i2c_read(i2c_dev_t *i2c, uint16_t dev_addr, uint16_t reg_addr, 56 uint16_t reg_num, const uint8_t *data, uint16_t size, 57 uint32_t timeout); 58 59 #ifdef __cplusplus 60 } 61 #endif /* __cplusplus */ 62 63 #endif /* HAL_PCA9544_H */ 64