Skip to content

Commit

Permalink
Merge branch 'esp-idf-without-arduino' into 'master'
Browse files Browse the repository at this point in the history
Remove dependency on Arduino

See merge request embedded/general-support-library!32
  • Loading branch information
gdex committed Aug 23, 2023
2 parents 01dec1f + 690fcd5 commit 1502fcd
Show file tree
Hide file tree
Showing 29 changed files with 527 additions and 334 deletions.
22 changes: 11 additions & 11 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,23 +30,23 @@ else ()
graphics/EmbeddedFont.cpp
graphics/EmbeddedFonts.cpp
graphics/Canvas.cpp
esp32-arduino/AnalogPin.cpp
esp32-arduino/Delays.cpp
esp32-arduino/GpioDigitalPin.cpp
esp32-arduino/I2CBus.cpp
esp32-arduino/I2CDevice.cpp
esp32-arduino/PacketUart.cpp
esp32-arduino/SerialDebug.cpp
esp32-arduino/SerialOut.cpp
esp32-arduino/SpiBus.cpp
esp32-arduino/SpiDevice.cpp
esp32-esp-idf/AnalogPin.cpp
esp32-esp-idf/Delays.cpp
esp32-esp-idf/GpioDigitalPin.cpp
esp32-esp-idf/I2CBus.cpp
esp32-esp-idf/I2CDevice.cpp
esp32-esp-idf/PacketUart.cpp
esp32-esp-idf/SerialDebug.cpp
esp32-esp-idf/SerialOut.cpp
esp32-esp-idf/SimpleUartDevice.cpp
esp32-esp-idf/SpiBus.cpp
esp32-esp-idf/SpiDevice.cpp
)
set(includedirs
${CMAKE_CURRENT_LIST_DIR}
)
idf_component_register(INCLUDE_DIRS ${includedirs}
SRCS ${srcs}
REQUIRES arduino
)
set_source_files_properties(graphics/EmbeddedFonts.cpp PROPERTIES COMPILE_FLAGS -Wno-missing-braces)
if ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
Expand Down
3 changes: 2 additions & 1 deletion GpioDigitalPin.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ class GpioDigitalPin
{
public:
enum class Direction : uint8_t { Input, Output };
enum class PullMode : uint8_t { Up, Down, None };

explicit GpioDigitalPin(GpioPinDefinition &pin) : gpioPin(pin) {}

void init(Direction type = Direction::Output) const;
bool init(Direction type = Direction::Output, PullMode pullMode = PullMode::None) const;
void set() const;
void reset() const;
bool check() const;
Expand Down
4 changes: 3 additions & 1 deletion PacketUart.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ class PacketUart
public:
class UartDevice;

explicit PacketUart(UartDevice &uart);
explicit PacketUart(UartDevice &uart) : uartDevice(uart) {}

uint16_t Receive(uint8_t* buffer, uint16_t bufferSize, uint16_t timeout = 200);
uint16_t ReceiveUntil(uint8_t* buffer, uint16_t bufferSize, uint8_t endByte, uint16_t timeoutMilliseconds = 0);
uint16_t ReceiveBetween(uint8_t* buffer, uint16_t bufferSize, uint8_t startByte, uint8_t endByte, uint16_t timeoutMilliseconds = 0);
uint16_t Send(const uint8_t* buffer, uint16_t bufferSize, uint32_t timeoutMilliseconds = 100) const;
private:
UartDevice &uartDevice;
Expand Down
11 changes: 2 additions & 9 deletions SpiDevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,11 @@ class SpiDevice
public:
explicit SpiDevice(SpiBus &bus) : spiBus(bus) {}

// Work only in half duplex mode
bool sendSync(const uint8_t* data, uint16_t length, uint32_t timeout = 1000) const;
bool receiveSync(uint8_t* data, uint16_t length, uint32_t timeout = 1000) const;

bool sendThenReceive(const uint8_t* txData,
uint16_t txCount,
uint8_t* rxData,
uint16_t rxCount,
uint32_t timeoutMilliseconds = 1000) const
{
return sendSync(txData, txCount, timeoutMilliseconds) && receiveSync(rxData, rxCount, timeoutMilliseconds);
}

// Work in full duplex mode
bool sendAndReceive(const uint8_t* txData, uint8_t* rxData, uint16_t size, uint32_t timeout = 1000) const;

private:
Expand Down
8 changes: 0 additions & 8 deletions esp32-arduino/AnalogPin.cpp

This file was deleted.

30 changes: 0 additions & 30 deletions esp32-arduino/GpioDigitalPin.cpp

This file was deleted.

9 changes: 0 additions & 9 deletions esp32-arduino/I2CBus.cpp

This file was deleted.

15 changes: 0 additions & 15 deletions esp32-arduino/I2CBus.h

This file was deleted.

23 changes: 0 additions & 23 deletions esp32-arduino/I2CDevice.cpp

This file was deleted.

74 changes: 0 additions & 74 deletions esp32-arduino/PacketUart.cpp

This file was deleted.

10 changes: 0 additions & 10 deletions esp32-arduino/PacketUartImpl.h

This file was deleted.

107 changes: 0 additions & 107 deletions esp32-arduino/SpiBus.cpp

This file was deleted.

Loading

0 comments on commit 1502fcd

Please sign in to comment.