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

Completing register skeletons

parent e4565831
No related branches found
No related tags found
No related merge requests found
......@@ -154,18 +154,13 @@ namespace MAX31856 {
/*
void MAX31856::setThermocoupleType(ThermocoupleType tc) {
return mutex.run ([&]() {
CR1 reg;
reg.value = spi->readU8(CR1::addr);
if (pfr == F60Hz) reg.PWRLNRJ = 0;
else reg.PWRLNRJ = 1;
reg.TCTYPE = tc;
spi->writeU8(CR1::addr, reg.value);
});
......@@ -177,9 +172,7 @@ namespace MAX31856 {
CR1 reg;
reg.value = spi->readU8(CR1::addr);
// TODO: Can this be done by casting?
if (reg.PWRLNRJ == 0) return F60Hz;
else return F50Hz;
return (ThermocoupleType)reg.TCTYPE;
});
}
......@@ -187,13 +180,6 @@ namespace MAX31856 {
*/
......
......@@ -36,6 +36,12 @@ namespace MAX31856 {
};
// #################################
// ### ###
// ### Register Declarations ###
// ### ###
// #################################
union CR0 {
struct __attribute__((packed)) {
......@@ -150,36 +156,89 @@ namespace MAX31856 {
};
union CJTO {
struct __attribute__((packed)) {
};
u8 value = 0x00;
static constexpr u8 addr = 0x09;
};
union CJTH {
struct __attribute__((packed)) {
};
u8 value = 0x00;
static constexpr u8 addr = 0x0A;
};
union CJTL {
struct __attribute__((packed)) {
};
u8 value = 0x00;
static constexpr u8 addr = 0x0B;
};
union LTCBH {
// Info: Read only!
struct __attribute__((packed)) {
};
u8 value = 0x00;
static constexpr u8 addr = 0x0C;
};
union LTCBM {
// Info: Read only!
struct __attribute__((packed)) {
};
u8 value = 0x00;
static constexpr u8 addr = 0x0D;
/*
};
union _ {
union LTCBL {
// Info: Read only!
struct __attribute__((packed)) {
};
u8 value = 0x00;
static constexpr u8 addr = 0x00;
static constexpr u8 addr = 0x0E;
};
*/
union SR {
// Info: Read only!
struct __attribute__((packed)) {
};
u8 value = 0x00;
static constexpr u8 addr = 0x0F;
};
// #################################
// #################################
......@@ -228,6 +287,9 @@ namespace MAX31856 {
void setPwrLnRjFrq(PowerlineFrequencyRejection pfr); // TODO: Better Name…?!
PowerlineFrequencyRejection getPwrLnRjFrq(); // TODO: Better Name…?!
void setThermocoupleType(ThermocoupleType tc);
ThermocoupleType getThermocoupleType();
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