45 this->m_alwaysSetMode = 0;
79 this->m_alwaysSetMode = alwaysSetMode;
93 if (this->m_alwaysSetMode) {
99 dat = (uint16_t) this->m_spi->
shift_in(MAX6675::BIT_WIDTH);
129 return dat + ((float) (temp & (BIT_1 | BIT_0))) / 4;
133 static const uint32_t SPI_DEFAULT_FREQ = 1000000;
136 static const uint8_t BIT_WIDTH = 12;
141 bool m_alwaysSetMode;
void set_mask(const PropWare::Port::Mask mask)
Utility class to handle general purpose I/O pins.
void set_dir(const PropWare::Port::Dir direction) const
Set port as either input or output.
void clear() const
Clear selected output port (set it to 0)
Generic definitions and functions for the Parallax Propeller.
PropWare::ErrorCode set_clock(const int32_t frequency)
Change the SPI module's clock frequency.
float read_float()
Read data in floating point form.
void set_mosi(const Port::Mask mask)
Release the current MOSI pin as a floating input and set the new one as output.
K-type thermocouple amplifier driver using SPI communication for the Parallax Propeller.
Mode
Descriptor for SPI signal as defined by Motorola modes.
void start(const Port::Mask mosi, const Port::Mask miso, const Port::Mask sclk, const Port::Mask cs)
Initialize communication with an MAX6675 device.
void set_bit_mode(const BitMode bitmode)
Set the bitmode of SPI communication.
BitMode
Determine if data is communicated with the LSB or MSB sent/received first.
void set_miso(const Port::Mask mask)
Set the new pin as input.
uint16_t read_whole()
Read data and return integer value.
void set() const
Set selected output port high (set all pins to 1)
uint16_t read()
Read data in fixed-point form.
void set_sclk(const Port::Mask mask)
Release the current SCLK pin as a floating input and set the new one as output.
void set_mode(const Mode mode)
Set the mode of SPI communication.
SPI serial communications library; Core functionality comes from a dedicated assembly cog...
void always_set_spi_mode(const bool alwaysSetMode)
Choose whether to always set the SPI mode and bitmode before reading or writing to the chip; Useful w...
MAX6675(SPI *spi)
Construction requires an instance of the SPI module; the SPI module does not need to be started...
uint32_t shift_in(const unsigned int bits) const
Read a value from the MISO line.