Skip to content

Commit

Permalink
----------
Browse files Browse the repository at this point in the history
  • Loading branch information
cclngit committed Jul 2, 2024
1 parent 594baee commit d853267
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 11 deletions.
Binary file modified Firmware/MTR_Charger_X5S/.DS_Store
Binary file not shown.
1 change: 0 additions & 1 deletion Firmware/MTR_Charger_X5S/lib/MTR_STUSB4500
Submodule MTR_STUSB4500 deleted from c1c55b
3 changes: 3 additions & 0 deletions Firmware/MTR_Charger_X5S/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,6 @@
platform = raspberrypi
board = pico
framework = arduino

lib_deps =
https://github.com/MoreThanRobotsFR/MTR_STUSB4500#main
47 changes: 37 additions & 10 deletions Firmware/MTR_Charger_X5S/src/main.cpp
Original file line number Diff line number Diff line change
@@ -1,18 +1,45 @@
#include <Arduino.h>
#include <Wire.h>
#include <MTR_STUSB4500.h>

// put function declarations here:
int myFunction(int, int);
// Create an instance of the STUSB4500 class
MTR_STUSB4500 stusb4500;

void setup() {
// put your setup code here, to run once:
int result = myFunction(2, 3);
// Initialize the STUSB4500 device
stusb4500.init();

// Set the number of sink PDOs to 1
stusb4500.setPdoNumber(1);

// Set the voltage value for SNK_PDO1 to 5V
// can't be set, because is hardcoded to 5V

// Set the current value for SNK_PDO1 to 1A
stusb4500.setISinkPdo1(1000);

}

void loop() {
// put your main code here, to run repeatedly:
}
// Get the alert status from the STUSB4500
uint8_t alertStatus;
if (stusb4500.getAlertStatus(alertStatus)) {
Serial.print("Alert status: 0x");
Serial.println(alertStatus, HEX);
}

// Get the port status from the STUSB4500
uint8_t portStatus;
if (stusb4500.getPortStatus(portStatus)) {
Serial.print("Port status: 0x");
Serial.println(portStatus, HEX);
}

// Get the device ID from the STUSB4500
uint8_t deviceID;
if (stusb4500.getDeviceID(deviceID)) {
Serial.print("Device ID: 0x");
Serial.println(deviceID, HEX);
}

// put function definitions here:
int myFunction(int x, int y) {
return x + y;
delay(1000); // Wait for 1 second
}

0 comments on commit d853267

Please sign in to comment.