⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 edp.h

📁 国外牛人公开的AVR代码
💻 H
字号:
/*! \file edp.h \brief Emerald Data Protocol System. */
//*****************************************************************************
//
// File Name	: 'edp.h'
// Title		: Emerald Data Protocol System
// Author		: Pascal Stang - Copyright (C) 2003
// Created		: 2003.07.01
// Revised		: 2003.07.21
// Version		: 0.1
// Target MCU	: Atmel AVR series
// Editor Tabs	: 4
//
// This code is distributed under the GNU Public License
//		which can be found at http://www.gnu.org/licenses/gpl.txt
//
//*****************************************************************************

#ifndef EDP_H
#define EDP_H

#include "edpdefs.h"

// defines
//#define EDP_DEBUG
// edp reply buffer size
#ifndef EDP_REPLY_BUFFER_SIZE
#define EDP_REPLY_BUFFER_SIZE	128
#endif
// edpSendCommand return values
#define EDP_COMMAND_OK		0
#define EDP_COMMAND_NODEV	1
// edpGetCommandReply return values
#define EDP_REPLY_OK		0
#define EDP_REPLY_BADCHKSUM	1

// structs and typedefs
typedef struct
{
	u08 SrcAddr;
	u08 Command;
	u08 Data[];
} EdpCommand;

typedef struct
{
	u08 Length;
	u08 Data[];
} EdpReply;

// typedefs
typedef u08 (*EdpSlaveHandlerFuncType)(u08 edpCmdLength, EdpCommand* edpCmd,
					u08 edpReplyLengthMax, EdpReply* edpReply);

// functions
void edpInit(void);
void edpSetSlaveHandler(EdpSlaveHandlerFuncType edpSlaveHandlerFunction);

// ************ EDP Master operations ************
u08 edpSendCommand(u08 deviceAddr, u08 cmdLength, EdpCommand* edpCommand);
u08 edpGetCommandReply(u08* responseCode, EdpReply** edpReply);
//u08 edpSendCommand(u08 deviceAddr, u08 sendLength, u08* sendData);
//u08 edpGetCommandReply(u08* responseCode, u08* replyLength, u08** replyData);

// ************ EDP Slave operations ************
void edpSlaveReceiveService(u08 receiveDataLength, u08* receiveData);
u08 edpSlaveTransmitService(u08 transmitDataLengthMax, u08* transmitData);

#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -