Skip to content

Commit

Permalink
Merge branch 'release-v1.2.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
MaJerle committed Nov 9, 2019
2 parents 388fc39 + f482958 commit 66865b3
Show file tree
Hide file tree
Showing 36 changed files with 328 additions and 330 deletions.
54 changes: 27 additions & 27 deletions dev/VisualStudio/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,39 +20,39 @@ main(void) {
ow_init(&ow, NULL); /* Initialize 1-Wire library and set user argument to 1 */

/* Get onewire devices connected on 1-wire port */
scan:
printf("Scanning 1-Wire port...\r\n");
if (scan_onewire_devices(&ow, rom_ids, OW_ARRAYSIZE(rom_ids), &rom_found) == owOK) {
printf("Devices scanned, found %d device%s!\r\n", (int)rom_found, "s" + (rom_found == 1));
} else {
printf("Device scan error\r\n");
Sleep(1000);
}
while (1) {
printf("Scanning 1-Wire port...\r\n");
if (scan_onewire_devices(&ow, rom_ids, OW_ARRAYSIZE(rom_ids), &rom_found) == owOK) {
printf("Devices scanned, found %d device%s!\r\n", (int)rom_found, "s" + (rom_found == 1));
} else {
printf("Device scan error\r\n");
Sleep(1000);
}

if (rom_found) {
/* Infinite loop */
for (size_t c = 0; c < 5; c++) {
printf("Start temperature conversion\r\n");

ow_ds18x20_start(&ow, NULL); /* Start conversion on all devices */
Sleep(1500); /* Release thread for 1 second */

/* Read temperature on all devices */
ow_protect(&ow, 1);
for (size_t i = 0; i < rom_found; i++) {
if (ow_ds18x20_is_b(&ow, &rom_ids[i])) {
float temp;
uint8_t resolution = ow_ds18x20_get_resolution_raw(&ow, &rom_ids[i]);
if (ow_ds18x20_read_raw(&ow, &rom_ids[i], &temp)) {
printf("Sensor %u temperature is %d.%d degrees (%u bits resolution)\r\n",
(unsigned)i, (int)temp, (int)((temp * 1000.0f) - (((int)temp) * 1000)), (unsigned)resolution);
if (rom_found > 0) {
/* Infinite loop */
for (size_t c = 0; c < 5; c++) {
printf("Start temperature conversion\r\n");

ow_ds18x20_start(&ow, NULL); /* Start conversion on all devices */
Sleep(1500); /* Release thread for 1 second */

/* Read temperature on all devices */
ow_protect(&ow, 1);
for (size_t i = 0; i < rom_found; ++i) {
if (ow_ds18x20_is_b(&ow, &rom_ids[i])) {
float temp;
uint8_t resolution = ow_ds18x20_get_resolution_raw(&ow, &rom_ids[i]);
if (ow_ds18x20_read_raw(&ow, &rom_ids[i], &temp)) {
printf("Sensor %u temperature is %d.%d degrees (%u bits resolution)\r\n",
(unsigned)i, (int)temp, (int)((temp * 1000.0f) - (((int)temp) * 1000)), (unsigned)resolution);
}
}
}
ow_unprotect(&ow, 1);
}
ow_unprotect(&ow, 1);
}
}
goto scan;
printf("Terminating application thread\r\n");
return 0;
}
Expand Down
4 changes: 2 additions & 2 deletions dev/VisualStudio/onewire_uart_dev.sln
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ Global
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{21B0EEA6-96AD-4699-8C90-79FFD626E9B7}.Debug|x64.ActiveCfg = Debug|x64
{21B0EEA6-96AD-4699-8C90-79FFD626E9B7}.Debug|x64.Build.0 = Debug|x64
{21B0EEA6-96AD-4699-8C90-79FFD626E9B7}.Debug|x64.ActiveCfg = Debug|Win32
{21B0EEA6-96AD-4699-8C90-79FFD626E9B7}.Debug|x64.Build.0 = Debug|Win32
{21B0EEA6-96AD-4699-8C90-79FFD626E9B7}.Debug|x86.ActiveCfg = Debug|Win32
{21B0EEA6-96AD-4699-8C90-79FFD626E9B7}.Debug|x86.Build.0 = Debug|Win32
{21B0EEA6-96AD-4699-8C90-79FFD626E9B7}.Release|x64.ActiveCfg = Release|x64
Expand Down
2 changes: 1 addition & 1 deletion dev/VisualStudio/ow_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
* This file is part of OneWire library.
*
* Author: Tilen MAJERLE <tilen@majerle.eu>
* Version: v1.1
* Version: v1.2.0
*/
#ifndef OW_HDR_CONFIG_H
#define OW_HDR_CONFIG_H
Expand Down
4 changes: 2 additions & 2 deletions docs/src/_mainpage.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
*
* \section sect_resources Download & Resources
*
* - <a class="download_url" href="https://github.com/MaJerle/onewire_uart/releases">Download library from Github releases</a>
* - <a href="https://github.com/MaJerle/onewire_uart_res">Resources and examples repository</a>
* - <a class="download_url" href="https://github.com/MaJerle/onewire_uart/releases">Download library at Github releases</a>
* - <a href="https://github.com/MaJerle/onewire_uart">Resources and examples repository</a>
* - Read \ref page_appnote before you start development
* - <a href="https://github.com/MaJerle/onewire_uart">Official development repository on Github</a>
* - <a href="https://www.maximintegrated.com/en/app-notes/index.mvp/id/214">Using a UART to Implement a 1-Wire Bus Master</a> from Maxim website
Expand Down

0 comments on commit 66865b3

Please sign in to comment.