Got the refactor building

This commit is contained in:
2024-08-22 23:00:55 -04:00
parent 3e4f0124db
commit 3a49761b66
10 changed files with 274 additions and 224 deletions

View File

@@ -8,55 +8,58 @@
#include <array>
#include "PINOUT.h"
#include "BoardDriverTypes.h"
#include "BoardTypes.h"
#include "Vector3D.h"
// define the physical dimensions of the board
static constexpr uint32_t BOARD_WIDTH{3};
static constexpr uint32_t BOARD_LENGTH{3};
static constexpr uint32_t BOARD_HEIGHT{3};
static constexpr V3D BOARD_DIMENSIONS{BOARD_WIDTH, BOARD_LENGTH, BOARD_HEIGHT};
// define the number of stacks
static constexpr uint32_t NUMBER_STACKS{BOARD_WIDTH * BOARD_LENGTH};
// define the CubeStacks
static BoardDriverTypes::CubeStack stack1{
static BOARD_TYPES::CubeStack stack1{
.adcPin=STACK1_ADC_PIN,
.ledPin=STACK1_LED_PIN
};
static BoardDriverTypes::CubeStack stack2{
static BOARD_TYPES::CubeStack stack2{
.adcPin=STACK2_ADC_PIN,
.ledPin=STACK2_LED_PIN
};
static BoardDriverTypes::CubeStack stack3{
static BOARD_TYPES::CubeStack stack3{
.adcPin=STACK3_ADC_PIN,
.ledPin=STACK3_LED_PIN
};
static BoardDriverTypes::CubeStack stack4{
static BOARD_TYPES::CubeStack stack4{
.adcPin=STACK4_ADC_PIN,
.ledPin=STACK4_LED_PIN
};
static BoardDriverTypes::CubeStack stack5{
static BOARD_TYPES::CubeStack stack5{
.adcPin=STACK5_ADC_PIN,
.ledPin=STACK5_LED_PIN
};
static BoardDriverTypes::CubeStack stack6{
static BOARD_TYPES::CubeStack stack6{
.adcPin=STACK6_ADC_PIN,
.ledPin=STACK6_LED_PIN
};
static BoardDriverTypes::CubeStack stack7{
static BOARD_TYPES::CubeStack stack7{
.adcPin=STACK7_ADC_PIN,
.ledPin=STACK7_LED_PIN
};
static BoardDriverTypes::CubeStack stack8{
static BOARD_TYPES::CubeStack stack8{
.adcPin=STACK8_ADC_PIN,
.ledPin=STACK8_LED_PIN
};
static BoardDriverTypes::CubeStack stack9{
static BOARD_TYPES::CubeStack stack9{
.adcPin=STACK9_ADC_PIN,
.ledPin=STACK9_LED_PIN
};
static std::array<BoardDriverTypes::CubeStack, NUMBER_STACKS> stacks{
static std::array<BOARD_TYPES::CubeStack, NUMBER_STACKS> stacks{
stack1, stack2, stack3,
stack4, stack5, stack6,
stack7, stack8, stack9

View File

@@ -5,45 +5,47 @@
#pragma once
#include <cstdint>
// Stack pins
// Stack 1 pins
#define STACK1_ADC_PIN 6
#define STACK1_LED_PIN 11
static constexpr uint8_t STACK1_ADC_PIN{6};
static constexpr uint8_t STACK1_LED_PIN{11};
// Stack 2 pins
#define STACK2_ADC_PIN 16
#define STACK2_LED_PIN 14
static constexpr uint8_t STACK2_ADC_PIN{16};
static constexpr uint8_t STACK2_LED_PIN{14};
// Stack 3 pins
#define STACK3_ADC_PIN 8
#define STACK3_LED_PIN 45
static constexpr uint8_t STACK3_ADC_PIN{8};
static constexpr uint8_t STACK3_LED_PIN{45};
// Stack 4 pins
#define STACK4_ADC_PIN 5
#define STACK4_LED_PIN 10
static constexpr uint8_t STACK4_ADC_PIN{5};
static constexpr uint8_t STACK4_LED_PIN{10};
// Stack 5 pins
#define STACK5_ADC_PIN 15
#define STACK5_LED_PIN 13
static constexpr uint8_t STACK5_ADC_PIN{15};
static constexpr uint8_t STACK5_LED_PIN{13};
// Stack 6 pins
#define STACK6_ADC_PIN 18
#define STACK6_LED_PIN 38
static constexpr uint8_t STACK6_ADC_PIN{18};
static constexpr uint8_t STACK6_LED_PIN{38};
// Stack 7 pins
#define STACK7_ADC_PIN 4
#define STACK7_LED_PIN 9
static constexpr uint8_t STACK7_ADC_PIN{4};
static constexpr uint8_t STACK7_LED_PIN{9};
// Stack 8 pins
#define STACK8_ADC_PIN 7
#define STACK8_LED_PIN 12
static constexpr uint8_t STACK8_ADC_PIN{7};
static constexpr uint8_t STACK8_LED_PIN{12};
// Stack 9 pins
#define STACK9_ADC_PIN 17
#define STACK9_LED_PIN 37
static constexpr uint8_t STACK9_ADC_PIN{17};
static constexpr uint8_t STACK9_LED_PIN{37};
// Bluetooth module configuration pins
#define BT_STATE_PIN 2
#define BT_EN_PIN 3
static constexpr uint8_t BT_STATE_PIN{2};
static constexpr uint8_t BT_EN_PIN{3};

View File

@@ -5,7 +5,7 @@
class V3D{
public:
V3D(uint32_t x=0, uint32_t y=0, uint32_t z=0):
constexpr V3D(uint32_t x=0, uint32_t y=0, uint32_t z=0):
x(x),
y(y),
z(z){}
@@ -41,6 +41,14 @@ class V3D{
return vector;
}
V3D operator*(const uint32_t scalar){
V3D vector{};
vector.x = this->x * scalar;
vector.y = this->y * scalar;
vector.z = this->z * scalar;
return vector;
}
bool operator==(const V3D &other){
return this->x == other.x && this->y == other.y && this->z == other.z;
}