2021-04-04 21:04:12 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
#include <cstdint>
|
|
|
|
|
#include <vector>
|
|
|
|
|
#include <optional>
|
|
|
|
|
#include <map>
|
|
|
|
|
|
|
|
|
|
namespace Bloom::Targets
|
|
|
|
|
{
|
2021-05-25 21:50:17 +01:00
|
|
|
enum class TargetPinType: int
|
|
|
|
|
{
|
2021-04-04 21:04:12 +01:00
|
|
|
UNKNOWN,
|
|
|
|
|
GPIO,
|
|
|
|
|
GND,
|
|
|
|
|
VCC,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct TargetPinDescriptor
|
|
|
|
|
{
|
|
|
|
|
int number;
|
|
|
|
|
bool supportsGpio = false;
|
|
|
|
|
std::string name;
|
|
|
|
|
std::string padName;
|
|
|
|
|
std::vector<std::string> functions;
|
|
|
|
|
|
|
|
|
|
TargetPinType type = TargetPinType::UNKNOWN;
|
2021-06-20 22:57:09 +01:00
|
|
|
|
|
|
|
|
bool operator == (const TargetPinDescriptor& pinDescriptor) const {
|
|
|
|
|
return this->number == pinDescriptor.number
|
|
|
|
|
&& this->supportsGpio == pinDescriptor.supportsGpio
|
|
|
|
|
&& this->name == pinDescriptor.name
|
|
|
|
|
&& this->padName == pinDescriptor.padName
|
|
|
|
|
&& this->functions == pinDescriptor.functions
|
|
|
|
|
&& this->type == pinDescriptor.type
|
|
|
|
|
;
|
|
|
|
|
}
|
2021-04-04 21:04:12 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct TargetPinState
|
|
|
|
|
{
|
2021-05-25 21:50:17 +01:00
|
|
|
enum class IoState: int
|
|
|
|
|
{
|
2021-04-04 21:04:12 +01:00
|
|
|
HIGH,
|
|
|
|
|
LOW,
|
|
|
|
|
};
|
|
|
|
|
|
2021-05-25 21:50:17 +01:00
|
|
|
enum class IoDirection: int
|
|
|
|
|
{
|
2021-04-04 21:04:12 +01:00
|
|
|
INPUT,
|
|
|
|
|
OUTPUT,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
std::optional<IoState> ioState;
|
|
|
|
|
std::optional<IoDirection> ioDirection;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
using TargetPinStateMappingType = std::map<int, Bloom::Targets::TargetPinState>;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Q_DECLARE_METATYPE(Bloom::Targets::TargetPinDescriptor)
|
|
|
|
|
Q_DECLARE_METATYPE(Bloom::Targets::TargetPinState)
|
|
|
|
|
Q_DECLARE_METATYPE(Bloom::Targets::TargetPinStateMappingType)
|