cleanup denkfehler

This commit is contained in:
Richard Koeppe 2024-05-16 00:43:08 +02:00
parent a02331451d
commit 1e93d42520
3 changed files with 1 additions and 149 deletions

View File

@ -100,21 +100,6 @@ int main(void) {
uint16_t can_id = 0x12; /*TODO*/
uint8_t data[8] = {0}; /*TODO*/
// uint8_t size_accel = VN200::SPI::BinaryGroups::Group1::payload_sizes[VN200::SPI::BinaryGroups::Group1::Accel];
// Attempt for custom binary group
// VN200::SPI::configuration_t config;
// config.AsyncMode = 0;
// config.RateDivisor = 4;
// config.setBinaryGroups({VN200::SPI::BinaryGroups::Group1::BitOffset});
// config.setOutputFields(VN200::SPI::BinaryGroups::Group1::BitOffset,
// {VN200::SPI::BinaryGroups::Group1::OutputFields::Accel, VN200::SPI::BinaryGroups::Group1::OutputFields::Imu});
// VN200::SPI::pkg_request_write_t<VN200::SPI::configuration_t> pkg_request_write_config;
// pkg_request_write_config.header.pkg.ID = 75; /* REGISTER ID FOR FIRST OUTPUT REGISTER */
// pkg_request_write_config.payload = config;
// HAL_SPI_Transmit(&hspi1, pkg_request_write_config.to_array(), pkg_request_write_config.size(), 100);
VN200::SPI::pkg_request_read_t package_request_read_imu(VN200::SPI::IMU::ID);
VN200::SPI::pkg_response_t<VN200::SPI::IMU::imu_t> package_response_read_imu;

View File

@ -10,47 +10,6 @@
namespace VN200 {
namespace SPI {
namespace BinaryGroups {
typedef uint8_t bit_offset_t;
namespace Group1 {
// /* The bit offset of group 1 */
// const bit_offset_t BitOffset = 0;
// /* The output fields of group 1 */
// enum OutputFields {
// TimeStartup = 0,
// TimeGps,
// TimeSyncIn,
// YawPitchRoll,
// Quaternion,
// AngularRate,
// Position,
// Velocity,
// Accel,
// Imu,
// MagPres,
// DeltaTheta,
// InsStatus,
// SyncInCnt,
// TimeGpsPps,
// EMPTY15
// };
// /* TODO */
// const uint8_t payload_sizes[16] = {8, 8, 8, 12, 16, 12, 24, 12, 12, 24, 20, 28, 2, 4, 8, 0};
} // namespace Group1
} // namespace BinaryGroups
// /* Abstract base class for all packages. */
// struct binary_package_t {
// /* TODO */
// binary_package_t(){};
// /* TODO */
// virtual uint16_t size() = 0;
// /* TODO */
// virtual uint8_t *to_array() = 0;
// std::vector<uint8_t> v;
// };
/* TODO */
union header_t {
@ -76,33 +35,6 @@ union header_t {
};
};
/* TODO */
// struct configuration_t : binary_package_t {
// uint16_t AsyncMode;
// uint16_t RateDivisor;
// uint16_t OutputGroup;
// uint8_t NumOutputFields;
// uint16_t *OutputFields; /* Array with unknown size. Set in constructor. */
// /* TODO */
// configuration_t(uint8_t NumOutputFields = 1 /* TODO */) {
// OutputFields = new uint16_t[NumOutputFields];
// this->NumOutputFields = NumOutputFields;
// };
// /* TODO */
// ~configuration_t() {
// delete OutputFields;
// OutputFields = nullptr;
// }
// /* TODO */
// uint16_t size() override;
// /* TODO */
// uint8_t *to_array() override;
// /* TODO */
// void setBinaryGroups(std::vector<SPI::BinaryGroups::bit_offset_t> desired_groups);
// /* TODO */
// void setOutputFields(SPI::BinaryGroups::bit_offset_t group_bit_offset, std::vector<int> desired_output_fields);
// };
/* Writes the desired payload into the specified register */
template <typename payload_t> struct pkg_request_write_t {
struct header_t::request_t header;

View File

@ -1,70 +1,5 @@
#include "vn-interface/vn200.h"
namespace VN200 {
namespace SPI {
// payload_size_t::payload_size_t() {
// group1 = {{BinaryGroups::Group1::TimeStartup, 8}, {BinaryGroups::Group1::TimeGps, 8}, {BinaryGroups::Group1::TimeSyncIn, 8},
// {BinaryGroups::Group1::YawPitchRoll, 12}, {BinaryGroups::Group1::Quaternion, 16}, {BinaryGroups::Group1::AngularRate, 12},
// {BinaryGroups::Group1::Position, 24}, {BinaryGroups::Group1::Velocity, 12}, {BinaryGroups::Group1::Accel, 12},
// {BinaryGroups::Group1::Imu, 24}, {BinaryGroups::Group1::MagPres, 20}, {BinaryGroups::Group1::DeltaTheta, 28},
// {BinaryGroups::Group1::InsStatus, 2}, {BinaryGroups::Group1::SyncInCnt, 4}, {BinaryGroups::Group1::TimeGpsPps, 8},
// {BinaryGroups::Group1::EMPTY15, 0}};
// }
// uint16_t configuration_t::size() { return sizeof(AsyncMode) + sizeof(RateDivisor) + sizeof(OutputGroup) + NumOutputFields * sizeof(uint16_t); }
// uint8_t *configuration_t::to_array() {
// v.clear();
// v.push_back(AsyncMode && 0xFF);
// v.push_back(AsyncMode >> 8);
// v.push_back(RateDivisor && 0xFF);
// v.push_back(RateDivisor >> 8);
// v.push_back(OutputGroup && 0xFF);
// v.push_back(OutputGroup >> 8);
// for (uint8_t i = 0; i < NumOutputFields; i++) {
// v.push_back(OutputFields[i] && 0xFF);
// v.push_back(OutputFields[i] >> 8);
// }
// return &v[0];
// }
// void configuration_t::setBinaryGroups(std::vector<SPI::BinaryGroups::bit_offset_t> desired_groups) {
// bool hit = false;
// /* Iterate over every bit of the OutputGroup */
// for (uint8_t i = 0; i < 8; i++) {
// for (auto desired_group : desired_groups) {
// if (desired_group == i) {
// hit = true;
// break;
// }
// }
// if (hit) {
// OutputGroup++;
// hit = false;
// }
// OutputGroup = OutputGroup << 1;
// }
// }
// void configuration_t::setOutputFields(SPI::BinaryGroups::bit_offset_t group_bit_offset, std::vector<int> desired_output_fields) {
// bool hit = false;
// /* Iterate over every bit of the OutputGroup */
// for (uint8_t i = 0; i < 16; i++) {
// for (auto desired_output_field : desired_output_fields) {
// if (desired_output_field == i) {
// hit = true;
// break;
// }
// }
// if (hit) {
// OutputFields[group_bit_offset]++;
// hit = false;
// }
// OutputFields[group_bit_offset] = OutputFields[group_bit_offset] << 1;
// }
// }
} // namespace SPI
// namespace SPI
namespace SPI {} // namespace SPI
} // namespace VN200