Gast
#2375002
Hi,
ich krame gerade in einer fleury Lib rum und frage mich wie das
funktioniert:
#define LCD_PORT PORTA /**< port for the LCD lines */
#define LCD_DATA0_PORT LCD_PORT /**< port for 4bit data bit 0 */
#define LCD_DATA1_PORT LCD_PORT /**< port for 4bit data bit 1 */
#define LCD_DATA2_PORT LCD_PORT /**< port for 4bit data bit 2 */
#define LCD_DATA3_PORT LCD_PORT /**< port for 4bit data bit 3 */
#define LCD_DATA0_PIN 0 /**< pin for 4bit data bit 0 */
#define LCD_DATA1_PIN 1 /**< pin for 4bit data bit 1 */
#define LCD_DATA2_PIN 2 /**< pin for 4bit data bit 2 */
#define LCD_DATA3_PIN 3 /**< pin for 4bit data bit 3 */
DDR(LCD_DATA0_PORT) |= _BV(LCD_DATA0_PIN);
DDR(LCD_DATA1_PORT) |= _BV(LCD_DATA1_PIN);
DDR(LCD_DATA2_PORT) |= _BV(LCD_DATA2_PIN);
DDR(LCD_DATA3_PORT) |= _BV(LCD_DATA3_PIN);
Konkret geht es mir um diesen Ausdruck:
DDR(LCD_DATA0_PORT)
Wird daraus nicht:
DDR(PORTA)?
und müsste es dann nicht DDRA heißen?
Man, ich sehe es gerade:
#define DDR(x) (*(&x - 1)) /* address of data direction register of
port x */
So eine Sau, man defines lassen aber auch jede Sauerei zu...
Schön ist das nicht, warum macht man soetwas???
Maddin