Marco-Krahl commented on a change in pull request #3487: URL: https://github.com/apache/incubator-nuttx/pull/3487#discussion_r610733065
########## File path: include/nuttx/1wire/1wire_master.h ########## @@ -0,0 +1,179 @@ +/**************************************************************************** + * include/nuttx/1wire/1wire_master.h + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +#ifndef __INCLUDE_NUTTX_1WIRE_1WIRE_MASTER_H +#define __INCLUDE_NUTTX_1WIRE_1WIRE_MASTER_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include <nuttx/config.h> + +#include <stdbool.h> + +/**************************************************************************** + * Public Types + ****************************************************************************/ + +struct onewire_dev_s; +struct onewire_master_s; + +struct onewire_config_s +{ + uint64_t romcode; /* Unique device identifier */ +}; + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +/**************************************************************************** + * Name: onewire_search + * + * Description: + * Search all devices from a 1-wire network. This is the 1-wire search + * algorithm from Maxim Application Note 187. + * + * Input Parameters: + * master - Pointer to the allocated 1-wire interface + * family - Limit search to devices of matching family + * alarmonly - Limit search to devices on alarm state + * cb_search - Callback to call on each device found + * arg - Argument passed to cb_search + * + * Return Value: + * Number of slaves present and matching family. + * + ****************************************************************************/ + +int onewire_search(FAR struct onewire_master_s *master, + int family, + bool alarmonly, + CODE void (*cb_search)(int family, + uint64_t romcode, + FAR void *arg), + FAR void *arg); + +/**************************************************************************** + * Name: onewire_write + * + * Description: + * Send a block of data on 1WIRE. Each write operation will be an 'atomic' + * operation in the sense that any other 1WIRE actions will be serialized + * and pend until this write completes. + * + * Input Parameters: + * master - Device-specific state data + * config - Described the 1WIRE configuration + * buffer - A pointer to the read-only buffer of data to be written to + * device + * buflen - The number of bytes to send from the buffer + * + * Returned Value: + * 0: success, <0: A negated errno + * + ****************************************************************************/ + +int onewire_write(FAR struct onewire_master_s *master, + FAR const struct onewire_config_s *config, + FAR const uint8_t *buffer, int buflen); Review comment: Mmh .. this is equal to all other bus interfaces like i2c and spi. So changing it to void* means we should do that also at all the other interfaces. I tried to keep the 1wire master stuff close to i2c master definition. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org