dRonin  adbada4
dRonin firmware
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
pios_max7456.h
Go to the documentation of this file.
1 
13 /*
14  * This program is free software; you can redistribute it and/or modify
15  * it under the terms of the GNU General Public License as published by
16  * the Free Software Foundation; either version 3 of the License, or
17  * (at your option) any later version.
18  *
19  * This program is distributed in the hope that it will be useful, but
20  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
21  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  * for more details.
23  *
24  * You should have received a copy of the GNU General Public License along
25  * with this program; if not, see <http://www.gnu.org/licenses/>
26  *
27  * Additional note on redistribution: The copyright and license notices above
28  * must be maintained in each individual source file that is a derivative work
29  * of this source file; otherwise redistribution is prohibited.
30  */
31 
32 #ifndef LIB_MAX7456_MAX7456_H_
33 #define LIB_MAX7456_MAX7456_H_
34 
35 #include <stdint.h>
36 #include <stdio.h>
37 
38 #include <pios_spi.h>
39 
40 #define MAX7456_MODE_PAL 0
41 #define MAX7456_MODE_NTSC 1
42 
43 #define MAX7456_ATTR_NONE 0
44 #define MAX7456_ATTR_INVERT 1
45 #define MAX7456_ATTR_BLINK 2
46 #define MAX7456_ATTR_LBC 4
47 
48 #define MAX7456_PAL_COLUMNS 30
49 #define MAX7456_PAL_ROWS 16
50 #define MAX7456_PAL_HCENTER (MAX7456_PAL_COLUMNS / 2)
51 #define MAX7456_PAL_VCENTER (MAX7456_PAL_ROWS / 2)
52 
53 #define MAX7456_NTSC_COLUMNS 30
54 #define MAX7456_NTSC_ROWS 13
55 #define MAX7456_NTSC_HCENTER (MAX7456_NTSC_COLUMNS / 2)
56 #define MAX7456_NTSC_VCENTER (MAX7456_NTSC_ROWS / 2)
57 
58 // NTSC and PAL have the same number of columns.
59 #define MAX7456_COLUMNS MAX7456_NTSC_COLUMNS
60 #define MAX7456_HCENTER MAX7456_NTSC_HCENTER
61 
62 // Special formatting values
63 #define MAX7456_FMT_H_CENTER 31
64 
65 typedef struct max7456_dev_s *max7456_dev_t;
66 
68 
76 int PIOS_MAX7456_init (max7456_dev_t *dev_out,
77  pios_spi_t spi_handle, uint32_t slave_idx);
78 
84 
91 void PIOS_MAX7456_upload_char (max7456_dev_t dev, uint8_t char_index,
92  const uint8_t *data);
93 
101  uint8_t char_index, uint8_t *data);
102 
111 void PIOS_MAX7456_put (max7456_dev_t dev, uint8_t col, uint8_t row,
112  uint8_t chr, uint8_t attr);
113 
122 void PIOS_MAX7456_puts (max7456_dev_t dev, uint8_t col, uint8_t row,
123  const char *s, uint8_t attr);
124 
135  uint8_t *mode, uint8_t *right, uint8_t *bottom,
136  uint8_t *hcenter, uint8_t *vcenter);
137 
143 
150 
157 void PIOS_MAX7456_set_mode(max7456_dev_t dev, bool force, uint8_t fallback);
158 
159 #endif /* LIB_MAX7456_MAX7456_H_ */
bool PIOS_MAX7456_stall_detect(max7456_dev_t dev)
Detects whether the OSD chip has stalled and attempts to restart it.
struct max7456_dev_s * max7456_dev_t
Definition: pios_max7456.h:65
void PIOS_MAX7456_put(max7456_dev_t dev, uint8_t col, uint8_t row, uint8_t chr, uint8_t attr)
Sets a position of character memory.
uint8_t data[XFER_BYTES_PER_PACKET]
Definition: bl_messages.h:129
SPI functions header.
void PIOS_MAX7456_set_mode(max7456_dev_t dev, bool force, uint8_t fallback)
Allows overriding the video mode used by OSD.
void PIOS_MAX7456_puts(max7456_dev_t dev, uint8_t col, uint8_t row, const char *s, uint8_t attr)
Sets a string into character memory.
void PIOS_MAX7456_get_extents(max7456_dev_t dev, uint8_t *mode, uint8_t *right, uint8_t *bottom, uint8_t *hcenter, uint8_t *vcenter)
Gets the extents of the screen.
void PIOS_MAX7456_clear(max7456_dev_t dev)
Clear the screen.
enum channel_mode mode
Definition: pios_servo.c:58
void PIOS_MAX7456_download_char(max7456_dev_t dev, uint8_t char_index, uint8_t *data)
Download a character from the device.
void PIOS_MAX7456_upload_char(max7456_dev_t dev, uint8_t char_index, const uint8_t *data)
Upload a character to the device.
int PIOS_MAX7456_init(max7456_dev_t *dev_out, pios_spi_t spi_handle, uint32_t slave_idx)
Allocate and initialise MAX7456 device.
void PIOS_MAX7456_wait_vsync()