mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
tests/driver_lis2dh12: add support for temperature sensor
This commit is contained in:
parent
0ab186ad50
commit
a338b65d29
@ -332,6 +332,19 @@ static int shell_is2dh12_set_scale(int argc, char **argv)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int shell_is2dh12_read_temp(int argc, char **argv)
|
||||
{
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
|
||||
int16_t temp;
|
||||
lis2dh12_read_temperature(&dev, &temp);
|
||||
|
||||
printf("%d.%02d °C\n", temp / 100, temp % 100);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const shell_command_t shell_commands[] = {
|
||||
{ "read", "Read acceleration data", shell_is2dh12_read },
|
||||
{ "read_fifo", "Read acceleration data from fifo", shell_is2dh12_read_fifo },
|
||||
@ -341,6 +354,7 @@ static const shell_command_t shell_commands[] = {
|
||||
{ "resolution", "Get/Set resolution", shell_is2dh12_set_resolution },
|
||||
{ "rate", "Get/Set sampline rate", shell_is2dh12_set_rate },
|
||||
{ "scale", "Get/Set measuring range", shell_is2dh12_set_scale },
|
||||
{ "temp", "Read temperature data", shell_is2dh12_read_temp },
|
||||
{ NULL, NULL, NULL },
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user