Giter VIP home page Giter VIP logo

tinyusb-sys-rs's Introduction

crates.io crates.io

TinyUSB Rust Bindings

TinyUSB is an open-source cross-platform USB Host/Device stack for embedded system, designed to be memory-safe with no dynamic allocation and thread-safe with all interrupt events are deferred then handled in the non-ISR task function.

This crate provides Rust bindings for the library.

Declare the dependency as such, for example to operate as a mass storage device on an MCU from the STM32F1 family:

[dependencies]
tinyusb-sys = { version = "0.1", features = ["device", "msc", "stm32f1"] }

Feature definitions

To use the crate, you must pick some features. You must pick one mode (host or device), at least one USB device class, and an MCU family.

Code examples will come soon.

Mode

  • host
  • device

Host features

  • msc
  • cdc
  • vendor
  • hub
  • hid
  • midi

Device features

  • bth
  • video
  • ecm_rndis
  • dfu
  • midi
  • ncm
  • dfu_runtime
  • hid
  • vendor
  • usbtmc
  • audio
  • msc
  • cdc

MCU Family

  • lpc11uxx NXP LPC11Uxx
  • lpc13xx NXP LPC13xx
  • lpc15xx NXP LPC15xx
  • lpc175x_6x NXP LPC175x, LPC176x
  • lpc177x_8x NXP LPC177x, LPC178x
  • lpc18xx NXP LPC18xx
  • lpc40xx NXP LPC40xx
  • lpc43xx NXP LPC43xx
  • lpc51uxx NXP LPC51U6x
  • lpc54xxx NXP LPC54xxx
  • lpc55xx NXP LPC55xx
  • nrf5x Nordic nRF5x series
  • samd21 MicroChip SAMD21
  • samd51 MicroChip SAMD51
  • samg MicroChip SAMDG series
  • same5x MicroChip SAM E5x
  • samd11 MicroChip SAMD11
  • saml22 MicroChip SAML22
  • saml21 MicroChip SAML21
  • samx7x MicroChip SAME70, S70, V70, V71 family
  • stm32f0 ST F0
  • stm32f1 ST F1
  • stm32f2 ST F2
  • stm32f3 ST F3
  • stm32f4 ST F4
  • stm32f7 ST F7
  • stm32h7 ST H7
  • stm32l1 ST L1
  • stm32l0 ST L0
  • stm32l4 ST L4
  • stm32g0 ST G0
  • stm32g4 ST G4
  • cxd56 SONY CXD56
  • msp430x5xx TI MSP430x5xx
  • msp432e4 TI MSP432E4xx
  • tm4c123 TI Tiva-C 123x
  • tm4c129 TI Tiva-C 129x
  • valentyusb_eptri Fomu eptri config
  • mimxrt10xx NXP iMX RT10xx
  • nuc121
  • nuc126
  • nuc120
  • nuc505
  • esp32s2 Espressif ESP32-S2
  • esp32s3 Espressif ESP32-S3
  • da1469x Dialog Semiconductor DA1469x
  • rp2040 Raspberry Pi RP2040
  • mkl25zxx NXP MKL25Zxx
  • k32l2bxx NXP K32L2Bxx
  • efm32gg Silabs EFM32GG
  • rx63x Renesas RX63N/631
  • rx65x Renesas RX65N/RX651
  • rx72n Renesas RX72N
  • mm32f327x Mind Motion MM32F327
  • gd32vf103 GigaDevice GD32VF103
  • bcm2711 Broadcom BCM2711
  • bcm2835 Broadcom BCM2835
  • bcm2837 Broadcom BCM2837
  • xmc4000 Infineon XMC4000
  • pic32mz MicroChip PIC32MZ family
  • ft90x BridgeTek FT90x
  • ft93x BridgeTek FT93x
  • f1c100s Allwinner F1C100s family

tinyusb-sys-rs's People

Contributors

nviennot avatar super-pizza avatar

Stargazers

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

Watchers

 avatar  avatar  avatar

tinyusb-sys-rs's Issues

How to define SDK directory?

Hi there

I am struggling to build this crate. I am targeting the RP2040, and the build cannot find the pico.h header that would normally be found in the SDK.

