Subversion Repositories Projects

Rev

Rev 762 | Rev 902 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 762 Rev 783
1
/****************************************************************************
1
/****************************************************************************
2
 *   Copyright (C) 2009-2010 by Claas Anders "CaScAdE" Rathje               *
2
 *   Copyright (C) 2009-2010 by Claas Anders "CaScAdE" Rathje               *
3
 *   admiralcascade@gmail.com                                               *
3
 *   admiralcascade@gmail.com                                               *
4
 *   Project-URL: http://www.mylifesucks.de/oss/c-osd/                      *
4
 *   Project-URL: http://www.mylifesucks.de/oss/c-osd/                      *
5
 *                                                                          *
5
 *                                                                          *
6
 *   This program is free software; you can redistribute it and/or modify   *
6
 *   This program is free software; you can redistribute it and/or modify   *
7
 *   it under the terms of the GNU General Public License as published by   *
7
 *   it under the terms of the GNU General Public License as published by   *
8
 *   the Free Software Foundation; either version 2 of the License.         *
8
 *   the Free Software Foundation; either version 2 of the License.         *
9
 *                                                                          *
9
 *                                                                          *
10
 *   This program is distributed in the hope that it will be useful,        *
10
 *   This program is distributed in the hope that it will be useful,        *
11
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of         *
11
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of         *
12
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
12
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
13
 *   GNU General Public License for more details.                           *
13
 *   GNU General Public License for more details.                           *
14
 *                                                                          *
14
 *                                                                          *
15
 *   You should have received a copy of the GNU General Public License      *
15
 *   You should have received a copy of the GNU General Public License      *
16
 *   along with this program; if not, write to the                          *
16
 *   along with this program; if not, write to the                          *
17
 *   Free Software Foundation, Inc.,                                        *
17
 *   Free Software Foundation, Inc.,                                        *
18
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.              *
18
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.              *
19
 ****************************************************************************/
19
 ****************************************************************************/
20
 
20
 
21
#ifndef _MAX7456_SOFTWARE_SPI_H
21
#ifndef _MAX7456_SOFTWARE_SPI_H
22
#define _MAX7456_SOFTWARE_SPI_H
22
#define _MAX7456_SOFTWARE_SPI_H
23
 
23
 
24
 
24
 
25
/* ##########################################################################
25
/* ##########################################################################
26
 * Software SPI to communicate with MAX7456
26
 * Software SPI to communicate with MAX7456
27
 * ##########################################################################*/
27
 * ##########################################################################*/
28
#define MAX_CS_HIGH             PORTA |=  (1 << PA1);
28
#define MAX_CS_HIGH             PORTA |=  (1 << PA1);
29
#define MAX_CS_LOW              PORTA &= ~(1 << PA1);
29
#define MAX_CS_LOW              PORTA &= ~(1 << PA1);
30
#define MAX_SDIN_HIGH           PORTA |=  (1 << PA2);
30
#define MAX_SDIN_HIGH           PORTA |=  (1 << PA2);
31
#define MAX_SDIN_LOW            PORTA &= ~(1 << PA2);
31
#define MAX_SDIN_LOW            PORTA &= ~(1 << PA2);
32
#define MAX_SCLK_HIGH           PORTA |=  (1 << PA3);
32
#define MAX_SCLK_HIGH           PORTA |=  (1 << PA3);
33
#define MAX_SCLK_LOW            PORTA &= ~(1 << PA3);
33
#define MAX_SCLK_LOW            PORTA &= ~(1 << PA3);
34
#define MAX_RESET_HIGH          PORTA |=  (1 << PA5);
34
#define MAX_RESET_HIGH          PORTA |=  (1 << PA5);
35
#define MAX_RESET_LOW           PORTA &= ~(1 << PA5);
35
#define MAX_RESET_LOW           PORTA &= ~(1 << PA5);
36
 
36
 
37
 
37
 
38
/* ##########################################################################
38
/* ##########################################################################
39
 * MAX7456 SPI & Display stuff
39
 * MAX7456 SPI & Display stuff
40
 * ##########################################################################*/
40
 * ##########################################################################*/
41
 
41
 
42
/**
42
/**
43
 * Send a byte through SPI
43
 * Send a byte through SPI
44
 */
