diff options
Diffstat (limited to 'tinyusb/examples/host')
26 files changed, 0 insertions, 1184 deletions
diff --git a/tinyusb/examples/host/CMakeLists.txt b/tinyusb/examples/host/CMakeLists.txt deleted file mode 100755 index f185ac4f..00000000 --- a/tinyusb/examples/host/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -cmake_minimum_required(VERSION 3.5) - -include(${CMAKE_CURRENT_SOURCE_DIR}/../../hw/bsp/family_support.cmake) - -project(tinyusb_host_examples) -family_initialize_project(tinyusb_host_examples ${CMAKE_CURRENT_LIST_DIR}) - -# family_add_subdirectory will filter what to actually add based on selected FAMILY -family_add_subdirectory(cdc_msc_hid) diff --git a/tinyusb/examples/host/cdc_msc_hid/.only.MCU_LPC175X_6X b/tinyusb/examples/host/cdc_msc_hid/.only.MCU_LPC175X_6X deleted file mode 100755 index e69de29b..00000000 --- a/tinyusb/examples/host/cdc_msc_hid/.only.MCU_LPC175X_6X +++ /dev/null diff --git a/tinyusb/examples/host/cdc_msc_hid/.only.MCU_LPC177X_8X b/tinyusb/examples/host/cdc_msc_hid/.only.MCU_LPC177X_8X deleted file mode 100755 index e69de29b..00000000 --- a/tinyusb/examples/host/cdc_msc_hid/.only.MCU_LPC177X_8X +++ /dev/null diff --git a/tinyusb/examples/host/cdc_msc_hid/.only.MCU_LPC18XX b/tinyusb/examples/host/cdc_msc_hid/.only.MCU_LPC18XX deleted file mode 100755 index e69de29b..00000000 --- a/tinyusb/examples/host/cdc_msc_hid/.only.MCU_LPC18XX +++ /dev/null diff --git a/tinyusb/examples/host/cdc_msc_hid/.only.MCU_LPC40XX b/tinyusb/examples/host/cdc_msc_hid/.only.MCU_LPC40XX deleted file mode 100755 index e69de29b..00000000 --- a/tinyusb/examples/host/cdc_msc_hid/.only.MCU_LPC40XX +++ /dev/null diff --git a/tinyusb/examples/host/cdc_msc_hid/.only.MCU_LPC43XX b/tinyusb/examples/host/cdc_msc_hid/.only.MCU_LPC43XX deleted file mode 100755 index e69de29b..00000000 --- a/tinyusb/examples/host/cdc_msc_hid/.only.MCU_LPC43XX +++ /dev/null diff --git a/tinyusb/examples/host/cdc_msc_hid/.only.MCU_MIMXRT10XX b/tinyusb/examples/host/cdc_msc_hid/.only.MCU_MIMXRT10XX deleted file mode 100755 index e69de29b..00000000 --- a/tinyusb/examples/host/cdc_msc_hid/.only.MCU_MIMXRT10XX +++ /dev/null diff --git a/tinyusb/examples/host/cdc_msc_hid/.only.MCU_RP2040 b/tinyusb/examples/host/cdc_msc_hid/.only.MCU_RP2040 deleted file mode 100755 index e69de29b..00000000 --- a/tinyusb/examples/host/cdc_msc_hid/.only.MCU_RP2040 +++ /dev/null diff --git a/tinyusb/examples/host/cdc_msc_hid/CMakeLists.txt b/tinyusb/examples/host/cdc_msc_hid/CMakeLists.txt deleted file mode 100755 index 0a99bc3a..00000000 --- a/tinyusb/examples/host/cdc_msc_hid/CMakeLists.txt +++ /dev/null @@ -1,29 +0,0 @@ -cmake_minimum_required(VERSION 3.5) - -include(${CMAKE_CURRENT_SOURCE_DIR}/../../../hw/bsp/family_support.cmake) - -# gets PROJECT name for the example (e.g. <BOARD>-<DIR_NAME>) -family_get_project_name(PROJECT ${CMAKE_CURRENT_LIST_DIR}) - -project(${PROJECT}) - -# Checks this example is valid for the family and initializes the project -family_initialize_project(${PROJECT} ${CMAKE_CURRENT_LIST_DIR}) - -add_executable(${PROJECT}) - -# Example source -target_sources(${PROJECT} PUBLIC - ${CMAKE_CURRENT_SOURCE_DIR}/src/hid_app.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/main.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/msc_app.c - ) - -# Example include -target_include_directories(${PROJECT} PUBLIC - ${CMAKE_CURRENT_SOURCE_DIR}/src - ) - -# Configure compilation flags and libraries for the example... see the corresponding function -# in hw/bsp/FAMILY/family.cmake for details. -family_configure_host_example(${PROJECT})
\ No newline at end of file diff --git a/tinyusb/examples/host/cdc_msc_hid/Makefile b/tinyusb/examples/host/cdc_msc_hid/Makefile deleted file mode 100755 index 6a2b4d90..00000000 --- a/tinyusb/examples/host/cdc_msc_hid/Makefile +++ /dev/null @@ -1,27 +0,0 @@ -include ../../../tools/top.mk -include ../../make.mk - -INC += \ - src \ - $(TOP)/hw \ - -# Example source -EXAMPLE_SOURCE += $(wildcard src/*.c) -SRC_C += $(addprefix $(CURRENT_PATH)/, $(EXAMPLE_SOURCE)) - -CFLAGS += -Wno-error=cast-align - -# TinyUSB Host Stack source -SRC_C += \ - src/class/cdc/cdc_host.c \ - src/class/hid/hid_host.c \ - src/class/msc/msc_host.c \ - src/host/hub.c \ - src/host/usbh.c \ - src/host/usbh_control.c \ - src/portable/ehci/ehci.c \ - src/portable/ohci/ohci.c \ - src/portable/nxp/transdimension/hcd_transdimension.c \ - src/portable/nxp/lpc17_40/hcd_lpc17_40.c - -include ../../rules.mk diff --git a/tinyusb/examples/host/cdc_msc_hid/src/hid_app.c b/tinyusb/examples/host/cdc_msc_hid/src/hid_app.c deleted file mode 100755 index 11437c2b..00000000 --- a/tinyusb/examples/host/cdc_msc_hid/src/hid_app.c +++ /dev/null @@ -1,296 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2021, Ha Thach (tinyusb.org) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - */ - -#include "bsp/board.h" -#include "tusb.h" - -//--------------------------------------------------------------------+ -// MACRO TYPEDEF CONSTANT ENUM DECLARATION -//--------------------------------------------------------------------+ - -// If your host terminal support ansi escape code such as TeraTerm -// it can be use to simulate mouse cursor movement within terminal -#define USE_ANSI_ESCAPE 0 - -#define MAX_REPORT 4 - -static uint8_t const keycode2ascii[128][2] = { HID_KEYCODE_TO_ASCII }; - -// Each HID instance can has multiple reports -static struct -{ - uint8_t report_count; - tuh_hid_report_info_t report_info[MAX_REPORT]; -}hid_info[CFG_TUH_HID]; - -static void process_kbd_report(hid_keyboard_report_t const *report); -static void process_mouse_report(hid_mouse_report_t const * report); -static void process_generic_report(uint8_t dev_addr, uint8_t instance, uint8_t const* report, uint16_t len); - -void hid_app_task(void) -{ - // nothing to do -} - -//--------------------------------------------------------------------+ -// TinyUSB Callbacks -//--------------------------------------------------------------------+ - -// Invoked when device with hid interface is mounted -// Report descriptor is also available for use. tuh_hid_parse_report_descriptor() -// can be used to parse common/simple enough descriptor. -// Note: if report descriptor length > CFG_TUH_ENUMERATION_BUFSIZE, it will be skipped -// therefore report_desc = NULL, desc_len = 0 -void tuh_hid_mount_cb(uint8_t dev_addr, uint8_t instance, uint8_t const* desc_report, uint16_t desc_len) -{ - printf("HID device address = %d, instance = %d is mounted\r\n", dev_addr, instance); - - // Interface protocol (hid_interface_protocol_enum_t) - const char* protocol_str[] = { "None", "Keyboard", "Mouse" }; - uint8_t const itf_protocol = tuh_hid_interface_protocol(dev_addr, instance); - - printf("HID Interface Protocol = %s\r\n", protocol_str[itf_protocol]); - - // By default host stack will use activate boot protocol on supported interface. - // Therefore for this simple example, we only need to parse generic report descriptor (with built-in parser) - if ( itf_protocol == HID_ITF_PROTOCOL_NONE ) - { - hid_info[instance].report_count = tuh_hid_parse_report_descriptor(hid_info[instance].report_info, MAX_REPORT, desc_report, desc_len); - printf("HID has %u reports \r\n", hid_info[instance].report_count); - } - - // request to receive report - // tuh_hid_report_received_cb() will be invoked when report is available - if ( !tuh_hid_receive_report(dev_addr, instance) ) - { - printf("Error: cannot request to receive report\r\n"); - } -} - -// Invoked when device with hid interface is un-mounted -void tuh_hid_umount_cb(uint8_t dev_addr, uint8_t instance) -{ - printf("HID device address = %d, instance = %d is unmounted\r\n", dev_addr, instance); -} - -// Invoked when received report from device via interrupt endpoint -void tuh_hid_report_received_cb(uint8_t dev_addr, uint8_t instance, uint8_t const* report, uint16_t len) -{ - uint8_t const itf_protocol = tuh_hid_interface_protocol(dev_addr, instance); - - switch (itf_protocol) - { - case HID_ITF_PROTOCOL_KEYBOARD: - TU_LOG2("HID receive boot keyboard report\r\n"); - process_kbd_report( (hid_keyboard_report_t const*) report ); - break; - - case HID_ITF_PROTOCOL_MOUSE: - TU_LOG2("HID receive boot mouse report\r\n"); - process_mouse_report( (hid_mouse_report_t const*) report ); - break; - - default: - // Generic report requires matching ReportID and contents with previous parsed report info - process_generic_report(dev_addr, instance, report, len); - break; - } - - // continue to request to receive report - if ( !tuh_hid_receive_report(dev_addr, instance) ) - { - printf("Error: cannot request to receive report\r\n"); - } -} - -//--------------------------------------------------------------------+ -// Keyboard -//--------------------------------------------------------------------+ - -// look up new key in previous keys -static inline bool find_key_in_report(hid_keyboard_report_t const *report, uint8_t keycode) -{ - for(uint8_t i=0; i<6; i++) - { - if (report->keycode[i] == keycode) return true; - } - - return false; -} - -static void process_kbd_report(hid_keyboard_report_t const *report) -{ - static hid_keyboard_report_t prev_report = { 0, 0, {0} }; // previous report to check key released - - //------------- example code ignore control (non-printable) key affects -------------// - for(uint8_t i=0; i<6; i++) - { - if ( report->keycode[i] ) - { - if ( find_key_in_report(&prev_report, report->keycode[i]) ) - { - // exist in previous report means the current key is holding - }else - { - // not existed in previous report means the current key is pressed - bool const is_shift = report->modifier & (KEYBOARD_MODIFIER_LEFTSHIFT | KEYBOARD_MODIFIER_RIGHTSHIFT); - uint8_t ch = keycode2ascii[report->keycode[i]][is_shift ? 1 : 0]; - putchar(ch); - if ( ch == '\r' ) putchar('\n'); // added new line for enter key - - fflush(stdout); // flush right away, else nanolib will wait for newline - } - } - // TODO example skips key released - } - - prev_report = *report; -} - -//--------------------------------------------------------------------+ -// Mouse -//--------------------------------------------------------------------+ - -void cursor_movement(int8_t x, int8_t y, int8_t wheel) -{ -#if USE_ANSI_ESCAPE - // Move X using ansi escape - if ( x < 0) - { - printf(ANSI_CURSOR_BACKWARD(%d), (-x)); // move left - }else if ( x > 0) - { - printf(ANSI_CURSOR_FORWARD(%d), x); // move right - } - - // Move Y using ansi escape - if ( y < 0) - { - printf(ANSI_CURSOR_UP(%d), (-y)); // move up - }else if ( y > 0) - { - printf(ANSI_CURSOR_DOWN(%d), y); // move down - } - - // Scroll using ansi escape - if (wheel < 0) - { - printf(ANSI_SCROLL_UP(%d), (-wheel)); // scroll up - }else if (wheel > 0) - { - printf(ANSI_SCROLL_DOWN(%d), wheel); // scroll down - } - - printf("\r\n"); -#else - printf("(%d %d %d)\r\n", x, y, wheel); -#endif -} - -static void process_mouse_report(hid_mouse_report_t const * report) -{ - static hid_mouse_report_t prev_report = { 0 }; - - //------------- button state -------------// - uint8_t button_changed_mask = report->buttons ^ prev_report.buttons; - if ( button_changed_mask & report->buttons) - { - printf(" %c%c%c ", - report->buttons & MOUSE_BUTTON_LEFT ? 'L' : '-', - report->buttons & MOUSE_BUTTON_MIDDLE ? 'M' : '-', - report->buttons & MOUSE_BUTTON_RIGHT ? 'R' : '-'); - } - - //------------- cursor movement -------------// - cursor_movement(report->x, report->y, report->wheel); -} - -//--------------------------------------------------------------------+ -// Generic Report -//--------------------------------------------------------------------+ -static void process_generic_report(uint8_t dev_addr, uint8_t instance, uint8_t const* report, uint16_t len) -{ - (void) dev_addr; - - uint8_t const rpt_count = hid_info[instance].report_count; - tuh_hid_report_info_t* rpt_info_arr = hid_info[instance].report_info; - tuh_hid_report_info_t* rpt_info = NULL; - - if ( rpt_count == 1 && rpt_info_arr[0].report_id == 0) - { - // Simple report without report ID as 1st byte - rpt_info = &rpt_info_arr[0]; - }else - { - // Composite report, 1st byte is report ID, data starts from 2nd byte - uint8_t const rpt_id = report[0]; - - // Find report id in the arrray - for(uint8_t i=0; i<rpt_count; i++) - { - if (rpt_id == rpt_info_arr[i].report_id ) - { - rpt_info = &rpt_info_arr[i]; - break; - } - } - - report++; - len--; - } - - if (!rpt_info) - { - printf("Couldn't find the report info for this report !\r\n"); - return; - } - - // For complete list of Usage Page & Usage checkout src/class/hid/hid.h. For examples: - // - Keyboard : Desktop, Keyboard - // - Mouse : Desktop, Mouse - // - Gamepad : Desktop, Gamepad - // - Consumer Control (Media Key) : Consumer, Consumer Control - // - System Control (Power key) : Desktop, System Control - // - Generic (vendor) : 0xFFxx, xx - if ( rpt_info->usage_page == HID_USAGE_PAGE_DESKTOP ) - { - switch (rpt_info->usage) - { - case HID_USAGE_DESKTOP_KEYBOARD: - TU_LOG1("HID receive keyboard report\r\n"); - // Assume keyboard follow boot report layout - process_kbd_report( (hid_keyboard_report_t const*) report ); - break; - - case HID_USAGE_DESKTOP_MOUSE: - TU_LOG1("HID receive mouse report\r\n"); - // Assume mouse follow boot report layout - process_mouse_report( (hid_mouse_report_t const*) report ); - break; - - default: break; - } - } -} diff --git a/tinyusb/examples/host/cdc_msc_hid/src/main.c b/tinyusb/examples/host/cdc_msc_hid/src/main.c deleted file mode 100755 index a14be05e..00000000 --- a/tinyusb/examples/host/cdc_msc_hid/src/main.c +++ /dev/null @@ -1,128 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2019 Ha Thach (tinyusb.org) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - */ - -#include <stdlib.h> -#include <stdio.h> -#include <string.h> - -#include "bsp/board.h" -#include "tusb.h" - -//--------------------------------------------------------------------+ -// MACRO CONSTANT TYPEDEF PROTYPES -//--------------------------------------------------------------------+ -void led_blinking_task(void); - -extern void cdc_task(void); -extern void hid_app_task(void); - -/*------------- MAIN -------------*/ -int main(void) -{ - board_init(); - - printf("TinyUSB Host CDC MSC HID Example\r\n"); - - tusb_init(); - - while (1) - { - // tinyusb host task - tuh_task(); - led_blinking_task(); - -#if CFG_TUH_CDC - cdc_task(); -#endif - -#if CFG_TUH_HID - hid_app_task(); -#endif - } - - return 0; -} - -//--------------------------------------------------------------------+ -// USB CDC -//--------------------------------------------------------------------+ -#if CFG_TUH_CDC -CFG_TUSB_MEM_SECTION static char serial_in_buffer[64] = { 0 }; - -void tuh_mount_cb(uint8_t dev_addr) -{ - // application set-up - printf("A device with address %d is mounted\r\n", dev_addr); - - tuh_cdc_receive(dev_addr, serial_in_buffer, sizeof(serial_in_buffer), true); // schedule first transfer -} - -void tuh_umount_cb(uint8_t dev_addr) -{ - // application tear-down - printf("A device with address %d is unmounted \r\n", dev_addr); -} - -// invoked ISR context -void tuh_cdc_xfer_isr(uint8_t dev_addr, xfer_result_t event, cdc_pipeid_t pipe_id, uint32_t xferred_bytes) -{ - (void) event; - (void) pipe_id; - (void) xferred_bytes; - - printf(serial_in_buffer); - tu_memclr(serial_in_buffer, sizeof(serial_in_buffer)); - - tuh_cdc_receive(dev_addr, serial_in_buffer, sizeof(serial_in_buffer), true); // waiting for next data -} - -void cdc_task(void) -{ - -} - -#endif - -//--------------------------------------------------------------------+ -// TinyUSB Callbacks -//--------------------------------------------------------------------+ - -//--------------------------------------------------------------------+ -// Blinking Task -//--------------------------------------------------------------------+ -void led_blinking_task(void) -{ - const uint32_t interval_ms = 1000; - static uint32_t start_ms = 0; - - static bool led_state = false; - - // Blink every interval ms - if ( board_millis() - start_ms < interval_ms) return; // not enough time - start_ms += interval_ms; - - board_led_write(led_state); - led_state = 1 - led_state; // toggle -} diff --git a/tinyusb/examples/host/cdc_msc_hid/src/msc_app.c b/tinyusb/examples/host/cdc_msc_hid/src/msc_app.c deleted file mode 100755 index 77a72052..00000000 --- a/tinyusb/examples/host/cdc_msc_hid/src/msc_app.c +++ /dev/null @@ -1,106 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2019 Ha Thach (tinyusb.org) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - */ - -#include "tusb.h" - -#if CFG_TUH_MSC - -//--------------------------------------------------------------------+ -// MACRO TYPEDEF CONSTANT ENUM DECLARATION -//--------------------------------------------------------------------+ -static scsi_inquiry_resp_t inquiry_resp; - -bool inquiry_complete_cb(uint8_t dev_addr, msc_cbw_t const* cbw, msc_csw_t const* csw) -{ - if (csw->status != 0) - { - printf("Inquiry failed\r\n"); - return false; - } - - // Print out Vendor ID, Product ID and Rev - printf("%.8s %.16s rev %.4s\r\n", inquiry_resp.vendor_id, inquiry_resp.product_id, inquiry_resp.product_rev); - - // Get capacity of device - uint32_t const block_count = tuh_msc_get_block_count(dev_addr, cbw->lun); - uint32_t const block_size = tuh_msc_get_block_size(dev_addr, cbw->lun); - - printf("Disk Size: %lu MB\r\n", block_count / ((1024*1024)/block_size)); - printf("Block Count = %lu, Block Size: %lu\r\n", block_count, block_size); - - return true; -} - -//------------- IMPLEMENTATION -------------// -void tuh_msc_mount_cb(uint8_t dev_addr) -{ - printf("A MassStorage device is mounted\r\n"); - - uint8_t const lun = 0; - tuh_msc_inquiry(dev_addr, lun, &inquiry_resp, inquiry_complete_cb); -// -// //------------- file system (only 1 LUN support) -------------// -// uint8_t phy_disk = dev_addr-1; -// disk_initialize(phy_disk); -// -// if ( disk_is_ready(phy_disk) ) -// { -// if ( f_mount(phy_disk, &fatfs[phy_disk]) != FR_OK ) -// { -// puts("mount failed"); -// return; -// } -// -// f_chdrive(phy_disk); // change to newly mounted drive -// f_chdir("/"); // root as current dir -// -// cli_init(); -// } -} - -void tuh_msc_umount_cb(uint8_t dev_addr) -{ - (void) dev_addr; - printf("A MassStorage device is unmounted\r\n"); - -// uint8_t phy_disk = dev_addr-1; -// -// f_mount(phy_disk, NULL); // unmount disk -// disk_deinitialize(phy_disk); -// -// if ( phy_disk == f_get_current_drive() ) -// { // active drive is unplugged --> change to other drive -// for(uint8_t i=0; i<CFG_TUH_DEVICE_MAX; i++) -// { -// if ( disk_is_ready(i) ) -// { -// f_chdrive(i); -// cli_init(); // refractor, rename -// } -// } -// } -} - -#endif diff --git a/tinyusb/examples/host/cdc_msc_hid/src/tusb_config.h b/tinyusb/examples/host/cdc_msc_hid/src/tusb_config.h deleted file mode 100755 index bc6c68e5..00000000 --- a/tinyusb/examples/host/cdc_msc_hid/src/tusb_config.h +++ /dev/null @@ -1,94 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2019 Ha Thach (tinyusb.org) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - */ - -#ifndef _TUSB_CONFIG_H_ -#define _TUSB_CONFIG_H_ - -#ifdef __cplusplus - extern "C" { -#endif - -//-------------------------------------------------------------------- -// COMMON CONFIGURATION -//-------------------------------------------------------------------- - -// defined by compiler flags for flexibility -#ifndef CFG_TUSB_MCU - #error CFG_TUSB_MCU must be defined -#endif - -#if CFG_TUSB_MCU == OPT_MCU_LPC43XX || CFG_TUSB_MCU == OPT_MCU_LPC18XX || CFG_TUSB_MCU == OPT_MCU_MIMXRT10XX - #define CFG_TUSB_RHPORT0_MODE (OPT_MODE_HOST | OPT_MODE_HIGH_SPEED) -#else - #define CFG_TUSB_RHPORT0_MODE OPT_MODE_HOST -#endif - -#ifndef CFG_TUSB_OS -#define CFG_TUSB_OS OPT_OS_NONE -#endif - -// CFG_TUSB_DEBUG is defined by compiler in DEBUG build -// #define CFG_TUSB_DEBUG 0 - -/* USB DMA on some MCUs can only access a specific SRAM region with restriction on alignment. - * Tinyusb use follows macros to declare transferring memory so that they can be put - * into those specific section. - * e.g - * - CFG_TUSB_MEM SECTION : __attribute__ (( section(".usb_ram") )) - * - CFG_TUSB_MEM_ALIGN : __attribute__ ((aligned(4))) - */ -#ifndef CFG_TUSB_MEM_SECTION -#define CFG_TUSB_MEM_SECTION -#endif - -#ifndef CFG_TUSB_MEM_ALIGN -#define CFG_TUSB_MEM_ALIGN __attribute__ ((aligned(4))) -#endif - -//-------------------------------------------------------------------- -// CONFIGURATION -//-------------------------------------------------------------------- - -// Size of buffer to hold descriptors and other data used for enumeration -#define CFG_TUH_ENUMERATION_BUFSIZE 256 - -#define CFG_TUH_HUB 1 -#define CFG_TUH_CDC 1 -#define CFG_TUH_HID 4 // typical keyboard + mouse device can have 3-4 HID interfaces -#define CFG_TUH_MSC 1 -#define CFG_TUH_VENDOR 0 - -// max device support (excluding hub device) -#define CFG_TUH_DEVICE_MAX (CFG_TUH_HUB ? 4 : 1) // hub typically has 4 ports - -//------------- HID -------------// -#define CFG_TUH_HID_EPIN_BUFSIZE 64 -#define CFG_TUH_HID_EPOUT_BUFSIZE 64 - -#ifdef __cplusplus - } -#endif - -#endif /* _TUSB_CONFIG_H_ */ diff --git a/tinyusb/examples/host/hid_controller/.only.MCU_LPC175X_6X b/tinyusb/examples/host/hid_controller/.only.MCU_LPC175X_6X deleted file mode 100755 index e69de29b..00000000 --- a/tinyusb/examples/host/hid_controller/.only.MCU_LPC175X_6X +++ /dev/null diff --git a/tinyusb/examples/host/hid_controller/.only.MCU_LPC177X_8X b/tinyusb/examples/host/hid_controller/.only.MCU_LPC177X_8X deleted file mode 100755 index e69de29b..00000000 --- a/tinyusb/examples/host/hid_controller/.only.MCU_LPC177X_8X +++ /dev/null diff --git a/tinyusb/examples/host/hid_controller/.only.MCU_LPC18XX b/tinyusb/examples/host/hid_controller/.only.MCU_LPC18XX deleted file mode 100755 index e69de29b..00000000 --- a/tinyusb/examples/host/hid_controller/.only.MCU_LPC18XX +++ /dev/null diff --git a/tinyusb/examples/host/hid_controller/.only.MCU_LPC40XX b/tinyusb/examples/host/hid_controller/.only.MCU_LPC40XX deleted file mode 100755 index e69de29b..00000000 --- a/tinyusb/examples/host/hid_controller/.only.MCU_LPC40XX +++ /dev/null diff --git a/tinyusb/examples/host/hid_controller/.only.MCU_LPC43XX b/tinyusb/examples/host/hid_controller/.only.MCU_LPC43XX deleted file mode 100755 index e69de29b..00000000 --- a/tinyusb/examples/host/hid_controller/.only.MCU_LPC43XX +++ /dev/null diff --git a/tinyusb/examples/host/hid_controller/.only.MCU_MIMXRT10XX b/tinyusb/examples/host/hid_controller/.only.MCU_MIMXRT10XX deleted file mode 100755 index e69de29b..00000000 --- a/tinyusb/examples/host/hid_controller/.only.MCU_MIMXRT10XX +++ /dev/null diff --git a/tinyusb/examples/host/hid_controller/.only.MCU_RP2040 b/tinyusb/examples/host/hid_controller/.only.MCU_RP2040 deleted file mode 100755 index e69de29b..00000000 --- a/tinyusb/examples/host/hid_controller/.only.MCU_RP2040 +++ /dev/null diff --git a/tinyusb/examples/host/hid_controller/CMakeLists.txt b/tinyusb/examples/host/hid_controller/CMakeLists.txt deleted file mode 100755 index aaf8bc34..00000000 --- a/tinyusb/examples/host/hid_controller/CMakeLists.txt +++ /dev/null @@ -1,28 +0,0 @@ -cmake_minimum_required(VERSION 3.5) - -include(${CMAKE_CURRENT_SOURCE_DIR}/../../../hw/bsp/family_support.cmake) - -# gets PROJECT name for the example (e.g. <BOARD>-<DIR_NAME>) -family_get_project_name(PROJECT ${CMAKE_CURRENT_LIST_DIR}) - -project(${PROJECT}) - -# Checks this example is valid for the family and initializes the project -family_initialize_project(${PROJECT} ${CMAKE_CURRENT_LIST_DIR}) - -add_executable(${PROJECT}) - -# Example source -target_sources(${PROJECT} PUBLIC - ${CMAKE_CURRENT_SOURCE_DIR}/src/hid_app.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/main.c - ) - -# Example include -target_include_directories(${PROJECT} PUBLIC - ${CMAKE_CURRENT_SOURCE_DIR}/src - ) - -# Configure compilation flags and libraries for the example... see the corresponding function -# in hw/bsp/FAMILY/family.cmake for details. -family_configure_host_example(${PROJECT})
\ No newline at end of file diff --git a/tinyusb/examples/host/hid_controller/Makefile b/tinyusb/examples/host/hid_controller/Makefile deleted file mode 100755 index 6f59faee..00000000 --- a/tinyusb/examples/host/hid_controller/Makefile +++ /dev/null @@ -1,30 +0,0 @@ -include ../../../tools/top.mk -include ../../make.mk - -INC += \ - src \ - $(TOP)/hw \ - -# Example source -EXAMPLE_SOURCE += \ - src/hid_app.c \ - src/main.c - -SRC_C += $(addprefix $(CURRENT_PATH)/, $(EXAMPLE_SOURCE)) - -CFLAGS += -Wno-error=cast-align - -# TinyUSB Host Stack source -SRC_C += \ - src/class/cdc/cdc_host.c \ - src/class/hid/hid_host.c \ - src/class/msc/msc_host.c \ - src/host/hub.c \ - src/host/usbh.c \ - src/host/usbh_control.c \ - src/portable/ehci/ehci.c \ - src/portable/ohci/ohci.c \ - src/portable/nxp/transdimension/hcd_transdimension.c \ - src/portable/nxp/lpc17_40/hcd_lpc17_40.c - -include ../../rules.mk diff --git a/tinyusb/examples/host/hid_controller/src/hid_app.c b/tinyusb/examples/host/hid_controller/src/hid_app.c deleted file mode 100755 index c61ce70f..00000000 --- a/tinyusb/examples/host/hid_controller/src/hid_app.c +++ /dev/null @@ -1,249 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2021, Ha Thach (tinyusb.org) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - */ - -#include "bsp/board.h" -#include "tusb.h" - -/* From https://www.kernel.org/doc/html/latest/input/gamepad.html - ____________________________ __ - / [__ZL__] [__ZR__] \ | - / [__ TL __] [__ TR __] \ | Front Triggers - __/________________________________\__ __| - / _ \ | - / /\ __ (N) \ | - / || __ |MO| __ _ _ \ | Main Pad - | <===DP===> |SE| |ST| (W) -|- (E) | | - \ || ___ ___ _ / | - /\ \/ / \ / \ (S) /\ __| - / \________ | LS | ____ | RS | ________/ \ | -| / \ \___/ / \ \___/ / \ | | Control Sticks -| / \_____/ \_____/ \ | __| -| / \ | - \_____/ \_____/ - - |________|______| |______|___________| - D-Pad Left Right Action Pad - Stick Stick - - |_____________| - Menu Pad - - Most gamepads have the following features: - - Action-Pad 4 buttons in diamonds-shape (on the right side) NORTH, SOUTH, WEST and EAST. - - D-Pad (Direction-pad) 4 buttons (on the left side) that point up, down, left and right. - - Menu-Pad Different constellations, but most-times 2 buttons: SELECT - START. - - Analog-Sticks provide freely moveable sticks to control directions, Analog-sticks may also - provide a digital button if you press them. - - Triggers are located on the upper-side of the pad in vertical direction. The upper buttons - are normally named Left- and Right-Triggers, the lower buttons Z-Left and Z-Right. - - Rumble Many devices provide force-feedback features. But are mostly just simple rumble motors. - */ - -// Sony DS4 report layout detail https://www.psdevwiki.com/ps4/DS4-USB -typedef struct TU_ATTR_PACKED -{ - uint8_t x, y, z, rz; // joystick - - struct { - uint8_t dpad : 4; // (hat format, 0x08 is released, 0=N, 1=NE, 2=E, 3=SE, 4=S, 5=SW, 6=W, 7=NW) - uint8_t square : 1; // west - uint8_t cross : 1; // south - uint8_t circle : 1; // east - uint8_t triangle : 1; // north - }; - - struct { - uint8_t l1 : 1; - uint8_t r1 : 1; - uint8_t l2 : 1; - uint8_t r2 : 1; - uint8_t share : 1; - uint8_t option : 1; - uint8_t l3 : 1; - uint8_t r3 : 1; - }; - - struct { - uint8_t ps : 1; // playstation button - uint8_t tpad : 1; // track pad click - uint8_t counter : 6; // +1 each report - }; - - // comment out since not used by this example - // uint8_t l2_trigger; // 0 released, 0xff fully pressed - // uint8_t r2_trigger; // as above - - // uint16_t timestamp; - // uint8_t battery; - // - // int16_t gyro[3]; // x, y, z; - // int16_t accel[3]; // x, y, z - - // there is still lots more info - -} sony_ds4_report_t; - -// check if device is Sony DualShock 4 -static inline bool is_sony_ds4(uint8_t dev_addr) -{ - uint16_t vid, pid; - tuh_vid_pid_get(dev_addr, &vid, &pid); - - return (vid == 0x054c && pid == 0x09cc); -} - -//--------------------------------------------------------------------+ -// MACRO TYPEDEF CONSTANT ENUM DECLARATION -//--------------------------------------------------------------------+ - -void hid_app_task(void) -{ - // nothing to do -} - -//--------------------------------------------------------------------+ -// TinyUSB Callbacks -//--------------------------------------------------------------------+ - -// Invoked when device with hid interface is mounted -// Report descriptor is also available for use. tuh_hid_parse_report_descriptor() -// can be used to parse common/simple enough descriptor. -// Note: if report descriptor length > CFG_TUH_ENUMERATION_BUFSIZE, it will be skipped -// therefore report_desc = NULL, desc_len = 0 -void tuh_hid_mount_cb(uint8_t dev_addr, uint8_t instance, uint8_t const* desc_report, uint16_t desc_len) -{ - uint16_t vid, pid; - tuh_vid_pid_get(dev_addr, &vid, &pid); - - printf("HID device address = %d, instance = %d is mounted\r\n", dev_addr, instance); - printf("VID = %04x, PID = %04x\r\n", vid, pid); - - // Sony DualShock 4 [CUH-ZCT2x] - if ( is_sony_ds4(dev_addr) ) - { - // request to receive report - // tuh_hid_report_received_cb() will be invoked when report is available - if ( !tuh_hid_receive_report(dev_addr, instance) ) - { - printf("Error: cannot request to receive report\r\n"); - } - } -} - -// Invoked when device with hid interface is un-mounted -void tuh_hid_umount_cb(uint8_t dev_addr, uint8_t instance) -{ - printf("HID device address = %d, instance = %d is unmounted\r\n", dev_addr, instance); - -} - -// check if different than 2 -bool diff_than_2(uint8_t x, uint8_t y) -{ - return (x - y > 2) || (y - x > 2); -} - -// check if 2 reports are different enough -bool diff_report(sony_ds4_report_t const* rpt1, sony_ds4_report_t const* rpt2) -{ - bool result; - - // x, y, z, rz must different than 2 to be counted - result = diff_than_2(rpt1->x, rpt2->x) || diff_than_2(rpt1->y , rpt2->y ) || - diff_than_2(rpt1->z, rpt2->z) || diff_than_2(rpt1->rz, rpt2->rz); - - // check the reset with mem compare - result |= memcmp(&rpt1->rz + 1, &rpt2->rz + 1, sizeof(sony_ds4_report_t)-4); - - return result; -} - -void process_sony_ds4(uint8_t const* report, uint16_t len) -{ - const char* dpad_str[] = { "N", "NE", "E", "SE", "S", "SW", "W", "NW", "none" }; - - // previous report used to compare for changes - static sony_ds4_report_t prev_report = { 0 }; - - uint8_t const report_id = report[0]; - report++; - len--; - - // all buttons state is stored in ID 1 - if (report_id == 1) - { - sony_ds4_report_t ds4_report; - memcpy(&ds4_report, report, sizeof(ds4_report)); - - // counter is +1, assign to make it easier to compare 2 report - prev_report.counter = ds4_report.counter; - - // only print if changes since it is polled ~ 5ms - // Since count+1 after each report and x, y, z, rz fluctuate within 1 or 2 - // We need more than memcmp to check if report is different enough - if ( diff_report(&prev_report, &ds4_report) ) - { - printf("(x, y, z, rz) = (%u, %u, %u, %u)\r\n", ds4_report.x, ds4_report.y, ds4_report.z, ds4_report.rz); - printf("DPad = %s ", dpad_str[ds4_report.dpad]); - - if (ds4_report.square ) printf("Square "); - if (ds4_report.cross ) printf("Cross "); - if (ds4_report.circle ) printf("Circle "); - if (ds4_report.triangle ) printf("Triangle "); - - if (ds4_report.l1 ) printf("L1 "); - if (ds4_report.r1 ) printf("R1 "); - if (ds4_report.l2 ) printf("L2 "); - if (ds4_report.r2 ) printf("R2 "); - - if (ds4_report.share ) printf("Share "); - if (ds4_report.option ) printf("Option "); - if (ds4_report.l3 ) printf("L3 "); - if (ds4_report.r3 ) printf("R3 "); - - if (ds4_report.ps ) printf("PS "); - if (ds4_report.tpad ) printf("TPad "); - - printf("\r\n"); - } - - prev_report = ds4_report; - } -} - -// Invoked when received report from device via interrupt endpoint -void tuh_hid_report_received_cb(uint8_t dev_addr, uint8_t instance, uint8_t const* report, uint16_t len) -{ - if ( is_sony_ds4(dev_addr) ) - { - process_sony_ds4(report, len); - } - - // continue to request to receive report - if ( !tuh_hid_receive_report(dev_addr, instance) ) - { - printf("Error: cannot request to receive report\r\n"); - } -} diff --git a/tinyusb/examples/host/hid_controller/src/main.c b/tinyusb/examples/host/hid_controller/src/main.c deleted file mode 100755 index e13fa818..00000000 --- a/tinyusb/examples/host/hid_controller/src/main.c +++ /dev/null @@ -1,93 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2019 Ha Thach (tinyusb.org) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - */ - -/* This example current worked and tested with following controller - * - Sony DualShock 4 [CUH-ZCT2x] VID = 0x054c, PID = 0x09cc - */ - - -#include <stdlib.h> -#include <stdio.h> -#include <string.h> - -#include "bsp/board.h" -#include "tusb.h" - -//--------------------------------------------------------------------+ -// MACRO CONSTANT TYPEDEF PROTYPES -//--------------------------------------------------------------------+ -void led_blinking_task(void); - -extern void cdc_task(void); -extern void hid_app_task(void); - -/*------------- MAIN -------------*/ -int main(void) -{ - board_init(); - - printf("TinyUSB Host HID Controller Example\r\n"); - - tusb_init(); - - while (1) - { - // tinyusb host task - tuh_task(); - led_blinking_task(); - -#if CFG_TUH_CDC - cdc_task(); -#endif - -#if CFG_TUH_HID - hid_app_task(); -#endif - } - - return 0; -} - -//--------------------------------------------------------------------+ -// TinyUSB Callbacks -//--------------------------------------------------------------------+ - -//--------------------------------------------------------------------+ -// Blinking Task -//--------------------------------------------------------------------+ -void led_blinking_task(void) -{ - const uint32_t interval_ms = 1000; - static uint32_t start_ms = 0; - - static bool led_state = false; - - // Blink every interval ms - if ( board_millis() - start_ms < interval_ms) return; // not enough time - start_ms += interval_ms; - - board_led_write(led_state); - led_state = 1 - led_state; // toggle -} diff --git a/tinyusb/examples/host/hid_controller/src/tusb_config.h b/tinyusb/examples/host/hid_controller/src/tusb_config.h deleted file mode 100755 index 74b471ae..00000000 --- a/tinyusb/examples/host/hid_controller/src/tusb_config.h +++ /dev/null @@ -1,95 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2019 Ha Thach (tinyusb.org) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - */ - -#ifndef _TUSB_CONFIG_H_ -#define _TUSB_CONFIG_H_ - -#ifdef __cplusplus - extern "C" { -#endif - -//-------------------------------------------------------------------- -// COMMON CONFIGURATION -//-------------------------------------------------------------------- - -// defined by compiler flags for flexibility -#ifndef CFG_TUSB_MCU - #error CFG_TUSB_MCU must be defined -#endif - -#if CFG_TUSB_MCU == OPT_MCU_LPC43XX || CFG_TUSB_MCU == OPT_MCU_LPC18XX || CFG_TUSB_MCU == OPT_MCU_MIMXRT10XX - #define CFG_TUSB_RHPORT0_MODE (OPT_MODE_HOST | OPT_MODE_HIGH_SPEED) -#else - #define CFG_TUSB_RHPORT0_MODE OPT_MODE_HOST -#endif - -#ifndef CFG_TUSB_OS -#define CFG_TUSB_OS OPT_OS_NONE -#endif - -// CFG_TUSB_DEBUG is defined by compiler in DEBUG build -// #define CFG_TUSB_DEBUG 0 - -/* USB DMA on some MCUs can only access a specific SRAM region with restriction on alignment. - * Tinyusb use follows macros to declare transferring memory so that they can be put - * into those specific section. - * e.g - * - CFG_TUSB_MEM SECTION : __attribute__ (( section(".usb_ram") )) - * - CFG_TUSB_MEM_ALIGN : __attribute__ ((aligned(4))) - */ -#ifndef CFG_TUSB_MEM_SECTION -#define CFG_TUSB_MEM_SECTION -#endif - -#ifndef CFG_TUSB_MEM_ALIGN -#define CFG_TUSB_MEM_ALIGN __attribute__ ((aligned(4))) -#endif - -//-------------------------------------------------------------------- -// CONFIGURATION -//-------------------------------------------------------------------- - -// Size of buffer to hold descriptors and other data used for enumeration -#define CFG_TUH_ENUMERATION_BUFSIZE 256 - -#define CFG_TUH_HUB 0 -#define CFG_TUH_CDC 0 -#define CFG_TUH_HID 4 // typical keyboard + mouse device can have 3-4 HID interfaces -#define CFG_TUH_MSC 0 -#define CFG_TUH_VENDOR 0 - -// max device support (excluding hub device) -// 1 hub typically has 4 ports -#define CFG_TUH_DEVICE_MAX (CFG_TUH_HUB ? 4 : 1) - -//------------- HID -------------// - -#define CFG_TUH_HID_EP_BUFSIZE 64 - -#ifdef __cplusplus - } -#endif - -#endif /* _TUSB_CONFIG_H_ */ |