Code Monkey home page Code Monkey logo

esp32-usb-v2's Introduction

Description

This is very early version and still WiP, so API may and probably will change. All implemented devices are provided with simple examples for arduino. Library is compatible with arduino, platformio, esp-idf and there will be also repository with examples for esp-idf.

I want to replace old callbacks build on class callback to use std::function, which also let us to use lambdas. In the future i maybe add C style callbacks too. I wanted to make this library as much flexible as possible, so all tinyusb callbacks are weak and its possible to override any in user code (advanced users only).

Library allows to build USB class devices and to make it usable with minimal effort:

  • CDC, communication device class,
  • MSC, mass storage class,
  • HID, human interface device class: keyboard, mouse, generic IN/OUT, option to combine few reports
  • MIDI, musical instrument digital interface class,
  • DFU, device firmware update class,- its still not ready
  • WebUSB, its using vendor class to show webusb usage.

How to

Library allows to set all values in standard USB device like:

  • manufacturer
  • product name
  • serial number
  • revision
  • VID and PID
ANYusb device;  // any USB class like HID, MSC, CDC
device.mfgStringId(addString(""));
device.productStringId(addString(""));
device.serialStringId(addString(""));
device.setVidPid(vid, pid);
device.setVersion(revisionBCD, usbBCD);

Todo

There is still a lot to do, so any suggestions are welcome.

Documentation

I would like to finish this project with fancy documentation, but this is time consuming and i have full time job and few more projects which i would like to continue, so any help is appreciated

https://tinyusb.esp32.eu.org/

Contributions

Issues and PRs are welcome.

Hardware

To use native USB we need to connect pins 19 and 20 to usb cable or with similar connectors:

esp32-usb-v2's People

Contributors

chegewara avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

esp32-usb-v2's Issues

Have option to make MSC device non-writable

For my use case, I wanted the MSC device to be read-only to this host accessing via USB interface. It would be useful to have some way to enable this.

I'm fairly new to using Arduino, etc. so I'm not sure of best approach (maybe I could enable within my project?), but for now I've implemented via the following hard coded change: ddfeaf1

I've tested the above commit using ESP32-S3, with SD-Card MSC interface, and Linux OS reports device is write protected, and mounts FAT32 filesystem as read-only.

Arduino: no headers files (.h) found

Hi,

I'm trying to prototype with Arduino, but I can't compile the sample sketches because of the error:
no headers files (.h) found. In fact there are no header files.

Here is what I have done:

  1. Repo downloaded,
  2. Copied to Arduino/libraries
  3. New project with example code (cdc)
  4. Result: usb_cdc.hpp: No such file or directory

Edit:
I've added the library.proprties file and it is working now.

Edit2:
I would also like to help with development if I can find the time. Is this the right email from the profile?
We could get in touch. Some initial introduction and explanation would be great.

Any help with this?

Mouse absolute positioning

Is it possible to extend the mouse library to absolute mouse movement using an extended descriptor?
Thanks

Arduino

Hi,

I wanted to try the USB MSC Ramdisk, so in order to make your library work as a Arduino library I created this library.properties file:

name=ESP32 USB V2
version=2.0.0
author= chegewara
maintainer=chegewara
sentence=USB Devices
paragraph=USB Devices
category=Communication
url=https://github.com/chegewara/esp32-usb-v2
architectures=*
includes=src/*.hpp, src/*.h

It works until:
.../Documents/Arduino/libraries/esp32-usb-v2-master/src/private/usb_device.hpp:6:10: fatal error: common/tusb_common.h: No such file or directory
Any guidelines for how to use this with Arduino?

Build fails with Arduinoand esp32s3 on Ubuntu Device

Hello,

Fantastic. I normally program on Windows, and have not had an issue yet with your library.

However, i recently setup CI for a new project/client - using this lib for the HID application and i ran into an issue.

 In file included from .pio/libdeps/esp32s3_fancy_display/esp32-usb-v2/src/usb_keyboard.hpp:3,
                   from lib/FancyDisplay/src/io/usb/local_keyboard.hpp:5,
                   from src/main.cpp:6:
  .pio/libdeps/esp32s3_fancy_display/esp32-usb-v2/src/usb_hid.hpp:86:102: error: 'void tud_hid_report_complete_cb(uint8_t, const uint8_t*, uint8_t)' should have been declared inside '::'
           friend void ::tud_hid_report_complete_cb(uint8_t instance, uint8_t const* report, uint8_t len);
                                                                                                        ^
  *** [.pio/build/esp32s3_fancy_display/src/main.cpp.o] Error 1
  ========================= [FAILED] Took 54.05 seconds =========================

This error only occurs within the github action runner. On my home machine (windows 10) the project builds and runs perfectly fine.

Importing your repository as an Arduino Library

Hello,
I am quite fascinated by your library for mass storage devices based on SDMMC.

The only issue I have is that I have no clue how to make it look like a library for Arduino and try the example.

Thank you so much. You certainly invested too much time to build it that neatly.

Keyboard example error

image
Text form:

In file included from c:\Users\tubey\OneDrive\Documents\Arduino\libraries\esp32-usb-v2-master\src/usb_keyboard.hpp:3,
                 from C:\Users\tubey\AppData\Local\Temp\.arduinoIDE-unsaved202364-14888-k6ptyg.sgj5l\keyboard\keyboard.ino:3:
c:\Users\tubey\OneDrive\Documents\Arduino\libraries\esp32-usb-v2-master\src/usb_hid.hpp:86:102: error: 'void tud_hid_report_complete_cb(uint8_t, const uint8_t*, uint8_t)' should have been declared inside '::'
         friend void ::tud_hid_report_complete_cb(uint8_t instance, uint8_t const* report, uint8_t len);
                                                                                                      ^
exit status 1

Compilation error: exit status 1`

From https://github.com/chegewara/esp32-usb-v2/blob/master/examples/arduino/hid/keyboard/keyboard.ino

Running ESP32-S2 from NodeMCU
Selected board in Arduino: ESP32S2 Dev Module (https://dl.espressif.com/dl/package_esp32_index.json,https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.