/* i2c - Simple example
Simple I2C example that shows how to initialize I2C
as well as reading and writing from and to registers for a sensor connected over I2C.
The sensor used in this example is a PCF85063 inertial measurement unit.
*/
#include <stdio.h>
#include "esp_log.h"
#include "driver/i2c.h"
static const char *TAG = "i2c-pcf85063";
#define I2C_MASTER_SDA_IO 36 //CONFIG_I2C_MASTER_SDA /*!< GPIO number used for I2C master data */
#define I2C_MASTER_SCL_IO 35 //CONFIG_I2C_MASTER_SCL /*!< GPIO number used for I2C master clock */
#define I2C_MASTER_NUM 0 /*!< I2C master i2c port number, the number of i2c peripheral interfaces available will depend on the chip */
#define I2C_MASTER_FREQ_HZ 400000 /*!< I2C master clock frequency */
#define I2C_MASTER_TX_BUF_DISABLE 0 /*!< I2C master doesn't
PCF8563/85063 高精度时钟IIC芯片 ESP驱动程序
于 2022-10-24 10:15:51 首次发布
该博客介绍了一个使用ESP32通过I2C接口与PCF85063时间传感器交互的简单示例。代码展示了如何初始化I2C,读写传感器寄存器以设置和获取时间,包括转换BCD码的函数。示例中还包含一个测试循环,用于周期性地读取和打印时间。

最低0.47元/天 解锁文章
288

被折叠的 条评论
为什么被折叠?



