This file contains various SPI macros, common constants, common typedefs, and various function prototypes which interface with the DOG module itself. The library is organized in such a way that the user should not have to interface with any of the macros in this file dealing with SPI communication. The user will mostly only find the function prototypes in this file of interest and perhaps the constants and typedefs should they choose to expand upon the library.
#define CLEARBIT |
( |
|
port, |
|
|
|
bit |
|
) |
| ((port) &= ~(1 << (bit))) |
Define CLEARBIT if not previously defined
Height of the entire display in pixels
Value:
(0 << DORD) | \
(1 << MSTR) | \
#define SETBIT(port, bit)
Definition: DOGM128_common.h:46
#define DOG_SPR1
Definition: DOGM128_user_config.h:64
#define DOG_SPR0
Definition: DOGM128_user_config.h:66
#define DOG_CPHA
Definition: DOGM128_user_config.h:62
#define DOG_SPCR
Definition: DOGM128_user_config.h:50
#define DOG_CPOL
Definition: DOGM128_user_config.h:60
#define DOG_SPE
Definition: DOGM128_user_config.h:54
#define DOG_SPIE
Definition: DOGM128_user_config.h:52
#define DOG_SPSR
Definition: DOGM128_user_config.h:41
#define DOG_SPR2X
Definition: DOGM128_user_config.h:43
Initialize SPI communication:
SPIE - SPI Interrupt DISABLED (we will poll instead)
SPE - SPI ENABLED
DORD - MSB First
MSTR - Configured as a MASTER
CPOL - Clock Polarity = 0
CPHA - Clock Phase = 0
SPI Clock = f_clk/2 (EA DOGM128 can handle up to 20MHz)
SPR1 - CLEARED
SPR0 - CLEARED
SPR2X - SET (When available)
#define DOG_PAGE_HEIGHT 8 |
Height of a single page in pixels
Clear A_0 pin; allows DOGM128 to receive commands.
Set A_0 pin; allows DOGM128 to receive data.
Width of the entire display in pixels
#define SETBIT |
( |
|
port, |
|
|
|
bit |
|
) |
| ((port) |= (1 << (bit))) |
Define SETBIT if not previously defined
portable 16-bit signed integer
portable 8-bit signed integer
portable 16-bit unsigned integer
portable 8-bit unsigned integer
used for power-on and power off
void dog_clear_buffer |
( |
void |
| ) |
|
This function is used to clear the entire character buffer; however it does not clear the display.
- Algorithm
- The function simply advances through the two-dimensional array which makes up the buffer and sets its contents equal to zero.
- Assumptions
-
void dog_clear_display |
( |
void |
| ) |
|
This function is used to clear the entire LCD display; however it does not clear the buffer.
- Algorithm
- Beginning at page 0, column 0, the function mimics an old typewriter with a manual carriage return. It sends a value of zero to the display continuously for each column of the page until it reaches the end of the line (page). At which point, the page is manually advanced and the column reset to zero (left side of display). It continues along this route until reaching the bottom-right corner. Finally, it resets the carriage to the top-left corner for future display writes.
- Assumptions
-
This function is used to initialize the EA DOGM128; it must be called prior to any of the other functions in this file and should only be called once. It also clears the display.
- Parameters
- display_mode = When set to DOG_NORMAL_DISPLAY, the pixels are normally off. When set to DOG_INVERTED_DISPLAY, the pixels are normally on (inverted).
- contrast = Contrast value ranging on the set [0,63]. Higher number means higher contrast.
- Algorithm
- The function initializes SPI communication between the EA DOGM128 and the microcontroller. It then sends various setup commands to the LCD as specified by the datasheet. Finally, it clears the display to remove any random pixels on the screen.
- Assumptions
- The user has correctly connected the screen to the microcontroller (keep your wiring neat) and has configured the user_config.h file according to his or her needs should the default configuration be changed.
This function is used set the display_mode of the DOG module.
- Parameters
- display_mode = When set to DOG_NORMAL_DISPLAY, the pixels are normally off. When set to DOG_INVERTED_DISPLAY, the pixels are normally on (inverted).
- Algorithm
- The function begins by masking out all bits except the LSB of the supplied display_mode value. It then sends this value to the display using the display mode set command as specified by the datasheet.
- Assumptions
-
This function is used to turn the DOG module on or off. The DOG module is powered on by default once the dog_init() function is called; this function can be used for toggling power once the dog_init() function has been called. It DOES NOT control the backlight.
- Parameters
- state = DOG_OFF to power down, DOG_ON to power up.
- Algorithm
- The function begins simply transmits the on/off command to the display
- Assumptions
-
void dog_print_buffer |
( |
void |
| ) |
|
This function is used to print the entire contents of the buffer to the display.
- Algorithm
- Beginning at page 0, column 0, the function mimics an old typewriter with a manual carriage return. It sends the corresponding buffer contents to the display continuously for each column of the page until it reaches the end of the line (page). At which point, the page is manually advanced and the column reset to zero (left side of display). It continues along this route until reaching the bottom-right corner. Finally, it resets the carriage to the top-left corner for future display writes.
- Assumptions
-
void dog_set_contrast |
( |
uint8_t |
contrast | ) |
|
This function is used set the contrast of the DOG module.
- Parameters
- contrast = Contrast value ranging on the set [0,63]. Higher number means higher contrast.
- Algorithm
- The function begins by masking out the 2 MSB's of the supplied contrast value. It then sends this value to the display using the contrast set commands as specified by the datasheet.
- Assumptions
-