Update README

This commit is contained in:
Gregory Nutt 2015-01-07 06:23:24 -06:00
parent 9dd82a5f08
commit 1446092e95
2 changed files with 45 additions and 18 deletions

View File

@ -692,7 +692,7 @@ Temperature Sensor
will read the current temperature from an LM75 compatible temperature sensor will read the current temperature from an LM75 compatible temperature sensor
and print the temperature on stdout in either units of degrees Fahrenheit or and print the temperature on stdout in either units of degrees Fahrenheit or
Centigrade. This tiny command line application is enabled with the following Centigrade. This tiny command line application is enabled with the following
configuratin options: configuration options:
Library Library
CONFIG_LIBM=y CONFIG_LIBM=y

View File

@ -347,28 +347,55 @@ events as follows:
Temperature Sensor Temperature Sensor
================== ==================
Support for the on-board LM-75 temperature sensor is available. This supported LM-75 Temperature Sensor Driver
has been verified, but has not been included in any of the available the -------------------------------
configurations. To set up the temperature sensor, add the following to the Support for the on-board LM-75 temperature sensor is available. This
NuttX configuration file support has been verified, but has not been included in any of the
available the configurations. To set up the temperature sensor, add the
following to the NuttX configuration file
CONFIG_I2C=y Drivers -> Sensors
CONFIG_I2C_LM75=y CONFIG_LM75=y
CONFIG_I2C_LM75=y
Then you can implement logic like the following to use the temperature sensor: Then you can implement logic like the following to use the temperature
sensor:
#include <nuttx/sensors/lm75.h> #include <nuttx/sensors/lm75.h>
#include <arch/board/board.h> #include <arch/board/board.h>
ret = stm32_lm75initialize("/dev/temp"); /* Register the temperature sensor */ ret = stm32_lm75initialize("/dev/temp"); /* Register the temperature sensor */
fd = open("/dev/temp", O_RDONLY); /* Open the temperature sensor device */ fd = open("/dev/temp", O_RDONLY); /* Open the temperature sensor device */
ret = ioctl(fd, SNIOC_FAHRENHEIT, 0); /* Select Fahrenheit */ ret = ioctl(fd, SNIOC_FAHRENHEIT, 0); /* Select Fahrenheit */
bytesread = read(fd, buffer, 8*sizeof(b16_t)); /* Read temperature samples */ bytesread = read(fd, buffer, 8*sizeof(b16_t)); /* Read temperature samples */
More complex temperature sensor operations are also available. See the IOCTL More complex temperature sensor operations are also available. See the
commands enumerated in include/nuttx/sensors/lm75.h. Also read the descriptions IOCTL commands enumerated in include/nuttx/sensors/lm75.h. Also read the
of the stm32_lm75initialize() and stm32_lm75attach() interfaces in the escriptions of the stm32_lm75initialize() and stm32_lm75attach()
arch/board/board.h file (sames as configs/stm3210e-eval/include/board.h). interfaces in the arch/board/board.h file (sames as
configs/stm3210e-eval/include/board.h).
NSH Command Line Application
----------------------------
There is a tiny NSH command line application at examples/system/lm75 that
will read the current temperature from an LM75 compatible temperature sensor
and print the temperature on stdout in either units of degrees Fahrenheit or
Centigrade. This tiny command line application is enabled with the following
configuration options:
Library
CONFIG_LIBM=y
CONFIG_LIBC_FLOATINGPOINT=y
Applications -> NSH Library
CONFIG_NSH_ARCHINIT=y
Applications -> System Add-Ons
CONFIG_SYSTEM_LM75=y
CONFIG_SYSTEM_LM75_DEVNAME="/dev/temp"
CONFIG_SYSTEM_LM75_FAHRENHEIT=y (or CENTIGRADE)
CONFIG_SYSTEM_LM75_STACKSIZE=1024
CONFIG_SYSTEM_LM75_PRIORITY=100
RTC RTC
=== ===