Trivial changes from review of last PR.

This commit is contained in:
Gregory Nutt 2017-09-14 15:04:43 -06:00
parent bbade5522d
commit 8beab59e0d
3 changed files with 12 additions and 6 deletions

View File

@ -735,6 +735,12 @@ examples/leds
^^^^^^^^^^^^
This is a simple test of the board LED driver at nuttx/drivers/leds/userled_*.c.
examples/lis2csh_reader
^^^^^^^^^^^^^^^^^^^^^^^
A simple reader example for the LIS3DSH acceleration sensor as found on
STM32F4Discovery rev. C
examples/ltdc
^^^^^^^^^^^^^

View File

@ -7,7 +7,7 @@ config EXAMPLES_LIS3DSH_READER
bool "LIS3DSH acceleration reader example"
default n
depends on LIS3DSH
depends on SPI_EXCHANGE
depends on SPI_EXCHANGE
---help---
Enable the LIS3DSH reader example

View File

@ -1,4 +1,4 @@
/*
/****************************************************************************
* lis3dsh_reader_main.c
*
* Copyright (C) 2017 Florian Olbrich. All rights reserved.
@ -59,8 +59,6 @@ int lis3dsh_reader_main(int argc, FAR char *argv[])
#endif
{
FILE *acc;
acc = fopen("/dev/acc0", "r");
struct acc_data_t
{
int16_t x;
@ -68,14 +66,16 @@ int lis3dsh_reader_main(int argc, FAR char *argv[])
int16_t z;
} acc_data;
acc = fopen("/dev/acc0", "r");
for (uint8_t i = 0; 1; i++)
{
fread( &acc_data, 6, 1, acc );
printf("x: %4d y: %4d z: %4d \r", acc_data.x, acc_data.y, acc_data.z);
printf("x: %4d y: %4d z: %4d \r",
acc_data.x, acc_data.y, acc_data.z);
usleep(300);
}
fclose(acc);
return EXIT_SUCCESS;
}