You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After logging data, remove the USB stick from your board, and insert it in your computer to see the data logged:
413
+
414
+

415
+
339
416
## USB Host Keyboard
340
417
341
418
It is possible to connect generic USB keyboards to the GIGA R1's USB-A connector without any additional circuitry. This library is included in the core, so it does not require any additional installation.
@@ -456,63 +533,10 @@ delay(1000);
456
533
Mouse.release();
457
534
```
458
535
459
-
## GIGA R1 as a USB Stick
460
-
461
-
It is possible to expose the external flash (16MB) on the GIGA R1 as a USB device. This makes it possible to store smaller files directly on the GIGA R1, which can be accessed through the sketch.
462
-
463
-
```arduino
464
-
#include "PluggableUSBMSD.h"
465
-
#include "QSPIFBlockDevice.h"
466
-
#include "MBRBlockDevice.h"
467
-
#include "FATFileSystem.h"
468
-
469
-
static QSPIFBlockDevice root;
470
-
mbed::MBRBlockDevice wifi_data(&root, 1);
471
-
mbed::MBRBlockDevice ota_data(&root, 2);
472
-
static mbed::FATFileSystem wifi("wifi");
473
-
static mbed::FATFileSystem ota("ota");
474
-
475
-
void USBMSD::begin()
476
-
{
477
-
int err = wifi.mount(&wifi_data);
478
-
if (err) {
479
-
while (!Serial);
480
-
Serial.println("Please run WiFiFirmwareUpdater before");
481
-
return;
482
-
}
483
-
ota.mount(&ota_data);
484
-
}
485
-
536
+
## Summary
486
537
487
-
USBMSD MassStorage(&root);
488
-
489
-
void setup() {
490
-
Serial.begin(115200);
491
-
MassStorage.begin();
492
-
}
493
-
494
-
void printDirectory(char* name) {
495
-
DIR *d;
496
-
struct dirent *p;
497
-
498
-
d = opendir(name);
499
-
if (d != NULL) {
500
-
while ((p = readdir(d)) != NULL) {
501
-
Serial.println(p->d_name);
502
-
}
503
-
}
504
-
closedir(d);
505
-
}
506
-
507
-
void loop() {
508
-
if (MassStorage.media_removed()) {
509
-
// list the content of the partitions
510
-
// you may need to restart the board for the list to update if you copied new files
511
-
Serial.println("Content of WiFi partition:");
512
-
printDirectory("/wifi");
513
-
Serial.println("Content of OTA partition:");
514
-
printDirectory("/ota");
515
-
}
516
-
delay(1000);
517
-
}
518
-
```
538
+
The goal with this guide was to provide a summary of all the GIGA R1's features, including:
539
+
- Enabling and disabling the USB-A port.
540
+
- Read & Write to a USB mass storage device (MSD).
541
+
- Connecting keyboards and reading key presses.
542
+
- Emulate a mouse/keyboard through the HID interface.
0 commit comments