|
DGUS LCD Library
1
|
DGUS II LCD Driver. More...


Go to the source code of this file.
Macros | |
| #define | PACKET_OK -1 |
| A "OK" ACK packet was received from dgus_packet_recv() | |
| #define | ACK_MODE_OK_DISABLED 0 |
| Set when the firmware does NOT have ACK (OK packets) enabled. | |
| #define | ACK_MODE_OK_WAIT 1 |
| Wait for OK packets on send. | |
Typedefs | |
| typedef void(* | packet_handler_cb) (char *data, uint8_t cmd, uint8_t len, uint16_t addr, uint8_t bytelen) |
| Packet Parsing handler. When a valid packet is recieved, this callback is invoked. | |
| typedef char(* | ser_recv_handler_cb) (void) |
| recv a single char from the usart | |
| typedef void(* | ser_send_handler_cb) (char *data, size_t len) |
| Send Handler. On platforms such as Arduino, this would likely be SERIALx.write(p, sz) | |
| typedef uint8_t(* | ser_available_handler_cb) (void) |
| Emount of bytes of serial data is available to be read. For devices with abacking buffer such as arduino, this maybe > 1. Most other devices will return byte by byte. | |
| typedef struct dgus_packet | dgus_packet |
| Opaque reference to a packet. | |
Functions | |
| void | dgus_init (ser_available_handler_cb avail, ser_recv_handler_cb recv, ser_send_handler_cb send, packet_handler_cb packet_handler) |
| Initialise the DGUS LCD interface. More... | |
| int | dgus_recv_data () |
| Receive and process data from the serial port. Call this in your main loop. More... | |
| void | buffer_u8 (dgus_packet *p, uint8_t *data, size_t len) |
| Append 1 byte len bytes to the send buffer in 8 bit format. More... | |
| void | buffer_u16 (dgus_packet *p, uint16_t *data, size_t len) |
| Append 2 bytes len bytes to the send buffer in 16 bit format. More... | |
| void | buffer_u32 (dgus_packet *p, uint32_t *data, size_t len) |
| Append 4 bytes len bytes to the send buffer in 2x word format. More... | |
| void | buffer_u32_1 (dgus_packet *p, uint32_t data) |
| Append 4 bytes 1 long of data to the send buffer in 8 bit format. More... | |
| void | dgus_packet_set_data (dgus_packet *p, uint8_t offset, uint8_t *data, uint8_t len) |
| Write 8 bites of data at position n in the buffer. More... | |
| DGUS_RETURN | send_data (enum command cmd, dgus_packet *p) |
| actually send the packet p with write cmd More... | |
| DGUS_RETURN | dgus_request_var (uint16_t addr, uint8_t len) |
| Async request a variable It is up to you to read the response. More... | |
| DGUS_RETURN | dgus_get_var (uint16_t addr, uint16_t *buf, uint8_t len) |
Read len bytes into buf at address addr. More... | |
| DGUS_RETURN | dgus_set_var (uint16_t addr, uint32_t data) |
Set data variable into addr on the DGUS. More... | |
| DGUS_RETURN | dgus_get_var8 (uint16_t addr, uint8_t *buf, uint8_t len) |
Get len 8 bit bytes from the device. no encoding is applied. More... | |
| DGUS_RETURN | dgus_set_var8 (uint16_t addr, uint8_t *data, uint8_t len) |
Set len 8 bit bytes to the device. no encoding is applied. More... | |
| dgus_packet * | dgus_packet_init () |
| Manually initialise the packet sending buffer. More... | |
| void | dgus_packet_set_len (dgus_packet *p, uint16_t len) |
| Override a packets current length. More... | |
| uint8_t * | dgus_packet_get_recv_buffer () |
| Get a pointer the current data recv buffer. More... | |
| uint8_t | _polling_wait () |
| Wait for the OK to return or data to arrive. More... | |
| DGUS_RETURN | _polling_read_16 (uint8_t *buf, uint8_t len) |
| Poll and read a 16 bit return value. More... | |
| DGUS_RETURN | dgus_set_cmd (uint16_t addr, uint8_t *data, uint8_t len) |
| Set data in the cmd area of the configuration. More... | |
| DGUS_RETURN | dgus_get_cmd (uint16_t addr, uint8_t *data, uint8_t len) |
| Get data from the cmd registers. More... | |
DGUS II LCD Driver.
| DGUS_RETURN _polling_read_16 | ( | uint8_t * | buf, |
| uint8_t | len | ||
| ) |
| uint8_t _polling_wait | ( | ) |
Wait for the OK to return or data to arrive.
| void buffer_u16 | ( | dgus_packet * | p, |
| uint16_t * | data, | ||
| size_t | len | ||
| ) |
Append 2 bytes len bytes to the send buffer in 16 bit format.
| p | dgus_packet packet |
| data | data to write |
| len | length of data bytes to write |
| void buffer_u32 | ( | dgus_packet * | p, |
| uint32_t * | data, | ||
| size_t | len | ||
| ) |
Append 4 bytes len bytes to the send buffer in 2x word format.
| p | dgus_packet packet |
| data | data to write |
| len | length of data bytes to write |
| void buffer_u32_1 | ( | dgus_packet * | p, |
| uint32_t | data | ||
| ) |
Append 4 bytes 1 long of data to the send buffer in 8 bit format.
| p | dgus_packet packet |
| data | data to write |
| void buffer_u8 | ( | dgus_packet * | p, |
| uint8_t * | data, | ||
| size_t | len | ||
| ) |
Append 1 byte len bytes to the send buffer in 8 bit format.
| p | dgus_packet packet |
| data | data to write |
| len | length of data bytes to write |
| DGUS_RETURN dgus_get_cmd | ( | uint16_t | addr, |
| uint8_t * | data, | ||
| uint8_t | len | ||
| ) |
| DGUS_RETURN dgus_get_var | ( | uint16_t | addr, |
| uint16_t * | buf, | ||
| uint8_t | len | ||
| ) |
Read len bytes into buf at address addr.
| addr | |
| buf | |
| len |
| DGUS_RETURN dgus_get_var8 | ( | uint16_t | addr, |
| uint8_t * | buf, | ||
| uint8_t | len | ||
| ) |
Get len 8 bit bytes from the device. no encoding is applied.
| addr | |
| buf | |
| len |
| void dgus_init | ( | ser_available_handler_cb | avail, |
| ser_recv_handler_cb | recv, | ||
| ser_send_handler_cb | send, | ||
| packet_handler_cb | packet_handler | ||
| ) |
Initialise the DGUS LCD interface.
Callbacks allow platform independance. On Arduino like platforms, avail would be "SerialPort.available()"
| avail | ser_available_handler_cb callback for the amount of bytes available |
| recv | function that receives bytes from the serial port |
| send | function that sends bytes over the serial port |
| packet_handler | function that should be called when the lcd has sent a packet to be processed |
| uint8_t* dgus_packet_get_recv_buffer | ( | ) |
Get a pointer the current data recv buffer.
| dgus_packet* dgus_packet_init | ( | ) |
Manually initialise the packet sending buffer.
| void dgus_packet_set_data | ( | dgus_packet * | p, |
| uint8_t | offset, | ||
| uint8_t * | data, | ||
| uint8_t | len | ||
| ) |
Write 8 bites of data at position n in the buffer.
| p | dgus_packet packet |
| offset | where in the buffer to write |
| data | data to write |
| len | length of data bytes to write |
| void dgus_packet_set_len | ( | dgus_packet * | p, |
| uint16_t | len | ||
| ) |
Override a packets current length.
| p | |
| len |
| int dgus_recv_data | ( | ) |
Receive and process data from the serial port. Call this in your main loop.
| DGUS_RETURN dgus_request_var | ( | uint16_t | addr, |
| uint8_t | len | ||
| ) |
Async request a variable It is up to you to read the response.
| addr | VAR Addres to read from |
| len | number of bytes to read |
| DGUS_RETURN dgus_set_cmd | ( | uint16_t | addr, |
| uint8_t * | data, | ||
| uint8_t | len | ||
| ) |
Set data in the cmd area of the configuration.
| addr | |
| data | |
| len |
| DGUS_RETURN dgus_set_var | ( | uint16_t | addr, |
| uint32_t | data | ||
| ) |
Set data variable into addr on the DGUS.
| addr | address of the VAR data in word (u16) format |
| data | data to send |
| DGUS_RETURN dgus_set_var8 | ( | uint16_t | addr, |
| uint8_t * | data, | ||
| uint8_t | len | ||
| ) |
Set len 8 bit bytes to the device. no encoding is applied.
| addr | |
| data | |
| len |
| DGUS_RETURN send_data | ( | enum command | cmd, |
| dgus_packet * | p | ||
| ) |
actually send the packet p with write cmd
| cmd | command type such as DGUS_CMD_VAR_W |
| p | packet handle |