Permalink
Browse files

examples: cleanup examples directory

Following changes are done as a part of cleanup:

1. Moved the platform specific `C` examples from top level examples/
directory to platform/ subdirectory and renamed helloedison.c to
gpio_edison.c

2. C specific examples are moved to a new c/ subdirectory. As a part
of this process, examples are modified to follow same standards
and few new examples are also added.

3. Include the newly added C examples to relevant API documentation

4. Ran clang-format for all source files in c/, c++/, platform/
subdirectories

Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
  • Loading branch information...
Mani-Sadhasivam authored and arfoll committed Nov 17, 2017
1 parent 3fb65de commit e562c774cf980a4cc52359edeba37cc64b0dc2e9
Showing with 1,539 additions and 1,022 deletions.
  1. +2 −0 Doxyfile.in
  2. +1 −1 api/mraa/aio.h
  3. +1 −1 api/mraa/gpio.h
  4. +1 −1 api/mraa/i2c.h
  5. +1 −1 api/mraa/iio.h
  6. +1 −0 api/mraa/led.h
  7. +1 −1 api/mraa/pwm.h
  8. +1 −1 api/mraa/spi.h
  9. +2 −45 examples/CMakeLists.txt
  10. +0 −73 examples/analogin_a0.c
  11. +0 −104 examples/blink-io.c
  12. +0 −108 examples/blink_onboard.c
  13. +2 −2 examples/c++/I2c-compass.cpp
  14. +50 −44 examples/c++/Iio-dummy.cpp
  15. +1 −1 examples/c++/Pwm3-cycle.cpp
  16. +1 −1 examples/c++/Spi-pot.cpp
  17. +2 −2 examples/c++/Uart-example.cpp
  18. +1 −1 examples/c++/UartOW.cpp
  19. +3 −2 examples/c++/initio.cpp
  20. +36 −0 examples/c/CMakeLists.txt
  21. +99 −0 examples/c/aio.c
  22. +147 −0 examples/c/gpio.c
  23. +94 −0 examples/c/gpio_advanced.c
  24. examples/{ → c}/hellomraa.c
  25. +121 −33 examples/{i2c_HMC5883L.c → c/i2c_hmc5883l.c}
  26. +170 −0 examples/c/i2c_mpu6050.c
  27. +172 −0 examples/c/iio.c
  28. +108 −0 examples/c/led.c
  29. +124 −0 examples/c/pwm.c
  30. +154 −0 examples/c/spi.c
  31. +52 −9 examples/{ → c}/uart.c
  32. +115 −0 examples/c/uart_advanced.c
  33. +50 −37 examples/{ → c}/uart_ow.c
  34. +0 −56 examples/cycle-pwm3.c
  35. +0 −72 examples/gpio_read6.c
  36. +0 −145 examples/iio_driver.c
  37. +0 −69 examples/isr_pin6.c
  38. +0 −47 examples/mmap-io2.c
  39. +12 −0 examples/platform/CMakeLists.txt
  40. +3 −3 examples/{ → platform}/firmata_curie_imu.c
  41. examples/{helloedison.c → platform/gpio_edison.c}
  42. +0 −1 examples/{ → platform}/i2c_firmata.c
  43. +8 −2 examples/{ → platform}/initio.c
  44. +0 −10 examples/samples.mapping.txt
  45. +0 −89 examples/spi_max7219.c
  46. +0 −57 examples/spi_mcp4261.c
