# MIOS32_LCD

## Functions
s32 | MIOS32_LCD_Init (u32 mode)
s32 | MIOS32_LCD_ParametersSet (mios32_lcd_parameters_t lcd_parameters)
s32 | MIOS32_LCD_ParametersFetchFromBslInfoRange (void)
mios32_lcd_parameters_t * | MIOS32_LCD_ParametersGet (void)
s32 | MIOS32_LCD_TypeIsGLCD (void)
const char * | MIOS32_LCD_LcdTypeName (mios32_lcd_type_t lcd_type)
s32 | MIOS32_LCD_DeviceSet (u8 device)
u8 | MIOS32_LCD_DeviceGet (void)
s32 | MIOS32_LCD_CursorSet (u16 column, u16 line)
s32 | MIOS32_LCD_GCursorSet (u16 x, u16 y)
s32 | MIOS32_LCD_CursorMapSet (u8 map_table[])
s32 | MIOS32_LCD_PrintString (const char *str)
s32 | MIOS32_LCD_PrintFormattedString (const char *format,...)
s32 | MIOS32_LCD_PrintBootMessage (void)
s32 | MIOS32_LCD_SpecialCharsInit (u8 table[64])
s32 | MIOS32_LCD_FontInit (u8 *font)
s32 | MIOS32_LCD_Data (u8 data)
s32 | MIOS32_LCD_Cmd (u8 cmd)
s32 | MIOS32_LCD_Clear (void)
s32 | MIOS32_LCD_PrintChar (char c)
s32 | MIOS32_LCD_SpecialCharInit (u8 num, u8 table[8])
s32 | MIOS32_LCD_BColourSet (u32 rgb)
s32 | MIOS32_LCD_FColourSet (u32 rgb)
mios32_lcd_bitmap_t | MIOS32_LCD_BitmapInit (u8 *memory, u16 width, u16 height, u16 line_offset, u8 colour_depth)
s32 | MIOS32_LCD_BitmapPixelSet (mios32_lcd_bitmap_t bitmap, u16 x, u16 y, u32 colour)
s32 | MIOS32_LCD_BitmapPrint (mios32_lcd_bitmap_t bitmap)
## Variables
mios32_lcd_parameters_t | mios32_lcd_parameters
u8 | mios32_lcd_device = 0
u16 | mios32_lcd_column
u16 | mios32_lcd_line
u8 | mios32_lcd_cursor_map [MIOS32_LCD_MAX_MAP_LINES]
u16 | mios32_lcd_x
u16 | mios32_lcd_y

## Detailed Description

LCD functions for MIOS32

## Function Documentation

s32 MIOS32_LCD_BColourSet | ( | u32 | rgb | ) |

Sets the background colour
Only relevant for colour GLCDs

Parameters:

  `[in]` | rgb | red/green/blue value, each colour with 8bit resolution:
          u32 colour = (r << 16) | (g << 8) | (b << 0);

Returns:
  < 0 on errors

Here is the call graph for this function:

mios32_lcd_bitmap_t MIOS32_LCD_BitmapInit | ( | u8 * | memory,
|  | u16 | width,
|  | u16 | height,
|  | u16 | line_offset,
|  | u8 | colour_depth |
| ) |  |  |

Only supported for graphical LCDs: initializes a bitmap type and clears it with the background colour.

Example:

       // global array (!)
       u8 bitmap_array[APP_LCD_BITMAP_SIZE];

       // Initialisation:
       mios32_lcd_bitmap_t bitmap = MIOS32_LCD_BitmapClear(bitmap_array,
                                                        APP_LCD_NUM_X*APP_LCD_WIDTH,
                                                        APP_LCD_NUM_Y*APP_LCD_HEIGHT,
                                                        APP_LCD_NUM_X*APP_LCD_WIDTH.
                                                     APP_LCD_COLOUR_DEPTH);

Parameters:

  `[in]` | memory | pointer to the bitmap array
  `[in]` | width | width of the bitmap (usually APP_LCD_NUM_X*APP_LCD_WIDTH)
  `[in]` | height | height of the bitmap (usually APP_LCD_NUM_Y*APP_LCD_HEIGHT)
  `[in]` | line_offset | byte offset between each line (usually same value as width)
  `[in]` | colour_depth | how many bits are allocated by each pixel (usually APP_LCD_COLOUR_DEPTH)

