Compare commits

...

No commits in common. "master" and "gh-pages" have entirely different histories.

131 changed files with 2980 additions and 360742 deletions

View file

@ -1,46 +0,0 @@
Thank you for opening an issue on an Adafruit Arduino library repository. To
improve the speed of resolution please review the following guidelines and
common troubleshooting steps below before creating the issue:
- **Do not use GitHub issues for troubleshooting projects and issues.** Instead use
the forums at http://forums.adafruit.com to ask questions and troubleshoot why
something isn't working as expected. In many cases the problem is a common issue
that you will more quickly receive help from the forum community. GitHub issues
are meant for known defects in the code. If you don't know if there is a defect
in the code then start with troubleshooting on the forum first.
- **If following a tutorial or guide be sure you didn't miss a step.** Carefully
check all of the steps and commands to run have been followed. Consult the
forum if you're unsure or have questions about steps in a guide/tutorial.
- **For Arduino projects check these very common issues to ensure they don't apply**:
- For uploading sketches or communicating with the board make sure you're using
a **USB data cable** and **not** a **USB charge-only cable**. It is sometimes
very hard to tell the difference between a data and charge cable! Try using the
cable with other devices or swapping to another cable to confirm it is not
the problem.
- **Be sure you are supplying adequate power to the board.** Check the specs of
your board and plug in an external power supply. In many cases just
plugging a board into your computer is not enough to power it and other
peripherals.
- **Double check all soldering joints and connections.** Flakey connections
cause many mysterious problems. See the [guide to excellent soldering](https://learn.adafruit.com/adafruit-guide-excellent-soldering/tools) for examples of good solder joints.
- **Ensure you are using an official Arduino or Adafruit board.** We can't
guarantee a clone board will have the same functionality and work as expected
with this code and don't support them.
If you're sure this issue is a defect in the code and checked the steps above
please fill in the following fields to provide enough troubleshooting information.
You may delete the guideline and text above to just leave the following details:
- Arduino board: **INSERT ARDUINO BOARD NAME/TYPE HERE**
- Arduino IDE version (found in Arduino -> About Arduino menu): **INSERT ARDUINO
VERSION HERE**
- List the steps to reproduce the problem below (if possible attach a sketch or
copy the sketch code in too): **LIST REPRO STEPS BELOW**

View file

@ -1,26 +0,0 @@
Thank you for creating a pull request to contribute to Adafruit's GitHub code!
Before you open the request please review the following guidelines and tips to
help it be more easily integrated:
- **Describe the scope of your change--i.e. what the change does and what parts
of the code were modified.** This will help us understand any risks of integrating
the code.
- **Describe any known limitations with your change.** For example if the change
doesn't apply to a supported platform of the library please mention it.
- **Please run any tests or examples that can exercise your modified code.** We
strive to not break users of the code and running tests/examples helps with this
process.
Thank you again for contributing! We will try to test and integrate the change
as soon as we can, but be aware we have many GitHub repositories to manage and
can't immediately respond to every request. There is no need to bump or check in
on a pull request (it will clutter the discussion of the request).
Also don't be worried if the request is closed or not integrated--sometimes the
priorities of Adafruit's GitHub code (education, ease of use) might not match the
priorities of the pull request. Don't fret, the open source community thrives on
forks and GitHub makes it easy to keep your changes in a forked repo.
After reviewing the guidelines above you can delete this text from the pull request.

View file

@ -1,44 +0,0 @@
name: Arduino Library CI
on: [pull_request, push, repository_dispatch]
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
arduino-platform:
- 'main_platforms'
# for rp2040 brain
- 'pico_rp2040_tinyusb'
steps:
- uses: actions/setup-python@v4
with:
python-version: '3.x'
- uses: actions/checkout@v3
- name: Run pre-commit
uses: pre-commit/action@v3.0.0
- uses: actions/checkout@v3
with:
repository: adafruit/ci-arduino
path: ci
- name: pre-install
run: bash ci/actions_install.sh
- name: clang
run: python3 ci/run-clang-format.py -e "ci/*" -e "bin/*" -r .
- name: test platforms
run: python3 ci/build_platform.py ${{ matrix.arduino-platform }}
- name: doxygen
env:
GH_REPO_TOKEN: ${{ secrets.GH_REPO_TOKEN }}
PRETTYNAME : "Adafruit MSA301 Sensor Library"
run: bash ci/doxy_gen_and_deploy.sh

2
.gitignore vendored
View file

@ -1,2 +0,0 @@
.idea
.pio

1
.nojekyll Normal file
View file

@ -0,0 +1 @@

View file

@ -1,25 +0,0 @@
# SPDX-FileCopyrightText: 2020 Diego Elio Pettenò
#
# SPDX-License-Identifier: Unlicense
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-yaml
- id: trailing-whitespace
- id: end-of-file-fixer
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v15.0.7
hooks:
- id: clang-format
exclude: ^(examples/.*.ino)
types_or: [c++, c, header]
- repo: https://github.com/codespell-project/codespell
rev: v2.2.4
hooks:
- id: codespell
exclude: ^(tools/esp_stub.py)
args: [-w]

View file

@ -1,13 +0,0 @@
# Adafruit TestBed [![Build Status](https://github.com/adafruit/Adafruit_TestBed/workflows/Arduino%20Library%20CI/badge.svg)](https://github.com/adafruit/Adafruit_TestBed/actions)[![Documentation](https://github.com/adafruit/ci-arduino/blob/master/assets/doxygen_badge.svg)](http://adafruit.github.io/Adafruit_TestBed/html/index.html)
This is the Adafruit TestBed library
Used internally for making testers, to reduce code replication!
Adafruit invests time and resources providing this open source code, please support Adafruit and open-source hardware by purchasing products from Adafruit!
Written by Limor Fried for Adafruit Industries.
BSD license, check license.txt for more information
All text above must be included in any redistribution
To install, use the Arduino Library Manager and search for "Adafruit TestBed" and install the library.

View file

@ -1,127 +0,0 @@
# Adafruit Community Code of Conduct
## Our Pledge
In the interest of fostering an open and welcoming environment, we as
contributors and leaders pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, gender identity and expression, level or type of
experience, education, socio-economic status, nationality, personal appearance,
race, religion, or sexual identity and orientation.
## Our Standards
We are committed to providing a friendly, safe and welcoming environment for
all.
Examples of behavior that contributes to creating a positive environment
include:
* Be kind and courteous to others
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Collaborating with other community members
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and sexual attention or advances
* The use of inappropriate images, including in a community member's avatar
* The use of inappropriate language, including in a community member's nickname
* Any spamming, flaming, baiting or other attention-stealing behavior
* Excessive or unwelcome helping; answering outside the scope of the question
asked
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate
The goal of the standards and moderation guidelines outlined here is to build
and maintain a respectful community. We ask that you dont just aim to be
"technically unimpeachable", but rather try to be your best self.
We value many things beyond technical expertise, including collaboration and
supporting others within our community. Providing a positive experience for
other community members can have a much more significant impact than simply
providing the correct answer.
## Our Responsibilities
Project leaders are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.
Project leaders have the right and responsibility to remove, edit, or
reject messages, comments, commits, code, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any community member for other behaviors that they deem
inappropriate, threatening, offensive, or harmful.
## Moderation
Instances of behaviors that violate the Adafruit Community Code of Conduct
may be reported by any member of the community. Community members are
encouraged to report these situations, including situations they witness
involving other community members.
You may report in the following ways:
In any situation, you may send an email to <support@adafruit.com>.
On the Adafruit Discord, you may send an open message from any channel
to all Community Helpers by tagging @community helpers. You may also send an
open message from any channel, or a direct message to @kattni#1507,
@tannewt#4653, @Dan Halbert#1614, @cater#2442, @sommersoft#0222, or
@Andon#8175.
Email and direct message reports will be kept confidential.
In situations on Discord where the issue is particularly egregious, possibly
illegal, requires immediate action, or violates the Discord terms of service,
you should also report the message directly to Discord.
These are the steps for upholding our communitys standards of conduct.
1. Any member of the community may report any situation that violates the
Adafruit Community Code of Conduct. All reports will be reviewed and
investigated.
2. If the behavior is an egregious violation, the community member who
committed the violation may be banned immediately, without warning.
3. Otherwise, moderators will first respond to such behavior with a warning.
4. Moderators follow a soft "three strikes" policy - the community member may
be given another chance, if they are receptive to the warning and change their
behavior.
5. If the community member is unreceptive or unreasonable when warned by a
moderator, or the warning goes unheeded, they may be banned for a first or
second offense. Repeated offenses will result in the community member being
banned.
## Scope
This Code of Conduct and the enforcement policies listed above apply to all
Adafruit Community venues. This includes but is not limited to any community
spaces (both public and private), the entire Adafruit Discord server, and
Adafruit GitHub repositories. Examples of Adafruit Community spaces include
but are not limited to meet-ups, audio chats on the Adafruit Discord, or
interaction at a conference.
This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. As a community
member, you are representing our community, and are expected to behave
accordingly.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 1.4, available at
<https://www.contributor-covenant.org/version/1/4/code-of-conduct.html>,
and the [Rust Code of Conduct](https://www.rust-lang.org/en-US/conduct.html).
For other projects adopting the Adafruit Community Code of
Conduct, please contact the maintainers of those projects for enforcement.
If you wish to use this code of conduct for your own project, consider
explicitly mentioning your moderation policy or making a copy with your
own moderation policy so as to avoid confusion.

View file

@ -1,51 +0,0 @@
// Testing basic peripherals on Brain
// required for Host MSC block device
#include "SdFat_Adafruit_Fork.h"
// required for USB host
#include "pio_usb.h"
#include "Adafruit_TinyUSB.h"
#include "Adafruit_TestBed_Brains.h"
void setup() {
Serial.begin(115200);
while (!Serial) delay(10);
Serial.println("Hello world, Tester Brains self test!");
Brain.begin();
Brain.LCD_printf(0, "RP2040 Tester Brain");
Brain.LCD_printf(1, __DATE__ __TIME__);
}
uint8_t i=0;
void loop() {
if (i == 0) {
// approx once every 2 seconds
Brain.LCD_printf(0, "Testing: %d", millis()/1000);
Brain.printI2CBusScan();
if (Brain.SD_detected()) {
Serial.print("SD inserted...");
if (! Brain.SD.begin(17, SD_SCK_MHZ(16))) {
Serial.println("Could not init SD!");
return;
}
uint32_t SDsize = Brain.SD.card()->sectorCount();
if (SDsize == 0) {
Serial.println("Can't determine the card size");
return;
}
Serial.printf("Card size = %0.1f GB\n", 0.000000512 * (float)SDsize);
Serial.println("Files found (date time size name):");
Brain.SD.ls(LS_R | LS_DATE | LS_SIZE);
}
}
Brain.setColor(Brain.Wheel(i));
//Brain.beepNblink();
i++;
delay(10);
}

View file

@ -1,151 +0,0 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2023 Ha Thach (tinyusb.org) for Adafruit Industries
*
* 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 ESP_BINARIES_H_
#define ESP_BINARIES_H_
// Configuration: select which bins to flash
#define BIN_FILES BIN_C6_BLINK_IO8
//--------------------------------------------------------------------+
// LIST OF BINARIES
//--------------------------------------------------------------------+
#define BIN_ESP32_NINA_1_7_4 0 // nina 1.7.4
#define BIN_ESP32_WIFI_AP_SKETCH 1 // esp32 AP with ssdi "YourAP"
#define BIN_FEATHER_ESP32_V2_BLINKY 2 // Feather esp32 v2 blinky sketch
#define BIN_FEATHER_S2 10 // Feather esp32s2 factory firmware
#define BIN_FEATHER_S3 11 // Feather esp32s3 factory firmware
#define BIN_METRO_S2 12 // Metro esp32s2 factory firmware
#define BIN_DEVKIT_S2 20 // Espressif s2 devkit
#define BIN_DEVKIT_S3 21 // Espressif s3 devkit
#define BIN_FEATHER_8266_BLINKY 30 // Feather esp8266 blinky sketch
#define BIN_C6_BLINK_IO8 40 // Blink sketch for C6 with LED on IO8
//--------------------------------------------------------------------+
// Binaries include
//--------------------------------------------------------------------+
#if BIN_FILES == BIN_ESP32_WIFI_AP_SKETCH
#include "esp_binaries/wifi_ap_binaries.h"
#elif BIN_FILES == BIN_FEATHER_ESP32_V2_BLINKY
#include "esp_binaries/feather_esp32_v2_blinky_binaries.h"
#elif BIN_FILES == BIN_NINA_1_7_4
#include "esp_binaries/nina_1_7_4_binaries.h"
#elif BIN_FILES == BIN_FEATHER_S2
#include "esp_binaries/feather_esp32s2_binaries.h"
#elif BIN_FILES == BIN_METRO_S2
#include "esp_binaries/metro_esp32s2_binaries.h"
#elif BIN_FILES == BIN_FEATHER_S3
#include "esp_binaries/feather_esp32s3_binaries.h"
#elif BIN_FILES == BIN_DEVKIT_S2
#include "esp_binaries/esp32s2_devkit_binaries.h"
#elif BIN_FILES == BIN_DEVKIT_S3
#include "esp_binaries/esp32s3_devkit_binaries.h"
#elif BIN_FILES == BIN_FEATHER_8266_BLINKY
#include "esp_binaries/feather_esp8266_blinky.h"
#elif BIN_FILES == BIN_C6_BLINK_IO8
#include "esp_binaries/c6_blink_io8.h"
#else
#error "Please select BIN_FILES in esp_binaries.h"
#endif
struct {
uint32_t addr;
esp32_zipfile_t const *zfile;
} bin_files[] = {
#if BIN_FILES == BIN_NINA_1_7_4
{0x00000, &NINA_W102_1_7_4},
#elif BIN_FILES == BIN_FEATHER_ESP32_V2_BLINKY
{0x1000, &feather_esp32v2_blinky_bootloader},
{0x8000, &feather_esp32v2_blinky_partitions},
{0xe000, &boot_app0},
{0x10000, &feather_esp32v2_blinky},
#elif BIN_FILES == BIN_FEATHER_S2
{0x1000, &esp32s2_feather_test_ino_bootloader},
{0x8000, &esp32s2_feather_test_ino_partitions},
{0xe000, &boot_app0},
{0x10000, &esp32s2_feather_test_ino},
{0x2d0000, &tinyuf2},
#elif BIN_FILES == BIN_METRO_S2
{0x1000, &selftest_ino_bootloader},
{0x8000, &selftest_ino_partitions},
{0xe000, &boot_app0},
{0x10000, &selftest_ino},
{0x2d0000, &tinyuf2},
#elif BIN_FILES == BIN_FEATHER_S3
{0x0000, &esp32s3_feather_test_ino_bootloader},
{0x8000, &esp32s3_feather_test_ino_partitions},
{0xe000, &boot_app0},
{0x10000, &esp32s3_feather_test_ino},
{0x2d0000, &tinyuf2},
#elif BIN_FILES == BIN_DEVKIT_S2
{0x1000, &Blink_ino_bootloader},
{0x8000, &Blink_ino_partitions},
{0xe000, &boot_app0},
{0x10000, &Blink_ino},
#elif BIN_FILES == BIN_DEVKIT_S3
{0x0000, &Blink_ino_bootloader},
{0x8000, &Blink_ino_partitions},
{0xe000, &boot_app0},
{0x10000, &Blink_ino},
#elif BIN_FILES == BIN_FEATHER_8266_BLINKY
{0x0000, &Blink_ino},
#elif BIN_FILES == BIN_C6_BLINK_IO8
{0x00000, &c6_blink_io8_bootloader},
{0x8000, &c6_blink_io8_partitions},
{0xe000, &boot_app0},
{0x10000, &c6_blink_io8},
#else
#error "Please select BIN_FILES in esp_binaries.h"
#endif
};
enum { BIN_FILES_COUNT = sizeof(bin_files) / sizeof(bin_files[0]) };
#endif

File diff suppressed because it is too large Load diff

View file

@ -1,181 +0,0 @@
// This sketch program ESP32 by flashing bin file via Serial Host.
// Hardware wiring is a bit different between S2/S3 and ESP32 + USB-to-UART chip
// For S2/S3 with native USB
// - Brain GPIO28 <-> ESP32 IO0
// - Brain Reset <-> ESP32 Enable
// - Brain USB Host <-> ESP32 native usb
// For ESP32 with USB-to-UART chip
// - Brain USB Host <-> ESP32 native usb
// - There is no need to connect IO0/Reset since we will use DTR/RTS to reset ESP32
// required for Host MSC block device
#include "SdFat_Adafruit_Fork.h"
// required for USB host
#include "pio_usb.h"
#include "Adafruit_TinyUSB.h"
#include "Adafruit_TestBed_Brains.h"
// Change BIN_FILES in esp_binaries.h header to select which binaries to flash
// bin_files[] is defined accordingly
#include "esp_binaries.h"
// 1 if programming ESP32-S2/S3 via native USB
// 0 if programming ESP32/8266 via USB-to-UART chip such as FTDI/CP210x/CH9102f
#define ESP32_NATIVE_USB 1
#define ESP32_RESET 27
#define ESP32_IO0 28
// Note: baudrate does not matter if programming S2/S3 native USB
// But does matter if programming ESP32/8266 via USB-to-UART chip
#define ESP32_BAUDRATE (115200*8)
// CDC Host object
Adafruit_USBH_CDC SerialHost;
#if ESP32_NATIVE_USB
// Declare BootROM with IO0 and Reset will use GPIO for bootloader reset
// This is typically for programming ESP32-S2/S3 via native USB
ESP32BootROMClass ESP32BootROM(SerialHost, ESP32_IO0, ESP32_RESET);
#else
// Defined an boot rom object that use SerialHost
// Declare BootROM without IO0 and Reset will use SerialHost.setDtrRts() for bootloader reset
// This is for programming ESP32/8266 via USB-to-UART chip such as FTDI/CP210x/CH9102f
ESP32BootROMClass ESP32BootROM(SerialHost);
#endif
//--------------------------------------------------------------------+
// Setup and Loop on Core0
//--------------------------------------------------------------------+
void print_speed(size_t count, uint32_t ms) {
float count_k = count / 1000.0F;
float sec = ms / 1000.0F;
float speed = count_k / sec;
Brain.LCD_printf(0, "%.01fKB %.01fs", count_k, sec);
Brain.LCD_printf(1, "Spd: %.01f KB/s", speed);
}
// Reset using DTR/RTS
void reset_with_dtr_rts(uint32_t ms) {
SerialHost.setDtrRts(false, true);
delay(ms);
SerialHost.setDtrRts(false, false);
}
void setup() {
Serial.begin(115200);
while (!Serial) delay(10);
Serial.println("Tester Brains: Programming ESP32 with SerialHost!");
// sync: wait for Brain.begin() called in core1 before accessing SD or other peripherals
while (!Brain.inited()) delay(10);
while (!Brain.esp32_begin(&ESP32BootROM, ESP32_BAUDRATE)) {
delay(100);
}
// Writing bin files
size_t total_bytes = 0;
uint32_t ms = millis();
for (size_t i = 0; i < BIN_FILES_COUNT; i++) {
Brain.LCD_printf("Flashing file %u", i);
Serial.printf("File %s\r\n", bin_files[i].zfile->name);
size_t wr_count = Brain.esp32_programFlashDefl(bin_files[i].zfile, bin_files[i].addr);
total_bytes += wr_count;
if (!wr_count) {
Brain.LCD_printf_error("Failed to flash");
}
}
print_speed(total_bytes, millis() - ms);
Brain.esp32_end();
// reset ESP32 to run new firmware
Brain.targetReset(); // reset using Reset pin GPIO27
// Reset using DTR if GPIO27 is not connected
reset_with_dtr_rts(20);
}
void loop() {
}
//--------------------------------------------------------------------+
// Setup and Loop on Core1
//--------------------------------------------------------------------+
// call usbh_begin() here to make pio usb background task run on core1
// NOTE: Brain.begin() should be called here as well to prevent race condition
void setup1() {
Brain.begin();
Brain.usbh_begin();
// Since we only support 1 CDC interface with Tester (also CFG_TUH_CDC = 1)
// the index will always be 0 for SerialHost
SerialHost.begin(115200);
Brain.LCD_printf(0, "No USB attached");
Brain.LCD_printf(1, "Plug your device");
}
// core1's loop: process usb host task on core1
void loop1() {
if (Brain.esp32_s3_inReset()) {
// Note: S3 has an USB-OTG errata
// https://www.espressif.com/sites/default/files/documentation/esp32-s3_errata_en.pdf
// which is walkarounded by idf/arduino-esp32 to always mux JTAG to USB for
// uploading and/or power on. Afterwards USB-OTG will be set up if selected
// so. However rp2040 USBH is running too fast and can actually retrieve
// device/configuration descriptor of JTAG before the OTG is fully setup.
// We delay a bit here
delay(500);
Brain.esp32_s3_clearReset();
}
Brain.USBHost.task();
// periodically flush SerialHost if connected
if (SerialHost && SerialHost.connected()) {
SerialHost.flush();
}
yield();
}
//--------------------------------------------------------------------+
// TinyUSB Host callbacks
// Note: running in the same core where Brain.USBHost.task() is called
//--------------------------------------------------------------------+
extern "C" {
// Invoked when device is mounted (configured)
void tuh_mount_cb(uint8_t daddr) {
uint16_t vid, pid;
tuh_vid_pid_get(daddr, &vid, &pid);
Serial.printf("Device attached, address = %d\r\n", daddr);
Brain.LCD_printf("USBID %04x:%04x", vid, pid);
}
/// Invoked when device is unmounted (bus reset/unplugged)
void tuh_umount_cb(uint8_t dev_addr) {
(void) dev_addr;
Brain.LCD_printf(1, "No USB Device");
}
// Invoked when a device with CDC interface is mounted
// idx is index of cdc interface in the internal pool.
void tuh_cdc_mount_cb(uint8_t idx) {
// bind SerialHost object to this interface index
SerialHost.mount(idx);
}
// Invoked when a device with CDC interface is unmounted
void tuh_cdc_umount_cb(uint8_t idx) {
// unbind SerialHost if this interface is unmounted
SerialHost.umount(idx);
}
}

View file

@ -1,142 +0,0 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2023 Ha Thach (tinyusb.org) for Adafruit Industries
*
* 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 ESP_BINARIES_H_
#define ESP_BINARIES_H_
// Configuration: select which bins to flash
#define BIN_FILES BIN_C6_BLINK_IO8
//--------------------------------------------------------------------+
// LIST OF BINARIES
//--------------------------------------------------------------------+
#define BIN_ESP32_NINA_1_7_4 0 // nina 1.7.4
#define BIN_ESP32_WIFI_AP_SKETCH 1 // esp32 AP with ssdi "YourAP"
#define BIN_FEATHER_S2 10 // Feather esp32s2 factory firmware
#define BIN_FEATHER_S3 11 // Feather esp32s3 factory firmware
#define BIN_METRO_S2 12 // Metro esp32s2 factory firmware
#define BIN_DEVKIT_S2 20 // Espressif s2 devkit
#define BIN_DEVKIT_S3 21 // Espressif s3 devkit
#define BIN_ESP8266 30 // Espressif esp8266
#define BIN_C6_BLINK_IO8 40 // Blink sketch for C6 with LED on IO8
//--------------------------------------------------------------------+
// Binaries include
//--------------------------------------------------------------------+
#if BIN_FILES == BIN_ESP32_WIFI_AP_SKETCH
#include "esp_binaries/wifi_ap_binaries.h"
#elif BIN_FILES == BIN_NINA_1_7_4
#include "esp_binaries/nina_1_7_4_binaries.h"
#elif BIN_FILES == BIN_FEATHER_S2
#include "esp_binaries/feather_esp32s2_binaries.h"
#elif BIN_FILES == BIN_METRO_S2
#include "esp_binaries/metro_esp32s2_binaries.h"
#elif BIN_FILES == BIN_FEATHER_S3
#include "esp_binaries/feather_esp32s3_binaries.h"
#elif BIN_FILES == BIN_DEVKIT_S2
#include "esp_binaries/esp32s2_devkit_binaries.h"
#elif BIN_FILES == BIN_DEVKIT_S3
#include "esp_binaries/esp32s3_devkit_binaries.h"
#elif BIN_FILES == BIN_ESP8266
#include "esp_binaries/esp8266_binaries.h"
#elif BIN_FILES == BIN_C6_BLINK_IO8
#include "esp_binaries/c6_blink_io8.h"
#else
#error "Please select BIN_FILES in esp_binaries.h"
#endif
struct {
uint32_t addr;
esp32_zipfile_t const *zfile;
} bin_files[] = {
#if BIN_FILES == BIN_NINA_1_7_4
{0x00000, &NINA_W102_1_7_4},
#elif BIN_FILES == BIN_FEATHER_S2
{0x1000, &esp32s2_feather_test_ino_bootloader},
{0x8000, &esp32s2_feather_test_ino_partitions},
{0xe000, &boot_app0},
{0x10000, &esp32s2_feather_test_ino},
{0x2d0000, &tinyuf2},
#elif BIN_FILES == BIN_METRO_S2
{0x1000, &selftest_ino_bootloader},
{0x8000, &selftest_ino_partitions},
{0xe000, &boot_app0},
{0x10000, &selftest_ino},
{0x2d0000, &tinyuf2},
#elif BIN_FILES == BIN_FEATHER_S3
{0x0000, &esp32s3_feather_test_ino_bootloader},
{0x8000, &esp32s3_feather_test_ino_partitions},
{0xe000, &boot_app0},
{0x10000, &esp32s3_feather_test_ino},
{0x2d0000, &tinyuf2},
#elif BIN_FILES == BIN_DEVKIT_S2
{0x1000, &Blink_ino_bootloader},
{0x8000, &Blink_ino_partitions},
{0xe000, &boot_app0},
{0x10000, &Blink_ino},
#elif BIN_FILES == BIN_DEVKIT_S3
{0x0000, &Blink_ino_bootloader},
{0x8000, &Blink_ino_partitions},
{0xe000, &boot_app0},
{0x10000, &Blink_ino},
#elif BIN_FILES == BIN_ESP8266
{0x00000, &esp8266_blink_io0},
#elif BIN_FILES == BIN_C6_BLINK_IO8
{0x00000, &c6_blink_io8_bootloader},
{0x8000, &c6_blink_io8_partitions},
{0xe000, &boot_app0},
{0x10000, &c6_blink_io8},
#else
#error "Please select BIN_FILES in esp_binaries.h"
#endif
};
enum { BIN_FILES_COUNT = sizeof(bin_files) / sizeof(bin_files[0]) };
#endif

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,134 +0,0 @@
// This sketch program ESP32 by flashing bin file from on-flash (with .h header)
// Supported/tested ESP MCU are: ESP32, ESP32-S2, ESP32-S3, ESP8266
// Hardware wiring:
// - Brain GPIO28 <-> ESP32 IO0
// - Brain Reset <-> ESP32 Enable
// - Brain TX/RX <-> ESP32 RX/TX
// required for Host MSC block device
#include "SdFat_Adafruit_Fork.h"
// required for USB host
#include "pio_usb.h"
#include "Adafruit_TinyUSB.h"
#include "Adafruit_TestBed_Brains.h"
// Change BIN_FILES in esp_binaries.h header to select which binaries to flash
// bin_files[] is defined accordingly
#include "esp_binaries.h"
#define ESP32_RESET 27
#define ESP32_IO0 28
#define ESP32_BAUDRATE 2000000
//#define ESP32_BAUDRATE 1500000
//#define ESP32_BAUDRATE 921600
//#define ESP32_BAUDRATE 115200
// Defined an boot rom object that use UART Serial1
ESP32BootROMClass ESP32BootROM(Serial1, ESP32_IO0, ESP32_RESET);
//--------------------------------------------------------------------+
// Setup and Loop on Core0
//--------------------------------------------------------------------+
void print_speed(size_t count, uint32_t ms) {
float count_k = count / 1000.0F;
float sec = ms / 1000.0F;
float speed = count_k / sec;
Brain.LCD_printf(0, "%.01fKB %.01fs", count_k, sec);
Brain.LCD_printf(1, "Spd: %.01f KB/s", speed);
}
void setup() {
Serial.begin(115200);
while (!Serial) delay(10);
Serial.println("Tester Brains: Programming ESP with UART!");
// sync: wait for Brain.begin() called in core1 before accessing SD or other peripherals
while (!Brain.inited()) delay(10);
while (!Brain.esp32_begin(&ESP32BootROM, ESP32_BAUDRATE)) {
// retry syncing
delay(100);
}
// Writing bin files
size_t total_bytes = 0;
uint32_t ms = millis();
for (size_t i = 0; i < BIN_FILES_COUNT; i++) {
Brain.LCD_printf(0, "Flashing file %u", i);
Serial.printf("File: %s\r\n", bin_files[i].zfile->name);
size_t wr_count = Brain.esp32_programFlashDefl(bin_files[i].zfile, bin_files[i].addr);
total_bytes += wr_count;
if (!wr_count) {
Brain.LCD_printf_error("Failed to flash");
}
}
print_speed(total_bytes, millis() - ms);
Brain.esp32_end();
// reset ESP32 to run new firmware
Brain.targetReset();
}
void loop() {
}
//--------------------------------------------------------------------+
// Setup and Loop on Core1
//--------------------------------------------------------------------+
// call usbh_begin() here to make pio usb background task run on core1
// NOTE: Brain.begin() should be called here as well to prevent race condition
void setup1() {
Brain.begin();
Brain.usbh_begin();
Brain.LCD_printf(0, "No USB attached");
Brain.LCD_printf(1, "Plug your device");
}
// core1's loop: process usb host task on core1
void loop1() {
if (Brain.esp32_s3_inReset()) {
// Note: S3 has an USB-OTG errata
// https://www.espressif.com/sites/default/files/documentation/esp32-s3_errata_en.pdf
// which is walkarounded by idf/arduino-esp32 to always mux JTAG to USB for
// uploading and/or power on. Afterwards USB-OTG will be set up if selected
// so. However rp2040 USBH is running too fast and can actually retrieve
// device/configuration descriptor of JTAG before the OTG is fully setup.
// We delay a bit here
delay(500);
Brain.esp32_s3_clearReset();
}
Brain.USBHost.task();
yield();
}
//--------------------------------------------------------------------+
// TinyUSB Host callbacks
// Note: running in the same core where Brain.USBHost.task() is called
//--------------------------------------------------------------------+
extern "C" {
// Invoked when device is mounted (configured)
void tuh_mount_cb(uint8_t daddr) {
uint16_t vid, pid;
tuh_vid_pid_get(daddr, &vid, &pid);
Serial.printf("Device attached, address = %d\r\n", daddr);
Brain.LCD_printf("USBID %04x:%04x", vid, pid);
}
/// Invoked when device is unmounted (bus reset/unplugged)
void tuh_umount_cb(uint8_t dev_addr) {
(void) dev_addr;
Brain.LCD_printf(1, "No USB Device");
}
}

View file

@ -1,121 +0,0 @@
// This sketch program SAMD with bin file from SDCard using Adafruit_DAP
// Hardware wiring:
// - Brain's header Reset <-> Target Reset
// - Brain's header SWDIO <-> Target SWDIO
// - Brain's header SWCLK <-> Target SWCLK
// - Brain's USB host to Target USB
// required for Host MSC block device
#include "SdFat_Adafruit_Fork.h"
// required for USB host
#include "pio_usb.h"
#include "Adafruit_TinyUSB.h"
// required for DAP programming
#include "Adafruit_DAP.h"
#include "Adafruit_TestBed_Brains.h"
// file path on SDCard to program
#define TEST_FILE_PATH "nrf/feather_nrf52840/bleblink.bin"
// DAP interface for nRF5x
Adafruit_DAP_nRF5x dap;
//--------------------------------------------------------------------+
// Setup and Loop on Core0
//--------------------------------------------------------------------+
void print_speed(size_t count, uint32_t ms) {
Brain.LCD_printf(0, "%.01fKB in %.01fs", count/1000.0F, ms / 1000.0F);
Serial.printf("Completed %u bytes in %.02f seconds.\r\n", count, ms / 1000.0F);
Serial.printf("Speed : %.02f KB/s\r\n", (count / 1000.0F) / (ms / 1000.0F));
}
void setup() {
Serial.begin(115200);
while (!Serial) delay(10);
Serial.println("Tester Brains: nRF52840 programming !");
// sync: wait for Brain.usbh_begin() called in core1 before accessing SD or other peripherals
while (!Brain.usbh_inited()) delay(10);
Brain.SD_begin(SD_SCK_MHZ(16));
// Print out file on SD if Serial is connected
if (Serial) {
Serial.println();
Serial.println("SD Contents:");
Serial.printf("Card size = %0.1f GB\n", 0.000000512 * Brain.SD.card()->sectorCount());
Brain.SD.ls(LS_R | LS_SIZE);
}
Brain.targetReset();
Brain.dap_begin(&dap);
Brain.dap_connect();
Brain.dap_unprotectBoot();
// erase chip before programming
Brain.dap_eraseChip();
// for nrf52840 don't use crc32 as it is not supported.
// Note: verify is with reading back increase programming time by 2x
uint32_t ms = millis();
size_t copied_bytes = Brain.dap_programFlash(TEST_FILE_PATH, 0, true, false);
ms = millis() - ms;
print_speed(copied_bytes, ms);
Brain.dap_protectBoot();
Brain.dap_disconnect();
Brain.targetReset();
}
void loop() {
}
//--------------------------------------------------------------------+
// Setup and Loop on Core1
//--------------------------------------------------------------------+
// call usbh_begin() here to make pio usb background task run on core1
// NOTE: Brain.begin() should be called here as well to prevent race condition
void setup1() {
Brain.begin();
Brain.usbh_begin();
Brain.LCD_printf(1, "No USB Device");
}
// core1's loop: process usb host task on core1
void loop1() {
Brain.USBHost.task();
}
//--------------------------------------------------------------------+
// TinyUSB Host callbacks
// Note: running in the same core where Brain.USBHost.task() is called
//--------------------------------------------------------------------+
extern "C" {
// Invoked when device is mounted (configured)
void tuh_mount_cb (uint8_t dev_addr)
{
uint16_t vid, pid;
tuh_vid_pid_get(dev_addr, &vid, &pid);
Brain.LCD_printf("USBID %04x:%04x", vid, pid);
}
/// Invoked when device is unmounted (bus reset/unplugged)
void tuh_umount_cb(uint8_t dev_addr)
{
(void) dev_addr;
Brain.LCD_printf(1, "No USB Device");
}
}

View file

@ -1,121 +0,0 @@
// This sketch program SAMD with bin file from SDCard using Adafruit_DAP
// Hardware wiring:
// - Brain's header Reset <-> Target Reset
// - Brain's header SWDIO <-> Target SWDIO
// - Brain's header SWCLK <-> Target SWCLK
// - Brain's USB host to Target USB
// required for Host MSC block device
#include "SdFat_Adafruit_Fork.h"
// required for USB host
#include "pio_usb.h"
#include "Adafruit_TinyUSB.h"
// required for DAP programming
#include "Adafruit_DAP.h"
#include "Adafruit_TestBed_Brains.h"
// file path on SDCard to program
#define TEST_FILE_PATH "nrf/feather_nrf52840/bleblink.bin"
// DAP interface for nRF5x
Adafruit_DAP_nRF5x dap;
//--------------------------------------------------------------------+
// Setup and Loop on Core0
//--------------------------------------------------------------------+
void print_speed(size_t count, uint32_t ms) {
Brain.LCD_printf(0, "%.01fKB in %.01fs", count/1000.0F, ms / 1000.0F);
Serial.printf("Completed %u bytes in %.02f seconds.\r\n", count, ms / 1000.0F);
Serial.printf("Speed : %.02f KB/s\r\n", (count / 1000.0F) / (ms / 1000.0F));
}
void setup() {
Serial.begin(115200);
while (!Serial) delay(10);
Serial.println("Tester Brains: nRF52840 programming !");
// sync: wait for Brain.usbh_begin() called in core1 before accessing SD or other peripherals
while (!Brain.usbh_inited()) delay(10);
Brain.SD_begin(SD_SCK_MHZ(16));
// Print out file on SD if Serial is connected
if (Serial) {
Serial.println();
Serial.println("SD Contents:");
Serial.printf("Card size = %0.1f GB\n", 0.000000512 * Brain.SD.card()->sectorCount());
Brain.SD.ls(LS_R | LS_SIZE);
}
Brain.targetReset();
Brain.dap_begin(&dap);
Brain.dap_connect();
Brain.dap_unprotectBoot();
// erase chip before programming
Brain.dap_eraseChip();
// for nrf52840 don't use crc32 as it is not supported.
// Note: verify is with reading back increase programming time by 2x
uint32_t ms = millis();
size_t copied_bytes = Brain.dap_programFlash(TEST_FILE_PATH, 0, true, false);
ms = millis() - ms;
print_speed(copied_bytes, ms);
Brain.dap_protectBoot();
Brain.dap_disconnect();
Brain.targetReset();
}
void loop() {
}
//--------------------------------------------------------------------+
// Setup and Loop on Core1
//--------------------------------------------------------------------+
// call usbh_begin() here to make pio usb background task run on core1
// NOTE: Brain.begin() should be called here as well to prevent race condition
void setup1() {
Brain.begin();
Brain.usbh_begin();
Brain.LCD_printf(1, "No USB Device");
}
// core1's loop: process usb host task on core1
void loop1() {
Brain.USBHost.task();
}
//--------------------------------------------------------------------+
// TinyUSB Host callbacks
// Note: running in the same core where Brain.USBHost.task() is called
//--------------------------------------------------------------------+
extern "C" {
// Invoked when device is mounted (configured)
void tuh_mount_cb (uint8_t dev_addr)
{
uint16_t vid, pid;
tuh_vid_pid_get(dev_addr, &vid, &pid);
Brain.LCD_printf("USBID %04x:%04x", vid, pid);
}
/// Invoked when device is unmounted (bus reset/unplugged)
void tuh_umount_cb(uint8_t dev_addr)
{
(void) dev_addr;
Brain.LCD_printf(1, "No USB Device");
}
}

File diff suppressed because it is too large Load diff

View file

@ -1,135 +0,0 @@
// This sketch program rp2040 by copying UF2 file from SDCard to
// rp2040 bootrom
// Hardware wiring:
// - Brain's Target GPIO28 to RP2 bootsel
// - Brain's Target Reset to RP2 Reset
// - Brain's USB host to RP2040 USB interface
// required for Host MSC block device
#include "SdFat_Adafruit_Fork.h"
// required for USB host
#include "pio_usb.h"
#include "Adafruit_TinyUSB.h"
#include "Adafruit_TestBed_Brains.h"
// firmware.h is converted using tools/file2carray.py e.g
// python tools/file2carray.py cdc_msc.uf2
// above command will generate cdc_msc.uf2.h with bindata, bindata_len
#include "metro_rp2350_cdc_msc.uf2.h"
// RP2040 Boot VID/PID
#define BOOT_VID 0x2e8a
#define BOOT_PID_RP2040 0x0003
#define BOOT_PID_RP2350 0x000f
// If USB filesystem is mounted
volatile bool is_usbfs_mounted = false;
//--------------------------------------------------------------------+
// Setup and Loop on Core0
//--------------------------------------------------------------------+
void print_speed(size_t count, uint32_t ms) {
Brain.LCD_printf(0, "%.01fKB %.01fs", count/1000.0F, ms / 1000.0F);
Serial.printf("Completed %u bytes in %.02f seconds.\r\n", count, ms / 1000.0F);
Serial.printf("Speed : %.02f KB/s\r\n", (count / 1000.0F) / (ms / 1000.0F));
}
void setup() {
Serial.begin(115200);
while (!Serial) delay(10);
Serial.println("Program RP2 by copy UF2 from Internal Flash to Bootloader!");
// sync: wait for Brain.begin() called in core1 before accessing SD or other peripherals
while (!Brain.inited()) delay(10);
// wait for USB filesystem is mounted. USB host bit-banging and task is
// processed on core1
while (!is_usbfs_mounted) delay(10);
// Copy UF2 file
Brain.LCD_printf(0, "Copying firmware");
Serial.println("Copying UF2 from Flash to USBHFS");
uint32_t ms = millis();
size_t copied_bytes = Brain.rp2_programUF2(bindata, bindata_len);
print_speed(copied_bytes, millis() - ms);
// wait for rp2040 boot rom to reset
// while (is_usbfs_mounted) delay(10);
}
void loop() {
Serial.flush();
}
//--------------------------------------------------------------------+
// Setup and Loop on Core1
//--------------------------------------------------------------------+
// call usbh_begin() here to make pio usb background task run on core1
// NOTE: Brain.begin() should be called here as well to prevent race condition
void setup1() {
Brain.begin();
Brain.usbh_begin();
Brain.LCD_printf(1, "No USB Device");
// reset rp2040 target into Boot Rom, default bootsel = 28, reset duration = 10 ms
Brain.rp2_targetResetBootRom();
}
// core1's loop: process usb host task on core1
void loop1() {
Brain.USBHost.task();
}
//--------------------------------------------------------------------+
// TinyUSB Host callbacks
// Note: running in the same core where Brain.USBHost.task() is called
//--------------------------------------------------------------------+
bool is_rp2_bootloader(uint16_t vid, uint16_t pid) {
return (vid == BOOT_VID && (pid == BOOT_PID_RP2040 || pid == BOOT_PID_RP2350));
}
extern "C" {
// Invoked when device is mounted (configured)
void tuh_mount_cb(uint8_t dev_addr) {
uint16_t vid, pid;
tuh_vid_pid_get(dev_addr, &vid, &pid);
if (!is_rp2_bootloader(vid, pid)) {
Brain.LCD_printf(1, "UnkDev %04x:%04x", vid, pid);
}
}
/// Invoked when device is unmounted (bus reset/unplugged)
void tuh_umount_cb(uint8_t dev_addr) {
(void)dev_addr;
Brain.LCD_printf(1, "No USB Device");
}
// Invoked when a device with MassStorage interface is mounted
void tuh_msc_mount_cb(uint8_t dev_addr) {
uint16_t vid, pid;
tuh_vid_pid_get(dev_addr, &vid, &pid);
if (is_rp2_bootloader(vid, pid)) {
is_usbfs_mounted = Brain.usbh_mountFS(dev_addr);
if (is_usbfs_mounted) {
uint16_t rp2variant = (pid == BOOT_PID_RP2040 ? 2040 : 2350);
Brain.LCD_printf(1, "RP%u Bootldr", rp2variant);
}
}
}
// Invoked when a device with MassStorage interface is unmounted
void tuh_msc_umount_cb(uint8_t dev_addr) {
is_usbfs_mounted = false;
Brain.usbh_umountFS(dev_addr);
}
}

View file

@ -1,160 +0,0 @@
// This sketch program rp2040 by copying UF2 file from SDCard to
// rp2040 bootrom
// Hardware wiring:
// - Brain's Target GPIO28 to RP2040 bootsel
// - Brain's Target Reset to RP2040 Reset
// - Brain's USB host to RP2040 USB interface
// required for Host MSC block device
#include "SdFat_Adafruit_Fork.h"
// required for USB host
#include "pio_usb.h"
#include "Adafruit_TinyUSB.h"
#include "Adafruit_TestBed_Brains.h"
// RP2040 Boot VID/PID
#define BOOT_VID 0x2e8a
#define BOOT_PID 0x0003
// UF2 file path on SDCard to copy
// #define UF2_FILE_PATH "pico/adafruit-circuitpython-raspberry_pi_pico-en_US-7.3.3.uf2"
//#define UF2_FILE_PATH "pico/blink.uf2"
#define UF2_FILE_PATH "pico/tinyusb_dev_cdc_msc.uf2"
// If USB filesystem is mounted
volatile bool is_usbfs_mounted = false;
//--------------------------------------------------------------------+
// Setup and Loop on Core0
//--------------------------------------------------------------------+
void prepare_sd(void) {
if (!Brain.SD_detected()) {
Brain.LCD_printf(0, "No SD Card");
while ( !Brain.SD_detected() ) delay(10);
}
if ( !Brain.SD_begin(SD_SCK_MHZ(16)) ) {
Brain.LCD_printf(0, "SD init failed");
while(1) delay(10);
}
Brain.LCD_printf(0, "SD mounted");
// Print out file on SD if Serial is connected
if (Serial) {
Serial.println();
Serial.println("SD Contents:");
Serial.printf("Card size = %0.1f GB\n", 0.000000512 * Brain.SD.card()->sectorCount());
Brain.SD.ls(LS_R | LS_DATE | LS_SIZE);
}
}
void print_speed(size_t count, uint32_t ms) {
Brain.LCD_printf(0, "%.01fKB %.01fs", count/1000.0F, ms / 1000.0F);
Serial.printf("Completed %u bytes in %.02f seconds.\r\n", count, ms / 1000.0F);
Serial.printf("Speed : %.02f KB/s\r\n", (count / 1000.0F) / (ms / 1000.0F));
}
void setup() {
Serial.begin(115200);
while (!Serial) delay(10);
Serial.println("Tester Brains: UF2 copy from SD to USBH FS test!");
// sync: wait for Brain.begin() called in core1 before accessing SD or other peripherals
while (!Brain.inited()) delay(10);
// prepare SD Card
prepare_sd();
// wait for USB filesystem is mounted. USB host bit-banging and task is
// processed on core1
while (!is_usbfs_mounted) delay(10);
// Copy UF2 file
Brain.LCD_printf(0, "Copying UF2 file");
Serial.println("Copying from SD to USBHFS: " UF2_FILE_PATH);
uint32_t ms = millis();
size_t copied_bytes = Brain.rp2_programUF2(UF2_FILE_PATH);
print_speed(copied_bytes, millis() - ms);
// wait for rp2040 boot rom to reset
// while (is_usbfs_mounted) delay(10);
}
void loop() {
Serial.flush();
}
//--------------------------------------------------------------------+
// Setup and Loop on Core1
//--------------------------------------------------------------------+
// call usbh_begin() here to make pio usb background task run on core1
// NOTE: Brain.begin() should be called here as well to prevent race condition
void setup1() {
Brain.begin();
Brain.usbh_begin();
Brain.LCD_printf(1, "No USB Device");
// reset rp2040 target into Boot Rom, default bootsel = 28, reset duration = 10 ms
Brain.rp2_targetResetBootRom();
}
// core1's loop: process usb host task on core1
void loop1() {
Brain.USBHost.task();
}
//--------------------------------------------------------------------+
// TinyUSB Host callbacks
// Note: running in the same core where Brain.USBHost.task() is called
//--------------------------------------------------------------------+
extern "C" {
// Invoked when device is mounted (configured)
void tuh_mount_cb (uint8_t dev_addr)
{
uint16_t vid, pid;
tuh_vid_pid_get(dev_addr, &vid, &pid);
if ( !(vid == BOOT_VID && pid == BOOT_PID) ) {
Brain.LCD_printf(1, "UnkDev %04x:%04x", vid, pid);
}
}
/// Invoked when device is unmounted (bus reset/unplugged)
void tuh_umount_cb(uint8_t dev_addr)
{
(void) dev_addr;
Brain.LCD_printf(1, "No USB Device");
}
// Invoked when a device with MassStorage interface is mounted
void tuh_msc_mount_cb(uint8_t dev_addr)
{
uint16_t vid, pid;
tuh_vid_pid_get(dev_addr, &vid, &pid);
if ( vid == BOOT_VID && pid == BOOT_PID ) {
is_usbfs_mounted = Brain.usbh_mountFS(dev_addr);
if (is_usbfs_mounted) {
Brain.LCD_printf(1, "RP2 Boot mounted");
}
}
}
// Invoked when a device with MassStorage interface is unmounted
void tuh_msc_umount_cb(uint8_t dev_addr)
{
is_usbfs_mounted = false;
Brain.usbh_umountFS(dev_addr);
}
}

View file

@ -1,126 +0,0 @@
// This sketch program SAMD with bin file from SDCard using Adafruit_DAP
// Hardware wiring:
// - Brain's header Reset <-> Target Reset
// - Brain's header SWDIO <-> Target SWDIO
// - Brain's header SWCLK <-> Target SWCLK
// - Brain's USB host to Target USB
// required for Host MSC block device
#include "SdFat_Adafruit_Fork.h"
// required for USB host
#include "pio_usb.h"
#include "Adafruit_TinyUSB.h"
// required for DAP programming
#include "Adafruit_DAP.h"
#include "Adafruit_TestBed_Brains.h"
// RP2040 Boot VID/PID
#define BOOT_VID 0x2e8a
#define BOOT_PID 0x0003
// file path on SDCard to prograom
#define TEST_FILE_PATH "samd21/metro/3505test.bin"
//#define TESTFILECRC 0x9709b384
// DAP interface for SAM21
Adafruit_DAP_SAM dap;
//--------------------------------------------------------------------+
// Setup and Loop on Core0
//--------------------------------------------------------------------+
void print_speed(size_t count, uint32_t ms) {
Brain.LCD_printf(0, "%.01fKB in %.01fs", count/1000.0F, ms / 1000.0F);
Serial.printf("Completed %u bytes in %.02f seconds.\r\n", count, ms / 1000.0F);
Serial.printf("Speed : %.02f KB/s\r\n", (count / 1000.0F) / (ms / 1000.0F));
}
void setup() {
Serial.begin(115200);
while (!Serial) delay(10);
Serial.println("Tester Brains: SAMD21 programming !");
// sync: wait for Brain.usbh_begin() called in core1 before accessing SD or other peripherals
while (!Brain.usbh_inited()) delay(10);
Brain.SD_begin(SD_SCK_MHZ(16));
// Print out file on SD if Serial is connected
if (Serial) {
Serial.println();
Serial.println("SD Contents:");
Serial.printf("Card size = %0.1f GB\n", 0.000000512 * Brain.SD.card()->sectorCount());
Brain.SD.ls(LS_R | LS_SIZE);
}
Brain.targetReset();
Brain.dap_begin(&dap);
Brain.dap_connect();
Brain.dap_unprotectBoot();
// erase chip before programming
Brain.dap_eraseChip();
uint32_t ms = millis();
size_t copied_bytes = Brain.dap_programFlash(TEST_FILE_PATH, 0);
ms = millis() - ms;
print_speed(copied_bytes, ms);
Brain.dap_protectBoot();
Brain.dap_disconnect();
Brain.targetReset();
}
void loop() {
}
//--------------------------------------------------------------------+
// Setup and Loop on Core1
//--------------------------------------------------------------------+
// call usbh_begin() here to make pio usb background task run on core1
// NOTE: Brain.begin() should be called here as well to prevent race condition
void setup1() {
Brain.begin();
Brain.usbh_begin();
Brain.LCD_printf(1, "No USB Device");
}
// core1's loop: process usb host task on core1
void loop1() {
Brain.USBHost.task();
}
//--------------------------------------------------------------------+
// TinyUSB Host callbacks
// Note: running in the same core where Brain.USBHost.task() is called
//--------------------------------------------------------------------+
extern "C" {
// Invoked when device is mounted (configured)
void tuh_mount_cb (uint8_t dev_addr)
{
uint16_t vid, pid;
tuh_vid_pid_get(dev_addr, &vid, &pid);
if ( !(vid == BOOT_VID && pid == BOOT_PID) ) {
Brain.LCD_printf(1, "UnkDev %04x:%04x", vid, pid);
}
}
/// Invoked when device is unmounted (bus reset/unplugged)
void tuh_umount_cb(uint8_t dev_addr)
{
(void) dev_addr;
Brain.LCD_printf(1, "No USB Device");
}
}

View file

@ -1,126 +0,0 @@
// This sketch program SAMD with bin file from SDCard using Adafruit_DAP
// Hardware wiring:
// - Brain's header Reset <-> Target Reset
// - Brain's header SWDIO <-> Target SWDIO
// - Brain's header SWCLK <-> Target SWCLK
// - Brain's USB host to Target USB
// required for Host MSC block device
#include "SdFat_Adafruit_Fork.h"
// required for USB host
#include "pio_usb.h"
#include "Adafruit_TinyUSB.h"
// required for DAP programming
#include "Adafruit_DAP.h"
#include "Adafruit_TestBed_Brains.h"
// RP2040 Boot VID/PID
#define BOOT_VID 0x2e8a
#define BOOT_PID 0x0003
// file path on SDCard to prograom
#define TEST_FILE_PATH "samd51/metro/3382test.bin"
//#define TESTFILECRC 0xB38619E4
// DAP interface for SAMD51
Adafruit_DAP_SAMx5 dap;
//--------------------------------------------------------------------+
// Setup and Loop on Core0
//--------------------------------------------------------------------+
void print_speed(size_t count, uint32_t ms) {
Brain.LCD_printf(0, "%.01fKB in %.01fs", count/1000.0F, ms / 1000.0F);
Serial.printf("Completed %u bytes in %.02f seconds.\r\n", count, ms / 1000.0F);
Serial.printf("Speed : %.02f KB/s\r\n", (count / 1000.0F) / (ms / 1000.0F));
}
void setup() {
Serial.begin(115200);
while (!Serial) delay(10);
Serial.println("Tester Brains: SAMD51 programming !");
// sync: wait for Brain.usbh_begin() called in core1 before accessing SD or other peripherals
while (!Brain.usbh_inited()) delay(10);
Brain.SD_begin(SD_SCK_MHZ(16));
// Print out file on SD if Serial is connected
if (Serial) {
Serial.println();
Serial.println("SD Contents:");
Serial.printf("Card size = %0.1f GB\n", 0.000000512 * Brain.SD.card()->sectorCount());
Brain.SD.ls(LS_R | LS_SIZE);
}
Brain.targetReset();
Brain.dap_begin(&dap);
Brain.dap_connect();
Brain.dap_unprotectBoot();
// erase chip before programming
Brain.dap_eraseChip();
uint32_t ms = millis();
size_t copied_bytes = Brain.dap_programFlash(TEST_FILE_PATH, 0);
ms = millis() - ms;
print_speed(copied_bytes, ms);
Brain.dap_protectBoot();
Brain.dap_disconnect();
Brain.targetReset();
}
void loop() {
}
//--------------------------------------------------------------------+
// Setup and Loop on Core1
//--------------------------------------------------------------------+
// call usbh_begin() here to make pio usb background task run on core1
// NOTE: Brain.begin() should be called here as well to prevent race condition
void setup1() {
Brain.begin();
Brain.usbh_begin();
Brain.LCD_printf(1, "No USB Device");
}
// core1's loop: process usb host task on core1
void loop1() {
Brain.USBHost.task();
}
//--------------------------------------------------------------------+
// TinyUSB Host callbacks
// Note: running in the same core where Brain.USBHost.task() is called
//--------------------------------------------------------------------+
extern "C" {
// Invoked when device is mounted (configured)
void tuh_mount_cb (uint8_t dev_addr)
{
uint16_t vid, pid;
tuh_vid_pid_get(dev_addr, &vid, &pid);
if ( !(vid == BOOT_VID && pid == BOOT_PID) ) {
Brain.LCD_printf(1, "UnkDev %04x:%04x", vid, pid);
}
}
/// Invoked when device is unmounted (bus reset/unplugged)
void tuh_umount_cb(uint8_t dev_addr)
{
(void) dev_addr;
Brain.LCD_printf(1, "No USB Device");
}
}

View file

@ -1,125 +0,0 @@
// This sketch program SAMD with bin file from SDCard using Adafruit_DAP
// Hardware wiring:
// - Brain's header Reset <-> Target Reset
// - Brain's header SWDIO <-> Target SWDIO
// - Brain's header SWCLK <-> Target SWCLK
// - Brain's USB host to Target USB
// required for Host MSC block device
#include "SdFat_Adafruit_Fork.h"
// required for USB host
#include "pio_usb.h"
#include "Adafruit_TinyUSB.h"
// required for DAP programming
#include "Adafruit_DAP.h"
#include "Adafruit_TestBed_Brains.h"
// RP2040 Boot VID/PID
#define BOOT_VID 0x2e8a
#define BOOT_PID 0x0003
// file path on SDCard to prograom
#define TEST_FILE_PATH "stm32f4/feather_stm32f405/tinyuf2-feather_stm32f405_express.bin"
// DAP interface for nRF5x
Adafruit_DAP_STM32 dap;
//--------------------------------------------------------------------+
// Setup and Loop on Core0
//--------------------------------------------------------------------+
void print_speed(size_t count, uint32_t ms) {
Brain.LCD_printf(0, "%.01fKB in %.01fs", count/1000.0F, ms / 1000.0F);
Serial.printf("Completed %u bytes in %.02f seconds.\r\n", count, ms / 1000.0F);
Serial.printf("Speed : %.02f KB/s\r\n", (count / 1000.0F) / (ms / 1000.0F));
}
void setup() {
Serial.begin(115200);
while (!Serial) delay(10);
Serial.println("Tester Brains: STM32F405 programming !");
// sync: wait for Brain.usbh_begin() called in core1 before accessing SD or other peripherals
while (!Brain.usbh_inited()) delay(10);
Brain.SD_begin(SD_SCK_MHZ(16));
// Print out file on SD if Serial is connected
if (Serial) {
Serial.println();
Serial.println("SD Contents:");
Serial.printf("Card size = %0.1f GB\n", 0.000000512 * Brain.SD.card()->sectorCount());
Brain.SD.ls(LS_R | LS_SIZE);
}
Brain.targetReset();
Brain.dap_begin(&dap);
Brain.dap_connect();
Brain.dap_unprotectBoot();
// erase chip before programming
Brain.dap_eraseChip();
uint32_t ms = millis();
size_t copied_bytes = Brain.dap_programFlash(TEST_FILE_PATH, 0);
ms = millis() - ms;
print_speed(copied_bytes, ms);
Brain.dap_protectBoot();
Brain.dap_disconnect();
Brain.targetReset();
}
void loop() {
}
//--------------------------------------------------------------------+
// Setup and Loop on Core1
//--------------------------------------------------------------------+
// call usbh_begin() here to make pio usb background task run on core1
// NOTE: Brain.begin() should be called here as well to prevent race condition
void setup1() {
Brain.begin();
Brain.usbh_begin();
Brain.LCD_printf(1, "No USB Device");
}
// core1's loop: process usb host task on core1
void loop1() {
Brain.USBHost.task();
}
//--------------------------------------------------------------------+
// TinyUSB Host callbacks
// Note: running in the same core where Brain.USBHost.task() is called
//--------------------------------------------------------------------+
extern "C" {
// Invoked when device is mounted (configured)
void tuh_mount_cb (uint8_t dev_addr)
{
uint16_t vid, pid;
tuh_vid_pid_get(dev_addr, &vid, &pid);
if ( !(vid == BOOT_VID && pid == BOOT_PID) ) {
Brain.LCD_printf(1, "UnkDev %04x:%04x", vid, pid);
}
}
/// Invoked when device is unmounted (bus reset/unplugged)
void tuh_umount_cb(uint8_t dev_addr)
{
(void) dev_addr;
Brain.LCD_printf(1, "No USB Device");
}
}

View file

@ -1,112 +0,0 @@
// This sketch program SAMD with bin file from SDCard using Adafruit_DAP
// Hardware wiring:
// - Brain's header Reset <-> Target Reset
// - Brain's header SWDIO <-> Target SWDIO
// - Brain's header SWCLK <-> Target SWCLK
// - Brain's USB host to Target USB
// required for Host MSC block device
#include "SdFat_Adafruit_Fork.h"
// required for USB host
#include "pio_usb.h"
#include "Adafruit_TinyUSB.h"
// required for DAP programming
#include "Adafruit_DAP.h"
#include "Adafruit_TestBed_Brains.h"
// file path on SDCard to hold nrf52840 binary
#define READ_FILE_PATH "nrf/readback.bin"
#define READ_SIZE (1024u*1024u) // 1 MB
// DAP interface for nRF5x
Adafruit_DAP_nRF5x dap;
//--------------------------------------------------------------------+
// Setup and Loop on Core0
//--------------------------------------------------------------------+
void print_speed(size_t count, uint32_t ms) {
Brain.LCD_printf(0, "%.01fKB in %.01fs", count/1000.0F, ms / 1000.0F);
Serial.printf("Completed %u bytes in %.02f seconds.\r\n", count, ms / 1000.0F);
Serial.printf("Speed : %.02f KB/s\r\n", (count / 1000.0F) / (ms / 1000.0F));
}
void setup() {
Serial.begin(115200);
while (!Serial) delay(10);
Serial.println("Tester Brains: Reading nRF52840 to SD Card!");
// sync: wait for Brain.usbh_begin() called in core1 before accessing SD or other peripherals
while (!Brain.usbh_inited()) delay(10);
Brain.SD_begin(SD_SCK_MHZ(16));
// Print out file on SD if Serial is connected
if (Serial) {
Serial.println();
Serial.println("SD Contents:");
Serial.printf("Card size = %0.1f GB\n", 0.000000512 * Brain.SD.card()->sectorCount());
Brain.SD.ls(LS_R | LS_SIZE);
}
Brain.targetReset();
Brain.dap_begin(&dap);
Brain.dap_connect();
uint32_t ms = millis();
size_t nbytes = Brain.dap_readFlash(READ_FILE_PATH, 0, READ_SIZE);
ms = millis() - ms;
print_speed(nbytes, ms);
Brain.dap_disconnect();
Brain.targetReset();
}
void loop() {
}
//--------------------------------------------------------------------+
// Setup and Loop on Core1
//--------------------------------------------------------------------+
// call usbh_begin() here to make pio usb background task run on core1
// NOTE: Brain.begin() should be called here as well to prevent race condition
void setup1() {
Brain.begin();
Brain.usbh_begin();
Brain.LCD_printf(1, "No USB Device");
}
// core1's loop: process usb host task on core1
void loop1() {
Brain.USBHost.task();
}
//--------------------------------------------------------------------+
// TinyUSB Host callbacks
// Note: running in the same core where Brain.USBHost.task() is called
//--------------------------------------------------------------------+
extern "C" {
// Invoked when device is mounted (configured)
void tuh_mount_cb (uint8_t dev_addr)
{
uint16_t vid, pid;
tuh_vid_pid_get(dev_addr, &vid, &pid);
Brain.LCD_printf("USBID %04x:%04x", vid, pid);
}
/// Invoked when device is unmounted (bus reset/unplugged)
void tuh_umount_cb(uint8_t dev_addr)
{
(void) dev_addr;
Brain.LCD_printf(1, "No USB Device");
}
}

View file

@ -1,115 +0,0 @@
// Testing USB host hardware on Brain by printing out VID/PID of attached device
// to LCD. Also determine if device support MSC or HID
// required for Host MSC block device
#include "SdFat_Adafruit_Fork.h"
// required for USB host
#include "pio_usb.h"
#include "Adafruit_TinyUSB.h"
#include "Adafruit_TestBed_Brains.h"
typedef struct {
uint16_t vid;
uint16_t pid;
bool mounted;
} dev_info_t;
// CFG_TUH_DEVICE_MAX is defined by tusb_config header
dev_info_t dev_info[CFG_TUH_DEVICE_MAX] = { 0 };
//--------------------------------------------------------------------+
// Setup and Loop on Core0
//--------------------------------------------------------------------+
void setup() {
}
void loop() {
// Scan and print VID/PID
uint8_t dev_count = 0;
for(uint8_t daddr=1; daddr < CFG_TUH_DEVICE_MAX+1; daddr++) {
dev_info_t const* dev = &dev_info[daddr-1];
if ( dev->mounted ) {
dev_count++;
Brain.LCD_printf("[%u] %04X:%04X", daddr, dev->vid, dev->pid);
}
delay(1000);
}
if ( dev_count == 0 ) {
Brain.LCD_printf(0, "No USB attached");
Brain.LCD_printf(1, "Plug your device");
}else {
Brain.LCD_printf("Devices num: %u", dev_count);
delay(1000);
}
}
//--------------------------------------------------------------------+
// Setup and Loop on Core1
//--------------------------------------------------------------------+
// call usbh_begin() hrere to make pio usb background task run on core1
// NOTE: Brain.begin() should be called here as well to prevent race condition
void setup1() {
Serial.begin(115200);
// while (!Serial) delay(10);
Serial.println("Tester Brains USB Host test!");
// Init Brain peripherals
Brain.begin();
// Init Brain USB Host
Brain.usbh_begin();
Brain.LCD_printf(0, "No USB attached");
Brain.LCD_printf(1, "Plug your device");
}
// core1's loop: process usb host task on core1
void loop1()
{
Brain.USBHost.task();
}
//--------------------------------------------------------------------+
// TinyUSB Host callbacks
//--------------------------------------------------------------------+
extern "C" {
// Invoked when device is mounted (configured)
void tuh_mount_cb (uint8_t daddr)
{
dev_info_t* dev = &dev_info[daddr-1];
dev->mounted = true;
tuh_vid_pid_get(daddr, &dev->vid, &dev->pid);
Serial.printf("Device attached, address = %d\r\n", daddr);
}
/// Invoked when device is unmounted (bus reset/unplugged)
void tuh_umount_cb(uint8_t daddr)
{
dev_info_t* dev = &dev_info[daddr-1];
dev->mounted = false;
Serial.printf("Device removed, address = %d\r\n", daddr);
}
// Invoked when a device with CDC interface is mounted
// idx is index of cdc interface in the internal pool.
void tuh_cdc_mount_cb(uint8_t idx) {
}
// Invoked when a device with CDC interface is unmounted
void tuh_cdc_umount_cb(uint8_t idx) {
}
}

View file

@ -1,125 +0,0 @@
// Testing USB host hardware on Brain by printing out VID/PID of attached device
// to LCD. Also determine if device support MSC or HID
// required for Host MSC block device
#include "SdFat_Adafruit_Fork.h"
// required for USB host
#include "pio_usb.h"
#include "Adafruit_TinyUSB.h"
#include "Adafruit_TestBed_Brains.h"
// CDC Host object
Adafruit_USBH_CDC SerialHost;
enum {
COLOR_NO_DEV = 0x00000ff,
COLOR_MOUNTED = 0x00ff00,
};
//--------------------------------------------------------------------+
// Setup and Loop on Core0
//--------------------------------------------------------------------+
void setup() {
}
void loop() {
uint8_t buf[64];
// Serial -> SerialHost
if (Serial.available()) {
size_t count = Serial.read(buf, sizeof(buf));
if ( SerialHost && SerialHost.connected() ) {
SerialHost.write(buf, count);
SerialHost.flush();
}
}
// SerialHost -> Serial
if ( SerialHost.connected() && SerialHost.available() ) {
size_t count = SerialHost.read(buf, sizeof(buf));
Serial.write(buf, count);
}
}
//--------------------------------------------------------------------+
// Setup and Loop on Core1
//--------------------------------------------------------------------+
// call usbh_begin() hrere to make pio usb background task run on core1
// NOTE: Brain.begin() should be called here as well to prevent race condition
void setup1() {
Serial.begin(115200);
while (!Serial) delay(10);
Serial.println("Tester Brains USB Host test!");
// Init Brain peripherals
Brain.begin();
// Init Brain USB Host
Brain.usbh_begin();
Brain.setColor(COLOR_NO_DEV);
// Since we only support 1 CDC interface with Tester (also CFG_TUH_CDC = 1)
// the index will always be 0 for SerialHost
SerialHost.begin(115200);
Brain.LCD_printf(0, "No USB attached");
Brain.LCD_printf(1, "Plug your device");
}
// core1's loop: process usb host task on core1
void loop1()
{
Brain.USBHost.task();
// periodically flush SerialHost if connected
if ( SerialHost && SerialHost.connected() ) {
SerialHost.flush();
}
}
//--------------------------------------------------------------------+
// TinyUSB Host callbacks
//--------------------------------------------------------------------+
extern "C" {
// Invoked when device is mounted (configured)
void tuh_mount_cb (uint8_t daddr)
{
uint16_t vid, pid;
tuh_vid_pid_get(daddr, &vid, &pid);
Serial.printf("Device attached, address = %d\r\n", daddr);
Brain.setColor(COLOR_MOUNTED);
Brain.LCD_printf(0, "USBID %04x:%04x", vid, pid);
Brain.LCD_printf(1, "MS %u HID %u CDC %u", tuh_msc_mounted(daddr), tuh_hid_instance_count(daddr), SerialHost.mounted());
}
/// Invoked when device is unmounted (bus reset/unplugged)
void tuh_umount_cb(uint8_t daddr)
{
Serial.printf("Device removed, address = %d\r\n", daddr);
Brain.setColor(COLOR_NO_DEV);
Brain.LCD_printf(0, "No USB attached");
Brain.LCD_printf(1, "Plug your device");
}
// Invoked when a device with CDC interface is mounted
// idx is index of cdc interface in the internal pool.
void tuh_cdc_mount_cb(uint8_t idx) {
// bind SerialHost object to this interface index
SerialHost.mount(idx);
}
// Invoked when a device with CDC interface is unmounted
void tuh_cdc_umount_cb(uint8_t idx) {
// unbind SerialHost if this interface is unmounted
SerialHost.umount(idx);
}
}

View file

@ -1,77 +0,0 @@
#include <Adafruit_TestBed.h>
extern Adafruit_TestBed TB;
#define DEFAULT_I2C_PORT &Wire
// Some boards have TWO I2C ports, how nifty. We should scan both
#if defined(ARDUINO_ARCH_RP2040) \
|| defined(ARDUINO_ADAFRUIT_QTPY_ESP32S2) \
|| defined(ARDUINO_ADAFRUIT_QTPY_ESP32S3_NOPSRAM) \
|| defined(ARDUINO_ADAFRUIT_QTPY_ESP32S3_N4R2) \
|| defined(ARDUINO_ADAFRUIT_QTPY_ESP32_PICO) \
|| defined(ARDUINO_SAM_DUE) \
|| defined(ARDUINO_ARCH_RENESAS_UNO)
#define SECONDARY_I2C_PORT &Wire1
#endif
void setup() {
Serial.begin(115200);
// Wait for Serial port to open
while (!Serial) {
delay(10);
}
delay(500);
Serial.println("Adafruit I2C Scanner");
#if defined(ARDUINO_ADAFRUIT_QTPY_ESP32S2) || \
defined(ARDUINO_ADAFRUIT_QTPY_ESP32S3_NOPSRAM) || \
defined(ARDUINO_ADAFRUIT_QTPY_ESP32S3_N4R2) || \
defined(ARDUINO_ADAFRUIT_QTPY_ESP32_PICO)
// ESP32 is kinda odd in that secondary ports must be manually
// assigned their pins with setPins()!
Wire1.setPins(SDA1, SCL1);
#endif
#if defined(ARDUINO_ADAFRUIT_FEATHER_ESP32S2)
// turn on the I2C power by setting pin to opposite of 'rest state'
pinMode(PIN_I2C_POWER, INPUT);
delay(1);
bool polarity = digitalRead(PIN_I2C_POWER);
pinMode(PIN_I2C_POWER, OUTPUT);
digitalWrite(PIN_I2C_POWER, !polarity);
#endif
#if defined(ARDUINO_ADAFRUIT_FEATHER_ESP32S2_TFT)
pinMode(TFT_I2C_POWER, OUTPUT);
digitalWrite(TFT_I2C_POWER, HIGH);
#endif
#if defined(ARDUINO_ADAFRUIT_FEATHER_ESP32S2_REVTFT)
pinMode(TFT_I2C_POWER, OUTPUT);
digitalWrite(TFT_I2C_POWER, HIGH);
#endif
#if defined(ADAFRUIT_FEATHER_ESP32_V2)
// Turn on the I2C power by pulling pin HIGH.
pinMode(NEOPIXEL_I2C_POWER, OUTPUT);
digitalWrite(NEOPIXEL_I2C_POWER, HIGH);
#endif
}
void loop() {
Serial.println("");
Serial.println("");
Serial.print("Default port (Wire) ");
TB.theWire = DEFAULT_I2C_PORT;
TB.printI2CBusScan();
#if defined(SECONDARY_I2C_PORT)
Serial.print("Secondary port (Wire1) ");
TB.theWire = SECONDARY_I2C_PORT;
TB.printI2CBusScan();
#endif
delay(3000); // wait 3 seconds
}

View file

@ -1,61 +0,0 @@
#include <Adafruit_TestBed.h>
#include <Adafruit_MCP4725.h>
extern Adafruit_TestBed TB;
Adafruit_MCP4725 dac;
#define ADDR A0
void setup(void) {
Serial.begin(115200);
Serial.println("Hello MCP4725 tester!");
TB.piezoPin = 5;
TB.ledPin = 11;
TB.begin();
}
void loop(void) {
pinMode(ADDR, INPUT);
TB.disableI2C();
if (! TB.testPullup(A5) || ! TB.testPullup(A4)) {
Serial.println("Waiting for I2C pullups");
return;
}
Serial.println("I2C pullups OK"); // pullups cool - next up!
if (!TB.scanI2CBus(0x62)) {
Serial.println("I2C 0x62 not found");
return;
}
Serial.println("I2C 0x62 found");
delay(10);
dac.begin(0x62);
dac.setVoltage(0, false);
if (! TB.testAnalogVoltage(A1, "Zero DAC", 1, 0.))
return;
dac.setVoltage(2048, false);
if (! TB.testAnalogVoltage(A1, "Half DAC", 1, 2.5))
return;
dac.setVoltage(4095, false);
if (! TB.testAnalogVoltage(A1, "Full DAC", 1, 5))
return;
// check addr
pinMode(ADDR, OUTPUT);
digitalWrite(ADDR, HIGH);
delay(10);
if (!TB.scanI2CBus(0x63)) {
Serial.println("I2C 0x63 not found");
}
Serial.println("I2C 0x63 found");
Serial.println("Test OK!");
//TB.beepNblink();
delay(500);
}

View file

@ -1,30 +0,0 @@
// Generated by tools/esp_compress.py
#define ESP_BINARIES_COUNT (1)
// const esp32_zipfile_t NINA_W102_1_7_5
const esp32_zipfile_t NINA_W102_1_7_5 = {
.name = "NINA_W102-1.7.5.bin.gz",
.data = NULL,
.compressed_len = 634996,
.uncompressed_len = 1160192,
.md5 =
{
0x07,
0x7c,
0xec,
0x6d,
0xaa,
0x68,
0x13,
0xc5,
0xa4,
0x68,
0x0f,
0x45,
0xc9,
0xd8,
0x77,
0x6b,
},
};

View file

@ -1,146 +0,0 @@
/* This sketch run on SAMD21/SAMD51 to program ESP32 by flashing bin file from SD Card
* Supported/tested ESP MCU are: ESP32, ESP32-S2, ESP32-S3, ESP8266
* Hardware wiring:
* - TB D2 <-> ESP32 IO0
* - TB D3 <-> ESP32 Enable
* - TB TX/RX <-> ESP32 RX/TX
*
* How to run this example:
* 0. Define ESP32_RESET, ESP32_IO0, SD_CS, SD_DETECT in this sketch according to your hardware setup
* 1. Generate compressed binary and its metadata (len, md5 etc..) by running:
* python3 tools/esp_compress.py --sd <directory_of_bin_files>
* For example: python tools/esp_compress.py --sd .
* 2. .bin.gz (e.g NINA_W102-1.7.5.bin.gz) and esp_binaries.h will be generated in the same directory
* 3. Copy esp_binaries.h to this example directory
* 4. Copy .bin.gz files to SD Card within BIN_DIR (defined in this sketch)
* 5. Insert SD Card to board
* 6. Upload this sketch to board
*
* Note: for convenience, this example included generated 'NINA_W102-1.7.5.bin.gz' and 'esp_binaries.h'
* from https://github.com/adafruit/nina-fw/releases/tag/1.7.5 in this example directory.
*/
#include "SdFat_Adafruit_Fork.h"
// #include "Adafruit_TinyUSB.h"
#include "Adafruit_TestBed.h"
//--------------------------------------------------------------------+
// Hardware Configuration
//--------------------------------------------------------------------+
// These are defined in airlift-capable board such PyPortal, PyBadge, etc.
#if defined(ESP32_GPIO0) && defined(ESP32_RESETN)
#define ESP32_RESET ESP32_RESETN
#define ESP32_IO0 ESP32_GPIO0
#else
#define ESP32_RESET 2
#define ESP32_IO0 3
#endif
#if defined(ARDUINO_PYPORTAL_M4)
#define SD_CS 32
#define SD_DETECT 33
#else
#define SD_CS 4
#define SD_DETECT 5 // optional
#endif
#define ESP32_BAUDRATE 2000000
//#define ESP32_BAUDRATE 1500000
//#define ESP32_BAUDRATE 921600
//#define ESP32_BAUDRATE 115200
//--------------------------------------------------------------------+
// Binaries and Path
//--------------------------------------------------------------------+
#define BIN_DIR "/" // SD card's directory that contains bin files
#include "esp_binaries.h"
struct {
uint32_t addr;
esp32_zipfile_t const *zfile;
} bin_files[] = {
{0x00000, &NINA_W102_1_7_5}
};
enum { BIN_FILES_COUNT = sizeof(bin_files) / sizeof(bin_files[0]) };
//--------------------------------------------------------------------+
// Defined an boot rom object that use UART Serial1
ESP32BootROMClass ESP32BootROM(Serial1, ESP32_IO0, ESP32_RESET);
SdFat SD;
File32 fbin;
//--------------------------------------------------------------------+
// Implementation
//--------------------------------------------------------------------+
void print_speed(size_t count, uint32_t ms) {
float count_k = count / 1000.0F;
float sec = ms / 1000.0F;
float speed = count_k / sec;
Serial.print(count_k); Serial.print("KB "); Serial.print(sec); Serial.println("s");
Serial.print("Spd: "); Serial.print(speed); Serial.println(" KB/s");
}
void setup() {
Serial.begin(115200);
while (!Serial) delay(10);
Serial.println("TestBed: Programming ESP32 with UART!");
#ifdef SD_DETECT
pinMode(SD_DETECT, INPUT_PULLUP);
if (digitalRead(SD_DETECT) == LOW) {
Serial.println("SD Card not inserted");
while (1) delay(10);
}
#endif
if (!SD.begin(SD_CS, SD_SCK_MHZ(12))) {
Serial.println("SD Card init failed");
while (1) delay(10);
}
Serial.println("SD Card init OK");
TB.begin();
while ( !TB.esp32_begin(&ESP32BootROM, ESP32_BAUDRATE) ) {
// retry syncing
delay(100);
}
// Writing bin files
size_t total_bytes = 0;
uint32_t ms = millis();
for(size_t i=0; i<BIN_FILES_COUNT; i++) {
Serial.printf("Flashing file %u\r\n", i);
Serial.printf("File: %s\r\n", bin_files[i].zfile->name);
char bin_path[128] = BIN_DIR;
strcat(bin_path, bin_files[i].zfile->name);
fbin.open(&SD, bin_path);
if (!fbin) {
Serial.printf("Failed to open file %s\r\n", bin_files[i].zfile->name);
continue;
}
size_t wr_count = TB.esp32_programFlashDefl(bin_files[i].zfile, bin_files[i].addr, &fbin);
total_bytes += wr_count;
if (!wr_count) {
Serial.printf("Failed to flash");
}
fbin.close();
}
print_speed(total_bytes, millis() - ms);
TB.esp32_end();
// reset ESP32 to run new firmware
TB.targetReset();
}
void loop() {
}

BIN
html/bc_s.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 676 B

BIN
html/bdwn.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 147 B

BIN
html/closed.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 132 B

BIN
html/doc.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 746 B

1596
html/doxygen.css Normal file

File diff suppressed because it is too large Load diff

BIN
html/doxygen.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

97
html/dynsections.js Normal file
View file

@ -0,0 +1,97 @@
function toggleVisibility(linkObj)
{
var base = $(linkObj).attr('id');
var summary = $('#'+base+'-summary');
var content = $('#'+base+'-content');
var trigger = $('#'+base+'-trigger');
var src=$(trigger).attr('src');
if (content.is(':visible')===true) {
content.hide();
summary.show();
$(linkObj).addClass('closed').removeClass('opened');
$(trigger).attr('src',src.substring(0,src.length-8)+'closed.png');
} else {
content.show();
summary.hide();
$(linkObj).removeClass('closed').addClass('opened');
$(trigger).attr('src',src.substring(0,src.length-10)+'open.png');
}
return false;
}
function updateStripes()
{
$('table.directory tr').
removeClass('even').filter(':visible:even').addClass('even');
}
function toggleLevel(level)
{
$('table.directory tr').each(function() {
var l = this.id.split('_').length-1;
var i = $('#img'+this.id.substring(3));
var a = $('#arr'+this.id.substring(3));
if (l<level+1) {
i.removeClass('iconfopen iconfclosed').addClass('iconfopen');
a.html('&#9660;');
$(this).show();
} else if (l==level+1) {
i.removeClass('iconfclosed iconfopen').addClass('iconfclosed');
a.html('&#9658;');
$(this).show();
} else {
$(this).hide();
}
});
updateStripes();
}
function toggleFolder(id)
{
// the clicked row
var currentRow = $('#row_'+id);
// all rows after the clicked row
var rows = currentRow.nextAll("tr");
var re = new RegExp('^row_'+id+'\\d+_$', "i"); //only one sub
// only match elements AFTER this one (can't hide elements before)
var childRows = rows.filter(function() { return this.id.match(re); });
// first row is visible we are HIDING
if (childRows.filter(':first').is(':visible')===true) {
// replace down arrow by right arrow for current row
var currentRowSpans = currentRow.find("span");
currentRowSpans.filter(".iconfopen").removeClass("iconfopen").addClass("iconfclosed");
currentRowSpans.filter(".arrow").html('&#9658;');
rows.filter("[id^=row_"+id+"]").hide(); // hide all children
} else { // we are SHOWING
// replace right arrow by down arrow for current row
var currentRowSpans = currentRow.find("span");
currentRowSpans.filter(".iconfclosed").removeClass("iconfclosed").addClass("iconfopen");
currentRowSpans.filter(".arrow").html('&#9660;');
// replace down arrows by right arrows for child rows
var childRowsSpans = childRows.find("span");
childRowsSpans.filter(".iconfopen").removeClass("iconfopen").addClass("iconfclosed");
childRowsSpans.filter(".arrow").html('&#9658;');
childRows.show(); //show all children
}
updateStripes();
}
function toggleInherit(id)
{
var rows = $('tr.inherit.'+id);
var img = $('tr.inherit_header.'+id+' img');
var src = $(img).attr('src');
if (rows.filter(':first').is(':visible')===true) {
rows.css('display','none');
$(img).attr('src',src.substring(0,src.length-8)+'closed.png');
} else {
rows.css('display','table-row'); // using show() causes jump in firefox
$(img).attr('src',src.substring(0,src.length-10)+'open.png');
}
}

BIN
html/folderclosed.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 616 B

BIN
html/folderopen.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 597 B

73
html/index.html Normal file
View file

@ -0,0 +1,73 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Adafruit MSA301 Sensor Library: Main Page</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">Adafruit MSA301 Sensor Library
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
</div><!-- top -->
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div class="header">
<div class="headertitle">
<div class="title">Adafruit MSA301 Sensor Library Documentation</div> </div>
</div><!--header-->
<div class="contents">
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.13
</small></address>
</body>
</html>

87
html/jquery.js vendored Normal file

File diff suppressed because one or more lines are too long

26
html/menu.js Normal file
View file

@ -0,0 +1,26 @@
function initMenu(relPath,searchEnabled,serverSide,searchPage,search) {
function makeTree(data,relPath) {
var result='';
if ('children' in data) {
result+='<ul>';
for (var i in data.children) {
result+='<li><a href="'+relPath+data.children[i].url+'">'+
data.children[i].text+'</a>'+
makeTree(data.children[i],relPath)+'</li>';
}
result+='</ul>';
}
return result;
}
$('#main-nav').append(makeTree(menudata,relPath));
$('#main-nav').children(':first').addClass('sm sm-dox').attr('id','main-menu');
if (searchEnabled) {
if (serverSide) {
$('#main-menu').append('<li style="float:right"><div id="MSearchBox" class="MSearchBoxInactive"><div class="left"><form id="FSearchBox" action="'+searchPage+'" method="get"><img id="MSearchSelect" src="'+relPath+'search/mag.png" alt=""/><input type="text" id="MSearchField" name="query" value="'+search+'" size="20" accesskey="S" onfocus="searchBox.OnSearchFieldFocus(true)" onblur="searchBox.OnSearchFieldFocus(false)"></form></div><div class="right"></div></div></li>');
} else {
$('#main-menu').append('<li style="float:right"><div id="MSearchBox" class="MSearchBoxInactive"><span class="left"><img id="MSearchSelect" src="'+relPath+'search/mag_sel.png" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" alt=""/><input type="text" id="MSearchField" value="'+search+'" accesskey="S" onfocus="searchBox.OnSearchFieldFocus(true)" onblur="searchBox.OnSearchFieldFocus(false)" onkeyup="searchBox.OnSearchFieldChange(event)"/></span><span class="right"><a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="'+relPath+'search/close.png" alt=""/></a></span></div></li>');
}
}
$('#main-menu').smartmenus();
}

2
html/menudata.js Normal file
View file

@ -0,0 +1,2 @@
var menudata={children:[
{text:"Main Page",url:"index.html"}]}

BIN
html/nav_f.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 153 B

BIN
html/nav_g.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 95 B

BIN
html/nav_h.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 98 B

Some files were not shown because too many files have changed in this diff Show more