summaryrefslogtreecommitdiff
path: root/SPI.c
diff options
context:
space:
mode:
authorJoshua Drake <Joshua.Ellis.Drake@gmail.com>2024-06-06 16:23:43 -0500
committerJoshua Drake <Joshua.Ellis.Drake@gmail.com>2024-06-06 16:23:43 -0500
commited2644ef4e934f2f7cf93890760737790925a1c8 (patch)
tree9acece7182c9dde4d3bd665705a8f795e8b2fc8a /SPI.c
parentf54fe1d4bfdec539ec9143d1ec9040bb737e850a (diff)
Changed loss of connection behavior and cleaned up code.
Diffstat (limited to 'SPI.c')
-rw-r--r--SPI.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/SPI.c b/SPI.c
index 96a18a8..1fff384 100644
--- a/SPI.c
+++ b/SPI.c
@@ -38,7 +38,7 @@
if(Ohm_150>7)WriteBuffer[3] = 0x7f;
else WriteBuffer[3] = (0x7f >> (7-Ohm_150));// + ((Ohm_68 - 4)<<7);
- WriteBuffer[5] = 0xff >> (15-Ohm_150);
+ WriteBuffer[5] = 0xff << (15-Ohm_150);
if(Ohm_68<5)WriteBuffer[1] = ((0xf0 >> (Ohm_68))&0x0f)| (testLED << 7);
else {WriteBuffer[1] = 0x0f | (testLED << 7); WriteBuffer[3] |= 0x80;}
//WriteBuffer[1] = 0xFF;
@@ -46,15 +46,16 @@
SPI_slaveSelect();
readData = MSSP1_SPI_Exchange8bitBuffer(WriteBuffer, 6, ReadBuffer);
SPI_slaveDeselect();
+ //if(ReadBuffer[5]>0)_LATB8 = 0;
}
void active(uint8_t *activeResistors)
{
- WriteBuffer[0] = WriteBuffer[2] = WriteBuffer[4] = 0x40;
+ WriteBuffer[0] = WriteBuffer[2] = WriteBuffer[4] = 0x40; //Output driver data will be received by host controller after next message is sent.
WriteBuffer[1] = WriteBuffer[3] = WriteBuffer[5] = 0x02;
SPI_slaveSelect();
readData = MSSP1_SPI_Exchange8bitBuffer(WriteBuffer, 6, ReadBuffer);
SPI_slaveDeselect();
- WriteBuffer[0] = WriteBuffer[2] = WriteBuffer[4] = 0x00;
+ WriteBuffer[0] = WriteBuffer[2] = WriteBuffer[4] = 0x00; //Output diagnostic data on next frame
WriteBuffer[1] = WriteBuffer[3] = WriteBuffer[5] = 0x00;
SPI_slaveSelect();
readData = MSSP1_SPI_Exchange8bitBuffer(WriteBuffer, 6, ReadBuffer);
@@ -132,12 +133,10 @@
SPI_slaveDeselect();
}
- void Message_HWCROCL(uint8_t outputs[3])
+ void Message_HWCROCL()
{
WriteBuffer[0] = WriteBuffer[2] = WriteBuffer[4] = 0x8D;
- WriteBuffer[1] = outputs[0];
- WriteBuffer[3] = outputs[1];
- WriteBuffer[5] = outputs[2];
+ WriteBuffer[1] = WriteBuffer[3] = WriteBuffer[5] = 0xff;
}
void Message_HWCRPWM(uint8_t outputs[3])