[an error occurred while processing this directive]
В месяц пару раз такое спрашивают - ЧИТАЙТЕ доку , там всё расписано... +
(«Телесистемы»: Конференция «Микроконтроллеры и их применение»)

миниатюрный аудио-видеорекордер mAVR

Отправлено Kenat 09 июня 2006 г. 12:20
В ответ на: Не подскажете ли, господа специалисты, как бы красивше подменять в ИАРе putchar - нужен то вывод на LCD, то в последовательный порт? отправлено <font color=gray> а вот спрошу-ка еще</font> 09 июня 2006 г. 11:30


/*******************
*
* Copyright 1998-2003 IAR Systems. All rights reserved.
*
* $Revision: 1.14 $
*
* This is a template implementation of the "__write" function used by
* the standard library. Replace it with a system-specific
* implementation.
*
* The "__write" function should output "size" number of bytes from
* "buffer" in some application-specific way. It should return the
* number of characters written, or _LLIO_ERROR on failure.
*
* If "buffer" is zero then __write should perform flushing of
* internal buffers, if any. In this case "handle" can be -1 to
* indicate that all handles should be flushed.
*
* The template implementation below assumes that the application
* provides the function "MyLowLevelPutchar". It should return the
* character written, or -1 on failure.
*
********************/

#include

_STD_BEGIN

#pragma module_name = "?__write"

int MyLowLevelPutchar(int x);

/*
* If the __write implementation uses internal buffering, uncomment
* the following line to ensure that we are called with "buffer" as 0
* (i.e. flush) when the application terminates.
*/

size_t __write(int handle, const unsigned char * buffer, size_t size)
{
/* Remove the #if #endif pair to enable the implementation */
#if 0

size_t nChars = 0;

if (buffer == 0)
{
/*
* This means that we should flush internal buffers. Since we
* don't we just return. (Remember, "handle" == -1 means that all
* handles should be flushed.)
*/
return 0;
}

/* This template only writes to "standard out" and "standard err",
* for all other file handles it returns failure. */
if (handle != _LLIO_STDOUT && handle != _LLIO_STDERR)
{
return _LLIO_ERROR;
}

for (/* Empty */; size != 0; --size)
{
if (MyLowLevelPutchar(*buffer++) < 0)
{
return _LLIO_ERROR;
}

++nChars;
}

return nChars;

#else

/* Always return error code when implementation is disabled. */
return _LLIO_ERROR;

#endif

}

_STD_END


Составить ответ  |||  Конференция  |||  Архив

Ответы


Отправка ответа

Имя (обязательно): 
Пароль: 
E-mail: 
NoIX ключ Запомнить

Тема (обязательно):
Сообщение:

Ссылка на URL: 
Название ссылки: 

URL изображения: 


Rambler's Top100 Рейтинг@Mail.ru
Перейти к списку ответов  |||  Конференция  |||  Архив  |||  Главная страница  |||  Содержание

E-mail: info@telesys.ru