Add extracted tools: CitrineOS, OpenOCPP, ShapeShifter

- CitrineOS core extracted (CSMS OCPP 2.0.1)
- OpenOCPP extracted (firmware OCPP 1.6J/2.0.1)
- ShapeShifter library installed (pip install -e)
- ShapeShifter specification extracted
- EVerest extracted

TODO updated with progress
This commit is contained in:
Eric F
2026-06-08 00:38:27 -04:00
parent 468cfeaa50
commit d398a6ced2
7326 changed files with 1177561 additions and 7 deletions

View File

@@ -0,0 +1,9 @@
load("@rules_cc//cc:defs.bzl", "cc_library")
cc_library(
name = "gpio",
srcs = ["src/gpio.cpp"],
hdrs = ["include/everest/gpio/gpio.hpp"],
visibility = ["//visibility:public"],
includes = ["include"],
)

View File

@@ -0,0 +1,30 @@
add_library(gpio STATIC)
add_library(everest::gpio ALIAS gpio)
ev_register_library_target(gpio)
target_sources(gpio
PRIVATE
src/gpio.cpp
)
target_include_directories(gpio
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
)
target_link_libraries(gpio
PRIVATE
)
install(TARGETS gpio
EXPORT everest-core-targets
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR}
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/everest
DESTINATION include
FILES_MATCHING PATTERN "*.hpp"
)

View File

@@ -0,0 +1,65 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright 2023 Pionix GmbH and Contributors to EVerest
/*
This is a simple wrapper for accessing GPIOs via the Linux kernel's
GPIO Character Device Userspace API (v1). This API was introduced in Linux
kernel version 4.8.
This wrapper attempts to provide a simple interface to that API, for uses
in EVerest where simply setting or reading of a single GPIO is required.
*/
#ifndef GPIO_HPP
#define GPIO_HPP
#include <string>
namespace Everest {
struct GpioSettings {
std::string chip_name;
int line_number{0};
bool inverted{false};
};
class Gpio {
public:
// open GPIO line
bool open(const std::string& chip_name, int line_number, bool inverted = false);
bool open(const GpioSettings& settings);
// free GPIO line
void close_all();
// Update the pin value in output mode. Do nothing in input mode.
void set(bool value);
// Set output mode with an initial value.
bool set_output(bool initial_value);
// Normally true means high, false means low. By setting this to true all outputs and inputs are inverted.
void invert_pin(bool inverted);
// Set to input mode.
bool set_input();
// Returns current pin value
bool read();
// indicated whether GPIO is ready to be used
bool is_ready();
private:
int fd{0};
int line_fd{0};
int line_number{0};
// flag to indicate wether GPIO is ready to be used
bool ready{false};
// set to true to invert both input and output values
bool inverted{false};
};
} // namespace Everest
#endif

View File

@@ -0,0 +1,120 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright 2023 Pionix GmbH and Contributors to EVerest
#include <everest/gpio/gpio.hpp>
#include <fcntl.h>
#include <linux/gpio.h>
#include <stdlib.h>
#include <sys/ioctl.h>
#include <system_error>
#include <unistd.h>
namespace Everest {
bool Gpio::open(const std::string& chip_name, int _line_number, bool _inverted) {
inverted = _inverted;
line_number = _line_number;
ready = false;
if (chip_name != "") {
fd = ::open(("/dev/" + chip_name).c_str(), O_RDONLY);
if (fd > 0) {
ready = true;
}
}
return ready;
}
bool Gpio::open(const GpioSettings& settings) {
return open(settings.chip_name, settings.line_number, settings.inverted);
}
void Gpio::close_all() {
if (ready) {
close(fd);
close(line_fd);
}
}
bool Gpio::set_output(bool initial_value) {
if (ready) {
if (inverted) {
initial_value = !initial_value;
}
struct gpiohandle_request rq;
rq.lineoffsets[0] = line_number;
rq.lines = 1;
rq.flags = GPIOHANDLE_REQUEST_OUTPUT;
int ret = ioctl(fd, GPIO_GET_LINEHANDLE_IOCTL, &rq);
line_fd = rq.fd;
if (ret < 0) {
ready = false;
}
set(initial_value);
}
return ready;
}
bool Gpio::set_input() {
if (ready) {
struct gpiohandle_request rq;
rq.lineoffsets[0] = line_number;
rq.lines = 1;
rq.flags = GPIOHANDLE_REQUEST_INPUT;
int ret = ioctl(fd, GPIO_GET_LINEHANDLE_IOCTL, &rq);
line_fd = rq.fd;
if (ret < 0)
ready = false;
}
return ready;
}
void Gpio::set(bool value) {
if (ready) {
if (inverted) {
value = !value;
}
struct gpiohandle_data data;
data.values[0] = (value ? 1 : 0);
int ret = ioctl(line_fd, GPIOHANDLE_SET_LINE_VALUES_IOCTL, &data);
if (ret < 0) {
ready = false;
}
}
}
bool Gpio::read() {
bool value = false;
if (ready) {
struct gpiohandle_data data;
int ret = ioctl(line_fd, GPIOHANDLE_GET_LINE_VALUES_IOCTL, &data);
if (ret < 0)
ready = false;
value = (data.values[0] == 1);
if (inverted) {
value = !value;
}
}
return value;
}
void Gpio::invert_pin(bool _inverted) {
inverted = _inverted;
}
bool Gpio::is_ready() {
return ready;
}
} // namespace Everest