随笔分类 -  C代码片断

常用C代码片断
摘要:/* * DBG.c * * Created on: 2018年4月10日 * Author: Administrator */ #include #include "osType.h" #include "osDBG.h" #include "osLibc.h" #include "MT_Uart.h" #define DBG_UART_FIFO 0... 阅读全文
posted @ 2018-04-10 18:23 lort 阅读(249) 评论(0) 推荐(0)
摘要:#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include ... 阅读全文
posted @ 2018-04-10 18:22 lort 阅读(231) 评论(0) 推荐(0)
摘要:/* ============================================================================ Name : test.c Author : Version : Copyright : Your copyright notice Description : Hello World i... 阅读全文
posted @ 2017-10-20 19:40 lort 阅读(1352) 评论(0) 推荐(1)
摘要:可以用printf()做串口打印输出 这个功能非常简单,首先在工程管理下的preprocessor把串口打开HAL_UART=TRUE。 然后看我的npi.c文件,多了什么自己琢磨,懒点的就直接复制吧: 再看头文件npi.h: 再再然后hal_driver.c下修改: void HalDriverI 阅读全文
posted @ 2016-08-09 15:01 lort 阅读(1773) 评论(0) 推荐(0)
摘要:首先要指出,字段属性有notify的不能同时有read,write属性,别问哥,哥也不知道,反正我做的就不能notify,只能read,write。 分享的程序段第一字段有notify属性,第二字段read,write属性。 费话少说,看代码,H文件: C文件: 在simpleBLEPeripher 阅读全文
posted @ 2016-08-09 14:54 lort 阅读(1041) 评论(0) 推荐(0)
摘要:TI写的按键比较啰嗦关键还没什么功能,所以重写了,阿莫的开发板, 头文件H: 以下是C文件 hal_driver.c要修改成下面的: onBoard.c要修改: good luck! 阅读全文
posted @ 2016-08-09 14:45 lort 阅读(556) 评论(0) 推荐(0)
摘要:#include "main.h"#ifndef __STD_GUI_CONTEX__#define __STD_GUI_CONTEX__ #define CPSTRSIZE 20//控件字符数#define TOUCHCOLOR RED#define TOUCHFONTCOLOR 0xffff # 阅读全文
posted @ 2016-07-29 15:57 lort 阅读(855) 评论(1) 推荐(1)
摘要:extern float GetTempOfVolMi(float V){ float K,B; if(0.03947 <= V < 2.02308) //0~50 { K = 24.731; B = 0.1341; } else if(2.02308 <= V < 4.09623)//50-100 阅读全文
posted @ 2016-06-13 09:50 lort 阅读(1300) 评论(0) 推荐(0)
摘要:Rt = R *EXP(B*(1/T1-1/T2))这里T1和T2指的是K度即开尔文温度,K度=273.15(绝对温度)+摄氏度;其中T2=(273.15+25)Rt 是热敏电阻在T1温度下的阻值; R是热敏电阻在T2常温下的标称阻值; B值是热敏电阻的重要参数; EXP是e的n次方; 求T1 =l 阅读全文
posted @ 2016-06-13 09:47 lort 阅读(46386) 评论(0) 推荐(1)
摘要:/**Keil Lib*2015.6.12*Pass*by lort*/uint32 Srandx ; uint32 SrandK = 1103515245;//0x41C64E6D;uint32 SrandB = 12345;//0x3039; void os_srand(uint32 seek) 阅读全文
posted @ 2016-06-13 09:45 lort 阅读(1540) 评论(0) 推荐(0)
摘要:unsigned short CRC16_Modbus ( unsigned char *pdata, int len){ unsigned short crc=0xFFFF; int i, j; for ( j=0; j<len;j++) { crc=crc^pdata[j]; for ( i=0 阅读全文
posted @ 2016-06-13 09:40 lort 阅读(4115) 评论(0) 推荐(0)