一键导入
tuyaopen-onchip-rtc
On-chip RTC for TuyaOpen using the tkl_rtc API: set and get wall-clock time as epoch seconds. RTC、实时时钟、走时、设置时间、读取时间、tkl_rtc、掉电保持时间。
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
On-chip RTC for TuyaOpen using the tkl_rtc API: set and get wall-clock time as epoch seconds. RTC、实时时钟、走时、设置时间、读取时间、tkl_rtc、掉电保持时间。
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | tuyaopen/onchip-rtc |
| description | On-chip RTC for TuyaOpen using the tkl_rtc API: set and get wall-clock time as epoch seconds. RTC、实时时钟、走时、设置时间、读取时间、tkl_rtc、掉电保持时间。 |
| when_to_use | Use when the user wants the hardware real-time clock: set or read wall-clock time (epoch seconds), e.g. for timestamps. |
| id | onchip-rtc |
| surfaces | ["embedded"] |
| tags | ["rtc","clock","time","on-chip","tkl_rtc"] |
CONFIG_ENABLE_RTC. No app_default.config change.board_register_hardware(). Call tkl_rtc_* directly. Single system RTC (no
instance id / pins) — record as onchip:rtc in used-peripherals.json if wanted.Time is epoch seconds (TIME_T = unsigned int). The RTC keeps running once
set; on a board without a battery-backed RTC the value is lost on power-down, so
set it from a trusted source (e.g. SNTP / user input) after boot.
#include "tal_api.h"
#include "tkl_rtc.h"
void app_rtc_demo(void)
{
tkl_rtc_init();
/* set: e.g. 2026-01-01 00:00:00 UTC = 1767225600 */
tkl_rtc_time_set((TIME_T)1767225600);
TIME_T now = 0;
tkl_rtc_time_get(&now);
PR_NOTICE("rtc now = %u", (unsigned)now);
}
| Function | Description |
|---|---|
tkl_rtc_init() | Initialise the RTC |
tkl_rtc_time_set(time_sec) | Set wall-clock time (TIME_T epoch seconds) |
tkl_rtc_time_get(&time_sec) | Read current time into a TIME_T |
tkl_rtc_deinit() | Release the RTC |
| Symptom | Likely cause | Fix |
|---|---|---|
| Time resets to 0 after reboot | No battery-backed RTC on this board | Re-set from SNTP / user after each boot |
| Time drifts | RTC crystal tolerance | Periodically re-sync from a trusted source |
| Get returns garbage | Read before tkl_rtc_init / before any set | Init first, set a known time before reading |
No dedicated SDK example; API is tkl_rtc.h (tkl_rtc_init/time_set/time_get/deinit).
End-to-end IoT product development orchestration for TuyaOpen projects. Guides from requirements gathering → Tuya Platform product/DP creation → complete embedded firmware generation. State-machine: detects project state and picks up from wherever development currently stands.
TDL audio codec usage for TuyaOpen: discover the audio device, capture microphone PCM frames via callback, play PCM back to the speaker, and set volume. 音频、麦克风、录音、播放、喇叭、扬声器、speaker、mic、声音、语音、codec。
TDL button input handling for TuyaOpen: create button, register event callbacks for single click, double click, long press, and multi-click. 按键、单击、双击、长按、多击、按键事件。
TDL camera control for TuyaOpen: find device, configure resolution/fps/format, open with frame callbacks for YUV422 and JPEG/H264 encoded output. 摄像头、相机、拍照、视频流、YUV、JPEG、H264、人脸识别、图像采集。
TDL display control for TuyaOpen: driver registration, open, brightness, and framebuffer flush via tdl_disp_* APIs. 显示屏、LCD、屏幕、显示、绘制、亮度、刷屏。
TDL thermal printer usage for TuyaOpen: discover the printer, print UTF-8 text (auto GBK conversion on ESC/POS), print 1-bit bitmaps, feed paper, and monitor paper/temperature status. 打印机、热敏打印、打印、小票、票据、出纸、ESC/POS、printer、DP48A。