Add ds18b20 udp broadcaster example.

Add license and readme details.
Rid of compile-time switches.
Rid of lazy initialization of sensor.
Minor code fixing.
This commit is contained in:
Grzegorz Hetman 2016-02-18 13:51:16 +01:00
parent 1da8626e6e
commit 72f30ad950
13 changed files with 278 additions and 102 deletions

View file

@ -0,0 +1,22 @@
The MIT License (MIT)
Copyright (c) 2016 Grzegorz Hetman : ghetman@gmail.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View file

@ -0,0 +1,3 @@
PROGRAM=ds18b20_broadcaster
EXTRA_COMPONENTS = extras/onewire extras/ds18b20
include ../../common.mk

View file

@ -0,0 +1,20 @@
# DS19B20 Broadcaster
>In this example you can see how to get data from multiple
>ds18b20 sensor and emit result over udb broadcaster address.
As a client server, you can use this simple udp receiver, writen in python:
```
import select, socket
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.bind(('<broadcast>', 8005))
s.setblocking(0)
while True:
result = select.select([s],[],[])
msg = result[0][0].recv(1024)
print msg.strip()
```

View file

@ -0,0 +1,118 @@
#include <string.h>
#include "espressif/esp_common.h"
#include "esp/uart.h"
#include "FreeRTOS.h"
#include "task.h"
#include "timers.h"
#include "queue.h"
#include "lwip/api.h"
#include "ssid_config.h"
// DS18B20 driver
#include "ds18b20/ds18b20.h"
// Onewire init
#include "onewire/onewire.h"
void broadcast_temperature(void *pvParameters)
{
uint8_t amount = 0;
uint8_t sensors = 2;
ds_sensor_t t[sensors];
// Use GPIO 13 as one wire pin.
uint8_t GPIO_FOR_ONE_WIRE = 13;
char msg[100];
// Broadcaster part
err_t err;
// Initialize one wire bus.
onewire_init(GPIO_FOR_ONE_WIRE);
while(1) {
// Send out some UDP data
struct netconn* conn;
// Create UDP connection
conn = netconn_new(NETCONN_UDP);
// Connect to local port
err = netconn_bind(conn, IP_ADDR_ANY, 8004);
if (err != ERR_OK) {
netconn_delete(conn);
printf("%s : Could not bind! (%s)\n", __FUNCTION__, lwip_strerr(err));
continue;
}
err = netconn_connect(conn, IP_ADDR_BROADCAST, 8005);
if (err != ERR_OK) {
netconn_delete(conn);
printf("%s : Could not connect! (%s)\n", __FUNCTION__, lwip_strerr(err));
continue;
}
for(;;) {
// Search all DS18B20, return its amount and feed 't' structure with result data.
amount = readDS18B20(GPIO_FOR_ONE_WIRE, t);
if (amount < sensors){
printf("Something is wrong, I expect to see %d sensors \nbut just %d was detected!\n", sensors, amount);
}
for (int i = 0; i < amount; ++i)
{
// Multiple "" here is just to satisfy compiler and don`t raise 'hex escape sequence out of range' warning.
sprintf(msg, "Sensor %d report: %d.%d ""\xC2""\xB0""C\n",t[i].id, t[i].major, t[i].minor);
printf("%s", msg);
struct netbuf* buf = netbuf_new();
void* data = netbuf_alloc(buf, strlen(msg));
memcpy (data, msg, strlen(msg));
err = netconn_send(conn, buf);
if (err != ERR_OK) {
printf("%s : Could not send data!!! (%s)\n", __FUNCTION__, lwip_strerr(err));
continue;
}
netbuf_delete(buf); // De-allocate packet buffer
}
vTaskDelay(1000/portTICK_RATE_MS);
}
err = netconn_disconnect(conn);
printf("%s : Disconnected from IP_ADDR_BROADCAST port 12346 (%s)\n", __FUNCTION__, lwip_strerr(err));
err = netconn_delete(conn);
printf("%s : Deleted connection (%s)\n", __FUNCTION__, lwip_strerr(err));
vTaskDelay(1000/portTICK_RATE_MS);
}
}
void user_init(void)
{
uart_set_baud(0, 115200);
printf("SDK version:%s\n", sdk_system_get_sdk_version());
// Set led to indicate wifi status.
sdk_wifi_status_led_install(2, PERIPHS_IO_MUX_GPIO2_U, FUNC_GPIO2);
struct sdk_station_config config = {
.ssid = WIFI_SSID,
.password = WIFI_PASS,
};
// Required to call wifi_set_opmode before station_set_config.
sdk_wifi_set_opmode(STATION_MODE);
sdk_wifi_station_set_config(&config);
xTaskCreate(&broadcast_temperature, (signed char *)"broadcast_temperature", 256, NULL, 2, NULL);
}

