Ultibo API
C/C++ API for Ultibo Core
Loading...
Searching...
No Matches
af16x2lcd.h File Reference
#include "ultibo/gpio.h"
#include "ultibo/i2c.h"
#include "ultibo/console.h"

Go to the source code of this file.

Data Structures

struct  _AF16X2LCD_PLATE

Macros

#define AF16X2LCD_CONSOLE_DESCRIPTION   "Adafruit 16x2 LCD"
 Description of AF16x2LCD device.
#define AF16X2LCD_SIGNATURE   0x000AF162
#define AF16X2LCD_MODEL_MONO   0
 LCD with Monochrome backlight.
#define AF16X2LCD_MODEL_RGB   1
 LCD with RGB backlight.
#define AF16X2LCD_PLATE_RS   GPIO_PIN_15
 GPIO pin for the LCD RS line.
#define AF16X2LCD_PLATE_RW   GPIO_PIN_14
 GPIO pin for the LCD RW line.
#define AF16X2LCD_PLATE_EN   GPIO_PIN_13
 GPIO pin for the LCD EN line.
#define AF16X2LCD_PLATE_D4   GPIO_PIN_12
 GPIO pin for the LCD D4 line.
#define AF16X2LCD_PLATE_D5   GPIO_PIN_11
 GPIO pin for the LCD D5 line.
#define AF16X2LCD_PLATE_D6   GPIO_PIN_10
 GPIO pin for the LCD D6 line.
#define AF16X2LCD_PLATE_D7   GPIO_PIN_9
 GPIO pin for the LCD D7 line.
#define AF16X2LCD_PLATE_RED   GPIO_PIN_6
 GPIO pin for the Backlight Red LED.
#define AF16X2LCD_PLATE_GREEN   GPIO_PIN_7
 GPIO pin for the Backlight Green LED.
#define AF16X2LCD_PLATE_BLUE   GPIO_PIN_8
 GPIO pin for the Backlight Blue LED.
#define AF16X2LCD_BUTTON_SELECT   GPIO_PIN_0
 GPIO pin for the Select button.
#define AF16X2LCD_BUTTON_RIGHT   GPIO_PIN_1
 GPIO pin for the Right button.
#define AF16X2LCD_BUTTON_DOWN   GPIO_PIN_2
 GPIO pin for the Down button.
#define AF16X2LCD_BUTTON_UP   GPIO_PIN_3
 GPIO pin for the Up button.
#define AF16X2LCD_BUTTON_LEFT   GPIO_PIN_4
 GPIO pin for the Left button.

Typedefs

typedef struct _AF16X2LCD_PLATE AF16X2LCD_PLATE

Functions

HANDLE STDCALL af16x2lcd_start (uint32_t model, BOOL invert, char *device, uint16_t address)
 Start the AF16x2LCD driver and register the GPIO and Console devices associated with the display.
BOOL STDCALL af16x2lcd_stop (HANDLE handle)
 Stop the AF16x2LCD driver and deregister the GPIO and Console devices associated with the display.
uint32_t STDCALL af16x2lcd_get_button (HANDLE handle, uint32_t button)
 Get the GPIO level of a button on the AF16x2LCD display.
BOOL STDCALL af16x2lcd_backlight_on (HANDLE handle)
 Turn on the backlight on the AF16x2LCD display.
BOOL STDCALL af16x2lcd_backlight_off (HANDLE handle)
 Turn off the backlight on the AF16x2LCD display.
BOOL STDCALL af16x2lcd_backlight_color (HANDLE handle, uint8_t red, uint8_t green, uint8_t blue)
 Set the backlight color on the AF16x2LCD display.

Macro Definition Documentation

◆ AF16X2LCD_CONSOLE_DESCRIPTION

#define AF16X2LCD_CONSOLE_DESCRIPTION   "Adafruit 16x2 LCD"

Description of AF16x2LCD device.

AF16x2LCD specific constants

◆ AF16X2LCD_SIGNATURE

#define AF16X2LCD_SIGNATURE   0x000AF162

◆ AF16X2LCD_MODEL_MONO

#define AF16X2LCD_MODEL_MONO   0

LCD with Monochrome backlight.

◆ AF16X2LCD_MODEL_RGB

#define AF16X2LCD_MODEL_RGB   1

LCD with RGB backlight.

◆ AF16X2LCD_PLATE_RS

#define AF16X2LCD_PLATE_RS   GPIO_PIN_15

GPIO pin for the LCD RS line.

AF16x2LCD GPIO constants

◆ AF16X2LCD_PLATE_RW

#define AF16X2LCD_PLATE_RW   GPIO_PIN_14

GPIO pin for the LCD RW line.

◆ AF16X2LCD_PLATE_EN

#define AF16X2LCD_PLATE_EN   GPIO_PIN_13

GPIO pin for the LCD EN line.

◆ AF16X2LCD_PLATE_D4

#define AF16X2LCD_PLATE_D4   GPIO_PIN_12

GPIO pin for the LCD D4 line.

