|
PropWare
3.0.0.229
C++ objects and CMake build system for Parallax Propeller
|
Go to the documentation of this file.
44 m_alwaysSetMode(alwaysSetMode) {
61 const bool alwaysSetMode =
false)
62 : m_cs(cs,
Pin::Dir::OUT),
64 m_alwaysSetMode(alwaysSetMode) {
85 this->m_alwaysSetMode = alwaysSetMode;
99 if (this->m_alwaysSetMode) {
100 this->m_spi->
set_clock(SPI_DEFAULT_FREQ);
106 dat = (uint16_t) this->m_spi->
shift_in(MAX6675::BIT_WIDTH);
136 return dat + ((
float) (temp & (BIT_1 | BIT_0))) / 4;
140 static const uint32_t SPI_DEFAULT_FREQ = 8000000;
142 static const SPI::BitMode SPI_BITMODE = SPI::BitMode::MSB_FIRST;
143 static const uint8_t BIT_WIDTH = 12;
148 bool m_alwaysSetMode;
void set_bit_mode(const BitMode bitmode)
Set the bitmode of SPI communication.
void set_sclk(const Port::Mask mask)
Release the current SCLK pin as a floating input and set the new one as output.
float read_float()
Read data in floating point form.
MAX6675(SPI &spi, const Port::Mask mosi, const Port::Mask miso, const Port::Mask sclk, const Port::Mask cs, const bool alwaysSetMode=false)
SPI serial communications library; Core functionality comes from a dedicated assembly cog.
uint32_t shift_in(const unsigned int bits) const
Read a value from the MISO line.
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...
static SPI & get_instance()
Best way to access an SPI instance is through here, where you can get a shared instance of the SPI mo...
Utility class to handle general purpose I/O pins.
PropWare::ErrorCode set_clock(const uint32_t frequency)
Change the SPI module's clock frequency.
void set() const
Set selected output port high (set all pins to 1)
void set_mosi(const Port::Mask mask)
Release the current MOSI pin as a floating input and set the new one as output.
void set_mode(const Mode mode)
Set the mode of SPI communication.
BitMode
Determine if data is communicated with the LSB or MSB sent/received first.
uint16_t read()
Read data in fixed-point form.
Generic definitions and functions for the Parallax Propeller.
void clear() const
Clear selected output port (set it to 0)
void set_miso(const Port::Mask mask)
Set the new pin as input.
K-type thermocouple amplifier driver using SPI communication for the Parallax Propeller.
uint16_t read_whole()
Read data and return integer value.
Mode
Descriptor for SPI signal as defined by Motorola modes.