Project structure
The component sc_lcd includes the module module_lcd and the module_text_display.
module_lcd
Configuration Defines
The module_lcd includes device support defines, each support header, located in the devices directory defines a number of parameters. It is sufficient for the user to specify which device to support in the lcd_conf.h for the device to be correctly supported. To do this lcd_conf.h must include the define: :: #define LCD_PART_NUMBER p
- where p is the part the user requires support for. lcd_conf.h must be located in the application project and not the module. Currently, support is provided for:
- AT043TN24V7
- K430WQAV4F
Implementation Specific Defines
It is possible to override the default defines when a part number is selected. The defines avaliable are:
- LCD_WIDTH
This define is used to represent the width of the LCD panel in pixels.
- LCD_HEIGHT
This define is used to represent the height of the LCD panel in terms of lines.
- LCD_BITS_PER_PIXEL
Count of bits used to set a pixels colour, i.e. if the screen was wired for rgb565 then the LCD_BITS_PER_PIXEL would be 16, rgb888 would be 24. This is independant of the actual bit depth of the lcd.
- LCD_HOR_FRONT_PORCH
The horizontal front porch timing requirement given in pixel clocks.
- LCD_HOR_BACK_PORCH
The horizontal back porch timing requirement given in pixel clocks.
- LCD_VERT_FRONT_PORCH
The vertical front porch timing requirement given in horizontal time periods.
- LCD_VERT_BACK_PORCH
The vertical back porch timing requirement given in horizontal time periods.
- LCD_HOR_PULSE_WIDTH
The horizontal pulse width timing requirement given in pixel clocks. This is the duration that the hsync signal should go low to denote the start of the horizontal frame. Set to 0 when hsync is not necessary.
- LCD_VERT_PULSE_WIDTH
The vertical pulse width timing requirement given in vertical time periods. This is the duration that the vsync signal should go low to denote the start of the vertical frame. Set to 0 when vsync is not necessary.
- LCD_FREQ_DIVIDEND
The defines FREQ_DIVIDEND and FREQ_DIVISOR are used to calculate the frequency of the clock used for LCD. The frequency configured = (FREQ_DIVIDEND / FREQ_DIVISOR) in MHz
- LCD_FREQ_DIVISOR
The defines FREQ_DIVIDEND and FREQ_DIVISOR are used to calculate the frequency of the clock used for LCD. The frequency configured = (FREQ_DIVIDEND / FREQ_DIVISOR) in MHz
API
- The LCD display module functionality is defined in
- lcd.xc
- lcd.h
- lcd_defines.h
- /devices
Where the following functions can be found:
-
void lcd_init(chanend c_lcd)
LCD init function.
This sets the lcd into a state where it is ready to accept data.
Parameters
c_lcd
The channel end connecting to the lcd server.
-
static void lcd_req(chanend c_lcd)
Receives the request for data from the LCD server.
Parameters
c_lcd
The channel end connecting to the lcd server.
-
static void lcd_update(chanend c_lcd, unsigned buffer[])
LCD update function.
This sends a buffer of data to the lcd server to to sent to the lcd.
Note, no array bounds checking is performed.
Parameters
c_lcd
The channel end connecting to the lcd server.
buffer[]
The data to to emitted to the lcd screen, stored in rgb565.
-
static void lcd_update_p(chanend c_lcd, unsigned buffer)
C interface for LCD update function.
This sends a buffer of data to the lcd server to to sent to the lcd.
Note, no array bounds checking is performed.
Parameters
c_lcd
The channel end connecting to the lcd server.
buffer
A pointer to data to to emitted to the lcd screen, stored in rgb565.
-
void lcd_server(chanend client, lcd_ports &ports)
The LCD server thread.
Parameters
client
The channel end connecting to the client.
ports
The structure carrying the LCD port details.