Kiibohd Controller
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.
Dieses Repo ist archiviert. Du kannst Dateien sehen und es klonen, kannst aber nicht pushen oder Issues/Pull-Requests öffnen.

usb_serial.h 2.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. /* Teensyduino Core Library
  2. * http://www.pjrc.com/teensy/
  3. * Copyright (c) 2013 PJRC.COM, LLC.
  4. * Modifications by Jacob Alexander (2013-2016)
  5. *
  6. * Permission is hereby granted, free of charge, to any person obtaining
  7. * a copy of this software and associated documentation files (the
  8. * "Software"), to deal in the Software without restriction, including
  9. * without limitation the rights to use, copy, modify, merge, publish,
  10. * distribute, sublicense, and/or sell copies of the Software, and to
  11. * permit persons to whom the Software is furnished to do so, subject to
  12. * the following conditions:
  13. *
  14. * 1. The above copyright notice and this permission notice shall be
  15. * included in all copies or substantial portions of the Software.
  16. *
  17. * 2. If the Software is incorporated into a build system that allows
  18. * selection among a list of target devices, then similar target
  19. * devices manufactured by PJRC.COM must be included in the list of
  20. * target devices and selectable in the same manner.
  21. *
  22. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  23. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  24. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  25. * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  26. * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  27. * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  28. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  29. * SOFTWARE.
  30. */
  31. #pragma once
  32. // ----- Includes -----
  33. // Compiler Includes
  34. #include <inttypes.h>
  35. // ----- Defines -----
  36. // Compatibility defines from AVR
  37. #define PROGMEM
  38. #define PGM_P const char *
  39. #define PSTR(str) (str)
  40. #define USB_SERIAL_DTR 0x01
  41. #define USB_SERIAL_RTS 0x02
  42. // ----- Structs -----
  43. // See: Universal Serial Bus Class Definitions for Communication Devices 1.11 Table 50
  44. // dwDTERate - Baud Rate : 4 bytes
  45. // bCharFormat - Stop Bits : 1 byte
  46. // 0: 1 stop bit
  47. // 1: 1.5 stop bits
  48. // 2: 2 stop bits
  49. // bParityType - Parity : 1 byte
  50. // 0: None
  51. // 1: Odd
  52. // 2: Even
  53. // 3: Mark
  54. // 4: Space
  55. // bDataBits - Data Bits : 1 byte
  56. // (5,6,7,8 or 16)
  57. //
  58. // Struct is 7 bytes wide
  59. typedef struct USBCDCLineCoding {
  60. uint32_t dwDTERate; // Baud Rate
  61. uint8_t bCharFormat; // Stop Bits
  62. uint8_t bParityType; // Parity
  63. uint8_t bDataBits; // Data Bits
  64. } USBCDCLineCoding;
  65. // ----- Variables -----
  66. extern volatile USBCDCLineCoding usb_cdc_line_coding;
  67. extern volatile uint8_t usb_cdc_line_rtsdtr;
  68. extern volatile uint8_t usb_cdc_transmit_flush_timer;
  69. extern volatile uint8_t usb_configuration;
  70. // ----- Functions -----
  71. int usb_serial_available();
  72. int usb_serial_getchar();
  73. int usb_serial_peekchar();
  74. int usb_serial_putchar( uint8_t c );
  75. int usb_serial_read( void *buffer, uint32_t size );
  76. int usb_serial_write( const void *buffer, uint32_t size );
  77. void usb_serial_flush_input();
  78. void usb_serial_flush_output();