Device driver for AIP31068.
More...
Device driver for AIP31068.
- Author
- Hendrik van Essen hendr.nosp@m.ik.v.nosp@m.e@fu-.nosp@m.berl.nosp@m.in.de
|
enum | aip31068_custom_symbol_t {
CUSTOM_SYMBOL_1 = 0
, CUSTOM_SYMBOL_2 = 1
, CUSTOM_SYMBOL_3 = 2
, CUSTOM_SYMBOL_4 = 3
,
CUSTOM_SYMBOL_5 = 4
, CUSTOM_SYMBOL_6 = 5
, CUSTOM_SYMBOL_7 = 6
, CUSTOM_SYMBOL_8 = 7
} |
| Keys for custom symbols. More...
|
|
enum | aip31068_text_insertion_mode_t { LEFT_TO_RIGHT
, RIGHT_TO_LEFT
} |
| Defines the direction of the text insertion. More...
|
|
enum | aip31068_font_size_t { FONT_SIZE_5x8
, FONT_SIZE_5x10
} |
| Size of a character of the display in dots/pixels. More...
|
|
enum | aip31068_bit_mode_t { BITMODE_4_BIT
, BITMODE_8_BIT
} |
| Bit mode for the display. More...
|
|
|
int | aip31068_init (aip31068_t *dev, const aip31068_params_t *params) |
| Initialization.
|
|
int | aip31068_turn_on (aip31068_t *dev) |
| Turn on the display.
|
|
int | aip31068_turn_off (aip31068_t *dev) |
| Turn off the display.
|
|
int | aip31068_clear (aip31068_t *dev) |
| Clear the display and set the cursor to position (0, 0).
|
|
int | aip31068_return_home (aip31068_t *dev) |
| Reset cursor position to (0, 0) and scroll display to original position.
|
|
int | aip31068_set_auto_scroll_enabled (aip31068_t *dev, bool enabled) |
| Enable or disable automated scrolling.
|
|
int | aip31068_set_cursor_blinking_enabled (aip31068_t *dev, bool enabled) |
| Enable or disable cursor blinking.
|
|
int | aip31068_set_cursor_visible (aip31068_t *dev, bool visible) |
| Show or hide the cursor.
|
|
int | aip31068_set_cursor_position (aip31068_t *dev, uint8_t row, uint8_t col) |
| Move the cursor to a given position.
|
|
int | aip31068_set_text_insertion_mode (aip31068_t *dev, aip31068_text_insertion_mode_t mode) |
| Set the direction from which the text is inserted, starting from the cursor.
|
|
int | aip31068_move_cursor_left (aip31068_t *dev) |
| Move the cursor one unit to the left.
|
|
int | aip31068_move_cursor_right (aip31068_t *dev) |
| Move the cursor one unit to the right.
|
|
int | aip31068_scroll_display_left (aip31068_t *dev) |
| Scroll the entire display content (all lines) one unit to the left.
|
|
int | aip31068_scroll_display_right (aip31068_t *dev) |
| Scroll the entire display content (all lines) one unit to the right.
|
|
int | aip31068_set_custom_symbol (aip31068_t *dev, aip31068_custom_symbol_t customSymbol, const uint8_t charmap[]) |
| Create a custom symbol.
|
|
int | aip31068_print_custom_symbol (aip31068_t *dev, aip31068_custom_symbol_t customSymbol) |
| Print a custom symbol by key reference.
|
|
int | aip31068_print (aip31068_t *dev, const char *data) |
| Print a string.
|
|
int | aip31068_print_char (aip31068_t *dev, char c) |
| Print a single character.
|
|
◆ aip31068_bit_mode_t
Bit mode for the display.
Enumerator |
---|
BITMODE_4_BIT | Use 4 bit mode.
|
BITMODE_8_BIT | Use 8 bit mode.
|
Definition at line 69 of file aip31068.h.
◆ aip31068_custom_symbol_t
Keys for custom symbols.
Enumerator |
---|
CUSTOM_SYMBOL_1 | 1st custom symbol
|
CUSTOM_SYMBOL_2 | 2nd custom symbol
|
CUSTOM_SYMBOL_3 | 3rd custom symbol
|
CUSTOM_SYMBOL_4 | 4th custom symbol
|
CUSTOM_SYMBOL_5 | 5th custom symbol
|
CUSTOM_SYMBOL_6 | 6th custom symbol
|
CUSTOM_SYMBOL_7 | 7th custom symbol
|
CUSTOM_SYMBOL_8 | 8th custom symbol
|
Definition at line 36 of file aip31068.h.
◆ aip31068_font_size_t
Size of a character of the display in dots/pixels.
Enumerator |
---|
FONT_SIZE_5x8 | Single character has 5x8 pixels.
|
FONT_SIZE_5x10 | Single character has 5x10 pixels.
|
Definition at line 61 of file aip31068.h.
◆ aip31068_text_insertion_mode_t
Defines the direction of the text insertion.
Starting from the cursor, either increment the column of the cursor position after insertion (LEFT_TO_RIGHT), or decrement the current column of the cursor position after insertion (RIGHT_TO_LEFT).
Enumerator |
---|
LEFT_TO_RIGHT | Insert text from left to right.
|
RIGHT_TO_LEFT | Insert text from right to left.
|
Definition at line 53 of file aip31068.h.
◆ aip31068_clear()
Clear the display and set the cursor to position (0, 0).
- Note
- : Also changes to setTextInsertionMode(LEFT_TO_RIGHT)
- Parameters
-
[in] | dev | Device descriptor of the AIP31068 |
- Return values
-
0 | on success |
-1 | if acquiring of I2C bus fails |
-EIO | When slave device doesn't ACK the byte |
-ENXIO | When no devices respond on the address sent on the bus |
-ETIMEDOUT | When timeout occurs before device's response |
-EINVAL | When an invalid argument is given |
-EOPNOTSUPP | When MCU driver doesn't support the flag operation |
-EAGAIN | When a lost bus arbitration occurs |
◆ aip31068_init()
Initialization.
- Parameters
-
[in] | dev | Device descriptor of the AIP31068 |
[in] | params | Parameters for device initialization |
- Return values
-
0 | on success |
-1 | if acquiring of I2C bus fails |
-EIO | When slave device doesn't ACK the byte |
-ENXIO | When no devices respond on the address sent on the bus |
-ETIMEDOUT | When timeout occurs before device's response |
-EINVAL | When an invalid argument is given |
-EOPNOTSUPP | When MCU driver doesn't support the flag operation |
-EAGAIN | When a lost bus arbitration occurs |
◆ aip31068_move_cursor_left()
Move the cursor one unit to the left.
When the cursor passes the 40th character of the first line and a second line is available, the cursor will move to the second line.
- Parameters
-
[in] | dev | Device descriptor of the AIP31068 |
- Return values
-
0 | on success |
-1 | if acquiring of I2C bus fails |
-EIO | When slave device doesn't ACK the byte |
-ENXIO | When no devices respond on the address sent on the bus |
-ETIMEDOUT | When timeout occurs before device's response |
-EINVAL | When an invalid argument is given |
-EOPNOTSUPP | When MCU driver doesn't support the flag operation |
-EAGAIN | When a lost bus arbitration occurs |
◆ aip31068_move_cursor_right()
int aip31068_move_cursor_right |
( |
aip31068_t * |
dev | ) |
|
Move the cursor one unit to the right.
When the cursor passes the 40th character of the first line and a second line is available, the cursor will move to the second line.
- Note
- : The cursor respects the setting for the insertion mode and is set to (1, 0) for LEFT_TO_RIGHT and to (1, COL_MAX) for RIGHT_TO_LEFT.
- Parameters
-
[in] | dev | Device descriptor of the AIP31068 |
- Return values
-
0 | on success |
-1 | if acquiring of I2C bus fails |
-EIO | When slave device doesn't ACK the byte |
-ENXIO | When no devices respond on the address sent on the bus |
-ETIMEDOUT | When timeout occurs before device's response |
-EINVAL | When an invalid argument is given |
-EOPNOTSUPP | When MCU driver doesn't support the flag operation |
-EAGAIN | When a lost bus arbitration occurs |
◆ aip31068_print()
int aip31068_print |
( |
aip31068_t * |
dev, |
|
|
const char * |
data |
|
) |
| |
Print a string.
- Parameters
-
[in] | dev | Device descriptor of the AIP31068 |
[in] | data | String to be printed (null-terminated) |
- Return values
-
0 | on success |
-1 | if acquiring of I2C bus fails |
-EIO | When slave device doesn't ACK the byte |
-ENXIO | When no devices respond on the address sent on the bus |
-ETIMEDOUT | When timeout occurs before device's response |
-EINVAL | When an invalid argument is given |
-EOPNOTSUPP | When MCU driver doesn't support the flag operation |
-EAGAIN | When a lost bus arbitration occurs |
◆ aip31068_print_char()
int aip31068_print_char |
( |
aip31068_t * |
dev, |
|
|
char |
c |
|
) |
| |
Print a single character.
- Parameters
-
[in] | dev | Device descriptor of the AIP31068 |
[in] | c | Character to be printed |
- Return values
-
0 | on success |
-1 | if acquiring of I2C bus fails |
-EIO | When slave device doesn't ACK the byte |
-ENXIO | When no devices respond on the address sent on the bus |
-ETIMEDOUT | When timeout occurs before device's response |
-EINVAL | When an invalid argument is given |
-EOPNOTSUPP | When MCU driver doesn't support the flag operation |
-EAGAIN | When a lost bus arbitration occurs |
◆ aip31068_print_custom_symbol()
Print a custom symbol by key reference.
- Parameters
-
[in] | dev | Device descriptor of the AIP31068 |
[in] | customSymbol | Key of the custom symbol to be printed |
- Return values
-
0 | on success |
-1 | if acquiring of I2C bus fails |
-EIO | When slave device doesn't ACK the byte |
-ENXIO | When no devices respond on the address sent on the bus |
-ETIMEDOUT | When timeout occurs before device's response |
-EINVAL | When an invalid argument is given |
-EOPNOTSUPP | When MCU driver doesn't support the flag operation |
-EAGAIN | When a lost bus arbitration occurs |
◆ aip31068_return_home()
Reset cursor position to (0, 0) and scroll display to original position.
- Parameters
-
[in] | dev | Device descriptor of the AIP31068 |
- Return values
-
0 | on success |
-1 | if acquiring of I2C bus fails |
-EIO | When slave device doesn't ACK the byte |
-ENXIO | When no devices respond on the address sent on the bus |
-ETIMEDOUT | When timeout occurs before device's response |
-EINVAL | When an invalid argument is given |
-EOPNOTSUPP | When MCU driver doesn't support the flag operation |
-EAGAIN | When a lost bus arbitration occurs |
◆ aip31068_scroll_display_left()
int aip31068_scroll_display_left |
( |
aip31068_t * |
dev | ) |
|
Scroll the entire display content (all lines) one unit to the left.
- Note
- : The cursor respects the setting for the insertion mode and is set to (1, 0) for LEFT_TO_RIGHT and to (1, COL_MAX) for RIGHT_TO_LEFT.
- Parameters
-
[in] | dev | Device descriptor of the AIP31068 |
- Return values
-
0 | on success |
-1 | if acquiring of I2C bus fails |
-EIO | When slave device doesn't ACK the byte |
-ENXIO | When no devices respond on the address sent on the bus |
-ETIMEDOUT | When timeout occurs before device's response |
-EINVAL | When an invalid argument is given |
-EOPNOTSUPP | When MCU driver doesn't support the flag operation |
-EAGAIN | When a lost bus arbitration occurs |
◆ aip31068_scroll_display_right()
int aip31068_scroll_display_right |
( |
aip31068_t * |
dev | ) |
|
Scroll the entire display content (all lines) one unit to the right.
- Parameters
-
[in] | dev | Device descriptor of the AIP31068 |
- Return values
-
0 | on success |
-1 | if acquiring of I2C bus fails |
-EIO | When slave device doesn't ACK the byte |
-ENXIO | When no devices respond on the address sent on the bus |
-ETIMEDOUT | When timeout occurs before device's response |
-EINVAL | When an invalid argument is given |
-EOPNOTSUPP | When MCU driver doesn't support the flag operation |
-EAGAIN | When a lost bus arbitration occurs |
◆ aip31068_set_auto_scroll_enabled()
int aip31068_set_auto_scroll_enabled |
( |
aip31068_t * |
dev, |
|
|
bool |
enabled |
|
) |
| |
Enable or disable automated scrolling.
- Parameters
-
[in] | dev | Device descriptor of the AIP31068 |
[in] | enabled | Enable or disable |
- Return values
-
0 | on success |
-1 | if acquiring of I2C bus fails |
-EIO | When slave device doesn't ACK the byte |
-ENXIO | When no devices respond on the address sent on the bus |
-ETIMEDOUT | When timeout occurs before device's response |
-EINVAL | When an invalid argument is given |
-EOPNOTSUPP | When MCU driver doesn't support the flag operation |
-EAGAIN | When a lost bus arbitration occurs |
◆ aip31068_set_cursor_blinking_enabled()
int aip31068_set_cursor_blinking_enabled |
( |
aip31068_t * |
dev, |
|
|
bool |
enabled |
|
) |
| |
Enable or disable cursor blinking.
- Parameters
-
[in] | dev | Device descriptor of the AIP31068 |
[in] | enabled | Enable or disable |
- Return values
-
0 | on success |
-1 | if acquiring of I2C bus fails |
-EIO | When slave device doesn't ACK the byte |
-ENXIO | When no devices respond on the address sent on the bus |
-ETIMEDOUT | When timeout occurs before device's response |
-EINVAL | When an invalid argument is given |
-EOPNOTSUPP | When MCU driver doesn't support the flag operation |
-EAGAIN | When a lost bus arbitration occurs |
◆ aip31068_set_cursor_position()
int aip31068_set_cursor_position |
( |
aip31068_t * |
dev, |
|
|
uint8_t |
row, |
|
|
uint8_t |
col |
|
) |
| |
Move the cursor to a given position.
- Parameters
-
[in] | dev | Device descriptor of the AIP31068 |
[in] | row | Row of the new cursor position (starting at 0) |
[in] | col | Column of the new cursor position (starting at 0) |
- Return values
-
0 | on success |
-1 | if acquiring of I2C bus fails |
-EIO | When slave device doesn't ACK the byte |
-ENXIO | When no devices respond on the address sent on the bus |
-ETIMEDOUT | When timeout occurs before device's response |
-EINVAL | When an invalid argument is given |
-EOPNOTSUPP | When MCU driver doesn't support the flag operation |
-EAGAIN | When a lost bus arbitration occurs |
◆ aip31068_set_cursor_visible()
int aip31068_set_cursor_visible |
( |
aip31068_t * |
dev, |
|
|
bool |
visible |
|
) |
| |
Show or hide the cursor.
- Parameters
-
[in] | dev | Device descriptor of the AIP31068 |
[in] | visible | Show or hide |
- Return values
-
0 | on success |
-1 | if acquiring of I2C bus fails |
-EIO | When slave device doesn't ACK the byte |
-ENXIO | When no devices respond on the address sent on the bus |
-ETIMEDOUT | When timeout occurs before device's response |
-EINVAL | When an invalid argument is given |
-EOPNOTSUPP | When MCU driver doesn't support the flag operation |
-EAGAIN | When a lost bus arbitration occurs |
◆ aip31068_set_custom_symbol()
Create a custom symbol.
Useful link: https://maxpromer.github.io/LCD-Character-Creator/
- Parameters
-
[in] | dev | Device descriptor of the AIP31068 |
[in] | customSymbol | Key to which a custom symbol should be assigned |
[in] | charmap | Bitmap definition of the custom symbol |
- Note
- : The size of charmap depends on how the AIP31068 was initialized. 8 bytes for FONT_SIZE_5x8 and 10 bytes for FONT_SIZE_5x10.
This function resets the cursor position. Therefore this function should be called before printing any characters to the display.
- Return values
-
0 | on success |
-1 | if acquiring of I2C bus fails |
-EIO | When slave device doesn't ACK the byte |
-ENXIO | When no devices respond on the address sent on the bus |
-ETIMEDOUT | When timeout occurs before device's response |
-EINVAL | When an invalid argument is given |
-EOPNOTSUPP | When MCU driver doesn't support the flag operation |
-EAGAIN | When a lost bus arbitration occurs |
◆ aip31068_set_text_insertion_mode()
Set the direction from which the text is inserted, starting from the cursor.
- Parameters
-
[in] | dev | Device descriptor of the AIP31068 |
[in] | mode | Insertion mode |
- Return values
-
0 | on success |
-1 | if acquiring of I2C bus fails |
-EIO | When slave device doesn't ACK the byte |
-ENXIO | When no devices respond on the address sent on the bus |
-ETIMEDOUT | When timeout occurs before device's response |
-EINVAL | When an invalid argument is given |
-EOPNOTSUPP | When MCU driver doesn't support the flag operation |
-EAGAIN | When a lost bus arbitration occurs |
◆ aip31068_turn_off()
Turn off the display.
- Parameters
-
[in] | dev | Device descriptor of the AIP31068 |
- Return values
-
0 | on success |
-1 | if acquiring of I2C bus fails |
-EIO | When slave device doesn't ACK the byte |
-ENXIO | When no devices respond on the address sent on the bus |
-ETIMEDOUT | When timeout occurs before device's response |
-EINVAL | When an invalid argument is given |
-EOPNOTSUPP | When MCU driver doesn't support the flag operation |
-EAGAIN | When a lost bus arbitration occurs |
◆ aip31068_turn_on()
Turn on the display.
- Parameters
-
[in] | dev | Device descriptor of the AIP31068 |
- Return values
-
0 | on success |
-1 | if acquiring of I2C bus fails |
-EIO | When slave device doesn't ACK the byte |
-ENXIO | When no devices respond on the address sent on the bus |
-ETIMEDOUT | When timeout occurs before device's response |
-EINVAL | When an invalid argument is given |
-EOPNOTSUPP | When MCU driver doesn't support the flag operation |
-EAGAIN | When a lost bus arbitration occurs |