From c0ec94e4c94371d22c334396c5d937d0a682de78 Mon Sep 17 00:00:00 2001 From: Karl Palsson Date: Mon, 26 Sep 2016 22:04:02 +0000 Subject: ubs-serial-rs485: First solidly working version. Needs major refactoring to split out the _actual_ arch dependent pieces. Needs parity and more complete baud rate support. Needs rs485 support. --- tests/usb-serial-rs485/usb_cdcacm.h | 56 +++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 tests/usb-serial-rs485/usb_cdcacm.h (limited to 'tests/usb-serial-rs485/usb_cdcacm.h') diff --git a/tests/usb-serial-rs485/usb_cdcacm.h b/tests/usb-serial-rs485/usb_cdcacm.h new file mode 100644 index 0000000..3228d0a --- /dev/null +++ b/tests/usb-serial-rs485/usb_cdcacm.h @@ -0,0 +1,56 @@ +/* + * This file is part of the libopencm3 project. + * + * Copyright (C) 2014 Karl Palsson + * + * This library is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library. If not, see . + */ +/* + * This is the header file for a usb_cdcacm implmentation, usb_cdcacm.c is the + * platform independent portion, and usb_cdcacm-arch.c should be re-implemented + * for other platforms. + */ + +#ifndef USB_CDCACM_H +#define USB_CDCACM_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + + void usb_cdcacm_init(usbd_device **usb_dev); + void usb_cdcacm_setup_pre_arch(void); + void usb_cdcacm_setup_post_arch(void); + void cdcacm_send_data(uint8_t *buf, uint16_t len); + void cdcacm_line_state_changed_cb(uint8_t linemask); + + /* Call this if you have data to send to the usb host */ + void glue_data_received_cb(uint8_t *buf, uint16_t len); + /* These will be called by usb_cdcacm code */ + void glue_send_data_cb(uint8_t *buf, uint16_t len); + + void glue_set_line_state_cb(uint8_t dtr, uint8_t rts); + int glue_set_line_coding_cb(uint32_t baud, uint8_t databits, + enum usb_cdc_line_coding_bParityType cdc_parity, + enum usb_cdc_line_coding_bCharFormat cdc_stopbits); + +#ifdef __cplusplus +} +#endif + +#endif /* USB_CDCACM_H */ + -- cgit