44
 */
45
void spi_send(uint8_t);
45
void spi_send(uint8_t);
46
 
46
 
47
/**
47
/**
48
 *  Send <byte> to <address> of MAX7456
48
 *  Send <byte> to <address> of MAX7456
49
 */
49
 */
50
void spi_send_byte(uint8_t, uint8_t);
50
void spi_send_byte(uint8_t, uint8_t);
51
 
51
 
52
/**
52
/**
53
 *  write a <character> to <address> of MAX7456 display memory
53
 *  write a <character> to <address> of MAX7456 display memory
54
 */
54
 */
55
void write_char(uint16_t, char);
55
void write_char(uint16_t, char);
56
 
56
 
57
/**
57
/**
58
 *  write a character <attribute> to <address> of MAX7456 display memory
58
 *  write a character <attribute> to <address> of MAX7456 display memory
59
 */
59
 */
60
void write_char_att(uint16_t, char);
60
void write_char_att(uint16_t, char);
61
/**
61
/**
62
 *  write a <character> at <x>/<y> to MAX7456 display memory
62
 *  write a <character> at <x>/<y> to MAX7456 display memory
63
 */
63
 */
64
void write_char_xy(uint8_t, uint8_t, char);
64
void write_char_xy(uint8_t, uint8_t, char);
65
/**
65
/**
66
 *  write a  character <attribute> at <x>/<y> to MAX7456 display memory
66
 *  write a  character <attribute> at <x>/<y> to MAX7456 display memory
67
 */
67
 */
68
void write_char_att_xy(uint8_t, uint8_t, char attribute);
68
void write_char_att_xy(uint8_t, uint8_t, char attribute);
69
 
69
 
70
/**
70
/**
71
 *  clear display memory
71
 *  clear display memory
72
 *  (also sets 8bit mode)
72
 *  (also sets 8bit mode)
73
 */
73
 */
74
void clear(void);
74
void clear(void);
75
 
75
 
76
/**
76
/**
77
 *  write an ascii <character> to <address> of MAX7456 display memory
77
 *  write an ascii <character> to <address> of MAX7456 display memory
78
 */
78
 */
79
void write_ascii_char(uint16_t, char);
79
void write_ascii_char(uint16_t, char);
80
 
80
 
81
/**
81
/**
82
 *  write an ascii <string> at <x>/<y> to MAX7456 display memory
82
 *  write an ascii <string> at <x>/<y> to MAX7456 display memory
83
 */
83
 */
84
void write_ascii_string(uint8_t, uint8_t, char*);
84
void write_ascii_string(uint8_t, uint8_t, char*);
85
 
85
 
86
/**
86
/**
-
 
87
 *  write an ascii <string> with lenght <len> at <x>/<y> to MAX7456 display memory
-
 
88
 */
-
 
89
void write_ascii_string_len(uint8_t x, uint8_t y, char *string, uint8_t len);
-
 
90
 
-
 
91
/**
87
 *  write an ascii <string> from progmen at <x>/<y> to MAX7456 display memory
92
 *  write an ascii <string> from progmen at <x>/<y> to MAX7456 display memory
88
 */
93
 */
89
void write_ascii_string_pgm(uint8_t, uint8_t, const char*);
94
void write_ascii_string_pgm(uint8_t, uint8_t, const char*);
90
 
95
 
91
/**
96
/**
92
 *  write an <string> from progmen at <x>/<y> downwards to MAX7456 display memory
97
 *  write an <string> from progmen at <x>/<y> downwards to MAX7456 display memory
93
 */
98
 */
94
void write_string_pgm_down(uint8_t, uint8_t, const char*, uint8_t);
99
void write_string_pgm_down(uint8_t, uint8_t, const char*, uint8_t);
95
 
100
 
96
/**
101
/**
97
 * Write a unsigned <number> at <x>/<y> to MAX7456 display memory
102
 * Write a unsigned <number> at <x>/<y> to MAX7456 display memory
98
 * <length> represents the length to rightbound the number
103
 * <length> represents the length to rightbound the number
99
 * <pad> = 1 will cause blank spaced to be filled up with zeros e.g. 007 instead of   7
104
 * <pad> = 1 will cause blank spaced to be filled up with zeros e.g. 007 instead of   7
100
 */