Returns:
  a configured bitmap as mios32_lcd_bitmap_t

s32 MIOS32_LCD_BitmapPixelSet | ( | mios32_lcd_bitmap_t | bitmap,
|  | u16 | x,
|  | u16 | y,
|  | u32 | colour |
| ) |  |  |

Inserts a pixel at the given x/y position into the bitmap with the given colour.

Example:

Parameters:

  `[in]` | bitmap | the bitmap where the pixel should be inserted
  `[in]` | x | the X position of the pixel
  `[in]` | y | the Y position of the pixel
  `[in]` | colour | the colour of the pixel (value range depends on APP_LCD_COLOUR_DEPTH, mono GLCDs should use 0 or 1)

Returns:
  < 0 on errors

Here is the call graph for this function:

s32 MIOS32_LCD_BitmapPrint | ( | mios32_lcd_bitmap_t | bitmap | ) |

Only supported for graphical LCDs: transfers a bitmap to the LCD at the current graphical cursor position.

Example:

       MIOS32_LCD_CursorSet(0, 0);
       MIOS32_LCD_BitmapPrint(bitmap);

Parameters:

  `[in]` | bitmap | the bitmap which should be print

Returns:
  < 0 on errors

Here is the call graph for this function:

s32 MIOS32_LCD_Clear | ( | void |  | ) |

Clear Screen

Returns:
  < 0 on errors

Here is the call graph for this function:

s32 MIOS32_LCD_Cmd | ( | u8 | cmd | ) |

Sends command byte to LCD

Parameters:

  `[in]` | cmd | command byte which should be sent to LCD

Returns:
  < 0 on errors

Here is the call graph for this function:

s32 MIOS32_LCD_CursorMapSet | ( | u8 | map_table[] | ) |

Set the cursor map for character displays

By default the positions are configured for 2x16, 2x20, 4x20 and 2x40 displays:

       u8 cursor_map[] = {0x00, 0x40, 0x14, 0x54}; // offset line 0/1/2/3
       MIOS32_LCD_CursorMapSet(cursor_map);

For 4x16 displays, the configuration has to be changed:

       u8 cursor_map[] = {0x00, 0x40, 0x10, 0x50}; // offset line 0/1/2/3
       MIOS32_LCD_CursorMapSet(cursor_map);

For 3x16 DOG displays use:

       u8 cursor_map[] = {0x00, 0x10, 0x20, 0x30}; // offset line 0/1/2/3
       MIOS32_LCD_CursorMapSet(cursor_map);

Parameters:

  `[in]` | map_table | the cursor map

Returns:
  < 0 on errors

s32 MIOS32_LCD_CursorSet | ( | u16 | column,
|  | u16 | line |
| ) |  |  |

Sets cursor to given position

Parameters:

  `[in]` | column | number
  `[in]` | line | number

Returns:
  < 0 on errors

Here is the call graph for this function:

s32 MIOS32_LCD_Data | ( | u8 | data | ) |

Sends data byte to LCD

Parameters:

  `[in]` | data | byte which should be sent to LCD

Returns:
  < 0 on errors

Here is the call graph for this function:

u8 MIOS32_LCD_DeviceGet | ( | void |  | ) |

Returns LCD device

Returns:
  device number

s32 MIOS32_LCD_DeviceSet | ( | u8 | device | ) |

Selects LCD device

Parameters:

  `[in]` | device | LCD device number

Returns:
  < 0 on errors

s32 MIOS32_LCD_FColourSet | ( | u32 | rgb | ) |

Sets the foreground colour
Only relevant for colour GLCDs

Parameters:

  `[in]` | rgb | red/green/blue value, each colour with 8bit resolution:
          u32 colour = (r << 16) | (g << 8) | (b << 0);

Returns:
  < 0 on errors

Here is the call graph for this function:

s32 MIOS32_LCD_FontInit | ( | u8 * | font | ) |

Initializes the graphical font
Only relevant for GLCDs

Parameters:

  `[in]` | *font | pointer to font

Returns:
  < 0 on errors