◆ AF16X2LCD_PLATE_D5

#define AF16X2LCD_PLATE_D5   GPIO_PIN_11

GPIO pin for the LCD D5 line.

◆ AF16X2LCD_PLATE_D6

#define AF16X2LCD_PLATE_D6   GPIO_PIN_10

GPIO pin for the LCD D6 line.

◆ AF16X2LCD_PLATE_D7

#define AF16X2LCD_PLATE_D7   GPIO_PIN_9

GPIO pin for the LCD D7 line.

◆ AF16X2LCD_PLATE_RED

#define AF16X2LCD_PLATE_RED   GPIO_PIN_6

GPIO pin for the Backlight Red LED.

◆ AF16X2LCD_PLATE_GREEN

#define AF16X2LCD_PLATE_GREEN   GPIO_PIN_7

GPIO pin for the Backlight Green LED.

◆ AF16X2LCD_PLATE_BLUE

#define AF16X2LCD_PLATE_BLUE   GPIO_PIN_8

GPIO pin for the Backlight Blue LED.

◆ AF16X2LCD_BUTTON_SELECT

#define AF16X2LCD_BUTTON_SELECT   GPIO_PIN_0

GPIO pin for the Select button.

◆ AF16X2LCD_BUTTON_RIGHT

#define AF16X2LCD_BUTTON_RIGHT   GPIO_PIN_1

GPIO pin for the Right button.

◆ AF16X2LCD_BUTTON_DOWN

#define AF16X2LCD_BUTTON_DOWN   GPIO_PIN_2

GPIO pin for the Down button.

◆ AF16X2LCD_BUTTON_UP

#define AF16X2LCD_BUTTON_UP   GPIO_PIN_3

GPIO pin for the Up button.

◆ AF16X2LCD_BUTTON_LEFT

#define AF16X2LCD_BUTTON_LEFT   GPIO_PIN_4

GPIO pin for the Left button.

Typedef Documentation

◆ AF16X2LCD_PLATE

AF16x2LCD specific types

Function Documentation

◆ af16x2lcd_start()

HANDLE STDCALL af16x2lcd_start ( uint32_t model,
BOOL invert,
char * device,
uint16_t address )

Start the AF16x2LCD driver and register the GPIO and Console devices associated with the display.

AF16x2LCD Functions

Parameters
ModelThe Adafruit 16x2 LCD Plate model (eg AF16X2LCD_MODEL_RGB)
InvertInvert the signal level for the LCD backlight (If True then GPIO_LEVEL_LOW equals On)
DeviceThe I2C device that the MCP23017 I/O Expander on the LCD Plate is connected to
AddressThe I2C address of the MCP23017 I/O Expander on the LCD Plate
Returns
The handle of the AF16x2LCD on success or INVALID_HANDLE_VALUE on failure
Note
This function will be called during startup if the parameter AF16X2LCD_AUTOSTART is True Can be called multiple times to support more than one 16x2 LCD display

◆ af16x2lcd_stop()

BOOL STDCALL af16x2lcd_stop ( HANDLE handle)

Stop the AF16x2LCD driver and deregister the GPIO and Console devices associated with the display.

Parameters
HandleThe handle of the AF16x2LCD or INVALID_HANDLE_VALUE for the default display
Returns
True if completed or False on failure

◆ af16x2lcd_get_button()

uint32_t STDCALL af16x2lcd_get_button ( HANDLE handle,
uint32_t button )

Get the GPIO level of a button on the AF16x2LCD display.

Parameters
HandleThe handle of the AF16x2LCD or INVALID_HANDLE_VALUE for the default display
ButtonThe button to get the level for (eg AF16X2LCD_BUTTON_LEFT)
Returns
The GPIO level of the button (eg GPIO_LEVEL_HIGH) or GPIO_LEVEL_UNKNOWN on failure

◆ af16x2lcd_backlight_on()

BOOL STDCALL af16x2lcd_backlight_on ( HANDLE handle)

Turn on the backlight on the AF16x2LCD display.

Parameters
HandleThe handle of the AF16x2LCD or INVALID_HANDLE_VALUE for the default display
Returns
True if completed or False on failure

◆ af16x2lcd_backlight_off()

BOOL STDCALL af16x2lcd_backlight_off ( HANDLE handle)

Turn off the backlight on the AF16x2LCD display.

Parameters
HandleThe handle of the AF16x2LCD or INVALID_HANDLE_VALUE for the default display
Returns
True if completed or False on failure

◆ af16x2lcd_backlight_color()

BOOL STDCALL af16x2lcd_backlight_color ( HANDLE handle,
uint8_t red,
uint8_t green,
uint8_t blue )

Set the backlight color on the AF16x2LCD display.

Parameters
HandleThe handle of the AF16x2LCD or INVALID_HANDLE_VALUE for the default display
RedThe Red value (0 for Off / 1 for On)
GreenThe Green value (0 for Off / 1 for On)
BlueThe Blue value (0 for Off / 1 for On)
Returns
True if completed or False on failure