View file

@ -0,0 +1,22 @@
The MIT License (MIT)
Copyright (c) 2016 Grzegorz Hetman : ghetman@gmail.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View file

@ -12,17 +12,22 @@
// DS18B20 driver
#include "ds18b20/ds18b20.h"
// Onewire init
#include "onewire/onewire.h"
void print_temperature(void *pvParameters)
{
int delay = 500;
uint8_t amount = 0;
// Declare amount of sensors
uint8_t sensors = 2;
DSENSOR t[sensors];
ds_sensor_t t[sensors];
// Use GPIO 13 as one wire pin.
uint8_t GPIO_FOR_ONE_WIRE = 13;
onewire_init(GPIO_FOR_ONE_WIRE);
while(1) {
// Search all DS18B20, return its amount and feed 't' structure with result data.
amount = readDS18B20(GPIO_FOR_ONE_WIRE, t);
@ -33,7 +38,8 @@ void print_temperature(void *pvParameters)
for (int i = 0; i < amount; ++i)
{
printf("Sensor %d report: %d.%d C\n",t[i].id, t[i].major, t[i].minor);
// Multiple "" here is just to satisfy compiler and don`t raise 'hex escape sequence out of range' warning.
printf("Sensor %d report: %d.%d ""\xC2""\xB0""C\n",t[i].id, t[i].major, t[i].minor);
}
printf("\n");
vTaskDelay(delay / portTICK_RATE_MS);
@ -46,6 +52,6 @@ void user_init(void)
printf("SDK version:%s\n", sdk_system_get_sdk_version());
xTaskCreate(&print_temperature, (signed char *)"get_task", 256, NULL, 2, NULL);
xTaskCreate(&print_temperature, (signed char *)"print_temperature", 256, NULL, 2, NULL);
}

22
extras/ds18b20/LICENSE Normal file
View file

@ -0,0 +1,22 @@
The MIT License (MIT)
Copyright (c) 2016 Grzegorz Hetman : ghetman@gmail.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View file

@ -13,13 +13,7 @@
#define DS1820_ALARMSEARCH 0xEC
#define DS1820_CONVERT_T 0x44
uint8_t readDS18B20(uint8_t pin, DSENSOR *result){
static uint8_t one_time = 1;
if (one_time){
onewire_init(pin);
one_time = 0;
}
uint8_t readDS18B20(uint8_t pin, ds_sensor_t *result){
uint8_t addr[8];
uint8_t sensor_id = 0;
@ -34,11 +28,11 @@ uint8_t readDS18B20(uint8_t pin, DSENSOR *result){
onewire_reset(pin);
onewire_select(pin, addr);
onewire_write(pin, DS1820_CONVERT_T, owDefaultPower);
onewire_write(pin, DS1820_CONVERT_T, ONEWIRE_DEFAULT_POWER);
sdk_os_delay_us(750);
onewire_reset(pin);
onewire_select(pin, addr);
onewire_write(pin, DS1820_READ_SCRATCHPAD, owDefaultPower);
onewire_write(pin, DS1820_READ_SCRATCHPAD, ONEWIRE_DEFAULT_POWER);
uint8_t get[10];
@ -75,14 +69,14 @@ float read_single_DS18B20(uint8_t pin){
onewire_init(pin);
onewire_reset(pin);
onewire_write(pin, DS1820_SKIP_ROM, owDefaultPower);
onewire_write(pin, DS1820_CONVERT_T, owDefaultPower);
onewire_write(pin, DS1820_SKIP_ROM, ONEWIRE_DEFAULT_POWER);
onewire_write(pin, DS1820_CONVERT_T, ONEWIRE_DEFAULT_POWER);
sdk_os_delay_us(750);
onewire_reset(pin);
onewire_write(pin, DS1820_SKIP_ROM, owDefaultPower);
onewire_write(pin, DS1820_READ_SCRATCHPAD, owDefaultPower);
onewire_write(pin, DS1820_SKIP_ROM, ONEWIRE_DEFAULT_POWER);
onewire_write(pin, DS1820_READ_SCRATCHPAD, ONEWIRE_DEFAULT_POWER);
uint8_t get[10];

View file

@ -1,17 +1,17 @@
#ifndef DRIVER_DS18B20_H_
#define DRIVER_DS18B20_H_
typedef struct DSENSOR {
typedef struct {
uint8_t id;
uint8_t major;
uint8_t minor;
} DSENSOR;
} ds_sensor_t;
// Scan all ds18b20 sensors on bus and return its amount.
// Result are saved in array of DSENSOR structure.
// Result are saved in array of ds_sensor_t structure.
// Cause printf in esp sdk don`t support float,
// I split result as two number (major, minor).
uint8_t readDS18B20(uint8_t pin, DSENSOR *result);
uint8_t readDS18B20(uint8_t pin, ds_sensor_t *result);
// This method is just to demonstrate how to read
// temperature from single dallas chip.

22
extras/onewire/LICENSE Normal file
View file

@ -0,0 +1,22 @@
The MIT License (MIT)
Copyright (c) 2014 zeroday nodemcu.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View file

@ -2,6 +2,6 @@
This is a port of bit banging one wire driver based on nodemcu implementaion.
For all aspect regarding license, please check in their code.
Seams that they port it from https://www.pjrc.com/teensy/td_libs_OneWire.html
For all aspect regarding license, please check LICENSE file and coresponding projects.

View file

@ -1,27 +1,17 @@
#include "onewire.h"
#if ONEWIRE_SEARCH
// global search state
static unsigned char ROM_NO[NUM_OW][8];
static uint8_t LastDiscrepancy[NUM_OW];
static uint8_t LastFamilyDiscrepancy[NUM_OW];
static uint8_t LastDeviceFlag[NUM_OW];
#endif
//#define noInterrupts void()
// gpio_enable(gpio, GPIO_OUTPUT);
static unsigned char ROM_NO[ONEWIRE_NUM][8];
static uint8_t LastDiscrepancy[ONEWIRE_NUM];
static uint8_t LastFamilyDiscrepancy[ONEWIRE_NUM];
static uint8_t LastDeviceFlag[ONEWIRE_NUM];
void onewire_init(uint8_t pin)
{
// pinMode(pin, INPUT);
gpio_enable(pin, GPIO_INPUT);
//platform_gpio_mode(pin, PLATFORM_GPIO_INPUT, PLATFORM_GPIO_PULLUP);
#if ONEWIRE_SEARCH
onewire_reset_search(pin);
#endif
}
// Perform the onewire reset function. We will wait up to 250uS for
// the bus to come high, if it doesn't then it is broken or shorted
// and we return a 0;
@ -56,7 +46,6 @@ uint8_t onewire_reset(uint8_t pin)
return r;
}
//
// Write a bit. Port and bit is used to cut lookup time and provide
// more certain timing.
//
@ -81,7 +70,6 @@ static void onewire_write_bit(uint8_t pin, uint8_t v)
}
}
//
// Read a bit. Port and bit is used to cut lookup time and provide
// more certain timing.
//
@ -101,7 +89,6 @@ static uint8_t onewire_read_bit(uint8_t pin)
return r;
}
//
// Write a byte. The writing code uses the active drivers to raise the
// pin high, if you need power after the write (e.g. DS18S20 in
// parasite power mode) then set 'power' to 1, otherwise the pin will
@ -125,7 +112,7 @@ void onewire_write(uint8_t pin, uint8_t v, uint8_t power /* = 0 */) {
void onewire_write_bytes(uint8_t pin, const uint8_t *buf, uint16_t count, bool power /* = 0 */) {
uint16_t i;
for (i = 0 ; i < count ; i++)
onewire_write(pin, buf[i], owDefaultPower);
onewire_write(pin, buf[i], ONEWIRE_DEFAULT_POWER);
if (!power) {
noInterrupts();
DIRECT_MODE_INPUT(pin);
@ -134,7 +121,6 @@ void onewire_write_bytes(uint8_t pin, const uint8_t *buf, uint16_t count, bool p
}
}
//
// Read a byte
//
uint8_t onewire_read(uint8_t pin) {
@ -153,24 +139,22 @@ void onewire_read_bytes(uint8_t pin, uint8_t *buf, uint16_t count) {
buf[i] = onewire_read(pin);
}
//
// Do a ROM select
//
void onewire_select(uint8_t pin, const uint8_t rom[8])
{
uint8_t i;
onewire_write(pin, 0x55, owDefaultPower); // Choose ROM
onewire_write(pin, 0x55, ONEWIRE_DEFAULT_POWER); // Choose ROM
for (i = 0; i < 8; i++) onewire_write(pin, rom[i], owDefaultPower);
for (i = 0; i < 8; i++) onewire_write(pin, rom[i], ONEWIRE_DEFAULT_POWER);
}
//
// Do a ROM skip
//
void onewire_skip(uint8_t pin)
{
onewire_write(pin, 0xCC, owDefaultPower); // Skip ROM
onewire_write(pin, 0xCC, ONEWIRE_DEFAULT_POWER); // Skip ROM
}
void onewire_depower(uint8_t pin)
@ -180,9 +164,6 @@ void onewire_depower(uint8_t pin)
interrupts();
}
#if ONEWIRE_SEARCH
//
// You need to use this function to start a search again from the beginning.
// You do not need to do it for the first search, though you could.
//
@ -190,7 +171,7 @@ void onewire_reset_search(uint8_t pin)
{
// reset the search state
LastDiscrepancy[pin] = 0;
LastDeviceFlag[pin] = FALSE;
LastDeviceFlag[pin] = 0;
LastFamilyDiscrepancy[pin] = 0;
int i;
for(i = 7; ; i--) {
@ -211,10 +192,9 @@ void onewire_target_search(uint8_t pin, uint8_t family_code)
ROM_NO[pin][i] = 0;
LastDiscrepancy[pin] = 64;
LastFamilyDiscrepancy[pin] = 0;
LastDeviceFlag[pin] = FALSE;
LastDeviceFlag[pin] = 0;
}
//
// Perform a search. If this function returns a '1' then it has
// enumerated the next device and you may retrieve the ROM from the
// OneWire::address variable. If there are no devices, no further
@ -227,8 +207,8 @@ void onewire_target_search(uint8_t pin, uint8_t family_code)
//--------------------------------------------------------------------------
// Perform the 1-Wire Search Algorithm on the 1-Wire bus using the existing
// search state.
// Return TRUE : device found, ROM number in ROM_NO buffer
// FALSE : device not found, end of search
// Return 1 : device found, ROM number in ROM_NO buffer
// 0 : device not found, end of search
//
uint8_t onewire_search(uint8_t pin, uint8_t *newAddr)
{
@ -253,13 +233,13 @@ uint8_t onewire_search(uint8_t pin, uint8_t *newAddr)
{
// reset the search
LastDiscrepancy[pin] = 0;
LastDeviceFlag[pin] = FALSE;
LastDeviceFlag[pin] = 0;
LastFamilyDiscrepancy[pin] = 0;
return FALSE;
return 0;
}
// issue the search command
onewire_write(pin, 0xF0, owDefaultPower);
onewire_write(pin, 0xF0, ONEWIRE_DEFAULT_POWER);
// loop to do the search
do
@ -330,9 +310,9 @@ uint8_t onewire_search(uint8_t pin, uint8_t *newAddr)
// check for last device
if (LastDiscrepancy[pin] == 0)
LastDeviceFlag[pin] = TRUE;
LastDeviceFlag[pin] = 1;
search_result = TRUE;
search_result = 1;
}
}
@ -340,9 +320,9 @@ uint8_t onewire_search(uint8_t pin, uint8_t *newAddr)
if (!search_result || !ROM_NO[pin][0])
{
LastDiscrepancy[pin] = 0;
LastDeviceFlag[pin] = FALSE;
LastDeviceFlag[pin] = 0;
LastFamilyDiscrepancy[pin] = 0;
search_result = FALSE;
search_result = 0;
}
else
{
@ -355,10 +335,6 @@ uint8_t onewire_search(uint8_t pin, uint8_t *newAddr)
return search_result;
}
#endif
#if ONEWIRE_CRC
// The 1-Wire CRC scheme is described in Maxim Application Note 27:
// "Understanding and Using Cyclic Redundancy Checks with Maxim iButton Products"
//
@ -427,7 +403,6 @@ uint8_t onewire_crc8(const uint8_t *addr, uint8_t len)
}
#endif
#if ONEWIRE_CRC16
// Compute the 1-Wire CRC16 and compare it against the received CRC.
// Example usage (reading a DS2408):
// // Put everything in a buffer so we can compute the CRC easily.
@ -447,7 +422,7 @@ uint8_t onewire_crc8(const uint8_t *addr, uint8_t len)
// This should just point into the received data,
// *not* at a 16-bit integer.
// @param crc - The crc starting value (optional)
// @return True, iff the CRC matches.
// @return 1, iff the CRC matches.
bool onewire_check_crc16(const uint8_t* input, uint16_t len, const uint8_t* inverted_crc, uint16_t crc)
{
crc = ~onewire_crc16(input, len, crc);
@ -489,6 +464,3 @@ uint16_t onewire_crc16(const uint8_t* input, uint16_t len, uint16_t crc)
}
return crc;
}
#endif
#endif

View file

@ -5,11 +5,10 @@
#include "FreeRTOS.h"
// 1 for keeping the parasitic power on H
#define owDefaultPower 1
#define ONEWIRE_DEFAULT_POWER 1
#define NUM_OW 20
#define FALSE 0
#define TRUE 1
// Maximum number of devices.
#define ONEWIRE_NUM 20
// You can exclude certain features from OneWire. In theory, this
// might save some space. In practice, the compiler automatically
@ -21,32 +20,15 @@
// is the exception, because it selects a fast but large algorithm
// or a small but slow algorithm.
// you can exclude onewire_search by defining that to 0
#ifndef ONEWIRE_SEARCH
#define ONEWIRE_SEARCH 1
#endif
// You can exclude CRC checks altogether by defining this to 0
#ifndef ONEWIRE_CRC
#define ONEWIRE_CRC 1
#endif
// Select the table-lookup method of computing the 8-bit CRC
// by setting this to 1. The lookup table enlarges code size by
// about 250 bytes. It does NOT consume RAM (but did in very
// old versions of OneWire). If you disable this, a slower
// but very compact algorithm is used.
#ifndef ONEWIRE_CRC8_TABLE
//#define ONEWIRE_CRC8_TABLE 0
#define ONEWIRE_CRC8_TABLE 0
#endif
// You can allow 16-bit CRC checks by defining this to 1
// (Note that ONEWIRE_CRC must also be 1.)
#ifndef ONEWIRE_CRC16
#define ONEWIRE_CRC16 1
#endif
// Platform specific I/O definitions
#define noInterrupts portDISABLE_INTERRUPTS
#define interrupts portENABLE_INTERRUPTS
@ -58,7 +40,6 @@
#define DIRECT_WRITE_LOW(pin) gpio_write(pin, 0)
#define DIRECT_WRITE_HIGH(pin) gpio_write(pin, 1)
void onewire_init(uint8_t pin);
// Perform a 1-Wire reset cycle. Returns 1 if a device responds
@ -99,7 +80,6 @@ void onewire_read_bytes(uint8_t pin, uint8_t *buf, uint16_t count);
// someone shorts your bus.
void onewire_depower(uint8_t pin);
#if ONEWIRE_SEARCH
// Clear the search state so that if will start from the beginning again.
void onewire_reset_search(uint8_t pin);
@ -114,14 +94,11 @@ void onewire_target_search(uint8_t pin, uint8_t family_code);
// get garbage. The order is deterministic. You will always get
// the same devices in the same order.
uint8_t onewire_search(uint8_t pin, uint8_t *newAddr);
#endif
#if ONEWIRE_CRC
// Compute a Dallas Semiconductor 8 bit CRC, these are used in the
// ROM and scratchpad registers.
uint8_t onewire_crc8(const uint8_t *addr, uint8_t len);
#if ONEWIRE_CRC16
// Compute the 1-Wire CRC16 and compare it against the received CRC.
// Example usage (reading a DS2408):
// // Put everything in a buffer so we can compute the CRC easily.
@ -157,7 +134,5 @@ bool onewire_check_crc16(const uint8_t* input, uint16_t len, const uint8_t* inve
// @param crc - The crc starting value (optional)
// @return The CRC16, as defined by Dallas Semiconductor.
uint16_t onewire_crc16(const uint8_t* input, uint16_t len, uint16_t crc);
#endif
#endif
#endif