- 常用函数命名规则: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->startAddress))
- buf在不同文件里的不同指向,tcp文件指向tcp_hdr,udp文件指向udp_hdr
#define BUF ((struct uip_tcpip_hdr *)&uip_buf[UIP_LLH_LEN])
#define BUF ((struct uip_eth_hdr *)&uip_buf[0])
- 署名打印:
void uip_log(char *m)
{
printf("uIP log:%s\r\n",m);
}
- 编译注释/选择编译:
#define DEBUG_PRINTF(...)
- 函数作为函数参数
int pthread_create(pthread_t *newthread, const pthread_attr_t *attr,
void *(*startroutine)(void *), void *arg)
void * (*) (void *)
void * demo(void * param){
return NULL;
- ##连接符的使用
#define __STM32_PIN(index, rcc, gpio, gpio_index) { 0, RCC_##rcc##Periph_GPIO##gpio, GPIO##gpio, GPIO_Pin_##gpio_index, GPIO_PortSourceGPIO##gpio, GPIO_PinSource##gpio_index}