Subversion Repositories Projects

Rev

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

Rev Author Line No. Line
331 cascade 1
/****************************************************************************
728 cascade 2
 *   Copyright (C) 2009-2010 by Claas Anders "CaScAdE" Rathje               *
331 cascade 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
 
762 - 21
#ifndef _MAX7456_SOFTWARE_SPI_H
22
#define _MAX7456_SOFTWARE_SPI_H
23
 
24
 
331 cascade 25
/* ##########################################################################
26
 * Software SPI to communicate with MAX7456
27
 * ##########################################################################*/
28
#define MAX_CS_HIGH             PORTA |=  (1 << PA1);
29
#define MAX_CS_LOW              PORTA &= ~(1 << PA1);
30
#define MAX_SDIN_HIGH           PORTA |=  (1 << PA2);
31
#define MAX_SDIN_LOW            PORTA &= ~(1 << PA2);
32
#define MAX_SCLK_HIGH           PORTA |=  (1 << PA3);
33
#define MAX_SCLK_LOW            PORTA &= ~(1 << PA3);
34
#define MAX_RESET_HIGH          PORTA |=  (1 << PA5);
35
#define MAX_RESET_LOW           PORTA &= ~(1 << PA5);
36
 
37
 
38
/* ##########################################################################
39
 * MAX7456 SPI & Display stuff
40
 * ##########################################################################*/
41
 
42
/**
43
 * Send a byte through SPI
44
 */
45
void spi_send(uint8_t);
46
 
47
/**
48
 *  Send <byte> to <address> of MAX7456
49
 */
50
void spi_send_byte(uint8_t, uint8_t);
51
 
52
/**
53
 *  write a <character> to <address> of MAX7456 display memory
54
 */
55
void write_char(uint16_t, char);
56
 
57
/**
58
 *  write a character <attribute> to <address> of MAX7456 display memory
59
 */
60
void write_char_att(uint16_t, char);
61
/**
62
 *  write a <character> at <x>/<y> to MAX7456 display memory
63
 */
64
void write_char_xy(uint8_t, uint8_t, char);
65
/**
66
 *  write a  character <attribute> at <x>/<y> to MAX7456 display memory
67
 */
68
void write_char_att_xy(uint8_t, uint8_t, char attribute);
69
 
70
/**
404 cascade 71
 *  clear display memory
72
 *  (also sets 8bit mode)
331 cascade 73
 */
74
void clear(void);
75
 
76
/**
77
 *  write an ascii <character> to <address> of MAX7456 display memory
78
 */
79
void write_ascii_char(uint16_t, char);
80
 
81
/**
82
 *  write an ascii <string> at <x>/<y> to MAX7456 display memory
83
 */
84
void write_ascii_string(uint8_t, uint8_t, char*);
85
 
86
/**
783 - 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
/**
346 cascade 92
 *  write an ascii <string> from progmen at <x>/<y> to MAX7456 display memory
93
 */
489 woggle 94
void write_ascii_string_pgm(uint8_t, uint8_t, const char*);
346 cascade 95
 
96
/**
379 cascade 97
 *  write an <string> from progmen at <x>/<y> downwards to MAX7456 display memory
98
 */
489 woggle 99
void write_string_pgm_down(uint8_t, uint8_t, const char*, uint8_t);
379 cascade 100
 
101
/**
519 cascade 102
 * Write a unsigned <number> at <x>/<y> to MAX7456 display memory
103
 * <length> represents the length to rightbound the number
349 cascade 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_u(uint8_t, uint8_t, uint16_t, int16_t, uint8_t);
331 cascade 107
 
108
/**
519 cascade 109
 * Write a signed <number> at <x>/<y> to MAX7456 display memory
110
 * <length> represents the length to rightbound the number
349 cascade 111
 * <pad> = 1 will cause blank spaced to be filled up with zeros e.g. 007 instead of   7
331 cascade 112
 */
349 cascade 113
void write_ndigit_number_s(uint8_t, uint8_t, int16_t, int16_t, uint8_t);
331 cascade 114
 
115
/**
519 cascade 116
 * Write a unsigned <number> at <x>/<y> to MAX7456 display memory as /10th of value
117
 * <length> represents the length to rightbound the number
118
 * <pad> = 1 will cause blank spaced to be filled up with zeros e.g. 007 instead of   7
331 cascade 119
 */
349 cascade 120
void write_ndigit_number_u_10th(uint8_t, uint8_t, uint16_t, int16_t, uint8_t);
331 cascade 121
 
122
/**
519 cascade 123
 * Write a signed <number> at <x>/<y> to MAX7456 display memory as /10th of value
124
 * <length> represents the length to rightbound the number
125
 * <pad> = 1 will cause blank spaced to be filled up with zeros e.g. 007 instead of   7
331 cascade 126
 */
349 cascade 127
void write_ndigit_number_s_10th(uint8_t, uint8_t, int16_t, int16_t, uint8_t);
331 cascade 128
 
129
/**
130
 *  write <seconds> as human readable time at <x>/<y> to MAX7456 display mem
131
 */
132
void write_time(uint8_t, uint8_t, uint16_t);
133
 
736 cascade 134
#if (ALLCHARSDEBUG|(WRITECHARS != -1))
331 cascade 135
/**
136
 * for testing write all chars to screen
137
 */
138
void write_all_chars();
139
 
140
/**
141
 * let the MAX7456 learn a new character at <number>
142
 * with <data>.
143
 */
144
void learn_char(uint8_t, unsigned char*);
736 cascade 145
#endif
412 cascade 146
 
147
/**
148
 * wirte a <position> at <x>/<y> assuming it is a gps position for long-/latitude
149
 */
150
void write_gps_pos(uint8_t, uint8_t, int32_t);
762 - 151
 
152
#endif