-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update update docs, add examples update docs up update build flags to fit esp-idf add msc-fat example move esp-idf examples to separate repo Temporary remove guards to compile with arduino and esp-idf, add sd card for sdspi and sd_mmc with example Add sd card class with example, sd class is working with both interfaces (spi and mmc) Initial hid code Initial hid code fixed something Fix examples Some fixes Some fixes Refactor MSC Refactor MSC Refactor MSC Add keyboard Fix examples Fix examples Some fixes Some fixes Refactor MSC Refactor MSC Refactor MSC Add keyboard Fix examples Create README.md Add keyboard
- Loading branch information
Showing
68 changed files
with
2,714 additions
and
568 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
*/documentation/** | ||
|
||
*/__pycache__/** | ||
|
||
library.json | ||
|
||
**/build/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "examples/esp-idf/hello-world-msc-fat/components/esp32-usb-v2"] | ||
path = examples/esp-idf/hello-world-msc-fat/components/esp32-usb-v2 | ||
url = https://github.com/chegewara/esp32-usb-v2.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# 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: | ||
- [x] CDC, communication device class, | ||
- [x] MSC, mass storage class, | ||
- [x] 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 | ||
- [x] 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: | ||
 | ||
 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
# This is Doxygen configuration file | ||
# | ||
# Doxygen provides over 260 configuration statements | ||
# To make this file easier to follow, | ||
# it contains only statements that are non-default | ||
# | ||
# NOTE: | ||
# It is recommended not to change defaults unless specifically required | ||
# Test any changes how they affect generated documentation | ||
# Make sure that correct warnings are generated to flag issues with documented code | ||
# | ||
# For the complete list of configuration statements see: | ||
# http://doxygen.nl/manual/config.html | ||
|
||
|
||
PROJECT_NAME = "Esp-docs simple example" | ||
|
||
## The 'INPUT' statement below is used as input by script 'gen-df-input.py' | ||
## to automatically generate API reference list files header_file.inc | ||
## These files are placed in '_inc' directory | ||
## and used to include in API reference documentation | ||
|
||
INPUT = \ | ||
$(PROJECT_PATH)/src/private/descriptor.hpp \ | ||
$(PROJECT_PATH)/src/private/endpoint.hpp \ | ||
$(PROJECT_PATH)/src/private/interface.hpp \ | ||
$(PROJECT_PATH)/src/private/usb_device.hpp \ | ||
$(PROJECT_PATH)/src/flashdisk.hpp \ | ||
$(PROJECT_PATH)/src/ramdisk.hpp \ | ||
$(PROJECT_PATH)/src/sdcard.hpp \ | ||
$(PROJECT_PATH)/src/usb_cdc.hpp \ | ||
$(PROJECT_PATH)/src/usb_dfu.hpp \ | ||
$(PROJECT_PATH)/src/usb_hid.hpp \ | ||
$(PROJECT_PATH)/src/usb_mouse.hpp \ | ||
$(PROJECT_PATH)/src/usb_msc.hpp \ | ||
$(PROJECT_PATH)/src/usb_webusb.hpp \ | ||
|
||
|
||
## Get warnings for functions that have no documentation for their parameters or return value | ||
## | ||
WARN_NO_PARAMDOC = YES | ||
|
||
## Enable preprocessing and remove __attribute__(...) expressions from the INPUT files | ||
## | ||
ENABLE_PREPROCESSING = NO | ||
MACRO_EXPANSION = YES | ||
EXPAND_ONLY_PREDEF = YES | ||
PREDEFINED = \ | ||
$(ENV_DOXYGEN_DEFINES) | ||
|
||
## Do not complain about not having dot | ||
## | ||
HAVE_DOT = NO | ||
|
||
## Generate XML that is required for Breathe | ||
## | ||
GENERATE_XML = YES | ||
XML_OUTPUT = xml | ||
|
||
GENERATE_HTML = NO | ||
HAVE_DOT = NO | ||
GENERATE_LATEX = NO | ||
GENERATE_MAN = YES | ||
GENERATE_RTF = NO | ||
|
||
## Skip distracting progress messages | ||
## | ||
QUIET = YES |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/bash | ||
set -u | ||
|
||
build-docs -t esp32s3 -l en -pp .. -b documentation | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
from esp_docs.conf_docs import * # noqa: F403,F401 | ||
|
||
extensions += ['sphinx_copybutton', | ||
'sphinxcontrib.wavedrom', | ||
'esp_docs.esp_extensions.dummy_build_system', | ||
'esp_docs.esp_extensions.run_doxygen', | ||
] | ||
# link roles config | ||
github_repo = 'chegewara/esp32-usb-v2' | ||
|
||
# # context used by sphinx_idf_theme | ||
html_context['github_user'] = 'chegewara' | ||
html_context['github_repo'] = 'esp32-usb-v2' | ||
|
||
html_static_path = ['../_static'] | ||
|
||
# # Extra options required by sphinx_idf_theme | ||
# project_slug = 'caplamp' | ||
# project_slug = 'esp-idf' | ||
# versions_url = './_static/doc_versions.js' | ||
|
||
idf_targets = ['esp32s2', 'esp32s3'] | ||
languages = ['en'] | ||
linkcheck_anchors = False | ||
todo_include_todos = True | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# -*- coding: utf-8 -*- | ||
# | ||
# English Language RTD & Sphinx config file | ||
# | ||
# Uses ../conf_common.py for most non-language-specific settings. | ||
|
||
# Importing conf_common adds all the non-language-specific | ||
# parts to this conf module | ||
|
||
try: | ||
from conf_common import * # noqa: F403,F401 | ||
except ImportError: | ||
import os | ||
import sys | ||
sys.path.insert(0, os.path.abspath('../')) | ||
from conf_common import * # noqa: F403,F401 | ||
|
||
# General information about the project. | ||
project = u'Esp32tinyusb' | ||
copyright = u'2020-2022, chegewara' | ||
|
||
# The language for content autogenerated by Sphinx. Refer to documentation | ||
# for a list of supported languages. | ||
language = 'en' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
USB CDC | ||
======= | ||
|
||
|
||
:example:`/arduino/cdc/` | ||
|
||
.. include-build-file:: inc/usb_cdc.inc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
USB DFU | ||
======= | ||
|
||
|
||
|
||
:example:`/arduino/dfu/` | ||
|
||
.. include-build-file:: inc/usb_dfu.inc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
USB flashdisk | ||
============= | ||
|
||
|
||
:example:`/arduino/msc/flashdisk` | ||
|
||
.. include-build-file:: inc/flashdisk.inc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
USB HID | ||
======= | ||
|
||
|
||
Examples | ||
^^^^^^^^ | ||
|
||
:example:`keyboard </arduino/hid/keyboard>` | ||
|
||
:example:`mouse </arduino/hid/mouse>` | ||
|
||
:example:`composite </arduino/hid/composite>` | ||
|
||
:example:`keyboard + mouse </arduino/hid/dual>` | ||
|
||
|
||
.. include-build-file:: inc/usb_hid.inc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
USB classes | ||
=========== | ||
|
||
|
||
|
||
.. toctree:: | ||
:maxdepth: 1 | ||
|
||
CDC <cdc> | ||
DFU <dfu> | ||
MSC <msc> | ||
HID <hid> | ||
WebUSB <webusb> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
USB MSC | ||
======= | ||
|
||
|
||
|
||
|
||
.. toctree:: | ||
:maxdepth: 1 | ||
|
||
Flashdisk <flashdisk> | ||
Ramdisk <ramdisk> | ||
Sd card <sdcard> | ||
|
||
.. include-build-file:: inc/usb_msc.inc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
USB ramdisk | ||
=========== | ||
|
||
|
||
:example:`/arduino/msc/ramdisk` | ||
|
||
.. include-build-file:: inc/ramdisk.inc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
USB sd card disk | ||
================ | ||
|
||
|
||
:example:`/arduino/msc/sdcard` | ||
|
||
.. include-build-file:: inc/sdcard.inc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
USB WebUSB | ||
========== | ||
|
||
|
||
:example:`/arduino/web` | ||
|
||
.. include-build-file:: inc/usb_webusb.inc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
USB device | ||
========== | ||
|
||
|
||
|
||
.. toctree:: | ||
:maxdepth: 1 | ||
|
||
Devices <classes/index> | ||
|
||
.. toctree:: | ||
:hidden: | ||
|
||
.. include-build-file:: inc/descriptor.inc | ||
.. include-build-file:: inc/endpoint.inc | ||
.. include-build-file:: inc/interface.inc | ||
.. include-build-file:: inc/usb_device.inc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
USB host | ||
======== | ||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
USB library | ||
================== | ||
This is project i decided to start some time ago to learn USB peripheral on esp32-S2. First library is working, but its not the best, so i decided to rewrite it completely to make it compatible with arduino and esp-idf this time. | ||
|
||
Although it is new library it is still reusing part of old code and has similar API, so it should be fairly easy to migrate code to new library for users. Both libraries, old and new one, should work with S2 and S3, but old library wont be supported when this one is finished. | ||
|
||
|
||
|
||
.. toctree:: | ||
:hidden: | ||
|
||
USB device <device/index> | ||
USB host <host/index> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/bash | ||
|
||
FOLDER='./documentation/en/esp32s3/html' | ||
|
||
ftp_site=192.168.0.5 | ||
username=$1 | ||
passwd=$2 | ||
remote=/usb-lib | ||
cd ${FOLDER} | ||
pwd | ||
|
||
ncftp -u $username -p $passwd ftp://$ftp_site <<EOF | ||
cd $remote | ||
mput -r * | ||
close | ||
quit | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#include "Arduino.h" | ||
#include "usb_cdc.hpp" | ||
|
||
using namespace esptinyusb; | ||
|
||
USBcdc cdc; | ||
|
||
void setup() | ||
{ | ||
Serial.begin(115200); | ||
|
||
if (!cdc.begin()) | ||
printf("failed to begin cdc\n"); | ||
|
||
cdc.onData([](){ | ||
printf("new data\n"); | ||
}); | ||
|
||
} | ||
|
||
void loop() | ||
{ | ||
while(Serial.available()) | ||
{ // If anything comes in Serial (USB), | ||
cdc.write(Serial.read()); | ||
} | ||
|
||
while(cdc.available()) | ||
{ // If anything comes in Serial1 (pins 0 & 1) | ||
Serial.write(cdc.read()); // read it and send it out Serial (USB) | ||
} | ||
|
||
delay(10); | ||
} |
Empty file.
Oops, something went wrong.