EA DOGM128 Driver  0.1
Driver code for the EA DOGM128
 All Files Functions Typedefs Enumerations Groups Pages
DOGM128_common.h
Go to the documentation of this file.
1 
21 /* Used to prevent multiple inclusion of the header file */
22 #ifndef DOGM128_COMMON_H
23 #define DOGM128_COMMON_H
24 
25 /*----------------------------------------------------------------------------*/
26 /* INCLUDES */
27 /*----------------------------------------------------------------------------*/
28 #include "DOGM128_user_config.h"
29 
30 /*----------------------------------------------------------------------------*/
31 /* CONSTANTS */
32 /*----------------------------------------------------------------------------*/
33 
35 #define DOG_WIDTH 128
36 
37 #define DOG_HEIGHT 64
38 
39 #define DOG_PAGE_HEIGHT 8
40 
41 /*----------------------------------------------------------------------------*/
42 /* MACROS */
43 /*----------------------------------------------------------------------------*/
45 #ifndef SETBIT
46 #define SETBIT(port,bit) ((port) |= (1 << (bit)))
47 #endif /* SETBIT */
48 
50 #ifndef CLEARBIT
51 #define CLEARBIT(port,bit) ((port) &= ~(1 << (bit)))
52 #endif /* CLEARBIT */
53 
67 #ifdef DOG_SPR2X
68 #define DOG_INIT_SPI() DOG_SPCR = ((0 << DOG_SPIE)| \
69  (1 << DOG_SPE) | \
70  (0 << DORD) | \
71  (1 << MSTR) | \
72  (0 << DOG_CPOL) | \
73  (0 << DOG_CPHA) | \
74  (0 << DOG_SPR1) | \
75  (0 << DOG_SPR0)); \
76  SETBIT(DOG_SPSR, DOG_SPR2X);
77 #else
78 #define DOG_INIT_SPI() DOG_SPCR = ((0 << DOG_SPIE) | \
79  (1 << DOG_SPE) | \
80  (0 << DORD) | \
81  (1 << MSTR) | \
82  (0 << DOG_CPOL) | \
83  (0 << DOG_CPHA) | \
84  (0 << DOG_SPR1) | \
85  (0 << DOG_SPR0));
86 #endif
87 
89 #define DOG_SLAVE_SELECT() CLEARBIT(DOG_SPI_PORT, DOG_SS_BAR_PIN);
90 
91 #define DOG_SLAVE_DESELECT() SETBIT(DOG_SPI_PORT, DOG_SS_BAR_PIN);
92 
93 #define DOG_ASSERT_RESET() CLEARBIT(DOG_RESET_PORT, DOG_RESET_PIN);
94 
95 #define DOG_UNASSERT_RESET() SETBIT(DOG_RESET_PORT, DOG_RESET_PIN);
96 
98 #define DOG_SEND_DATA() \
99  SETBIT(DOG_DATA_OR_COMMAND_PORT, DOG_DATA_OR_COMMAND_PIN);
100 
101 #define DOG_SEND_COMMAND() \
102  CLEARBIT(DOG_DATA_OR_COMMAND_PORT, DOG_DATA_OR_COMMAND_PIN);
103 
104 /*----------------------------------------------------------------------------*/
105 /* TYPEDEFS */
106 /*----------------------------------------------------------------------------*/
107 
108 typedef unsigned char uint8_t ;
109 typedef signed char int8_t ;
110 typedef unsigned int uint16_t ;
111 typedef signed int int16_t ;
112 
114 typedef enum{DOG_OFF = 0, DOG_ON} dog_power_state_t;
115 
117 typedef enum{DOG_NORMAL_DISPLAY = 0, DOG_INVERTED_DISPLAY} dog_display_mode_t;
118 
119 /*----------------------------------------------------------------------------*/
120 /* FUNCTIONS */
121 /*----------------------------------------------------------------------------*/
122 
148 void dog_init(dog_display_mode_t display_mode, uint8_t contrast);
149 
166 void dog_clear_display(void);
167 
179 void dog_clear_buffer(void);
180 
198 void dog_print_buffer(void);
199 
213 void dog_set_contrast(uint8_t contrast);
214 
230 void dog_invert_pixels(dog_display_mode_t display_mode);
231 
245 void dog_power(dog_power_state_t state);
246 
247 #endif /* DOGM128_COMMON_H */ /* DOGM128_common */
void dog_set_contrast(uint8_t contrast)
Definition: DOGM128_common.c:208
dog_display_mode_t
Definition: DOGM128_common.h:117
void dog_clear_buffer(void)
Definition: DOGM128_common.c:191
void dog_clear_display(void)
Definition: DOGM128_common.c:104
signed char int8_t
Definition: DOGM128_common.h:109
void dog_invert_pixels(dog_display_mode_t display_mode)
Definition: DOGM128_common.c:227
void dog_power(dog_power_state_t state)
Definition: DOGM128_common.c:243
signed int int16_t
Definition: DOGM128_common.h:111
void dog_print_buffer(void)
Definition: DOGM128_common.c:148
dog_power_state_t
Definition: DOGM128_common.h:114
unsigned char uint8_t
Definition: DOGM128_common.h:108
unsigned int uint16_t
Definition: DOGM128_common.h:110
void dog_init(dog_display_mode_t display_mode, uint8_t contrast)
Definition: DOGM128_common.c:40