GLCD Library
A C Library for Embedded Applications
Main Page
Related Pages
Modules
Data Structures
Files
File List
Globals
All
Data Structures
Files
Functions
Variables
Enumerations
Enumerator
Macros
Groups
Pages
AVR8.h
Go to the documentation of this file.
1
7
/*
8
Copyright (c) 2012, Andy Gock
9
10
All rights reserved.
11
12
Redistribution and use in source and binary forms, with or without
13
modification, are permitted provided that the following conditions are met:
14
* Redistributions of source code must retain the above copyright
15
notice, this list of conditions and the following disclaimer.
16
* Redistributions in binary form must reproduce the above copyright
17
notice, this list of conditions and the following disclaimer in the
18
documentation and/or other materials provided with the distribution.
19
* Neither the name of Andy Gock nor the
20
names of its contributors may be used to endorse or promote products
21
derived from this software without specific prior written permission.
22
23
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
24
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26
DISCLAIMED. IN NO EVENT SHALL ANDY GOCK BE LIABLE FOR ANY
27
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
30
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33
*/
34
35
#ifndef GLCD_PINOUTS_AVR8_H_
36
#define GLCD_PINOUTS_AVR8_H_
37
38
#if defined(GLCD_DEVICE_AVR8)
39
40
#include <avr/io.h>
41
#include <avr/pgmspace.h>
42
43
#ifndef _BITHELPERS_
44
#define _BITHELPERS_
45
#define sbi(var, mask) ((var) |= _BV(mask))
46
#define cbi(var, mask) ((var) &= ~(_BV(mask)))
47
#define DDR(x) (*(&x - 1))
48
#define PIN(x) (*(&x - 2))
49
#endif
50
51
#define swap(a, b) { uint8_t t = a; a = b; b = t; }
52
53
#if defined(GLCD_CONTROLLER_PCD8544)
54
59
#define AVR_SS_PORT PORTB
60
#define AVR_SS_PIN 0
61
#define CONTROLLER_MOSI_PORT PORTB
62
#define CONTROLLER_MOSI_PIN 2
63
#define CONTROLLER_MISO_PORT PORTB
64
#define CONTROLLER_MISO_PIN 3
65
#define CONTROLLER_SCK_PORT PORTB
66
#define CONTROLLER_SCK_PIN 1
67
73
#define CONTROLLER_SS_PORT PORTA
74
#define CONTROLLER_SS_PIN 5
75
#define CONTROLLER_DC_PORT PORTB
76
#define CONTROLLER_DC_PIN 5
77
#define CONTROLLER_RST_PORT PORTB
78
#define CONTROLLER_RST_PIN 4
79
81
#elif defined (GLCD_CONTROLLER_ST7565R)
82
86
#define AVR_SS_PORT PORTB
87
#define AVR_SS_PIN 0
88
#define CONTROLLER_MOSI_PORT PORTB
89
#define CONTROLLER_MOSI_PIN 2
90
#define CONTROLLER_MISO_PORT PORTB
91
#define CONTROLLER_MISO_PIN 3
92
#define CONTROLLER_SCK_PORT PORTB
93
#define CONTROLLER_SCK_PIN 1
94
100
#define CONTROLLER_A0_PORT PORTC
101
#define CONTROLLER_A0_PIN 0
102
#define CONTROLLER_SS_PORT PORTG
103
#define CONTROLLER_SS_PIN 0
104
#define CONTROLLER_RST_PORT PORTG
105
#define CONTROLLER_RST_PIN 1
106
107
#else
108
#error "Controller not supported by AVR8"
109
#endif
110
115
#define GLCD_SELECT() cbi(CONTROLLER_SS_PORT,CONTROLLER_SS_PIN)
116
#define GLCD_DESELECT() sbi(CONTROLLER_SS_PORT,CONTROLLER_SS_PIN)
117
#define GLCD_DC_LOW() cbi(CONTROLLER_DC_PORT,CONTROLLER_DC_PIN)
118
#define GLCD_DC_HIGH() sbi(CONTROLLER_DC_PORT,CONTROLLER_DC_PIN)
119
#define GLCD_RESET_LOW() cbi(CONTROLLER_RST_PORT,CONTROLLER_RST_PIN)
120
#define GLCD_RESET_HIGH() sbi(CONTROLLER_RST_PORT,CONTROLLER_RST_PIN)
121
122
#define GLCD_A0_LOW() cbi(CONTROLLER_A0_PORT,CONTROLLER_A0_PIN)
123
#define GLCD_A0_HIGH() sbi(CONTROLLER_A0_PORT,CONTROLLER_A0_PIN)
124
127
#endif
128
129
#endif
/* GLCD_PINOUTS_AVR8_H_ */
devices
AVR8.h
Generated on Thu Dec 19 2013 01:26:32 for GLCD Library by
1.8.5