diff --git a/examples/README.txt b/examples/README.txt index e2888208e..72f1941f3 100644 --- a/examples/README.txt +++ b/examples/README.txt @@ -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 ^^^^^^^^^^^^^ diff --git a/examples/lis3dsh_reader/Kconfig b/examples/lis3dsh_reader/Kconfig index ac2bdf6d3..dd2ff8940 100755 --- a/examples/lis3dsh_reader/Kconfig +++ b/examples/lis3dsh_reader/Kconfig @@ -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 diff --git a/examples/lis3dsh_reader/lis3dsh_reader_main.c b/examples/lis3dsh_reader/lis3dsh_reader_main.c index e21c6b2d9..e3a63057d 100644 --- a/examples/lis3dsh_reader/lis3dsh_reader_main.c +++ b/examples/lis3dsh_reader/lis3dsh_reader_main.c @@ -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; }