目录
一、前言
C 实现时经常给人比较松散的感觉,基于面对对象的思维将模块变量耦合在一起会实现比较整洁优雅便于维护。
二、设计方式
三、示例
设计抽象接口ICANRcv.h
#ifndef _ICANRCV_H
#define _ICANRCV_H 1
typedef struct {
uint32_t msg_id; /* message identifier */
uint8_t eframe_format; /* frame format: 0 is standard frame, 1 is extended frame */
uint8_t eframe_type; /* frame type: 0 is data frame, 1 is remote frame */
uint8_t len; /* Length of Message Data Field , in Bytes. */
uint8_t data_buf[8];
} ICANRcvFrame_t;
typedef struct {
ICANRcvFrame_t frame;
uint8_t lock;
} ICANRcvMsg_t;
typede