Discussion:
Multiple max31855 devices
(too old to reply)
tiagojbalmeida@gmail.com [nuttx]
2018-01-04 11:33:00 UTC
Permalink
I would like to register two max31855 devices for my application using the same SPI/SSP channel and controlling dataflow by using different GPIO chip select pins for each one. The SPI/SSP channel and GPIO pin would have to be defined through app config file instead of defining it on nuttx. Would that be possible to achieve and how could that be done?
spudarnia@yahoo.com [nuttx]
2018-01-04 12:58:31 UTC
Permalink
Yes, I believe you are correct. Currently it uses


SPI_SELECT(priv->spi, SPIDEV_TEMPERATURE(0), true);


I think you would have to add the devid as a uint32_t parameter to max31855_register(). Save that in the struct max31855_dev_s, then replace all occurrences of SPIDEV_TEMPERATURE(0) like:


SPI_SELECT(priv->spi, priv->devid, true);



Currently, max31855_register() is used in only one configuration so that impact would not be bad:


$ find . -name "*.c" | xargs grep max31855_register
./stm32f4discovery/src/stm32_max31855.c: ret = max31855_register(devpath, spi);


That call would have to change to:


ret = max31855_register(devpath, spi, SPIDEV_TEMPERATURE(0));


When you verify the change, I will be happy to incorporate a patch or PR (provided that you follow the coding standard)


Greg

Continue reading on narkive:
Loading...