[−][src]Crate mraa_sys
A crate with bindings generated by
bindgen
for the Intel mraa
library for low-speed IO communication.
Cross compilation
This package uses pkg_config
to find the location of mraa
headers and libraries, so by setting the
appropriate environment variables, it is possible to cross compile this
library for other systems.
Example for cross compiling to BeagleBone:
SYSROOT=/path/to/sysroot
export PKG_CONFIG_SYSROOT_DIR="$SYSROOT"
export PKG_CONFIG_LIBDIR="$SYSROOT/usr/lib/arm-linux-gnueabihf/pkgconfig"
export PKG_CONFIG_ALLOW_CROSS=1
export PKG_CONFIG_ALLOW_SYSTEM_LIBS=1
export PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1
cargo build --target=armv7-unknown-linux-gnueabihf
Structs
_aio | |
_gpio | |
_i2c | |
_led | |
_mraa_uart_ow | for now, we simply use the normal MRAA UART context |
_pwm | |
_spi | |
_uart | |
mraa_gpio_event | Gpio event object |
Constants
Functions
mraa_adc_raw_bits⚠ | Check the board's bit size when reading the value |
mraa_adc_supported_bits⚠ | Return value that the raw value should be shifted to. Zero if no ADC |
mraa_add_subplatform⚠ | Add mraa subplatform |
mraa_aio_close⚠ | Close the analog input context, this will free the memory for the context |
mraa_aio_get_bit⚠ | Gets the bit value mraa is shifting the analog read to. @param dev the analog input context |
mraa_aio_init⚠ | Initialise an Analog input device, connected to the specified pin. Aio pins are always 0 indexed reguardless of their position. Check your board mapping for details. An arduino style layout will have A0 as pin14 but AIO0. |
mraa_aio_read⚠ | Read the input voltage. By default mraa will shift the raw value up or down to a 10 bit value. |
mraa_aio_read_float⚠ | Read the input voltage and return it as a normalized float (0.0f-1.0f). |
mraa_aio_set_bit⚠ | Set the bit value which mraa will shift the raw reading from the ADC to. I.e. 10bits @param dev the analog input context @param bits the bits the return from read should be i.e 10 |
mraa_deinit⚠ | De-Initilise MRAA |
mraa_get_aio_count⚠ | Get the number of usable analog pins, board must be initialised. |
mraa_get_default_i2c_bus⚠ | Get default i2c bus, board must be initialised. |
mraa_get_gpio_count⚠ | Get the number of usable GPIOs, board must be initialised. |
mraa_get_i2c_bus_count⚠ | Get platform usable I2C bus count, board must be initialised. |
mraa_get_i2c_bus_id⚠ | Get I2C adapter number in sysfs. |
mraa_get_pin_count⚠ | Get platform pincount, board must be initialised. |
mraa_get_pin_name⚠ | Get name of pin, board must be initialised. |
mraa_get_platform_adc_raw_bits⚠ | Check the specified board's bit size when reading the value |
mraa_get_platform_adc_supported_bits⚠ | Return value that the raw value should be shifted to. Zero if no ADC |
mraa_get_platform_combined_type⚠ | Get combined platform type, board must be initialised. The combined type is represented as (sub_platform_type << 8) | main_platform_type |
mraa_get_platform_name⚠ | Return the Platform's Name, If no platform detected return NULL |
mraa_get_platform_pin_count⚠ | Get specified platform pincount, board must be initialised. |
mraa_get_platform_type⚠ | Get platform type, board must be initialised. |
mraa_get_platform_version⚠ | Return the platform's versioning info, the information given depends per platform and can be NULL. platform_offset has to be given. Do not modify this pointer |
mraa_get_pwm_count⚠ | Get the number of usable PWM pins, board must be initialised. |
mraa_get_spi_bus_count⚠ | Get the number of usable SPI buses, board must be initialised. |
mraa_get_sub_platform_id⚠ | Convert pin or bus index to corresponding sub platform id. |
mraa_get_sub_platform_index⚠ | Convert pin or bus sub platform id to index. |
mraa_get_uart_count⚠ | Get the number of usable UARTs, board must be initialised. |
mraa_get_version⚠ | Get the version string of mraa autogenerated from git tag |
mraa_gpio_close⚠ | Close the Gpio context |
mraa_gpio_dir⚠ | Set Gpio(s) direction |
mraa_gpio_edge_mode⚠ | Set the edge mode on the gpio |
mraa_gpio_get_events⚠ | Get an array of structures describing triggered events. |
mraa_gpio_get_pin⚠ | Get a pin number of the gpio, invalid will return -1 |
mraa_gpio_get_pin_raw⚠ | Get a gpio number as used within sysfs, invalid will return -1 |
mraa_gpio_init⚠ | Initialise gpio_context, based on board number |
mraa_gpio_init_by_name⚠ | Initialise gpio_context, based on gpio line name |
mraa_gpio_init_multi⚠ | Initialise gpio_context, based on board number, for multiple pins (can be one). |
mraa_gpio_init_raw⚠ | Initialise gpio context without any mapping to a pin |
mraa_gpio_input_mode⚠ | Set Gpio input mode |
mraa_gpio_isr⚠ | Set an interrupt on pin(s). |
mraa_gpio_isr_exit⚠ | Stop the current interrupt watcher on this Gpio, and set the Gpio edge mode to MRAA_GPIO_EDGE_NONE(only for sysfs interface). |
mraa_gpio_lookup⚠ | Get GPIO index by pin name, board must be initialised. |
mraa_gpio_mode⚠ | Set Gpio(s) Output Mode, |
mraa_gpio_out_driver_mode⚠ | Set Gpio output driver mode. This is not a standard feature, it needs custom implementation for each board |
mraa_gpio_owner⚠ | Change ownership of the context. |
mraa_gpio_read⚠ | Read the Gpio value. This can be 0 or 1. A resonse of -1 means that there was a fatal error. |
mraa_gpio_read_dir⚠ | Read Gpio(s) direction |
mraa_gpio_read_multi⚠ | Read the Gpio(s) value. The user must provide an integer array with a length equal to the number of pins provided to mraa_gpio_init_multi() function. |
mraa_gpio_use_mmaped⚠ | Enable using memory mapped io instead of sysfs, chardev based I/O can be considered memorymapped |
mraa_gpio_write⚠ | Write to the Gpio Value. |
mraa_gpio_write_multi⚠ | Write to the Gpio(s) Value. The user must provide an integer array with a length equal to the number of pins provided to mraa_gpio_init_multi() function. |
mraa_has_sub_platform⚠ | Detect presence of sub platform. |
mraa_i2c_lookup⚠ | Get I2C bus index by bus name, board must be initialised. |
mraa_i2c_init⚠ | Initialise i2c context, using board defintions |
mraa_i2c_init_raw⚠ | Initialise i2c context, passing in the i2c bus to use. |
mraa_i2c_frequency⚠ | Sets the frequency of the i2c context. Most platforms do not support this. |
mraa_i2c_read⚠ | Simple bulk read from an i2c context |
mraa_i2c_read_byte⚠ | Simple read for a single byte from the i2c context |
mraa_i2c_read_byte_data⚠ | Read a single byte from i2c context, from designated register |
mraa_i2c_read_word_data⚠ | Read a single word from i2c context, from designated register |
mraa_i2c_read_bytes_data⚠ | Bulk read from i2c context, starting from designated register |
mraa_i2c_write⚠ | Write length bytes to the bus, the first byte in the array is the command/register to write |
mraa_i2c_write_byte⚠ | Write a single byte to an i2c context |
mraa_i2c_write_byte_data⚠ | Write a single byte to an i2c context |
mraa_i2c_write_word_data⚠ | Write a single word to an i2c context |
mraa_i2c_address⚠ | Sets the i2c slave address. |
mraa_i2c_stop⚠ | De-inits an mraa_i2c_context device |
mraa_init⚠ | |
mraa_init_io⚠ | Create IO using a description in the format: [io]-[pin] [io]-[raw]-[pin] [io]-[raw]-[id]-[pin] [io]-[raw]-[path] |
mraa_init_json_platform⚠ | Instantiate an unknown board using a json file |
mraa_is_sub_platform_id⚠ | Check if pin or bus id includes sub platform mask. |
mraa_led_clear_trigger⚠ | Clear active LED trigger |
mraa_led_close⚠ | Close LED file descriptors and free the context memory |
mraa_led_init⚠ | Initialise led_context, based on led index. |
mraa_led_init_raw⚠ | Initialise led_context, based on led function name.
The structure of LED entry in sysfs is "devicename:colour:function"
This api expects only one unique LED identifier which would be
"function" name most often. For instance, |
mraa_led_read_brightness⚠ | Read LED brightness |
mraa_led_read_max_brightness⚠ | Read LED maximum brightness |
mraa_led_set_brightness⚠ | Set LED brightness |
mraa_led_set_trigger⚠ | Set LED trigger |
mraa_pin_mode_test⚠ | Checks if a pin is able to use the passed in mode. |
mraa_pwm_close⚠ | Close and unexport the PWM pin |
mraa_pwm_enable⚠ | Set the enable status of the PWM pin. None zero will assume on with output being driven. and 0 will disable the output. |
mraa_pwm_get_max_period⚠ | Get the maximum pwm period in us |
mraa_pwm_get_min_period⚠ | Get the minimum pwm period in us |
mraa_pwm_init⚠ | Initialise pwm_context, uses board mapping |
mraa_pwm_init_raw⚠ | Initialise pwm_context, raw mode |
mraa_pwm_lookup⚠ | Get PWM index by PWM name, board must be initialised. |
mraa_pwm_owner⚠ | Change ownership of context |
mraa_pwm_period⚠ | Set the PWM period as seconds represented in a float |
mraa_pwm_period_ms⚠ | Set period, milliseconds. |
mraa_pwm_period_us⚠ | Set period, microseconds |
mraa_pwm_pulsewidth⚠ | Set pulsewidth, As represnted by seconds in a (float) |
mraa_pwm_pulsewidth_ms⚠ | Set pulsewidth, milliseconds |
mraa_pwm_pulsewidth_us⚠ | Set pulsewidth, microseconds |
mraa_pwm_read⚠ | Read the output duty-cycle percentage, as a float |
mraa_pwm_write⚠ | Set the output duty-cycle percentage, as a float |
mraa_remove_subplatform⚠ | Remove a mraa subplatform |
mraa_result_print⚠ | Print a textual representation of the mraa_result_t |
mraa_set_log_level⚠ | Sets the log level to use from 0-7 where 7 is very verbose. These are the syslog log levels, see syslog(3) for more information on the levels. |
mraa_set_priority⚠ | This function attempts to set the mraa process to a given priority and the scheduler to SCHED_RR. Highest * priority is typically 99 and minimum is 0. This function * will set to MAX if * priority is > MAX. Function will return -1 on failure. |
mraa_spi_bit_per_word⚠ | Set bits per mode on transaction, defaults at 8 |
mraa_spi_frequency⚠ | Set the SPI device operating clock frequency. |
mraa_spi_init⚠ | Initialise SPI_context, uses board mapping. Sets the muxes |
mraa_spi_init_raw⚠ | Initialise SPI_context without any board configuration, selects a bus and a mux. |
mraa_spi_lookup⚠ | Get SPI bus index by bus name, board must be initialised. |
mraa_spi_lsbmode⚠ | Change the SPI lsb mode |
mraa_spi_mode⚠ | Set the SPI device mode. see spidev 0-3. |
mraa_spi_stop⚠ | De-inits an mraa_spi_context device |
mraa_spi_transfer_buf⚠ | Transfer Buffer of bytes to the SPI device. Both send and recv buffers are passed in |
mraa_spi_transfer_buf_word⚠ | Transfer Buffer of uint16 to the SPI device. Both send and recv buffers are passed in |
mraa_spi_write⚠ | Write Single Byte to the SPI device. |
mraa_spi_write_buf⚠ | Write Buffer of bytes to the SPI device. The pointer return has to be free'd by the caller. It will return a NULL pointer in cases of error. |
mraa_spi_write_buf_word⚠ | Write Buffer of uint16 to the SPI device. The pointer return has to be free'd by the caller. It will return a NULL pointer in cases of error. |
mraa_spi_write_word⚠ | Write Two Bytes to the SPI device. |
mraa_uart_data_available⚠ | Check to see if data is available on the device for reading |
mraa_uart_flush⚠ | Flush the outbound data. Blocks until complete. |
mraa_uart_get_dev_path⚠ | Get Char pointer with tty device path within Linux For example. Could point to "/dev/ttyS0" |
mraa_uart_init⚠ | Initialise uart_context, uses board mapping |
mraa_uart_init_raw⚠ | Initialise a raw uart_context. No board setup. |
mraa_uart_lookup⚠ | Get UART index by name, board must be initialised. |
mraa_uart_ow_bit⚠ | Write a bit to a 1-wire bus and read a bit corresponding to the time slot back. This is possible due to the way we wired the TX and RX together with a diode, forming a loopback. |
mraa_uart_ow_command⚠ | Send a command byte to a device on the 1-wire bus |
mraa_uart_ow_crc8⚠ | Perform a Dallas 1-wire compliant CRC8 computation on a buffer |
mraa_uart_ow_get_dev_path⚠ | Get char pointer with tty device path within Linux For example. Could point to "/dev/ttyS0" |
mraa_uart_ow_init⚠ | Initialise uart_ow_context, uses UART board mapping |
mraa_uart_ow_init_raw⚠ | Initialise a raw uart_ow_context. No board setup. |
mraa_uart_ow_read_byte⚠ | Read a byte from the 1-wire bus |
mraa_uart_ow_reset⚠ | Send a reset pulse to the 1-wire bus and test for device presence |
mraa_uart_ow_rom_search⚠ | Begin a rom code search of the 1-wire bus. This function implements the 1-wire search algorithm. See the uart_ow.c example for an idea on how to use this function to identify all devices present on the bus. |
mraa_uart_ow_stop⚠ | Destroy a mraa_uart_ow_context |
mraa_uart_ow_write_byte⚠ | Write a byte to a 1-wire bus |
mraa_uart_read⚠ | Read bytes from the device into a buffer |
mraa_uart_sendbreak⚠ | Send a break to the device. Blocks until complete. |
mraa_uart_set_baudrate⚠ | Set the baudrate. Takes an int and will attempt to decide what baudrate is to be used on the UART hardware. |
mraa_uart_set_flowcontrol⚠ | Set the flowcontrol |
mraa_uart_set_mode⚠ | Set the transfer mode For example setting the mode to 8N1 would be "mraa_uart_set_mode(dev, 8,MRAA_UART_PARITY_NONE , 1)" |
mraa_uart_set_non_blocking⚠ | Set the blocking state for write operations |
mraa_uart_set_timeout⚠ | Set the timeout for read and write operations <= 0 will disable that timeout |
mraa_uart_settings⚠ | Get the current settings of an UART. This is an unintrusive function. Meaning it intends not to change anything, only read the values without disturbing. |
mraa_uart_stop⚠ | Destroy a mraa_uart_context |
mraa_uart_write⚠ | Write bytes in buffer to a device |
Type Definitions
__uint8_t | |
__uint16_t | |
mraa_aio_context | Opaque pointer definition to the internal struct _aio. This context refers to one single AIO pin on the board. |
mraa_boolean_t | MRAA boolean type 1 For TRUE |
mraa_gpio_context | Opaque pointer definition to the internal struct _gpio |
mraa_gpio_dir_t | Gpio Direction options |
mraa_gpio_edge_t | Gpio Edge types for interrupts |
mraa_gpio_events_t | |
mraa_gpio_input_mode_t | Gpio input modes |
mraa_gpio_mode_t | Gpio Output modes |
mraa_gpio_out_driver_mode_t | Gpio output driver modes |
mraa_i2c_mode_t | Enum reprensenting different i2c speeds/modes |
mraa_i2c_context | Opaque pointer definition to the internal struct _i2c |
mraa_intel_edison_miniboard_t | Intel edison miniboard numbering enum |
mraa_intel_edison_t | Intel Edison raw GPIO numbering enum |
mraa_led_context | Opaque pointer definition to the internal struct _led |
mraa_pinmodes_t | Enum representing different possible modes for a pin. |
mraa_platform_t | MRAA supported platform types |
mraa_pwm_context | Mraa Pwm Context |
mraa_raspberry_wiring_t | Raspberry PI Wiring compatible numbering enum |
mraa_result_t | MRAA return codes |
mraa_spi_context | Opaque pointer definition to the internal struct _spi |
mraa_spi_mode_t | MRAA SPI Modes |
mraa_timestamp_t | |
mraa_uart_context | Mraa Uart Context |
mraa_uart_ow_context | |
mraa_uart_ow_rom_cmd_t | UART One Wire ROM related Command bytes |
mraa_uart_parity_t | Enum representing different uart parity states |