![](https://img-blog.csdnimg.cn/20201014180756930.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
C
InJre
这个作者很懒,什么都没留下…
展开
-
通过结构体、地址调用函数,函数的一些另类调用方式
Java、C++等面向对象语言中,class有方法和属性,C也能通过结构体实现类似功能。原创 2022-11-06 21:07:38 · 111 阅读 · 0 评论 -
代码的“处理”英文该使用handle/cope/deal
deal cope handle原创 2022-10-09 10:08:42 · 975 阅读 · 0 评论 -
位操作:置1、置0、取反、取值--SetBit ResetBit Reversebit GetBit
【代码】位操作:置1、置0、取反、取值--SetBit ResetBit Reversebit GetBit。原创 2022-09-04 10:51:45 · 1043 阅读 · 0 评论 -
通讯浮点数据处理,数据转换,hex转float
串口通讯有时会收到的数据是浮点型。我们需要将hex数据改成浮点。原创 2022-08-05 22:14:23 · 1813 阅读 · 0 评论 -
微秒(us)延时 程序
1static void retry_delay_100us(void) { /* 100 microsecond delay */ rt_thread_delay((RT_TICK_PER_SECOND * 1 + 9999) / 10000);}2wait_loop_index = ((PWR_FLAG_SETTING_DELAY_US * SystemCoreClo...原创 2019-12-31 11:24:41 · 7281 阅读 · 2 评论 -
整形转字符串(数字转文字),itoa(sprintf)和 atoi
很长一段时间,我认为字符串和整数互换是用标题上的两个函数,几次这折腾,我觉得有必要让自己记住。实际sprintf = itoa下面一个例子是将字符串的数字递增1 字符串转整形;2 ++;3 然后再转字符串 i_boot_times = atol(c_old_boot_times); /* boot count +1 */ i_boot_times ++; ...原创 2019-12-20 10:57:52 · 234 阅读 · 0 评论 -
easyflash env例程
嵌入式设备中经常用到需要保存到flash中的变量,我叫他环境变量env。easyflash可以很方便的创建、保存、读取这些变量。原创 2019-12-20 10:47:59 · 1970 阅读 · 0 评论 -
几种printf
int vfprintf ( FILE * stream, const char * format, va_list arg );Write formatted data from variable argument list to streamint fprintf ( FILE * stream, const char * format, … );Write formatted dat...原创 2019-12-11 09:08:51 · 393 阅读 · 0 评论 -
C库常用函数
/* * The sign of a nonzero value returned by the comparison functions is * determined by the sign of the difference between the values of the first * pair of characters (both interpreted as unsigne...原创 2019-11-11 11:14:39 · 344 阅读 · 0 评论 -
读代码2 enum与struct
enum artnet_packet_type_e { ARTNET_POLL = 0x2000, ARTNET_REPLY = 0x2100, ARTNET_DMX = 0x5000, ARTNET_ADDRESS = 0x6000, ARTNET_INPUT = 0x7000, ARTNET_TODREQUEST = 0x8000, ARTNET_TODDATA =...原创 2019-11-07 10:34:35 · 100 阅读 · 0 评论 -
读代码1 -realloc
struct webnet_cgi_item{ const char* name; void (*handler)(struct webnet_session* session);};static struct webnet_cgi_item* _cgi_items = RT_NULL;void webnet_cgi_register(const char* name,...原创 2019-11-07 10:22:30 · 129 阅读 · 0 评论 -
函数作为结构体成员
#include "pch.h"#include <stdio.h>void action1(void){ printf("work\n");}void action2(void){ printf("study\n");}void action3(char* msg){ printf("%s",msg);}struct humans { void (*...原创 2019-09-25 15:58:27 · 3083 阅读 · 0 评论 -
漂亮编程
常用函数命名规则:is=判断函数 | get/write/output=读 | set/read/input=写 |#define is_valid_start_address(a) ((a) >= 1 && (a) <= MAX_DMX_START_ADDRESS)if (! is_valid_start_address (slave->startAdd...原创 2019-09-25 15:44:16 · 116 阅读 · 0 评论 -
字符指令、通讯常用函数 - 字符函数库ctype.h
using ::std::isalnum; /* non-0 iff c is alphabetic or numeric */ 判断字母or数字 using ::std::isalpha; /* non-0 iff c is alphabetic */ 判断字母 using ::std::iscntrl; /* non-0 iff c is a ...原创 2019-06-14 11:41:46 · 158 阅读 · 0 评论