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

📄 avrprogrammer.cpp

📁 一个开放源代码的AVR单片机编程器
💻 CPP
字号:
/*****************************************************************************
 *
 * Atmel Corporation
 *
 * File              : AVRProgrammer.cpp
 * Compiler          : Dev-C++ 4.9.8.0 - http://bloodshed.net/dev/
 * Revision          : $Revision: 3.0 $
 * Date              : $Date: Tuesday, January 17, 2006 18:33:48 UTC $
 * Updated by        : $Author: raapeland $
 *
 * Support mail      : avr@atmel.com
 *
 * Target platform   : Win32
 *
 * AppNote           : AVR911 - AVR Open-source Programmer
 *
 * Description       : An abstract class containing a framework for a generic
 *                     programmer for AVR parts. Reading and writing Flash, EEPROM
 *                     lock bits and all fuse bits and reading OSCCAL and reading
 *                     signature bytes are supported.
 *
 *
 ****************************************************************************/
#include "AVRProgrammer.hpp"


/* Constructor */
AVRProgrammer::AVRProgrammer( CommChannel * _comm ) :
	pagesize( -1 )
{
	if( _comm == NULL )
		throw new ErrorMsg( "NULL pointer provided for communication channel!" );

	comm = _comm;
}


/* Destructor */
AVRProgrammer::~AVRProgrammer()
{
	/* No code here */
}


string AVRProgrammer::readProgrammerID( CommChannel * _comm )
{
	string id( "1234567" ); // Reserve 7 characters.

	if( _comm == NULL )
		throw new ErrorMsg( "NULL pointer provided for communication channel!" );

	/* Synchonize with programmer */
	for( int i = 0; i < 10; i++ )
		_comm->sendByte( 27 ); // Send ESC

	/* Send 'S' command to programmer */
	_comm->sendByte( 'S' );
	_comm->flushTX();

	/* Read 7 characters */
	for( long i = 0; i < id.size(); i++ )
	{
		id[i] = _comm->getByte();
	}

	return id;
}

/* end of file */

⌨️ 快捷键说明

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