qp_comms.h (1078B)
1 // Copyright 2021 Nick Brassel (@tzarc) 2 // SPDX-License-Identifier: GPL-2.0-or-later 3 4 #pragma once 5 6 #include <stdbool.h> 7 #include <stdlib.h> 8 9 #include "qp_internal.h" 10 11 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 12 // Base comms APIs 13 14 bool qp_comms_init(painter_device_t device); 15 bool qp_comms_start(painter_device_t device); 16 void qp_comms_stop(painter_device_t device); 17 uint32_t qp_comms_send(painter_device_t device, const void* data, uint32_t byte_count); 18 19 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 20 // Comms APIs that use a D/C pin 21 22 bool qp_comms_command(painter_device_t device, uint8_t cmd); 23 bool qp_comms_command_databyte(painter_device_t device, uint8_t cmd, uint8_t data); 24 uint32_t qp_comms_command_databuf(painter_device_t device, uint8_t cmd, const void* data, uint32_t byte_count); 25 bool qp_comms_bulk_command_sequence(painter_device_t device, const uint8_t* sequence, size_t sequence_len);