随笔分类 - C/C++
摘要:#include <stdint.h> #include <stddef.h> #include <stdint.h> #include <stddef.h> void* memcpy_forward(void* dst, const void* src, size_t n) { uint8_t*
阅读全文
摘要:在这段代码中,memcpy 的作用是 解决内存对齐问题和不可访问内存的读取问题。以下是详细分析: 1. 核心用途 if (!esp_ptr_byte_accessible(buffer)) { memcpy(temp_buffer, buffer, (bytes_cur_line + 3) / 4
阅读全文
摘要:#define BYTES_PER_LINE 16 void esp_log_buffer_hex_internal(const char* tag, const void* buffer, uint16_t buff_len) { if (buff_len == 0) { return; } ch
阅读全文
摘要:// 基本用法 __declspec(deprecated) void old_function() { // 旧函数实现 } // 可以添加自定义警告消息(C++14 起支持) __declspec(deprecated("This function is obsolete. Use new_fu
阅读全文
摘要:MQTT Keepalive=0 意味着客户端不希望发送心跳包(PINGREQ),也不希望服务器发送心跳响应(PINGRESP)。 这是一个特殊的值,具有特定的含义和重要的注意事项。 详细解释 1. 正常 Keepalive 机制 在深入了解 keepalive=0 之前,先理解正常的 keepal
阅读全文
摘要:textarea中没有接口直接可以设置光标的状态,并且ta中的光标也只是根据ta中的label围出来的区域(area)。闪烁光标的是在ta内置的动画进行:操作 光标区域 根据指定的时间让光标区域不断隐藏(透明)-显示(不透明) 所以我们可以控制光标的闪烁时间,设置为 0 就是不闪烁,但是理论上来说我
阅读全文
摘要:static esp_mqtt_client_handle_t mqtt_clients[2] = { NULL, NULL }; static esp_mqtt_client_config_t m_mqtt_cfg[2] = { 0 }; static void mqtt_event_handle
阅读全文
摘要:lv_obj_t *imgBtn=lv_imgbtn_create(lv_scr_act(), NULL); lv_obj_set_style_local_transform_zoom(imgBtn, LV_BTN_PART_MAIN,LV_STATE_DEFAULT,2);
阅读全文
摘要:static lv_style_t style_scr_act; if (style_scr_act.prop_cnt == 0) { lv_style_init(&style_scr_act); lv_style_set_bg_opa(&style_scr_act, LV_OPA_COVER);
阅读全文
摘要:// 从文件加载证书 X509* load_certificate_from_file(const char* filename) { BIO* bio = BIO_new_file(filename, "r"); if (!bio) { fprintf(stderr, "Error opening
阅读全文
摘要:int save_public_key_from_file(const char* filename,RSA *key) { BIO* bio = BIO_new_file(filename, "w"); if (!bio) return NULL; int ret = PEM_write_bio_
阅读全文
摘要:测试代码: #include <openssl/rsa.h> #include <openssl/pem.h> #include <openssl/err.h> #include <string.h> void handle_openssl_errors() { ERR_print_errors_f
阅读全文
摘要:好的,这是一个非常经典且高效的位操作技巧,用于实现内存对齐(Memory Alignment)。我们来一步步拆解这行代码: uint32_t aligned = (n + 7u) & ~7u; 它的目的: 计算大于等于 n 的最小的、8字节对齐的数。 换句话说,它会把 n “向上取整”到最接近的 8
阅读全文

浙公网安备 33010602011771号