
действительно!))) спасибо! Причем я точно помню, что эти макросы я видел, пытался применить, но почему то решил, что они не совсем подходят.
Сейчас вижу, что я тогда тупанул!

ЗЫ Поторопился с выводами
вот код:
Код
#define __AVR__
#include "pin_macros.h"
#include <ioavr.h>
#define __SEPARATELY
#define Line0 B,2,H
#define Line1 B,3,H
#define Line2 B,4,H
#define Line3 B,5,H
#define SetLine(line) do{DRIVER(line,INPUT); SET(line); }while(0) /* input with pullup */
#define ClrLine(line) do{CLR(line); DRIVER(line,OUTPUT); }while(0) /* output with log "0" */
void test(void){
#if __SEPARATELY
SET(Line0);
CLR(Line0);
DRIVER(Line0,INPUT);
DRIVER(Line0,OUTPUT);
#else
SetLine(Line0);
ClrLine(Line1);
#endif
}
В таком виде работает (правда с допиливанием двух макросов PIN_ON_H и PIN_ON_L в файле AVR_pin_macros.h). Но если использовать мои макросы SetLine и ClrLine, состоящие из двух макросов Волкова, то компилятор опять выдает ошибки.
Цитата
Error[Pe055]: too many arguments in macro invocation ... 23
Error[Pe054]: too few arguments in macro invocation .... 23
Warning[Pe223]: function "PIN_SET_" declared implicitly ... 23
Error[Pe020]: identifier "B" is undefined ... 23
Error[Pe020]: identifier "INPUT" is undefined .... 23
Error[Pe054]: too few arguments in macro invocation ... 23
....
Никак нельзя это обойти?
PPS. Вбил свои макросы SetLine ClrLine без макросов Волкова, но по образу и подобию
Код
#define Line0 B,2
#define Line1 B,3
#define Line2 B,4
#define Line3 B,5
#define _SetLine(port,bit) do{DDR##port &= ~(1<<bit); PORT##port |= (1<<bit); }while(0) /* input with pullup */
#define _ClrLine(port,bit) do{PORT##port &= ~(1<<bit); DDR##port |= (1<<bit); }while(0) /* output with log "0" */
#define SetLine(line) _SetLine(line)
#define ClrLine(line) _ClrLine(line)
Сообщение отредактировал ibiza11 - Dec 15 2013, 09:09