mirror of
https://github.com/meshtastic/firmware.git
synced 2025-08-28 07:30:16 +00:00
Applied trunk fmt
This commit is contained in:
parent
cc4bdc26c9
commit
2c41f639fb
@ -196,7 +196,8 @@ void portduinoSetup()
|
||||
// if we're using a usermode driver, we need to initialize it here, to get a serial number back for mac address
|
||||
if (settingsStrings[spidev] == "ch341") {
|
||||
try {
|
||||
ch341Hal = new Ch341Hal(0, settingsStrings[lora_usb_serial_num], settingsMap[lora_usb_vid], settingsMap[lora_usb_pid]);
|
||||
ch341Hal =
|
||||
new Ch341Hal(0, settingsStrings[lora_usb_serial_num], settingsMap[lora_usb_vid], settingsMap[lora_usb_pid]);
|
||||
} catch (std::exception &e) {
|
||||
std::cerr << e.what() << std::endl;
|
||||
std::cerr << "Could not initialize CH341 device!" << std::endl;
|
||||
|
@ -4,10 +4,10 @@
|
||||
// include RadioLib
|
||||
#include "platform/portduino/PortduinoGlue.h"
|
||||
#include <RadioLib.h>
|
||||
#include <libpinedio-usb.h>
|
||||
#include <unistd.h>
|
||||
#include <csignal>
|
||||
#include <iostream>
|
||||
#include <libpinedio-usb.h>
|
||||
#include <unistd.h>
|
||||
|
||||
// include the library for Raspberry GPIO pins
|
||||
|
||||
@ -27,7 +27,8 @@ class Ch341Hal : public RadioLibHal
|
||||
{
|
||||
public:
|
||||
// default constructor - initializes the base HAL and any needed private members
|
||||
explicit Ch341Hal(uint8_t spiChannel, std::string serial = "", uint32_t vid = 0x1A86, uint32_t pid = 0x5512, uint32_t spiSpeed = 2000000, uint8_t spiDevice = 0, uint8_t gpioDevice = 0)
|
||||
explicit Ch341Hal(uint8_t spiChannel, std::string serial = "", uint32_t vid = 0x1A86, uint32_t pid = 0x5512,
|
||||
uint32_t spiSpeed = 2000000, uint8_t spiDevice = 0, uint8_t gpioDevice = 0)
|
||||
: RadioLibHal(PI_INPUT, PI_OUTPUT, PI_LOW, PI_HIGH, PI_RISING, PI_FALLING)
|
||||
{
|
||||
if (serial != "") {
|
||||
@ -52,10 +53,7 @@ class Ch341Hal : public RadioLibHal
|
||||
pinedio_set_pin_mode(&pinedio, 5, true);
|
||||
}
|
||||
|
||||
~Ch341Hal()
|
||||
{
|
||||
pinedio_deinit(&pinedio);
|
||||
}
|
||||
~Ch341Hal() { pinedio_deinit(&pinedio); }
|
||||
|
||||
void getSerialString(char *_serial, size_t len)
|
||||
{
|
||||
@ -110,10 +108,7 @@ class Ch341Hal : public RadioLibHal
|
||||
pinedio_deattach_interrupt(&this->pinedio, (pinedio_int_pin)interruptNum);
|
||||
}
|
||||
|
||||
void delay(unsigned long ms) override
|
||||
{
|
||||
delayMicroseconds(ms * 1000);
|
||||
}
|
||||
void delay(unsigned long ms) override { delayMicroseconds(ms * 1000); }
|
||||
|
||||
void delayMicroseconds(unsigned long us) override
|
||||
{
|
||||
@ -153,7 +148,7 @@ class Ch341Hal : public RadioLibHal
|
||||
{
|
||||
int32_t ret = pinedio_transceive(&this->pinedio, out, in, len);
|
||||
if (ret < 0) {
|
||||
std::cerr << "Could not perform SPI transfer: " << ret << std::endl;;
|
||||
std::cerr << "Could not perform SPI transfer: " << ret << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user