mraa  2.0.0
Low Level Skeleton Library for Communication on GNU/Linux platforms
uart_ow.h
Go to the documentation of this file.
1 /*
2  * Author: Jon Trulson <jtrulson@ics.com>
3  * Copyright (c) 2016 Intel Corporation
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining
6  * a copy of this software and associated documentation files (the
7  * "Software"), to deal in the Software without restriction, including
8  * without limitation the rights to use, copy, modify, merge, publish,
9  * distribute, sublicense, and/or sell copies of the Software, and to
10  * permit persons to whom the Software is furnished to do so, subject to
11  * the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be
14  * included in all copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23  */
24 
25 #pragma once
26 
58 #ifdef __cplusplus
59 extern "C" {
60 #endif
61 
62 #include <stdio.h>
63 
64 #include "common.h"
65 #include "uart.h"
66 
68 #define MRAA_UART_OW_ROMCODE_SIZE 8
69 
71 typedef struct _mraa_uart_ow {
75  unsigned char ROM_NO[MRAA_UART_OW_ROMCODE_SIZE]; /* 8 byte (64b) rom code */
83 
87 typedef enum {
94 
102 
110 
119 
127 
135 
143 int mraa_uart_ow_write_byte(mraa_uart_ow_context dev, uint8_t byte);
144 
154 int mraa_uart_ow_bit(mraa_uart_ow_context dev, uint8_t bit);
155 
163 
178 
188 mraa_result_t mraa_uart_ow_command(mraa_uart_ow_context dev, uint8_t command, uint8_t* id);
189 
197 uint8_t mraa_uart_ow_crc8(uint8_t* buffer, uint16_t length);
198 
199 #ifdef __cplusplus
200 }
201 #endif
UART module.
Definition: uart_ow.h:92
mraa_uart_ow_context mraa_uart_ow_init_raw(const char *path)
unsigned char ROM_NO[MRAA_UART_OW_ROMCODE_SIZE]
Definition: uart_ow.h:75
mraa_boolean_t LastDeviceFlag
Definition: uart_ow.h:81
unsigned int mraa_boolean_t
Definition: common.h:78
mraa_result_t mraa_uart_ow_rom_search(mraa_uart_ow_context dev, mraa_boolean_t start, uint8_t *id)
int mraa_uart_ow_read_byte(mraa_uart_ow_context dev)
struct _uart * mraa_uart_context
Definition: uart.h:49
Definition: uart_ow.h:88
mraa_uart_ow_context mraa_uart_ow_init(int uart)
const char * mraa_uart_ow_get_dev_path(mraa_uart_ow_context dev)
struct _mraa_uart_ow * mraa_uart_ow_context
Definition: uart_ow.h:71
mraa_uart_context uart
Definition: uart_ow.h:73
Definition: uart_ow.h:89
uint8_t mraa_uart_ow_crc8(uint8_t *buffer, uint16_t length)
Definition: uart_ow.h:91
int mraa_uart_ow_write_byte(mraa_uart_ow_context dev, uint8_t byte)
Definition: uart_ow.h:90
int mraa_uart_ow_bit(mraa_uart_ow_context dev, uint8_t bit)
mraa_result_t mraa_uart_ow_command(mraa_uart_ow_context dev, uint8_t command, uint8_t *id)
mraa_result_t
Definition: types.h:209
int LastFamilyDiscrepancy
Definition: uart_ow.h:79
#define MRAA_UART_OW_ROMCODE_SIZE
Definition: uart_ow.h:68
mraa_result_t mraa_uart_ow_reset(mraa_uart_ow_context dev)
mraa_result_t mraa_uart_ow_stop(mraa_uart_ow_context dev)
int LastDiscrepancy
Definition: uart_ow.h:77
mraa_uart_ow_rom_cmd_t
Definition: uart_ow.h:87