Is there any way to define where the SDK is installed?

Examples of using this library

Are there any examples of actually using this library?

In my project where I'm attempting to us this, I'm finding that irq_add_shared_handler() from Pico-SDK is needed for device 'cdc'.

This is a linked list of interrupt handlers. That is a little complex for my microcontroller, I don't need something so dynamic. I wonder how people dealt with this? Do I have to link in the entire Pico-SDK to use this library?

Support for esp32c*

From the docs it seems like esp32 is supported for xtensa only.
If that is correct would be amazing to also support riscv.

picoSDK 1.4.0

There seems to be a change in picoSDK to accommodate CDC devices but the solution does not play nice with Rust.

Any idea how to work with this? I'm a bit of a newb to Rust.

https://forums.raspberrypi.com/viewtopic.php?t=334842

Trying to use:

Cargo.toml: tinyusb-sys = { version = "0.1", features = ["device", "cdc", "rp2040"] }

Build error :

The following warnings were emitted during compilation:

warning: tinyusb/src/class/cdc/cdc_device.c:62:21: error: 'CFG_TUD_CDC_RX_BUFSIZE' undeclared here (not in a function); did you mean 'CFG_TUD_CDC_EP_BUFSIZE'?
warning:    62 |   uint8_t rx_ff_buf[CFG_TUD_CDC_RX_BUFSIZE];
warning:       |                     ^~~~~~~~~~~~~~~~~~~~~~
warning:       |                     CFG_TUD_CDC_EP_BUFSIZE
warning: tinyusb/src/class/cdc/cdc_device.c:63:21: error: 'CFG_TUD_CDC_TX_BUFSIZE' undeclared here (not in a function); did you mean 'CFG_TUD_CDC_EP_BUFSIZE'?
warning:    63 |   uint8_t tx_ff_buf[CFG_TUD_CDC_TX_BUFSIZE];
warning:       |                     ^~~~~~~~~~~~~~~~~~~~~~
warning:       |                     CFG_TUD_CDC_EP_BUFSIZE

error: failed to run custom build command for `tinyusb-sys v0.1.0`

