-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into feature/enable_disable_source
- Loading branch information
Showing
41 changed files
with
2,845 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# | ||
# AUTO GENERATED - MARKED REGIONS WILL BE KEPT | ||
# template version 3 | ||
# | ||
|
||
# module setup: | ||
# - ${MODULE_NAME}: module name | ||
ev_setup_cpp_module() | ||
|
||
# ev@bcc62523-e22b-41d7-ba2f-825b493a3c97:v1 | ||
# insert your custom targets and additional config variables here | ||
add_subdirectory(phyverso_mcu_comms) | ||
add_subdirectory(phyverso_cli) | ||
add_subdirectory(phyverso_config) | ||
|
||
target_include_directories(${MODULE_NAME} | ||
PRIVATE | ||
"common" | ||
"phyverso_mcu_comms" | ||
"phyverso_mcu_comms/nanopb" | ||
"phyverso_mcu_comms/protobuf" | ||
"phyverso_config" | ||
) | ||
|
||
target_link_libraries(${MODULE_NAME} | ||
PRIVATE | ||
Pal::Sigslot | ||
phyverso_mcu_comms | ||
phyverso_config | ||
) | ||
# ev@bcc62523-e22b-41d7-ba2f-825b493a3c97:v1 | ||
|
||
target_sources(${MODULE_NAME} | ||
PRIVATE | ||
"connector_1/evse_board_supportImpl.cpp" | ||
"connector_2/evse_board_supportImpl.cpp" | ||
"rcd_1/ac_rcdImpl.cpp" | ||
"rcd_2/ac_rcdImpl.cpp" | ||
"connector_lock_1/connector_lockImpl.cpp" | ||
"connector_lock_2/connector_lockImpl.cpp" | ||
) | ||
|
||
# ev@c55432ab-152c-45a9-9d2e-7281d50c69c3:v1 | ||
target_sources(${MODULE_NAME} | ||
PRIVATE | ||
"board_support_common.cpp" | ||
) | ||
|
||
# install MCU configs | ||
install( | ||
DIRECTORY "." | ||
DESTINATION "${CMAKE_INSTALL_SYSCONFDIR}/everest" | ||
FILES_MATCHING PATTERN "*.json" | ||
) | ||
# ev@c55432ab-152c-45a9-9d2e-7281d50c69c3:v1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// Copyright Pionix GmbH and Contributors to EVerest | ||
|
||
#include "PhyVersoBSP.hpp" | ||
#include <filesystem> | ||
|
||
namespace module { | ||
|
||
void PhyVersoBSP::init() { | ||
// initialize serial driver | ||
if (!serial.open_device(config.serial_port.c_str(), config.baud_rate)) { | ||
EVLOG_AND_THROW(EVEXCEPTION(Everest::EverestConfigError, "Could not open serial port ", config.serial_port, | ||
" with baud rate ", config.baud_rate)); | ||
return; | ||
} | ||
|
||
invoke_init(*p_connector_1); | ||
invoke_init(*p_connector_2); | ||
invoke_init(*p_rcd_1); | ||
invoke_init(*p_rcd_2); | ||
invoke_init(*p_connector_lock_1); | ||
invoke_init(*p_connector_lock_2); | ||
|
||
std::filesystem::path mcu_config_file = config.mcu_config_file; | ||
|
||
if (mcu_config_file.is_relative()) { | ||
// Add everest config folder prefix if relative path is given | ||
mcu_config_file = info.paths.etc / mcu_config_file; | ||
} | ||
|
||
if (!verso_config.open_file(mcu_config_file.string())) { | ||
EVLOG_AND_THROW(EVEXCEPTION(Everest::EverestConfigError, "Could not open config file ", mcu_config_file)); | ||
} | ||
|
||
serial.signal_config_request.connect([&]() { | ||
serial.send_config(verso_config); | ||
EVLOG_info << "Sent config packet to MCU"; | ||
}); | ||
} | ||
|
||
void PhyVersoBSP::ready() { | ||
serial.run(); | ||
|
||
invoke_ready(*p_connector_1); | ||
invoke_ready(*p_connector_2); | ||
invoke_ready(*p_rcd_1); | ||
invoke_ready(*p_rcd_2); | ||
invoke_ready(*p_connector_lock_1); | ||
invoke_ready(*p_connector_lock_2); | ||
} | ||
|
||
} // namespace module |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// Copyright Pionix GmbH and Contributors to EVerest | ||
|
||
#ifndef PHY_VERSO_BSP_HPP | ||
#define PHY_VERSO_BSP_HPP | ||
|
||
// | ||
// AUTO GENERATED - MARKED REGIONS WILL BE KEPT | ||
// template version 2 | ||
// | ||
|
||
#include "ld-ev.hpp" | ||
|
||
// headers for provided interface implementations | ||
#include <generated/interfaces/ac_rcd/Implementation.hpp> | ||
#include <generated/interfaces/connector_lock/Implementation.hpp> | ||
#include <generated/interfaces/evse_board_support/Implementation.hpp> | ||
|
||
// ev@4bf81b14-a215-475c-a1d3-0a484ae48918:v1 | ||
// insert your custom include headers here | ||
#include "phyverso_mcu_comms/evSerial.h" | ||
// ev@4bf81b14-a215-475c-a1d3-0a484ae48918:v1 | ||
|
||
namespace module { | ||
|
||
struct Conf { | ||
std::string serial_port; | ||
int baud_rate; | ||
int reset_gpio; | ||
std::string mcu_config_file; | ||
int conn1_max_current_A_import; | ||
int conn1_min_current_A_import; | ||
int conn1_min_phase_count_import; | ||
int conn1_max_phase_count_import; | ||
int conn1_min_current_A_export; | ||
int conn1_max_current_A_export; | ||
int conn1_min_phase_count_export; | ||
int conn1_max_phase_count_export; | ||
bool conn1_has_socket; | ||
bool conn1_dc; | ||
int conn2_max_current_A_import; | ||
int conn2_min_current_A_import; | ||
int conn2_min_phase_count_import; | ||
int conn2_max_phase_count_import; | ||
int conn2_min_current_A_export; | ||
int conn2_max_current_A_export; | ||
int conn2_min_phase_count_export; | ||
int conn2_max_phase_count_export; | ||
bool conn2_has_socket; | ||
bool conn2_dc; | ||
}; | ||
|
||
class PhyVersoBSP : public Everest::ModuleBase { | ||
public: | ||
PhyVersoBSP() = delete; | ||
PhyVersoBSP(const ModuleInfo& info, Everest::MqttProvider& mqtt_provider, Everest::TelemetryProvider& telemetry, | ||
std::unique_ptr<evse_board_supportImplBase> p_connector_1, | ||
std::unique_ptr<evse_board_supportImplBase> p_connector_2, std::unique_ptr<ac_rcdImplBase> p_rcd_1, | ||
std::unique_ptr<ac_rcdImplBase> p_rcd_2, std::unique_ptr<connector_lockImplBase> p_connector_lock_1, | ||
std::unique_ptr<connector_lockImplBase> p_connector_lock_2, Conf& config) : | ||
ModuleBase(info), | ||
mqtt(mqtt_provider), | ||
telemetry(telemetry), | ||
p_connector_1(std::move(p_connector_1)), | ||
p_connector_2(std::move(p_connector_2)), | ||
p_rcd_1(std::move(p_rcd_1)), | ||
p_rcd_2(std::move(p_rcd_2)), | ||
p_connector_lock_1(std::move(p_connector_lock_1)), | ||
p_connector_lock_2(std::move(p_connector_lock_2)), | ||
config(config){}; | ||
|
||
Everest::MqttProvider& mqtt; | ||
Everest::TelemetryProvider& telemetry; | ||
const std::unique_ptr<evse_board_supportImplBase> p_connector_1; | ||
const std::unique_ptr<evse_board_supportImplBase> p_connector_2; | ||
const std::unique_ptr<ac_rcdImplBase> p_rcd_1; | ||
const std::unique_ptr<ac_rcdImplBase> p_rcd_2; | ||
const std::unique_ptr<connector_lockImplBase> p_connector_lock_1; | ||
const std::unique_ptr<connector_lockImplBase> p_connector_lock_2; | ||
const Conf& config; | ||
|
||
// ev@1fce4c5e-0ab8-41bb-90f7-14277703d2ac:v1 | ||
// insert your public definitions here | ||
evSerial serial; | ||
// ev@1fce4c5e-0ab8-41bb-90f7-14277703d2ac:v1 | ||
|
||
protected: | ||
// ev@4714b2ab-a24f-4b95-ab81-36439e1478de:v1 | ||
// insert your protected definitions here | ||
// ev@4714b2ab-a24f-4b95-ab81-36439e1478de:v1 | ||
|
||
private: | ||
friend class LdEverest; | ||
void init(); | ||
void ready(); | ||
|
||
// ev@211cfdbe-f69a-4cd6-a4ec-f8aaa3d1b6c8:v1 | ||
// insert your private definitions here | ||
evConfig verso_config; | ||
// ev@211cfdbe-f69a-4cd6-a4ec-f8aaa3d1b6c8:v1 | ||
}; | ||
|
||
// ev@087e516b-124c-48df-94fb-109508c7cda9:v1 | ||
// insert other definitions here | ||
// ev@087e516b-124c-48df-94fb-109508c7cda9:v1 | ||
|
||
} // namespace module | ||
|
||
#endif // PHY_VERSO_BSP_HPP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// Copyright Pionix GmbH and Contributors to EVerest | ||
|
||
#include "board_support_common.hpp" | ||
|
||
namespace module { | ||
|
||
types::board_support_common::BspEvent to_bsp_event(CpState s) { | ||
switch (s) { | ||
case CpState_STATE_A: | ||
return {types::board_support_common::Event::A}; | ||
case CpState_STATE_B: | ||
return {types::board_support_common::Event::B}; | ||
case CpState_STATE_C: | ||
return {types::board_support_common::Event::C}; | ||
case CpState_STATE_D: | ||
return {types::board_support_common::Event::D}; | ||
case CpState_STATE_E: | ||
return {types::board_support_common::Event::E}; | ||
case CpState_STATE_F: | ||
return {types::board_support_common::Event::F}; | ||
// This should never happen | ||
default: | ||
return {types::board_support_common::Event::F}; | ||
} | ||
} | ||
|
||
types::board_support_common::BspEvent to_bsp_event(CoilState s) { | ||
// TODO: implement coil type handling | ||
if (s.coil_state) { | ||
return {types::board_support_common::Event::PowerOn}; | ||
} else { | ||
return {types::board_support_common::Event::PowerOff}; | ||
} | ||
} | ||
} // namespace module |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// Copyright Pionix GmbH and Contributors to EVerest | ||
|
||
#ifndef EVSE_BOARD_SUPPORT_COMMON_HPP | ||
#define EVSE_BOARD_SUPPORT_COMMON_HPP | ||
|
||
#include "phyverso.pb.h" | ||
#include <generated/interfaces/evse_board_support/Implementation.hpp> | ||
|
||
namespace module { | ||
types::board_support_common::BspEvent to_bsp_event(CpState s); | ||
types::board_support_common::BspEvent to_bsp_event(CoilState s); | ||
} // namespace module | ||
|
||
#endif // EVSE_BOARD_SUPPORT_COMMON_HPP |
Oops, something went wrong.