Skip to content
Snippets Groups Projects
Commit 608e70d9 authored by fxk8y's avatar fxk8y :spider:
Browse files

Fault bit accessors

parent 6188e805
No related branches found
No related tags found
No related merge requests found
......@@ -176,6 +176,86 @@ namespace MAX31856 {
});
}
bool MAX31856::isTCOpenCircuit() {
return mutex.runReturn<bool> ([&]() {
SR reg;
reg.value = spi->readU8(SR::addr);
return reg.OPEN;
});
}
bool MAX31856::isTCOVUV() {
return mutex.runReturn<bool> ([&]() {
SR reg;
reg.value = spi->readU8(SR::addr);
return reg.OVUV;
});
}
bool MAX31856::isTCLOW() {
return mutex.runReturn<bool> ([&]() {
SR reg;
reg.value = spi->readU8(SR::addr);
return reg.TCLOW;
});
}
bool MAX31856::isTCHIGH() {
return mutex.runReturn<bool> ([&]() {
SR reg;
reg.value = spi->readU8(SR::addr);
return reg.TCHIGH;
});
}
bool MAX31856::isCJLOW() {
return mutex.runReturn<bool> ([&]() {
SR reg;
reg.value = spi->readU8(SR::addr);
return reg.CJLOW;
});
}
bool MAX31856::isCJHIGH() {
return mutex.runReturn<bool> ([&]() {
SR reg;
reg.value = spi->readU8(SR::addr);
return reg.CJHIGH;
});
}
bool MAX31856::isCJRANGE() {
return mutex.runReturn<bool> ([&]() {
SR reg;
reg.value = spi->readU8(SR::addr);
return reg.CJRANGE;
});
}
bool MAX31856::isTCRANGE() {
return mutex.runReturn<bool> ([&]() {
SR reg;
reg.value = spi->readU8(SR::addr);
return reg.TCRANGE;
});
}
......
......@@ -79,6 +79,13 @@ namespace MAX31856 {
union MASK {
struct __attribute__((packed)) {
u8 OpenFAULTMask : 1;
u8 OVUVFAULTMask : 1;
u8 TCLowFAULTMask : 1;
u8 TCHighFAULTMask : 1;
u8 CJLowFAULTMask : 1;
u8 CJHighFAULTMask : 1;
u8 _reserved_ : 2;
};
u8 value = 0x00;
......@@ -229,6 +236,14 @@ namespace MAX31856 {
// Info: Read only!
struct __attribute__((packed)) {
bool OPEN : 1;
bool OVUV : 1;
bool TCLOW : 1;
bool TCHIGH : 1;
bool CJLOW : 1;
bool CJHIGH : 1;
bool TCRANGE : 1;
bool CJRANGE : 1;
};
u8 value = 0x00;
......@@ -290,6 +305,14 @@ namespace MAX31856 {
void setThermocoupleType(ThermocoupleType tc);
ThermocoupleType getThermocoupleType();
bool isTCOpenCircuit(); // fault bit
bool isTCOVUV(); // fault bit
bool isTCLOW(); // fault bit
bool isTCHIGH(); // fault bit
bool isCJLOW(); // fault bit
bool isCJHIGH(); // fault bit
bool isTCRANGE(); // fault bit
bool isCJRANGE(); // fault bit
void mainLoop();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment