GithubHelp home page GithubHelp logo

esp-thumb-n-joy's Introduction

esp-thumb-n-joy ๐Ÿฆ€

WORK IN PROGRESS Example for joystick initialisation and work with it

Important : We updated the builder for Wokwi and example is now available on multiple chips directly from your browser (without gitpod)! Visit the Corresponding Wokwi project links under the screenshots below and try it!

Description

Here you can find a simple bare-metal example for newcomers that shows, how to initialise and work with joystick on different Espressif boards:

Important : below in this branch you can find pin connection for REAL hardware, not for Wokwi. Pin connection for every chip for Wokwi can be found in corresponding branches

Some screenshots

ESP32 with ILI9341 display and joystick

crispy-click-esp32


ESP32-S2 with ILI9341 display and two buttons

crispy-click-esp32s2


ESP32-C3 with ILI9341 display and two buttons

crispy-click-esp32c3


Important : If you want to set your own pins for buttons or change the number of buttons, you should customize it in these lines of code

Build and flash

Build for ESP32-S3-USB-OTG

cargo espflash --release --monitor --target xtensa-esp32s3-none-elf 

Build for ESP32

cargo espflash --release --monitor --target xtensa-esp32-none-elf 

Build for ESP32-S2

cargo espflash --release --monitor --target xtensa-esp32s2-none-elf 

Build for ESP32-C3

cargo espflash --release --monitor --target riscv32imac-unknown-none-elf

Dev Containers

This repository offers Dev Containers supports for:

Note

In order to use Gitpod the project needs to be published in a GitLab, GitHub, or Bitbucket repository.

In order to use GitHub Codespaces the project needs to be published in a GitHub repository and the user needs to be part of the Codespaces beta or have the project under an organization.

If using VS Code or GitHub Codespaces, you can pull the image instead of building it from the Dockerfile by selecting the image property instead of build in .devcontainer/devcontainer.json. Further customization of the Dev Container can be achived, see .devcontainer.json reference.

When using Dev Containers, some tooling to facilitate building, flashing and simulating in Wokwi is also added.

Build

  • Terminal approach:

    scripts/build.sh  [debug | release]
    

    If no argument is passed, release will be used as default

  • UI approach:

    The default build task is already set to build the project, and it can be used in VS Code and Gitpod:

    • From the Command Palette (Ctrl-Shift-P or Cmd-Shift-P) run the Tasks: Run Build Task command.
    • Terminal-> Run Build Task in the menu.
    • With Ctrl-Shift-B or Cmd-Shift-B.
    • From the Command Palette (Ctrl-Shift-P or Cmd-Shift-P) run the Tasks: Run Task command and select Build.
    • From UI: Press Build on the left side of the Status Bar.

Flash

Note

When using GitHub Codespaces, we need to make the ports public, see instructions.

  • Terminal approach:

    • Using flash.sh script:

      scripts/flash.sh [debug | release]
      

      If no argument is passed, release will be used as default

  • UI approach:

    • From the Command Palette (Ctrl-Shift-P or Cmd-Shift-P) run the Tasks: Run Task command and select Build & Flash.
    • From UI: Press Build & Flash on the left side of the Status Bar.
  • Any alternative flashing method from host machine.

Wokwi Simulation

When using a custom Wokwi project, please change the WOKWI_PROJECT_ID in run-wokwi.sh. If no project id is specified, a DevKit for esp32c3 will be used.

Warning

ESP32-S3 is not available in Wokwi

  • Terminal approach:

    scripts/run-wokwi.sh [debug | release]
    

    If no argument is passed, release will be used as default

  • UI approach:

    The default test task is already set to build the project, and it can be used in VS Code and Gitpod:

    • From the Command Palette (Ctrl-Shift-P or Cmd-Shift-P) run the Tasks: Run Test Task command
    • With Ctrl-Shift-, or Cmd-Shift-,

      Note

      This Shortcut is not available in Gitpod by default.

    • From the Command Palette (Ctrl-Shift-P or Cmd-Shift-P) run the Tasks: Run Task command and select Build & Run Wokwi.
    • From UI: Press Build & Run Wokwi on the left side of the Status Bar.

Warning

The simulation will pause if the browser tab is in the background.This may affect the execution, specially when debuging.

Debuging with Wokwi

Wokwi offers debugging with GDB.

  • Terminal approach:

    $HOME/.espressif/tools/riscv32-esp-elf/esp-2021r2-patch3-8.4.0/riscv32-esp-elf/bin/riscv32-esp-elf-gdb target/riscv32imc-esp-espidf/debug/esp_clock -ex "target remote localhost:9333"
    

    Wokwi Blog: List of common GDB commands for debugging.

  • UI approach:

    1. Run the Wokwi Simulation in debug profile
    2. Go to Run and Debug section of the IDE (Ctrl-Shift-D or Cmd-Shift-D)
    3. Start Debugging by pressing the Play Button or pressing F5
    4. Choose the proper user:
      • esp when using VS Code or GitHub Codespaces
      • gitpod when using Gitpod

esp-thumb-n-joy's People

Contributors

playfulfence avatar

Stargazers

 avatar

Watchers

 avatar

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.