Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions src/encoders/mt6835/MT6835.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,21 @@ uint8_t MT6835::getStatus(){
return laststatus;
};

uint8_t MT6835::getCalibrationStatus(){
uint8_t data[3] = {0};
data[0] = MT6835_OP_READ << 4 | MT6835_REG_CAL_STATUS >> 8;
data[1] = MT6835_REG_CAL_STATUS;

spi->beginTransaction(settings);
if(nCS >= 0)
digitalWrite(nCS, LOW);
spi->transfer(data, 3);
if(nCS >= 0)
digitalWrite(nCS, HIGH);
spi->endTransaction();

return data[2] >> 6;
}

bool MT6835::setZeroFromCurrentPosition(){
MT6835Command cmd;
Expand Down
2 changes: 2 additions & 0 deletions src/encoders/mt6835/MT6835.h
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,8 @@ class MT6835 {

uint8_t getStatus();

uint8_t getCalibrationStatus();

bool setZeroFromCurrentPosition();
bool writeEEPROM(); // wait 6s after calling this method

Expand Down