config.h.bak

来自「TG12864A引脚资料」· BAK 代码 · 共 48 行

BAK
48
字号

#ifndef __CONFIG_H__
#define __CONFIG_H__ 1

#include <avr/io.h>

#define LCD_DATA_PIN  PINC
#define LCD_DATA_DDR DDRC
#define LCD_DATA PORTC
#define LCD_DI    7
#define LCD_RW  6
#define LCD_E     5
#define LCD_CS1 4
#define LCD_CS2 3
#define LCD_RST  2

#define set_bit(sfr,bit)  sfr |= _BV(bit)
#define clr_bit(sfr,bit)   sfr &= ~_BV(bit)

#define set_LCD_DI  set_bit(PORTD,LCD_DI)
#define clr_LCD_DI  clr_bit(PORTD,LCD_DI)

#define set_LCD_RW  set_bit(PORTD,LCD_RW)
#define clr_LCD_RW  clr_bit(PORTD,LCD_RW)

#define set_LCD_E  set_bit(PORTD,LCD_E)
#define clr_LCD_E  clr_bit(PORTD,LCD_E)

#define set_LCD_CS1  set_bit(PORTD,LCD_CS1)
#define clr_LCD_CS1  clr_bit(PORTD,LCD_CS1)

#define set_LCD_CS2  set_bit(PORTD,LCD_CS2)
#define clr_LCD_CS2  clr_bit(PORTD,LCD_CS2)

#define set_LCD_RST  set_bit(PORTD,LCD_RST)
#define clr_LCD_RST  clr_bit(PORTD,LCD_RST)

#define SELECT_LEFT {set_LCD_CS1;clr_LCD_CS2;}
#define SELECT_RIGHT {set_LCD_CS2;clr_LCD_CS1;}
#define SELECT_ALL {set_LCD_CS1; set_LCD_CS2;}

#define IO_init() {PORTC = 0xff;\
                            PORTD = 0xdf;\
                            DDRC = 0xff;\
                            DDRD = 0xff;}

#endif

⌨️ 快捷键说明

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