From cbb98006474de53cf6dc3f4152813bba318683f0 Mon Sep 17 00:00:00 2001 From: Hannes Siebeneicher Date: Wed, 2 Aug 2023 15:12:59 +0200 Subject: [PATCH] Add codeBlock and frontmatter board information --- .../tutorials/cheat-sheet/cheat-sheet.md | 2 +- .../tutorials/giga-audio/content.md | 2 + .../tutorials/giga-camera/giga-camera.md | 2 + .../giga-dual-core/giga-dual-core.md | 2 + .../giga-getting-started.md | 2 + .../giga-micropython/giga-micropython.md | 2 + .../tutorials/giga-usb/giga-usb.md | 253 +----------------- .../tutorials/giga-wifi/giga-wifi.md | 2 + 8 files changed, 19 insertions(+), 248 deletions(-) diff --git a/content/hardware/10.mega/boards/giga-r1-wifi/tutorials/cheat-sheet/cheat-sheet.md b/content/hardware/10.mega/boards/giga-r1-wifi/tutorials/cheat-sheet/cheat-sheet.md index 5bb66c6df1..6b8a36fa64 100644 --- a/content/hardware/10.mega/boards/giga-r1-wifi/tutorials/cheat-sheet/cheat-sheet.md +++ b/content/hardware/10.mega/boards/giga-r1-wifi/tutorials/cheat-sheet/cheat-sheet.md @@ -15,7 +15,7 @@ tags: - Audio Jack author: 'Jacob Hylén' hardware: - - hardware/08.mega/boards/giga-r1-wifi + - hardware/10.mega/boards/giga-r1-wifi software: - ide-v1 - ide-v2 diff --git a/content/hardware/10.mega/boards/giga-r1-wifi/tutorials/giga-audio/content.md b/content/hardware/10.mega/boards/giga-r1-wifi/tutorials/giga-audio/content.md index 06a6ccd188..b568b96c90 100644 --- a/content/hardware/10.mega/boards/giga-r1-wifi/tutorials/giga-audio/content.md +++ b/content/hardware/10.mega/boards/giga-r1-wifi/tutorials/giga-audio/content.md @@ -2,6 +2,8 @@ title: Guide to GIGA R1 Advanced ADC/DAC and Audio Features description: 'Learn how to use the ADC/DAC features, along with useful examples on how to generate waveforms and play audio from a file.' author: José Bagur, Taddy Chung & Karl Söderby +hardware: + - hardware/10.mega/boards/giga-r1-wifi tags: [ADC, DAC, Audio, USB] --- diff --git a/content/hardware/10.mega/boards/giga-r1-wifi/tutorials/giga-camera/giga-camera.md b/content/hardware/10.mega/boards/giga-r1-wifi/tutorials/giga-camera/giga-camera.md index cb06295e8c..a09298a982 100644 --- a/content/hardware/10.mega/boards/giga-r1-wifi/tutorials/giga-camera/giga-camera.md +++ b/content/hardware/10.mega/boards/giga-r1-wifi/tutorials/giga-camera/giga-camera.md @@ -3,6 +3,8 @@ title: GIGA R1 Camera Guide description: Learn about the GIGA R1 WiFi's camera connector, and how to use existing examples. tags: [ArduCAM, Camera, Processing] author: Karl Söderby +hardware: + - hardware/10.mega/boards/giga-r1-wifi --- The GIGA R1 has a dedicated camera connector that allows certain camera modules to mount directly on the board. This makes it possible to add machine vision to your GIGA R1 board without much effort at all. diff --git a/content/hardware/10.mega/boards/giga-r1-wifi/tutorials/giga-dual-core/giga-dual-core.md b/content/hardware/10.mega/boards/giga-r1-wifi/tutorials/giga-dual-core/giga-dual-core.md index 884ec84c7c..c6bf6f6724 100644 --- a/content/hardware/10.mega/boards/giga-r1-wifi/tutorials/giga-dual-core/giga-dual-core.md +++ b/content/hardware/10.mega/boards/giga-r1-wifi/tutorials/giga-dual-core/giga-dual-core.md @@ -2,6 +2,8 @@ title: Guide to GIGA R1 Dual Cores description: Learn how to access and control the M4 and M7 cores on the GIGA R1, and how to communicate between them using RPC. author: Karl Söderby +hardware: + - hardware/10.mega/boards/giga-r1-wifi tags: [Dual Core, M4, M7] --- diff --git a/content/hardware/10.mega/boards/giga-r1-wifi/tutorials/giga-getting-started/giga-getting-started.md b/content/hardware/10.mega/boards/giga-r1-wifi/tutorials/giga-getting-started/giga-getting-started.md index 65aa374053..03ab441fa1 100644 --- a/content/hardware/10.mega/boards/giga-r1-wifi/tutorials/giga-getting-started/giga-getting-started.md +++ b/content/hardware/10.mega/boards/giga-r1-wifi/tutorials/giga-getting-started/giga-getting-started.md @@ -2,6 +2,8 @@ title: Getting Started with GIGA R1 WiFi description: A step-by-step guide to install the board package needed for the GIGA R1 WiFi board. author: Karl Söderby +hardware: + - hardware/10.mega/boards/giga-r1-wifi tags: [GIGA R1 WiFi, Installation, IDE] --- diff --git a/content/hardware/10.mega/boards/giga-r1-wifi/tutorials/giga-micropython/giga-micropython.md b/content/hardware/10.mega/boards/giga-r1-wifi/tutorials/giga-micropython/giga-micropython.md index 0eafc7d904..1133f2b997 100644 --- a/content/hardware/10.mega/boards/giga-r1-wifi/tutorials/giga-micropython/giga-micropython.md +++ b/content/hardware/10.mega/boards/giga-r1-wifi/tutorials/giga-micropython/giga-micropython.md @@ -2,6 +2,8 @@ title: MicroPython on the GIGA R1 description: Get started with MicroPython on the GIGA R1. author: Karl Söderby +hardware: + - hardware/10.mega/boards/giga-r1-wifi tags: [MicroPython, dfu-util] --- diff --git a/content/hardware/10.mega/boards/giga-r1-wifi/tutorials/giga-usb/giga-usb.md b/content/hardware/10.mega/boards/giga-r1-wifi/tutorials/giga-usb/giga-usb.md index e533b031e9..744a9e08d9 100644 --- a/content/hardware/10.mega/boards/giga-r1-wifi/tutorials/giga-usb/giga-usb.md +++ b/content/hardware/10.mega/boards/giga-r1-wifi/tutorials/giga-usb/giga-usb.md @@ -2,6 +2,8 @@ title: Guide to Arduino GIGA USB Features description: 'Learn how you can turn your USB device into a mouse or keyboard, how to read & write to a USB mass storage, and connecting a keyboard via the USB-A connector.' author: Karl Söderby +hardware: + - hardware/10.mega/boards/giga-r1-wifi tags: [USB, USB HID, USBHost, Mass Storage, Keyboard, Mouse] --- @@ -92,234 +94,19 @@ FILE *f = fopen("/usb/text.txt", "r+"); Below is an example sketch that can be used to **list** files in a USB mass storage device. -```arduino -#include -#include -#include - -USBHostMSD msd; -mbed::FATFileSystem usb("usb"); - - -void setup() -{ - Serial.begin(115200); - - pinMode(PA_15, OUTPUT); //enable the USB-A port - digitalWrite(PA_15, HIGH); - - while (!Serial) - ; - - Serial.println("Starting USB Dir List example..."); - - // if you are using a Max Carrier uncomment the following line - // start_hub(); - - while (!msd.connect()) { - //while (!port.connected()) { - delay(1000); - } - - Serial.print("Mounting USB device... "); - int err = usb.mount(&msd); - if (err) { - Serial.print("Error mounting USB device "); - Serial.println(err); - while (1); - } - Serial.println("done."); - - char buf[256]; - - // Display the root directory - Serial.print("Opening the root directory... "); - DIR* d = opendir("/usb/"); - Serial.println(!d ? "Fail :(" : "Done"); - if (!d) { - snprintf(buf, sizeof(buf), "error: %s (%d)\r\n", strerror(errno), -errno); - Serial.print(buf); - } - Serial.println("done."); - - Serial.println("Root directory:"); - unsigned int count { 0 }; - while (true) { - struct dirent* e = readdir(d); - if (!e) { - break; - } - count++; - snprintf(buf, sizeof(buf), " %s\r\n", e->d_name); - Serial.print(buf); - } - Serial.print(count); - Serial.println(" files found!"); - - snprintf(buf, sizeof(buf), "Closing the root directory... "); - Serial.print(buf); - fflush(stdout); - err = closedir(d); - snprintf(buf, sizeof(buf), "%s\r\n", (err < 0 ? "Fail :(" : "OK")); - Serial.print(buf); - if (err < 0) { - snprintf(buf, sizeof(buf), "error: %s (%d)\r\n", strerror(errno), -errno); - Serial.print(buf); - } -} - -void loop() -{ -} -``` + ### File Read Below is an example sketch that can be used to **read** files from a USB mass storage device. -```arduino -#include -#include -#include - -USBHostMSD msd; -mbed::FATFileSystem usb("usb"); - -// If you are using a Portenta Machine Control uncomment the following line -mbed::DigitalOut otg(PB_14, 0); - -void setup() { - Serial.begin(115200); - - pinMode(PA_15, OUTPUT); //enable the USB-A port - digitalWrite(PA_15, HIGH); - - while (!Serial); - - delay(2500); - Serial.println("Starting USB File Read example..."); - - // if you are using a Max Carrier uncomment the following line - //start_hub(); - - while (!msd.connect()) { - delay(1000); - } - - Serial.println("Mounting USB device..."); - int err = usb.mount(&msd); - if (err) { - Serial.print("Error mounting USB device "); - Serial.println(err); - while (1); - } - Serial.print("read done "); - mbed::fs_file_t file; - struct dirent *ent; - int dirIndex = 0; - int res = 0; - Serial.println("Open file.."); - FILE *f = fopen("/usb/Arduino.txt", "r+"); - char buf[256]; - Serial.println("File content:"); - - while (fgets(buf, 256, f) != NULL) { - Serial.print(buf); - } - - Serial.println("File closing"); - fflush(stdout); - err = fclose(f); - if (err < 0) { - Serial.print("fclose error:"); - Serial.print(strerror(errno)); - Serial.print(" ("); - Serial.print(-errno); - Serial.print(")"); - } else { - Serial.println("File closed"); - } -} - -void loop() { - -} -``` + ### File Write Below is an example sketch that can be used to **write** files from a USB mass storage device. -```arduino -#include -#include -#include - -USBHostMSD msd; -mbed::FATFileSystem usb("usb"); - -// mbed::DigitalOut pin5(PC_6, 0); -mbed::DigitalOut otg(PB_8, 1); - -void setup() { - Serial.begin(115200); - - pinMode(PA_15, OUTPUT); //enable the USB-A port - digitalWrite(PA_15, HIGH); - - while (!Serial); - - msd.connect(); - - while (!msd.connected()) { - //while (!port.connected()) { - delay(1000); - } - - Serial.println("Mounting USB device..."); - int err = usb.mount(&msd); - if (err) { - Serial.print("Error mounting USB device "); - Serial.println(err); - while (1); - } - Serial.print("read done "); - mbed::fs_file_t file; - struct dirent *ent; - int dirIndex = 0; - int res = 0; - Serial.println("Open /usb/numbers.txt"); - FILE *f = fopen("/usb/numbers.txt", "w+"); - for (int i = 0; i < 10; i++) { - Serial.print("Writing numbers ("); - Serial.print(i); - Serial.println("/10)"); - fflush(stdout); - err = fprintf(f, "%d\n", i); - if (err < 0) { - Serial.println("Fail :("); - error("error: %s (%d)\n", strerror(errno), -errno); - } - } - - Serial.println("File closing"); - fflush(stdout); - err = fclose(f); - if (err < 0) { - Serial.print("fclose error:"); - Serial.print(strerror(errno)); - Serial.print(" ("); - Serial.print(-errno); - Serial.print(")"); - } else { - Serial.println("File closed"); - } -} - -void loop() { - -} -``` + ### Datalogger Example @@ -439,35 +226,7 @@ Please note that this library is in **Alpha** development stage. This means supp ***The USBHostGiga library is not available in the Arduino IDE and needs to be installed manually. You can do so my navigating to `Sketch` > `Include Library` > `Add .ZIP Library`.*** -```arduino -#include "USBHostGiga.h" - -//REDIRECT_STDOUT_TO(Serial) -Keyboard keyb; -HostSerial ser; - -void setup() { - // put your setup code here, to run once: - Serial.begin(115200); - while (!Serial); - pinMode(PA_15, OUTPUT); - keyb.begin(); - ser.begin(); -} - - -void loop() { - if (keyb.available()) { - auto _key = keyb.read(); - Serial.println(keyb.getAscii(_key)); - } - while (ser.available()) { - auto _char = ser.read(); - Serial.write(_char); - } - //delay(1); -} -``` + ## USB HID diff --git a/content/hardware/10.mega/boards/giga-r1-wifi/tutorials/giga-wifi/giga-wifi.md b/content/hardware/10.mega/boards/giga-r1-wifi/tutorials/giga-wifi/giga-wifi.md index dcb9e99da6..abeb8b7200 100644 --- a/content/hardware/10.mega/boards/giga-r1-wifi/tutorials/giga-wifi/giga-wifi.md +++ b/content/hardware/10.mega/boards/giga-r1-wifi/tutorials/giga-wifi/giga-wifi.md @@ -2,6 +2,8 @@ title: GIGA R1 WiFi Network Examples description: Discover examples compatible with the WiFi library included in the GIGA core. author: Karl Söderby +hardware: + - hardware/10.mega/boards/giga-r1-wifi tags: [Wi-Fi, Web Server, AP Mode, SSL, UDP] ---