This commit introduces support for Dallas Semiconductor (DS) 1-wire compliant device support using an available UART device. The principle of operation is described in the following Application note by Maxim Electronics: https://www.maximintegrated.com/en/app-notes/index.mvp/id/214 with help (1-wire search) from: https://www.maximintegrated.com/en/app-notes/index.mvp/id/187 It has been tested on Galileo 2 and Edison, with 2 DS 1-wire devices, the DS18B20 and DS2413 connected to the bus. A UPM driver for the DS2413 is already complete and a PR will be submitted after this one. It is important that you use a UART with CMOS/TTL level voltages (3.3v/5v) RX and TX lines. DO NOT use standard RS232 level voltages or you are going to have a bad day. In order for this to work, a simple interface circuit, using a single diode must be constructed: (forgive my "Asciihematic" :) -| U| A| TX---|<--+ R| | T| RX-------o--------o 1-wire data bus -| The diode on TX is a 1N4148 (cheap and common), with the cathode connected to TX, and the anode connected to RX and the 1-wire data line. The 1-wire data line requires a pull-up resistor, as the DS 1-wire spec requires. 4.7-5K is typical for DS 1-wire buses. NOTE: DHT-type (temp/humidity sensor) 1-wire devices ARE NOT DS 1-wire compliant, and will not work with this code/circuit unfortunately. Also note, this will use up one of your UARTs, which cannot be used for any other purpose (ie: to access true UART-type serial devices). You can however, connect as many DS 1-wire devices as feasible to this UART, as it will function as a DS 1-wire bus master. Signed-off-by: Jon Trulson <jtrulson@ics.com> Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
59 lines
2.0 KiB
CMake
59 lines
2.0 KiB
CMake
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 (uart_ow uart_ow.c)
|
|
add_executable (mraa-gpio mraa-gpio.c)
|
|
add_executable (mraa-i2c mraa-i2c.c)
|
|
add_executable (spi_max7219 spi_max7219.c)
|
|
add_executable (iio_driver iio_driver.c)
|
|
|
|
include_directories(${PROJECT_SOURCE_DIR}/api)
|
|
# FIXME Hack to access mraa internal types used by mraa-i2c
|
|
include_directories(${PROJECT_SOURCE_DIR}/include)
|
|
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 (uart_ow mraa)
|
|
target_link_libraries (mraa-gpio mraa)
|
|
target_link_libraries (mraa-i2c mraa)
|
|
target_link_libraries (spi_max7219 mraa)
|
|
target_link_libraries (iio_driver mraa)
|
|
|
|
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++)
|
|
|
|
install (DIRECTORY ${PROJECT_SOURCE_DIR}/examples/ DESTINATION ${CMAKE_INSTALL_DATADIR}/mraa/examples)
|
|
|
|
if (INSTALLGPIOTOOL AND NOT INSTALLTOOLS)
|
|
install (TARGETS mraa-gpio DESTINATION bin)
|
|
endif()
|
|
|
|
if (INSTALLTOOLS)
|
|
install (TARGETS mraa-gpio DESTINATION bin)
|
|
install (TARGETS mraa-i2c DESTINATION bin)
|
|
endif()
|