Defines | Functions | Variables

# lcd.c File Reference

Dotmatrix LCD Library. More...

`#include <avr/io.h>`
`#include <stdlib.h>`
`#include <stdio.h>`
`#include <string.h>`
`#include <util/delay.h>`
`#include "lcd.h"`
`#include "buzzer.h"`
Include dependency graph for lcd.c:

Go to the source code of this file.

## Defines
#define | DISPLAY_bp 4
#define | BACKLIGHT_bp 5
## Functions
void | print_buffer (void)
| send the buffer contents to the display
void | lcd_scroll (void)
| scroll individual lines
void | push_char (uint8_t data)
| push a character into the buffer.
int | lcd_putchar (char data, FILE *stream)
| Write one Character on the Display.
## Variables
char | display_buffer [LCD_ROWS][LCD_COLS+1]
| buffer used when scrolling is enabled
char | input_buffer [LCD_ROWS][INPUT_BUFFER_SIZE+1]
| buffer used to store the received characters and rotate the lines
uint8_t | buffer_index = 0
| always pints to the first line
uint8_t | char_index = 0
| points to the next char to write
uint8_t | formfeed = 0
| is set is an formfeed () is received to parse a sequence of special characters
uint8_t | escape = 0
| is set if an escape is received, to parse control secquences
uint8_t | bell = 0
| is set if an bell is received, to parse control secquences
uint8_t | firstchar = 0
| contains the first char of a sequence of 2 chars that schould be parsed
uint8_t | scroll = 0
| scroll enable flag
char | remap [256]
| lookup table to translate display charset to ASCII charset

## Detailed Description

Dotmatrix LCD Library.

Authors:
  Dominic Rathje (dominic.rathje@uni-ulm.de)
  Christian Degenhart (christian.degenhart@uni-ulm.de)

Version:
  1.1

Note:
  - Compiler : WinAVR 20100110
  - Supported devices : ATMega8

Definition in file lcd.c.

## Function Documentation

int lcd_putchar | ( | char | data,
|  | FILE * | sream
| ) |  |

Write one Character on the Display.

Characters received are transformer by a lookup-table because the charset of the Display is not equal to ASCII. As input to this function any ASCII character that can be typed ba a German or American Keyboard is valid and displayed correctly on the screen.

As the Display has some amazing special characters, like fancy arrows, there are some sequences that are parsed and replaced by the corresponding symbol. See https://wiki.fs-et.de/student-lab/UartDisplay for details on the parser.

Parameters:

  data | ASCII Character to print.
  stream | (is necessary to be compatible with printf)

Returns:
  0 on success.

Definition at line 187 of file lcd.c.

Here is the call graph for this function:

void lcd_scroll | ( | void | ) |

scroll individual lines

This function should be called by the main loop regularly if scroll mode is activated. Each time this function is executed the content of a line longer than the physical display lentgh is rotated by one position.

Definition at line 134 of file lcd.c.

Here is the call graph for this function:

void print_buffer | ( | void | ) |

send the buffer contents to the display

prints the contents of the buffer on the screen. This function is called automatically by lcd_putchar when a is received.

Definition at line 78 of file lcd.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void push_char | ( | uint8_t | data ) |

push a character into the buffer.

This is a internal function, that should not be called from other files. To print the buffer to the display call print_buffer()

Parameters:

  data | Character to print.

Returns:
  void

Definition at line 169 of file lcd.c.

Here is the caller graph for this function:

## Variable Documentation

char input_buffer[LCD_ROWS][INPUT_BUFFER_SIZE+1]

Initial value:

     {
            "********************\0",
            "**  UART-Display  **\0",
            "**by Ernst Abrazzo**\0",
            "********************\0"
            }

buffer used to store the received characters and rotate the lines

Definition at line 30 of file lcd.c.

char remap[256]

Initial value:

     {
              0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
             16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
             32,  33,  34,  35, 162,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
             48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
            160,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
             80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90, 250, 251, 252,  29, 196,
             96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
            112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 253, 254, 255, 206, 127,
            128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
            144, 145, 146, 147, 148, 149,  45,  45, 152, 153, 154, 155, 156, 157, 158, 159,
            160,  40, 162,  64, 164, 163, 254,  95, 168, 169, 170, 171, 172, 173, 174, 175,
            128, 140, 130, 131, 180, 143, 182, 183, 184, 185, 186, 187, 139, 138, 190,  96,
            192, 193, 194, 195,  91, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207,
            208, 209, 210, 211, 212, 213,  92, 215, 216, 217, 218, 219,  94, 221, 222, 190,
            127, 225, 226, 227, 123, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
            240, 125, 242, 243, 244, 245, 124, 247, 248, 249, 250, 251, 126, 253, 254, 255
    }

lookup table to translate display charset to ASCII charset

Definition at line 59 of file lcd.c.