Skip to content

Remove logger #19

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Sep 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .github/workflows/compile-examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ jobs:
- fqbn: arduino:mbed_portenta:envie_m7
platforms: |
- name: arduino:mbed_portenta
additional-sketch-paths: |
- examples/PortentaH7Logger
- fqbn: arduino:renesas_portenta:portenta_c33
platforms: |
- name: arduino:renesas_portenta
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ The Arduino_UnifiedStorage library provides a unified interface to access differ
## Examples
* [**examples/SimpleStorageWriteRead**](https://github.com/arduino-libraries/Arduino_UnifiedStorage/blob/main/examples/SimpleStorageWriteRead/SimpleStorageWriteRead.ino) - Write/read simple data from SD, USB and internal storage
* [**examples/AdvancedUSBInternalOperations**](https://github.com/arduino-libraries/Arduino_UnifiedStorage/blob/main/examples/AdvancedUSBInternalOperations/AdvancedUSBInternalOperations.ino) - Navigate file structure and demonstrate file operations between USB and internal storage
* [**examples/PortentaH7Logger**](https://github.com/arduino-libraries/Arduino_UnifiedStorage/blob/main/examples/PortentaH7Logger/PortentaH7Logger.ino) - Log analog input to the Portenta H7 with timestamp, then save to internal storage and backup to USB (if detected)
* [**examples/BackupInternalPartitions**](https://github.com/arduino-libraries/Arduino_UnifiedStorage/blob/main/examples/BackupInternalPartitions/BackupInternalPartitions.ino) - Back up all partitions on the internal storage to a USB Mass Storage device.

## Instructions
Expand Down Expand Up @@ -47,3 +46,5 @@ This library has been tested with the following STM32 and Renesas based Arduino
* Portenta C33 + Vision Shield: SD and QSPI
* Opta: Internal QSPI Flash and USB


Note: Due to an unforeseen compatibility issue on the Portenta Breakout Board, inserting a USB drive on the USB-A port of the breakout board may occasionally cause a reboot on Portenta C33 boards. You can work around this issue by connecting your USB Mass Storage device through a USB hub. This limitation only affects Portenta C33 boards.
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ void setup() {
Serial.println(errno);
}


if(internalStorage.begin(FS_FAT)){
Serial.println("Internal storage mounted.");
} else {
Expand Down
181 changes: 0 additions & 181 deletions examples/PortentaH7Logger/PortentaH7Logger.ino

This file was deleted.

29 changes: 0 additions & 29 deletions src/USBStorage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,8 @@
// The maximum number of attempts to mount the USB drive
constexpr auto MAX_MOUNT_ATTEMPTS = 10;

volatile bool USBStorage::usbAvailable = false;

USBStorage::USBStorage(){
#if defined(ARDUINO_PORTENTA_C33)
register_hotplug_callback(DEV_USB, [](){
USBStorage::usbAvailable = !USBStorage::usbAvailable;
});
#endif
}

bool USBStorage::begin(FileSystems fs){
Expand Down Expand Up @@ -56,34 +50,11 @@ Folder USBStorage::getRootFolder(){
return Folder("/usb");
}

bool USBStorage::isAvailable(){
return usbAvailable;
}

bool USBStorage::isConnected(){
return this -> connected;
}

void USBStorage::checkConnection(){
#if defined(ARDUINO_PORTENTA_H7_M7)
USBHost * host;
USBDeviceConnected * dev;
unsigned long currentMillis = millis();
boolean found = false;

if (currentMillis - previousMillis >= interval) {
this->previousMillis = currentMillis;
host = USBHost::getHostInst();

if ((dev = host->getDevice(0)) != NULL){
usbAvailable = true;
found = true;
} else{
usbAvailable = false;
}
}
#endif
}

bool USBStorage::format(FileSystems fs){
if(fs == FS_FAT){
Expand Down
11 changes: 0 additions & 11 deletions src/USBStorage.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,7 @@ class USBStorage : public Arduino_UnifiedStorage {
*/
bool isConnected();

/**
* Checks if the USB storage is available.
*
* @return true if available, false otherwise.
*/
bool isAvailable();

/**
* Checks the USB storage connection status.
*/
void checkConnection();



Expand All @@ -76,7 +66,6 @@ class USBStorage : public Arduino_UnifiedStorage {
bool connected = false;
unsigned long previousMillis;
unsigned int interval = 500;
static volatile bool usbAvailable;
};

#endif