s32 MIOS32_LCD_GCursorSet | ( | u16 | x,
|  | u16 | y |
| ) |  |  |

Sets graphical cursor to given position
Only relevant for GLCDs

Parameters:

  `[in]` | x | position
  `[in]` | y | position

Returns:
  < 0 on errors

Here is the call graph for this function:

s32 MIOS32_LCD_Init | ( | u32 | mode | ) |

Initializes LCD driver

Parameters:

  `[in]` | mode | currently only mode 0 supported

Returns:
  < 0 if initialisation failed

Here is the call graph for this function:

const char* MIOS32_LCD_LcdTypeName | ( | mios32_lcd_type_t | lcd_type | ) |

s32 MIOS32_LCD_ParametersFetchFromBslInfoRange | ( | void |  | ) |

Fetches the LCD Parameters from Bootloader Info range.

Note that this function is alreay called during startup. It can be used if the original type and dimensions should be restored after another LCD type has been selected during runtime.

Returns:
  0 on errors

mios32_lcd_parameters_t* MIOS32_LCD_ParametersGet | ( | void |  | ) |

Returns the current LCD parameters

s32 MIOS32_LCD_ParametersSet | ( | mios32_lcd_parameters_t | lcd_parameters | ) |

Sets LCD Parameters during runtime.

Note that the default parameters are stored in Bootloader Info range, and fetched during startup via MIOS32_LCD_ParametersFetchFromBslInfoRange

But it's possible to change them during runtime, and it's also possible that an alternative LCD driver (!= MIOS32_LCD=universal) overrides them!

Parameters:

  `[in]` | the | new lcd_parameters

Returns:
  0 on errors

s32 MIOS32_LCD_PrintBootMessage | ( | void |  | ) |

Used during startup to print the boot message, which consists of two lines specified with MIOS32_LCD_BOOT_MSG_LINE1 and MIOS32_LCD_BOOT_MSG_LINE2.
Both lines should be adapted in the mios32_config.h file of an application.
The message is automatically print by the programming model after each reset.
It will also be returned on a SysEx query.

Returns:
  < 0 on errors

Here is the call graph for this function:

s32 MIOS32_LCD_PrintChar | ( | char | c | ) |

Prints a single character

Parameters:

  `[in]` | c | character to be print

Returns:
  < 0 on errors

Here is the call graph for this function:

s32 MIOS32_LCD_PrintFormattedString | ( | const char * | format,
|  |  | ... |
| ) |  |  |

Prints a \0 (zero) terminated formatted string (like printf)

Parameters:

  `[in]` | *format | zero-terminated format string - 64 characters supported maximum!
  | ... | additional arguments

Returns:
  < 0 on errors

Here is the call graph for this function:

s32 MIOS32_LCD_PrintString | ( | const char * | str | ) |

Prints a \0 (zero) terminated string

Parameters:

  `[in]` | str | pointer to string

Returns:
  < 0 on errors

Here is the call graph for this function:

s32 MIOS32_LCD_SpecialCharInit | ( | u8 | num,
|  | u8 | table[8] |
| ) |  |  |

Initializes a single special character

Parameters:

  `[in]` | num | character number (0-7)
  `[in]` | table | 8 byte pattern

Returns:
  < 0 on errors

Here is the call graph for this function:

s32 MIOS32_LCD_SpecialCharsInit | ( | u8 | table[64] | ) |

Initializes all 8 special characters

Parameters:

  `[in]` | table | 8 * 8 (=64) bytes which contain the pixel lines

Returns:
  < 0 on errors

Here is the call graph for this function:

s32 MIOS32_LCD_TypeIsGLCD | ( | void |  | ) |

Returns 1 if the currently selected LCD type is a GLCD, otherwise 0

Note: GLCDs are determined by checking the mios32_lcd_parameters.lcd_type setting - if bit #7 is set (>= 0x80), the LCD is a GLCD

Returns:
  1 or 0

## Variable Documentation

u16 mios32_lcd_column

u8 mios32_lcd_cursor_map[MIOS32_LCD_MAX_MAP_LINES]

u8 mios32_lcd_device = 0

u16 mios32_lcd_line

mios32_lcd_parameters_t mios32_lcd_parameters

u16 mios32_lcd_x

u16 mios32_lcd_y