105
 */
101
void write_ndigit_number_u(uint8_t, uint8_t, uint16_t, int16_t, uint8_t);
106
void write_ndigit_number_u(uint8_t, uint8_t, uint16_t, int16_t, uint8_t);
102
 
107
 
103
/**
108
/**
104
 * Write a signed <number> at <x>/<y> to MAX7456 display memory
109
 * Write a signed <number> at <x>/<y> to MAX7456 display memory
105
 * <length> represents the length to rightbound the number
110
 * <length> represents the length to rightbound the number
106
 * <pad> = 1 will cause blank spaced to be filled up with zeros e.g. 007 instead of   7
111
 * <pad> = 1 will cause blank spaced to be filled up with zeros e.g. 007 instead of   7
107
 */
112
 */
108
void write_ndigit_number_s(uint8_t, uint8_t, int16_t, int16_t, uint8_t);
113
void write_ndigit_number_s(uint8_t, uint8_t, int16_t, int16_t, uint8_t);
109
 
114
 
110
/**
115
/**
111
 * Write a unsigned <number> at <x>/<y> to MAX7456 display memory as /10th of value
116
 * Write a unsigned <number> at <x>/<y> to MAX7456 display memory as /10th of value
112
 * <length> represents the length to rightbound the number
117
 * <length> represents the length to rightbound the number
113
 * <pad> = 1 will cause blank spaced to be filled up with zeros e.g. 007 instead of   7
118
 * <pad> = 1 will cause blank spaced to be filled up with zeros e.g. 007 instead of   7
114
 */
119
 */
115
void write_ndigit_number_u_10th(uint8_t, uint8_t, uint16_t, int16_t, uint8_t);
120
void write_ndigit_number_u_10th(uint8_t, uint8_t, uint16_t, int16_t, uint8_t);
116
 
121
 
117
/**
122
/**
118
 * Write a signed <number> at <x>/<y> to MAX7456 display memory as /10th of value
123
 * Write a signed <number> at <x>/<y> to MAX7456 display memory as /10th of value
119
 * <length> represents the length to rightbound the number
124
 * <length> represents the length to rightbound the number
120
 * <pad> = 1 will cause blank spaced to be filled up with zeros e.g. 007 instead of   7
125
 * <pad> = 1 will cause blank spaced to be filled up with zeros e.g. 007 instead of   7
121
 */
126
 */
122
void write_ndigit_number_s_10th(uint8_t, uint8_t, int16_t, int16_t, uint8_t);
127
void write_ndigit_number_s_10th(uint8_t, uint8_t, int16_t, int16_t, uint8_t);
123
 
128
 
124
/**
129
/**
125
 *  write <seconds> as human readable time at <x>/<y> to MAX7456 display mem
130
 *  write <seconds> as human readable time at <x>/<y> to MAX7456 display mem
126
 */
131
 */
127
void write_time(uint8_t, uint8_t, uint16_t);
132
void write_time(uint8_t, uint8_t, uint16_t);
128
 
133
 
129
#if (ALLCHARSDEBUG|(WRITECHARS != -1))
134
#if (ALLCHARSDEBUG|(WRITECHARS != -1))
130
/**
135
/**
131
 * for testing write all chars to screen
136
 * for testing write all chars to screen
132
 */
137
 */
133
void write_all_chars();
138
void write_all_chars();
134
 
139
 
135
/**
140
/**
136
 * let the MAX7456 learn a new character at <number>
141
 * let the MAX7456 learn a new character at <number>
137
 * with <data>.
142
 * with <data>.
138
 */
143
 */
139
void learn_char(uint8_t, unsigned char*);
144
void learn_char(uint8_t, unsigned char*);
140
#endif
145
#endif
141
 
146
 
142
/**
147
/**
143
 * wirte a <position> at <x>/<y> assuming it is a gps position for long-/latitude
148
 * wirte a <position> at <x>/<y> assuming it is a gps position for long-/latitude
144
 */
149
 */
145
void write_gps_pos(uint8_t, uint8_t, int32_t);
150
void write_gps_pos(uint8_t, uint8_t, int32_t);
146
 
151
 
147
#endif
152
#endif
148
 
153