Skip to content

Commit bebf66b

Browse files
authored
Merge pull request #26 from formulaslug/pdb
Merge Pdb into main
2 parents 94eec85 + 58dcffc commit bebf66b

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

PDB/main.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,11 +106,22 @@ int main(){
106106
printf("entering main\n");
107107

108108
can = new CAN(PA_11, PA_12, 500000);
109+
can->filter(0x188, 0xFF, CANAny); //ACC_TPDO_STATUS TODO: does this even work?
109110

110111
queue.call_every(200ms, send_PDB_TPDO_POWER_A);
111112
queue.call_every(200ms, send_PDB_TPDO_POWER_B);
112113

113114
while (true) {
115+
116+
CANMessage msg;
117+
while (can->read(msg)) {
118+
if (msg.id == 0x188) // ACC_TPDO_STATUS
119+
{
120+
bool precharge_done = msg.data[0] & 0x08;
121+
dcdc_ctrl.write(precharge_done);
122+
}
123+
}
124+
114125
for (int i = 0; i < 16; i++)
115126
{
116127
S0.write(i & 0x1);

0 commit comments

Comments
 (0)