atml_lcd.h
来自「找的一个用U2270B开发的射频卡项目文件」· C头文件 代码 · 共 156 行
H
156 行
// $Id: atml_Lcd.h,v 1.2 2006/10/18 18:15:12 tprescott Exp $
/*****************************************************
Project : atml_LCD.h
Date : 9/08/2006
Author : Toby Prescott
Company : Atmel
Comments: AVR Studio GCC
Revisions:
v1.0 - Started written for CodeVision
v2.1 - 1/19/06 Changed driver completely to
make drawing easier
v2.6 - 9/8/06 Clean for WinAVR
*****************************************************/
/* modified from shareware thanks to:
Michael J. Karas
Carousel Design Solutions
4217 Grimes Ave South
Edina MN 55416
(952) 929-7537
****************************************************/
#ifndef ATMLLCD_H__
#define ATMLLCD_H__
#include <inttypes.h>
#include <avr/io.h>
#include <avr/pgmspace.h>
#include <avr/eeprom.h>
#include <string.h>
#include "rfid_Timers.h"
#include "atml_Fonts.h"
// Declare your global function prototypes here
void lcd_Init_Display(void);
void lcd_Write_Display(unsigned char command, unsigned char data);
unsigned char lcd_Read_Display(unsigned char command);
void lcd_ConfigDisplay(void);
/* LCD function prototype list */
void lcd_erase(void);
void lcd_test(unsigned char pattern);
void lcd_clear_area(unsigned char left, unsigned char top, unsigned char right, unsigned char bottom);
void lcd_invert_area(unsigned char left, unsigned char top, unsigned char right, unsigned char bottom);
void lcd_horz_line(unsigned char left, unsigned char right, unsigned char row);
void lcd_vert_line(unsigned char top, unsigned char bottom, unsigned char column);
void lcd_clr_horz_line(unsigned char left, unsigned char right, unsigned char row);
void lcd_clr_vert_line(unsigned char top, unsigned char bottom, unsigned char column);
void lcd_box(unsigned char left, unsigned char top, unsigned char right, unsigned char bottom);
void lcd_clr_box(unsigned char left, unsigned char top, unsigned char right, unsigned char bottom);
void lcd_update(unsigned char top, unsigned char bottom);
unsigned char lcd_put5x7_Char(unsigned char left, unsigned char top, unsigned char cChar);
unsigned char lcd_put_String(unsigned char left, unsigned char top, unsigned char *sChar);
unsigned char lcd_put_fString(unsigned char left, unsigned char top, const char *sChar_P);
void lcd_fill_area(unsigned char left, unsigned char top, unsigned char right, unsigned char bottom);
unsigned char end_String_Pos(unsigned char left, unsigned char *sChar);
unsigned char end_fString_Pos(unsigned char left, const char *sChar_P);
unsigned char lcd_center(unsigned char *sChar);
unsigned char lcd_fcenter(const char *sChar_P);
unsigned char lcd_put_Atmel_Logo(unsigned char left, unsigned char top);
/* LCD screen and bitmap image array consants */
#define X_BYTES 128
#define Y_BYTES 8
#define SCRN_LEFT 0
#define SCRN_TOP 0
#define SCRN_RIGHT 127
#define SCRN_BOTTOM 63
// Declare your global variables (extern) here
extern unsigned char brightPercent;
extern unsigned char contrastVal EEMEM;
extern unsigned char brightVal EEMEM;
extern unsigned char l_display_array[Y_BYTES][X_BYTES];
extern unsigned char reverseState EEMEM;
extern unsigned char upDate;
// Declare your global labels here
#define LCD_ERROR 0
#define NUMBER_OF_COLUMNS 128
#define NUMBER_OF_ROWS 64
#define NUMBER_OF_PAGES 8
#define FIRST_PAGE 0
#define FIRST_COLUMN 0
#define LAST_PAGE 7
#define LAST_COLUMN 127
#define CMD 0x01
#define DATA 0xFF
#define CS1_BIT 0x20 // PortD5
#define A0_BIT 0x04 // PortG2 mega128 (PortE2 usb1287)
#define WR_BIT 0x01 // PortG0 mega128 (PortE0 usb1287)
#define RD_BIT 0x02 // PortG1 mega128 (PortE1 usb1287)
#define BUS_RELEASE 0xF8
/* The following definitions are the command codes that are passed to the
display via the data bus. */
#define DISPLAY_ON 0xAF
#define DISPLAY_OFF 0xAE
#define START_LINE_SET 0x40
#define PAGE_ADDRESS_SET 0xB0
/* The Column Address is a two byte operation that writes the most significant
bits of the address to D3 - D0 and then writes the least significant bits to
D3- D0. Since the Column Address auto increments after each write, direct
access is infrequent. */
#define COLUMN_ADDRESS_HIGH 0x10
#define COLUMN_ADDRESS_LOW 0x00
#define ADC_SELECT_NORMAL 0xA0
#define ADC_SELECT_REVERSE 0xA1
#define DISPLAY_NORMAL 0xA6
#define DISPLAY_REVERSE 0xA7
#define ALL_POINTS_ON 0xA5
#define ALL_POINTS_OFF 0xA4
#define LCD_BIAS_1_9 0xA2
#define LCD_BIAS_1_7 0xA3
#define READ_MODIFY_WRITE 0xE0
#define END 0xEE
#define RESET_DISPLAY 0xE2
#define COMMON_OUTPUT_NORMAL 0xC0
#define COMMON_OUTPUT_REVERSE 0xC8
/* The power control set value is obtained by OR'ing the values together to
create the appropriate data value. For example:
data = (POWER_CONTROL_SET | BOOSTER_CIRCUIT |
VOLTAGE_REGULATOR | VOLTAGE_FOLLOWER);
Only the bits that are desired need be OR'ed in because the initial value
of POWER_CONTROL_SET sets them to zero. */
#define POWER_CONTROL_SET 0x28
#define BOOSTER_CIRCUIT 0x04
#define VOLTAGE_REGULATOR 0x02
#define VOLTAGE_FOLLOWER 0x01
/* The initial value of the V5_RESISTOR_RATIO sets the Rb/Ra ratio to the
smallest setting. The valid range of the ratio is:
0x20 <= V5_RESISTOR_RATIO <= 0x27 */
#define V5_RESISTOR_RATIO 0x24
/* When the electronic volume command is input, the electronic volume register
set command becomes enabled. Once the electronic volume mode has been set,
no other command except for the electronic volume register command can be
used. Once the electronic volume register set command has been used to set
data into the register, then the electronic volume mode is released. */
#define ELECTRONIC_VOLUME_SET 0x81
#define ELECTRONIC_VOLUME_INIT 0x30
#endif // ATMLLCD_H__
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?