Skip to content

Commit

Permalink
Added i2c input handler for long variable
Browse files Browse the repository at this point in the history
 - Progress on #22
  • Loading branch information
pyr0ball committed Jul 6, 2019
1 parent 7877456 commit 95ea534
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions firmware/AVR-Source/Pyr0_Piezo_Sensor_v2.x.x/pP_i2c.cpp
Expand Up @@ -10,7 +10,7 @@ void pP_i2c::i2cInput(int bytesReceived) {
cmdRcvd[a] = Wire.receive();
}
else {
Wire.receive();
longRcvd[a] = Wire.receive();
}
}
if (bytesReceived == 1 && (cmdRcvd[0] < regMapSize)) {
Expand Down Expand Up @@ -46,7 +46,7 @@ void pP_i2c::i2cInput(int bytesReceived) {
return;
break;
case 0x06:
voltMeterConstant = (uint8_t) cmdRcvd[1];
voltMeterConstant = longRcvd[0]*65536+longRcvd[1]*256+longRcvd[2];
return;
break;
default:
Expand Down
4 changes: 3 additions & 1 deletion firmware/AVR-Source/Pyr0_Piezo_Sensor_v2.x.x/pP_i2c.h
Expand Up @@ -16,10 +16,12 @@

/*-------------------------Variables------------------------*/
#define regMapSize 7
#define maxBytes 3
#define maxBytes 2
#define longBytes 4
byte regMap[regMapSize];
byte regMapTemp[regMapSize];
byte cmdRcvd[maxBytes];
byte longRcvd[longBytes];

/*------------------------------------------------*/

Expand Down

0 comments on commit 95ea534

Please sign in to comment.