diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2019-03-12 12:58:04 -0400 |
---|---|---|
committer | KevinOConnor <kevin@koconnor.net> | 2019-03-17 19:38:18 -0400 |
commit | 0af89e4766e5a25abb9d5d9667e2f187c4cec7c1 (patch) | |
tree | 27d5c7bd3671253dbd9bc56d06143fcf2c3cd522 /src | |
parent | 618b374ae56d1021800b10c5b8eb5e6754d60452 (diff) | |
download | kutter-0af89e4766e5a25abb9d5d9667e2f187c4cec7c1.tar.gz kutter-0af89e4766e5a25abb9d5d9667e2f187c4cec7c1.tar.xz kutter-0af89e4766e5a25abb9d5d9667e2f187c4cec7c1.zip |
thermocouple: Define thermocouple types using enumerations
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'src')
-rw-r--r-- | src/thermocouple.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/thermocouple.c b/src/thermocouple.c index 2389e7b6..412317fb 100644 --- a/src/thermocouple.c +++ b/src/thermocouple.c @@ -14,12 +14,14 @@ #include "spicmds.h" // spidev_transfer enum { - TS_CHIP_MAX31855 = 1 << 0, - TS_CHIP_MAX31856 = 1 << 1, - TS_CHIP_MAX31865 = 1 << 2, - TS_CHIP_MAX6675 = 1 << 3 + TS_CHIP_MAX31855, TS_CHIP_MAX31856, TS_CHIP_MAX31865, TS_CHIP_MAX6675 }; +DECL_ENUMERATION("thermocouple_type", "MAX31855", TS_CHIP_MAX31855); +DECL_ENUMERATION("thermocouple_type", "MAX31856", TS_CHIP_MAX31856); +DECL_ENUMERATION("thermocouple_type", "MAX31865", TS_CHIP_MAX31865); +DECL_ENUMERATION("thermocouple_type", "MAX6675", TS_CHIP_MAX6675); + struct thermocouple_spi { struct timer timer; uint32_t rest_time; @@ -49,7 +51,7 @@ void command_config_thermocouple(uint32_t *args) { uint8_t chip_type = args[2]; - if (chip_type > TS_CHIP_MAX6675 || !chip_type) + if (chip_type > TS_CHIP_MAX6675) shutdown("Invalid thermocouple chip type"); struct thermocouple_spi *spi = oid_alloc( args[0], command_config_thermocouple, sizeof(*spi)); @@ -58,7 +60,7 @@ command_config_thermocouple(uint32_t *args) spi->chip_type = chip_type; } DECL_COMMAND(command_config_thermocouple, - "config_thermocouple oid=%c spi_oid=%c chip_type=%c"); + "config_thermocouple oid=%c spi_oid=%c thermocouple_type=%c"); void command_query_thermocouple(uint32_t *args) |