spi_temperature: Provide a default value for spi_speed

All of the Maxim chips support a 4Mhz spi transfer rate, so use that
as a default spi speed.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2018-07-24 15:49:14 -04:00
parent 5b124d59f2
commit 63dffd9307
3 changed files with 3 additions and 7 deletions

View File

@ -639,9 +639,9 @@
# heater parameters. The parameters below describe sensor parameters.
#sensor_type:
# One of "MAX6675", "MAX31855", "MAX31856", or "MAX31865".
#spi_speed:
#spi_speed: 4000000
# The SPI speed (in hz) to use when communicating with the chip.
# This parameter must be provided.
# The default is 4000000.
#sensor_pin:
# The chip select line for the sensor chip. This parameter must be
# provided.

View File

@ -32,7 +32,7 @@ class SensorBase:
pin = pin_params['pin']
# SPI bus configuration
spi_oid = mcu.create_oid()
spi_speed = config.getint('spi_speed', minval=0)
spi_speed = config.getint('spi_speed', 4000000, minval=1)
mcu.add_config_cmd(
"config_spi oid=%u bus=0 pin=%s mode=1 rate=%u shutdown_msg=" % (
spi_oid, pin, spi_speed))

View File

@ -59,7 +59,6 @@ min_temp: 0
max_temp: 100
control: watermark
sensor_type: MAX6675
spi_speed: 100000
sensor_pin: ar2
[temperature_fan test_max31855]
@ -68,7 +67,6 @@ min_temp: 0
max_temp: 100
control: watermark
sensor_type: MAX31855
spi_speed: 100000
sensor_pin: ar5
[temperature_fan test_max31856]
@ -77,7 +75,6 @@ min_temp: 0
max_temp: 100
control: watermark
sensor_type: MAX31856
spi_speed: 100000
sensor_pin: ar7
[temperature_fan test_max31865]
@ -86,7 +83,6 @@ min_temp: 0
max_temp: 100
control: watermark
sensor_type: MAX31865
spi_speed: 100000
sensor_pin: ar13
[thermistor my_custom_thermistor]