Subversion Repositories Projects

Rev

Rev 404 | Rev 489 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

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