Skip to content

Commit 4f5dd17

Browse files
committed
fixed all pin instances and created new interface
1 parent 53d07f3 commit 4f5dd17

7 files changed

Lines changed: 52 additions & 6 deletions

File tree

include/CCU_Constants.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
#define CCU_CONSTANTS
33

44
/* Watchdog constants */
5-
constexpr int WATCHDOG_PIN = 26;
6-
constexpr int SOFTWARE_OK_PIN = 27; // Watchdog's !RESET pin
5+
constexpr int WATCHDOG_PIN = 35;
6+
constexpr int SOFTWARE_OK_PIN = 34; // Watchdog's !RESET pin
77
constexpr unsigned long WATCHDOG_KICK_INTERVAL_MS = 10UL;
88

99
#endif

lib/interfaces/include/DisplayInterface.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ using pin = size_t;
1515

1616
namespace DISPLAY_PINS
1717
{
18-
constexpr const pin LCD_CS = 36;
18+
constexpr const pin LCD_CS = 39;
1919
constexpr const pin LCD_SCK = 13;
2020
constexpr const pin LCD_MISO = 12;
2121
constexpr const pin LCD_MOSI = 11;
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#ifndef Level2Interface
2+
#define Level2Interface
3+
4+
#include <etl/singleton.h>
5+
#include <Arduino.h>
6+
#include "CCUData.h"
7+
8+
using pin = size_t;
9+
10+
11+
/* 240V Charging Constants */
12+
namespace LEVEL2_PARAMS {
13+
14+
constexpr const pin CONTROL_V_SENSE = 37; //pin to read voltage on CP line
15+
constexpr const pin CONTROL_PWM_SENSE = 29; // pin to read PWM signal from CP
16+
constexpr const pin PROXIMITY_SENSE = 15; // pin to read voltage on PP
17+
18+
};
19+
20+
class Level2Interface
21+
{
22+
private:
23+
pin teensy_cp_v;
24+
pin teensy_cp_pwm;
25+
pin teensy_pp_v;
26+
pin enabled;
27+
28+
public:
29+
Level2Interface(
30+
pin cp_v = LEVEL2_PARAMS::CONTROL_V_SENSE,
31+
pin cp_pwm = LEVEL2_PARAMS::CONTROL_PWM_SENSE,
32+
pin pp_v = LEVEL2_PARAMS::PROXIMITY_SENSE) :
33+
teensy_cp_v(cp_v),
34+
teensy_cp_pwm(cp_pwm),
35+
teensy_pp_v(pp_v),
36+
enabled(CCUData.level_2_enabled)
37+
{};
38+
39+
void init();
40+
}

lib/interfaces/include/WatchdogInterface.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ using pin = size_t;
99
/* Watchdog Constants */
1010
namespace WATCHDOG_PARAMS {
1111

12-
constexpr const pin WATCHDOG_PIN = 26; //teensy input to watchdog
13-
constexpr const pin SOFTWARE_OK_PIN = 27; // Watchdog's !RESET pin
12+
constexpr const pin WATCHDOG_PIN = 35; //teensy input to watchdog
13+
constexpr const pin SOFTWARE_OK_PIN = 34; // Watchdog's !RESET pin
1414
constexpr unsigned long WATCHDOG_KICK_INTERVAL_MS = 10UL;
1515

1616
};
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#include "Level2Interface.h"
2+
3+
void Level2Interface::init() {
4+
pinMode(CONTROL_V_SENSE, in)
5+
}

lib/utilities/CCUData.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ struct CCUData
2626
float min_cell_temp = 0; //value given for initialization
2727
static constexpr float balancing_voltage = 3.8; //voltage at which cells begin balancing
2828
float max_board_temp;
29+
bool level_2_enabled = false; //tells CCU systems what to do
2930
};
3031

3132

src/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#include "DisplayInterface.h"
1818

1919

20-
FlexCAN_Type<CAN2> CHARGER_CAN; //placed here after debugging
20+
FlexCAN_Type<CAN3> CHARGER_CAN; //placed here after debugging
2121
FlexCAN_Type<CAN1> ACU_CAN;
2222

2323

0 commit comments

Comments
 (0)