From 53de825c4c4d8325c02341177f62ab84897eb5ee Mon Sep 17 00:00:00 2001
From: guowenxue <guowenxue@gmail.com>
Date: Sat, 25 Jul 2026 22:09:43 +0800
Subject: [PATCH] update vscode task.json and add stm32flash tools
---
ex2.i2c-bitbang/Board/isl1208.h | 73 ++++++++++++++++++++++++++++++++++++
1 files changed, 73 insertions(+), 0 deletions(-)
diff --git a/ex2.i2c-bitbang/Board/isl1208.h b/ex2.i2c-bitbang/Board/isl1208.h
new file mode 100644
index 0000000..b9f8856
--- /dev/null
+++ b/ex2.i2c-bitbang/Board/isl1208.h
@@ -0,0 +1,73 @@
+/**********************************************************************
+ * Copyright: (C)2026 LingYun IoT System Studio
+ * Author: GuoWenxue<guowenxue@gmail.com>
+ *
+ * Description: ISL1208 RTC driver on ISKBoard
+ *
+ * ChangeLog:
+ * Version Date Author Description
+ * V1.0.0 2026.07.08 GuoWenxue Release initial version
+ *
+ ************************************************************************/
+
+#ifndef __ISL1208_H
+#define __ISL1208_H
+
+#include "i2c_bitbang.h"
+
+/**
+ * @brief RTC 时间结构体 (标准十进制格式,应用层直接读写)
+ */
+typedef struct {
+ uint8_t second; /* 秒: 00 - 59 */
+ uint8_t minute; /* 分: 00 - 59 */
+ uint8_t hour; /* 时: 00 - 23 (固定为24小时制) */
+ uint8_t day; /* 日: 01 - 31 */
+ uint8_t month; /* 月: 01 - 12 */
+ uint8_t year; /* 年: 00 - 99 (代表 2000 - 2099 年) */
+ uint8_t weekday; /* 星期: 00 - 06 (00代表星期天) */
+} rtc_time_t;
+
+/**
+ * @brief ISL1208 硬件初始化与掉电自愈函数
+ * @param bus: 绑定的 I2C 物理总线指针 (如 &i2c1_bus)
+ * @retval 0: 初始化成功; -1: 总线通信失败或芯片未响应
+ */
+extern int isl1208_init(i2c_bus_t *bus);
+
+/**
+ * @brief 应用层设置 RTC 时间接口函数(rtc_time_t格式)
+ * @param time 指向待写入时间数据的 rtc_time_t 结构体常指针
+ * @retval 0:成功, -1:失败
+ */
+extern int isl1208_set_time(const rtc_time_t *time);
+
+/**
+ * @brief 应用层设置 RTC 时间接口函数(字符串格式)
+ * @param time_str 输入的时间字符串指针,格式如 "2026-01-01 10:00:00"
+ * @retval 0:成功, -1:失败
+ */
+extern int isl1208_set_time_str(const char *time_str);
+
+/**
+ * @brief 应用层获取 RTC 时间接口函数
+ * @param time 指向用于接收时间数据的 rtc_time_t 结构体指针
+ * @retval 0:成功, -1:失败
+ */
+extern int isl1208_get_time(rtc_time_t *time);
+
+/**
+ * @brief 应用层获取 RTC 时间接口函数(字符串格式)
+ * @param buf 用于存储格式化时间字符串的缓冲区指针
+ * @param buf_len 接收缓冲区长度(建议至少20字节)
+ * @retval 0:成功, -1:失败
+ */
+extern int isl1208_get_time_str(char *buf, size_t buf_len);
+
+/**
+ * @brief 获取并格式化打印当前 RTC 时间接口函数
+ * @retval 0:成功, -1:失败
+ */
+extern int isl1208_print_time(void);
+
+#endif /* __ISL1208_H */
--
Gitblit v1.10.0