Caused by:
  process didn't exit successfully: `/Users/kevinpeck/Desktop/RepRap-RatRigVCore3/rp2040-project-template/target/debug/build/tinyusb-sys-210bd74e28cbde15/build-script-build` (exit status: 1)
  --- stdout
  OPT_LEVEL = Some("3")
  TARGET = Some("thumbv6m-none-eabi")
  HOST = Some("x86_64-apple-darwin")
  CC_thumbv6m-none-eabi = None
  CC_thumbv6m_none_eabi = None
  TARGET_CC = None
  CC = None
  CROSS_COMPILE = None
  CFLAGS_thumbv6m-none-eabi = None
  CFLAGS_thumbv6m_none_eabi = None
  TARGET_CFLAGS = None
  CFLAGS = None
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some("true")
  CARGO_CFG_TARGET_FEATURE = Some("llvm14-builtins-abi,mclass,thumb-mode,v5te,v6")
  TARGET = Some("thumbv6m-none-eabi")
  OPT_LEVEL = Some("3")
  HOST = Some("x86_64-apple-darwin")
  CC_thumbv6m-none-eabi = None
  CC_thumbv6m_none_eabi = None
  TARGET_CC = None
  CC = None
  CROSS_COMPILE = None
  CFLAGS_thumbv6m-none-eabi = None
  CFLAGS_thumbv6m_none_eabi = None
  TARGET_CFLAGS = None
  CFLAGS = None
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some("true")
  CARGO_CFG_TARGET_FEATURE = Some("llvm14-builtins-abi,mclass,thumb-mode,v5te,v6")
  running: "arm-none-eabi-gcc" "-O3" "-ffunction-sections" "-fdata-sections" "-g" "-fno-omit-frame-pointer" "-mthumb" "-march=armv6s-m" "-I" "tinyusb/src" "-I" "/Users/kevinpeck/Desktop/RepRap-RatRigVCore3/rp2040-project-template/target/thumbv6m-none-eabi/debug/build/tinyusb-sys-b50017a813ab06a7/out" "-Wall" "-Wextra" "-o" "/Users/kevinpeck/Desktop/RepRap-RatRigVCore3/rp2040-project-template/target/thumbv6m-none-eabi/debug/build/tinyusb-sys-b50017a813ab06a7/out/tinyusb/src/class/audio/audio_device.o" "-c" "tinyusb/src/class/audio/audio_device.c"
  exit status: 0
  running: "arm-none-eabi-gcc" "-O3" "-ffunction-sections" "-fdata-sections" "-g" "-fno-omit-frame-pointer" "-mthumb" "-march=armv6s-m" "-I" "tinyusb/src" "-I" "/Users/kevinpeck/Desktop/RepRap-RatRigVCore3/rp2040-project-template/target/thumbv6m-none-eabi/debug/build/tinyusb-sys-b50017a813ab06a7/out" "-Wall" "-Wextra" "-o" "/Users/kevinpeck/Desktop/RepRap-RatRigVCore3/rp2040-project-template/target/thumbv6m-none-eabi/debug/build/tinyusb-sys-b50017a813ab06a7/out/tinyusb/src/class/bth/bth_device.o" "-c" "tinyusb/src/class/bth/bth_device.c"
  exit status: 0
  running: "arm-none-eabi-gcc" "-O3" "-ffunction-sections" "-fdata-sections" "-g" "-fno-omit-frame-pointer" "-mthumb" "-march=armv6s-m" "-I" "tinyusb/src" "-I" "/Users/kevinpeck/Desktop/RepRap-RatRigVCore3/rp2040-project-template/target/thumbv6m-none-eabi/debug/build/tinyusb-sys-b50017a813ab06a7/out" "-Wall" "-Wextra" "-o" "/Users/kevinpeck/Desktop/RepRap-RatRigVCore3/rp2040-project-template/target/thumbv6m-none-eabi/debug/build/tinyusb-sys-b50017a813ab06a7/out/tinyusb/src/class/cdc/cdc_device.o" "-c" "tinyusb/src/class/cdc/cdc_device.c"
  cargo:warning=tinyusb/src/class/cdc/cdc_device.c:62:21: error: 'CFG_TUD_CDC_RX_BUFSIZE' undeclared here (not in a function); did you mean 'CFG_TUD_CDC_EP_BUFSIZE'?
  cargo:warning=   62 |   uint8_t rx_ff_buf[CFG_TUD_CDC_RX_BUFSIZE];
  cargo:warning=      |                     ^~~~~~~~~~~~~~~~~~~~~~
  cargo:warning=      |                     CFG_TUD_CDC_EP_BUFSIZE
  cargo:warning=tinyusb/src/class/cdc/cdc_device.c:63:21: error: 'CFG_TUD_CDC_TX_BUFSIZE' undeclared here (not in a function); did you mean 'CFG_TUD_CDC_EP_BUFSIZE'?
  cargo:warning=   63 |   uint8_t tx_ff_buf[CFG_TUD_CDC_TX_BUFSIZE];
  cargo:warning=      |                     ^~~~~~~~~~~~~~~~~~~~~~
  cargo:warning=      |                     CFG_TUD_CDC_EP_BUFSIZE
  exit status: 1

  --- stderr


  error occurred: Command "arm-none-eabi-gcc" "-O3" "-ffunction-sections" "-fdata-sections" "-g" "-fno-omit-frame-pointer" "-mthumb" "-march=armv6s-m" "-I" "tinyusb/src" "-I" "/Users/kevinpeck/Desktop/RepRap-RatRigVCore3/rp2040-project-template/target/thumbv6m-none-eabi/debug/build/tinyusb-sys-b50017a813ab06a7/out" "-Wall" "-Wextra" "-o" "/Users/kevinpeck/Desktop/RepRap-RatRigVCore3/rp2040-project-template/target/thumbv6m-none-eabi/debug/build/tinyusb-sys-b50017a813ab06a7/out/tinyusb/src/class/cdc/cdc_device.o" "-c" "tinyusb/src/class/cdc/cdc_device.c" with args "arm-none-eabi-gcc" did not execute successfully (status code exit status: 1).

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.