whycyhl
2022-05-05 94861120b14313f81fc666e612c48c9e8a81f1e7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
/************************** Copyright (c) **********************************
**                 FUZHOU FUGUANG ELECTRONICS Co.,LTD.
**                        ¸£Öݸ£¹âµç×ÓÓÐÏÞ¹«Ë¾
**                       http://www.fuguang.com
**
**-------------- File Info -------------------------------------------------
** File name:            AD7843_Driver.h
** Last modified Date:  2008-11-16
** Last Version:        1.0
** Descriptions:        AD7843 Drivers lib
**
**--------------------------------------------------------------------------
** Created by:            mxpopstar
** Created date:        2008-11-16
** Version:                1.0
** Descriptions:        The original version
**
**--------------------------------------------------------------------------
** Modified by:            mxpopstar
** Modified date:        2008-11-20
** Version:
** Descriptions:        AD7843 Drivers lib
**
***************************************************************************/
//
 
#ifndef AD7843_Driver_H
#define AD7843_Driver_H
//----------------------------------------------------------------------------------
//--------------------- IOPORT -----------------------------------------------------
#define     AD7843_CS_DDR            DDRA
#define     AD7843_CS_PORT            PORTA
#define     AD7843_CS_PIN            PA7
#define     AD7843_CS_1             AD7843_CS_PORT |= (1<<AD7843_CS_PIN)        //PINA7  
#define        AD7843_CS_0             AD7843_CS_PORT &= ~(1<<AD7843_CS_PIN)
//----------------------------------------------------------------------------------
#define     AD7843_MOSI_DDR            DDRB
#define     AD7843_MOSI_PORT        PORTB
#define     AD7843_MOSI_PIN            PB2
#define     AD7843_MOSI_1           AD7843_MOSI_PORT |= (1<<AD7843_MOSI_PIN)    //PINB2
#define     AD7843_MOSI_0           AD7843_MOSI_PORT &= ~(1<<AD7843_MOSI_PIN)
//----------------------------------------------------------------------------------
#define     AD7843_MISO_DDR            DDRB
#define     AD7843_MISO_PORT        PORTB
#define     AD7843_MISO_PIN            PB3
#define     AD7843_MISO_PNAME        PINB
#define     AD7843_MISO_1           (AD7843_MISO_PNAME & (1<<AD7843_MISO_PIN))    //PINB3
//----------------------------------------------------------------------------------
#define     AD7843_SCK_DDR            DDRB
#define     AD7843_SCK_PORT            PORTB
#define     AD7843_SCK_PIN            PB1
#define     AD7843_SCK_1            AD7843_SCK_PORT |= (1<<AD7843_SCK_PIN)        //PINB1
#define     AD7843_SCK_0            AD7843_SCK_PORT &= ~(1<<AD7843_SCK_PIN)
//----------------------------------------------------------------------------------
#define     AD7843_PENIRQ_DDR        DDRD
#define     AD7843_PENIRQ_PORT        PORTD
#define     AD7843_PENIRQ_PIN        PD1
#define     AD7843_PENIRQ_PNAME        PIND
#define        AD7843_PENIRQ_1            AD7843_PENIRQ_PORT |= (1<<AD7843_PENIRQ_PIN)
#define     NO_AD7843_PENIRQ           (AD7843_PENIRQ_PNAME & (1<<AD7843_PENIRQ_PIN))    //PIND1
//----------------------------------------------------------------------------------
 
#define ButtonNull 0
#define Button0    1
#define Button1    2
#define Button2    3
#define Button3    4
#define Button4    5
#define Button5    6
#define Button6    7
#define Button7    8
#define Button8    9
 
#define MenuItem0  10
#define MenuItem1  11
#define MenuItem2  12
#define MenuItem3  13
#define MenuItem4  14
#define MenuItem5  15
 
#define ButtonOK       2
#define ButtonCancel   4
#define ButtonSingleOK 3
 
#include<avr/io.h>
#include <util/delay.h>
#include "Buzzer_Driver.h"
 
void InitIo_AD7843(void);
void SpiWrite_AD7843(const unsigned char byte);
unsigned char SpiRead_AD7843(void);
void GetAndDSPKeyboardSel(void);
void SetKeyboardSel(const unsigned char settype);
unsigned char GetTouchLocal(void);
unsigned char GetButtonDown(const unsigned char x, const unsigned char y);
void EnableCustomInput(void);
void DisableCustomInput(void);
 
#endif
//