View
@@ -866,7 +866,9 @@ EXCLUDE_SYMBOLS =
# command).
EXAMPLE_PATH = @CMAKE_CURRENT_SOURCE_DIR@/examples/ \
@CMAKE_CURRENT_SOURCE_DIR@/examples/c \
@CMAKE_CURRENT_SOURCE_DIR@/examples/c++/ \
@CMAKE_CURRENT_SOURCE_DIR@/examples/platform/ \
@CMAKE_CURRENT_SOURCE_DIR@/docs/
# If the value of the EXAMPLE_PATH tag contains directories, you can use the
View
@@ -30,7 +30,7 @@
* AIO is the anlog input & output interface to libmraa. It is used to read or
* set the voltage applied to an AIO pin.
*
* @snippet analogin_a0.c Interesting
* @snippet aio.c Interesting
*/
#ifdef __cplusplus
View
@@ -33,7 +33,7 @@
* through sysfs), or memory mapped IO via a /dev/uio device or /dev/mem
* depending again on the board configuration.
*
* @snippet gpio_read6.c Interesting
* @snippet gpio.c Interesting
*/
#ifdef __cplusplus
View
@@ -32,7 +32,7 @@
* communicate to multiple i2c slaves by configuring the address.
* @htmlinclude i2c.txt
*
* @snippet i2c_HMC5883L.c Interesting
* @snippet i2c_hmc5883l.c Interesting
*/
#ifdef __cplusplus
View
@@ -67,7 +67,7 @@ typedef struct {
*
* An iio context represents an IIO device
*
* @snippet iio_driver.c Interesting
* @snippet iio.c Interesting
*/
#ifdef __cplusplus
View
@@ -31,6 +31,7 @@
* LED is the Light Emitting Diode interface to libmraa. It is used to
* access the on board LED's via sysfs.
*
* @snippet led.c Interesting
*/
#ifdef __cplusplus
View
@@ -33,7 +33,7 @@
* of resolution so make sure you check the board & pin you are using before
* hand.
*
* @snippet cycle-pwm3.c Interesting
* @snippet pwm.c Interesting
*/
#ifdef __cplusplus
View
@@ -34,7 +34,7 @@
* more information on spidev devices is available
* [here](https://www.kernel.org/doc/Documentation/spi/spidev).
*
* @snippet spi_mcp4261.c Interesting
* @snippet spi.c Interesting
*/
#ifdef __cplusplus
View
@@ -1,48 +1,5 @@
add_executable (i2c_HMC5883L i2c_HMC5883L.c)
add_executable (hellomraa hellomraa.c)
add_executable (cycle-pwm3 cycle-pwm3.c)
add_executable (blink-io blink-io.c)
add_executable (analogin_a0 analogin_a0.c)
add_executable (isr_pin6 isr_pin6.c)
add_executable (gpio_read6 gpio_read6.c)
add_executable (spi_mcp4261 spi_mcp4261.c)
add_executable (mmap-io2 mmap-io2.c)
add_executable (blink_onboard blink_onboard.c)
add_executable (uart uart.c)
add_executable (spi_max7219 spi_max7219.c)
if (NOT ANDROID_TOOLCHAIN)
add_executable (iio_driver iio_driver.c)
endif ()
include_directories(${PROJECT_SOURCE_DIR}/api)
include_directories(${PROJECT_SOURCE_DIR}/api/mraa)
target_link_libraries (hellomraa mraa)
target_link_libraries (i2c_HMC5883L mraa m)
target_link_libraries (cycle-pwm3 mraa)
target_link_libraries (blink-io mraa)
target_link_libraries (analogin_a0 mraa)
target_link_libraries (isr_pin6 mraa)
target_link_libraries (gpio_read6 mraa)
target_link_libraries (spi_mcp4261 mraa)
target_link_libraries (mmap-io2 mraa)
target_link_libraries (blink_onboard mraa)
target_link_libraries (uart mraa)
target_link_libraries (spi_max7219 mraa)
if (NOT ANDROID_TOOLCHAIN)
target_link_libraries (iio_driver mraa)
endif ()
if (ONEWIRE)
add_executable (uart_ow uart_ow.c)
target_link_libraries (uart_ow mraa)
endif ()
if (FIRMATA)
add_executable (firmata_curie_imu firmata_curie_imu.c)
add_executable (i2c_firmata i2c_firmata.c)
target_link_libraries (firmata_curie_imu mraa)
target_link_libraries (i2c_firmata mraa)
endif ()
add_subdirectory (c)
add_subdirectory (platform)
if (NOT ANDROID_TOOLCHAIN)
add_subdirectory (c++)
View

This file was deleted.

Oops, something went wrong.
View

This file was deleted.

Oops, something went wrong.
Oops, something went wrong.

0 comments on commit e562c77

Please sign in to comment.