I have been fighting for awhile to get only a keyboard device using a teensy LC but selecting the usb type keyboard still creates a composite device that includes serial, keyboard and multimedia keyboard.
I've been able to get keyboard only by editing usb_desc.h and yield.cpp, but I was wondering if this could be added as a feature you could select from the menu.
I.e. the build actually doing what it says it is doing by ONLY making a keyboard, not a multi device like it currently does.
Example usb_desc.h
And sample yield.cpp
I've been able to get keyboard only by editing usb_desc.h and yield.cpp, but I was wondering if this could be added as a feature you could select from the menu.
I.e. the build actually doing what it says it is doing by ONLY making a keyboard, not a multi device like it currently does.
Example usb_desc.h
Code:
#elif defined(USB_KEYBOARDONLY)
#define VENDOR_ID 0x16C0
#define PRODUCT_ID 0x04D0
#define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
#define MANUFACTURER_NAME_LEN 11
#define PRODUCT_NAME {'K','e','y','b','o','a','r','d'}
#define PRODUCT_NAME_LEN 8
#define EP0_SIZE 64
#define NUM_ENDPOINTS 1
#define NUM_USB_BUFFERS 14
#define NUM_INTERFACE 1
//#define SEREMU_INTERFACE 1 // Serial emulation
//#define SEREMU_TX_ENDPOINT 1
//#define SEREMU_TX_SIZE 64
//#define SEREMU_TX_INTERVAL 1
//#define SEREMU_RX_ENDPOINT 2
//#define SEREMU_RX_SIZE 32
//#define SEREMU_RX_INTERVAL 2
#define KEYBOARD_INTERFACE 0 // Keyboard
#define KEYBOARD_ENDPOINT 1
#define KEYBOARD_SIZE 8
#define KEYBOARD_INTERVAL 1
//#define KEYMEDIA_INTERFACE 2 // Keyboard Media Keys
//#define KEYMEDIA_ENDPOINT 4
//#define KEYMEDIA_SIZE 8
//#define KEYMEDIA_INTERVAL 4
#define ENDPOINT1_CONFIG ENDPOINT_TRANSMIT_ONLY
//#define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_ONLY
//#define ENDPOINT3_CONFIG ENDPOINT_TRANSMIT_ONLY
//#define ENDPOINT4_CONFIG ENDPOINT_TRANSMIT_ONLY
//#define ENDPOINT5_CONFIG ENDPOINT_TRANSMIT_ONLY
//#define ENDPOINT6_CONFIG ENDPOINT_TRANSMIT_ONLY
And sample yield.cpp
Code:
#include <Arduino.h>
#include "EventResponder.h"
void yield(void) __attribute__ ((weak));
void yield(void)
{
static uint8_t running=0;
if (running) return; // TODO: does this need to be atomic?
running = 1;
//if (Serial.available()) serialEvent();
if (Serial1.available()) serialEvent1();
if (Serial2.available()) serialEvent2();
if (Serial3.available()) serialEvent3();
#ifdef HAS_KINETISK_UART3
if (Serial4.available()) serialEvent4();
#endif
#ifdef HAS_KINETISK_UART4
if (Serial5.available()) serialEvent5();
#endif
#if defined(HAS_KINETISK_UART5) || defined (HAS_KINETISK_LPUART0)
if (Serial6.available()) serialEvent6();
#endif
running = 0;
EventResponder::runFromYield();
};