forked from youen/OneWireArduinoSlave
Compare commits
9 Commits
Author | SHA1 | Date |
---|---|---|
Youen Toupin | 54917a0b83 | 7 years ago |
Youen Toupin | b61587aa7b | 7 years ago |
Youen Toupin | 0867eccc3a | 7 years ago |
Youen Toupin | 33215645db | 7 years ago |
Youen Toupin | b1fbe102c9 | 7 years ago |
Youen Toupin | efdcb0d2ba | 7 years ago |
Youen Toupin | 42711b30d6 | 7 years ago |
Youen Toupin | 89732cfc6a | 7 years ago |
ntruchsess | 5b3c090601 | 9 years ago |
16 changed files with 262 additions and 240 deletions
@ -1,63 +0,0 @@
|
||||
############################################################################### |
||||
# Set default behavior to automatically normalize line endings. |
||||
############################################################################### |
||||
* text=auto |
||||
|
||||
############################################################################### |
||||
# Set default behavior for command prompt diff. |
||||
# |
||||
# This is need for earlier builds of msysgit that does not have it on by |
||||
# default for csharp files. |
||||
# Note: This is only used by command line |
||||
############################################################################### |
||||
#*.cs diff=csharp |
||||
|
||||
############################################################################### |
||||
# Set the merge driver for project and solution files |
||||
# |
||||
# Merging from the command prompt will add diff markers to the files if there |
||||
# are conflicts (Merging from VS is not affected by the settings below, in VS |
||||
# the diff markers are never inserted). Diff markers may cause the following |
||||
# file extensions to fail to load in VS. An alternative would be to treat |
||||
# these files as binary and thus will always conflict and require user |
||||
# intervention with every merge. To do so, just uncomment the entries below |
||||
############################################################################### |
||||
#*.sln merge=binary |
||||
#*.csproj merge=binary |
||||
#*.vbproj merge=binary |
||||
#*.vcxproj merge=binary |
||||
#*.vcproj merge=binary |
||||
#*.dbproj merge=binary |
||||
#*.fsproj merge=binary |
||||
#*.lsproj merge=binary |
||||
#*.wixproj merge=binary |
||||
#*.modelproj merge=binary |
||||
#*.sqlproj merge=binary |
||||
#*.wwaproj merge=binary |
||||
|
||||
############################################################################### |
||||
# behavior for image files |
||||
# |
||||
# image files are treated as binary by default. |
||||
############################################################################### |
||||
#*.jpg binary |
||||
#*.png binary |
||||
#*.gif binary |
||||
|
||||
############################################################################### |
||||
# diff behavior for common document formats |
||||
# |
||||
# Convert binary document formats to text before diffing them. This feature |
||||
# is only available from the command line. Turn it on by uncommenting the |
||||
# entries below. |
||||
############################################################################### |
||||
#*.doc diff=astextplain |
||||
#*.DOC diff=astextplain |
||||
#*.docx diff=astextplain |
||||
#*.DOCX diff=astextplain |
||||
#*.dot diff=astextplain |
||||
#*.DOT diff=astextplain |
||||
#*.pdf diff=astextplain |
||||
#*.PDF diff=astextplain |
||||
#*.rtf diff=astextplain |
||||
#*.RTF diff=astextplain |
@ -1,6 +0,0 @@
|
||||
/.vs |
||||
/Debug |
||||
/*.opensdf |
||||
/*.sdf |
||||
/*.opendb |
||||
/*.suo |
@ -0,0 +1,112 @@
|
||||
{ |
||||
"configurations": [ |
||||
{ |
||||
"name": "Mac", |
||||
"includePath": [ |
||||
"/usr/include", |
||||
"/usr/local/include", |
||||
"/opt/arduino-1.8.5/hardware/arduino/avr/cores/arduino", |
||||
"/opt/arduino-1.8.5/hardware/tools/avr/avr/include", |
||||
"/opt/arduino-1.8.5/hardware/arduino/avr/variants/standard", |
||||
"${workspaceRoot}", |
||||
"${workspaceRoot}/src" |
||||
], |
||||
"defines": [ |
||||
"ARDUINO=160", |
||||
"__AVR__", |
||||
"UBRRH", |
||||
"__AVR_ATmega328P__", |
||||
"VS_INTELLISENSE" |
||||
], |
||||
"intelliSenseMode": "clang-x64", |
||||
"browse": { |
||||
"path": [ |
||||
"/usr/include", |
||||
"/usr/local/include", |
||||
"${workspaceRoot}" |
||||
], |
||||
"limitSymbolsToIncludedHeaders": true, |
||||
"databaseFilename": "" |
||||
}, |
||||
"macFrameworkPath": [ |
||||
"/System/Library/Frameworks", |
||||
"/Library/Frameworks" |
||||
] |
||||
}, |
||||
{ |
||||
"name": "Linux", |
||||
"includePath": [ |
||||
"/usr/include/c++/4.9", |
||||
"/usr/include/x86_64-linux-gnu/c++/4.9", |
||||
"/usr/include/c++/4.9/backward", |
||||
"/usr/lib/gcc/x86_64-linux-gnu/4.9/include", |
||||
"/usr/local/include", |
||||
"/usr/lib/gcc/x86_64-linux-gnu/4.9/include-fixed", |
||||
"/usr/include/x86_64-linux-gnu", |
||||
"/usr/include", |
||||
"/opt/arduino-1.8.5/hardware/arduino/avr/cores/arduino", |
||||
"/opt/arduino-1.8.5/hardware/tools/avr/avr/include", |
||||
"/opt/arduino-1.8.5/hardware/arduino/avr/variants/standard", |
||||
"${workspaceRoot}", |
||||
"${workspaceRoot}/src" |
||||
], |
||||
"defines": [ |
||||
"ARDUINO=160", |
||||
"__AVR__", |
||||
"UBRRH", |
||||
"__AVR_ATmega328P__", |
||||
"VS_INTELLISENSE" |
||||
], |
||||
"intelliSenseMode": "clang-x64", |
||||
"browse": { |
||||
"path": [ |
||||
"/usr/include/c++/4.9", |
||||
"/usr/include/x86_64-linux-gnu/c++/4.9", |
||||
"/usr/include/c++/4.9/backward", |
||||
"/usr/lib/gcc/x86_64-linux-gnu/4.9/include", |
||||
"/usr/local/include", |
||||
"/usr/lib/gcc/x86_64-linux-gnu/4.9/include-fixed", |
||||
"/usr/include/x86_64-linux-gnu", |
||||
"/usr/include", |
||||
"${workspaceRoot}" |
||||
], |
||||
"limitSymbolsToIncludedHeaders": true, |
||||
"databaseFilename": "" |
||||
}, |
||||
"compilerPath": "/usr/bin/gcc", |
||||
"cStandard": "c11", |
||||
"cppStandard": "c++14" |
||||
}, |
||||
{ |
||||
"name": "Win32", |
||||
"includePath": [ |
||||
"C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/include", |
||||
"/opt/arduino-1.8.5/hardware/arduino/avr/cores/arduino", |
||||
"/opt/arduino-1.8.5/hardware/tools/avr/avr/include", |
||||
"/opt/arduino-1.8.5/hardware/arduino/avr/variants/standard", |
||||
"${workspaceRoot}", |
||||
"${workspaceRoot}/src" |
||||
], |
||||
"defines": [ |
||||
"_DEBUG", |
||||
"UNICODE", |
||||
"_UNICODE", |
||||
"ARDUINO=160", |
||||
"__AVR__", |
||||
"UBRRH", |
||||
"__AVR_ATmega328P__", |
||||
"VS_INTELLISENSE" |
||||
], |
||||
"intelliSenseMode": "msvc-x64", |
||||
"browse": { |
||||
"path": [ |
||||
"C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/include/*", |
||||
"${workspaceRoot}" |
||||
], |
||||
"limitSymbolsToIncludedHeaders": true, |
||||
"databaseFilename": "" |
||||
} |
||||
} |
||||
], |
||||
"version": 3 |
||||
} |
@ -1,32 +0,0 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00 |
||||
# Visual Studio 2013 |
||||
VisualStudioVersion = 12.0.31101.0 |
||||
MinimumVisualStudioVersion = 10.0.40219.1 |
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OneWireIO", "OneWireIO.vcxproj", "{3B500971-1570-460F-81C3-22AC3B7764B9}" |
||||
EndProject |
||||
Global |
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution |
||||
Debug|Any CPU = Debug|Any CPU |
||||
Debug|Mixed Platforms = Debug|Mixed Platforms |
||||
Debug|Win32 = Debug|Win32 |
||||
Release|Any CPU = Release|Any CPU |
||||
Release|Mixed Platforms = Release|Mixed Platforms |
||||
Release|Win32 = Release|Win32 |
||||
EndGlobalSection |
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution |
||||
{3B500971-1570-460F-81C3-22AC3B7764B9}.Debug|Any CPU.ActiveCfg = Debug|Win32 |
||||
{3B500971-1570-460F-81C3-22AC3B7764B9}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 |
||||
{3B500971-1570-460F-81C3-22AC3B7764B9}.Debug|Mixed Platforms.Build.0 = Debug|Win32 |
||||
{3B500971-1570-460F-81C3-22AC3B7764B9}.Debug|Win32.ActiveCfg = Debug|Win32 |
||||
{3B500971-1570-460F-81C3-22AC3B7764B9}.Debug|Win32.Build.0 = Debug|Win32 |
||||
{3B500971-1570-460F-81C3-22AC3B7764B9}.Release|Any CPU.ActiveCfg = Release|Win32 |
||||
{3B500971-1570-460F-81C3-22AC3B7764B9}.Release|Mixed Platforms.ActiveCfg = Release|Win32 |
||||
{3B500971-1570-460F-81C3-22AC3B7764B9}.Release|Mixed Platforms.Build.0 = Release|Win32 |
||||
{3B500971-1570-460F-81C3-22AC3B7764B9}.Release|Win32.ActiveCfg = Release|Win32 |
||||
{3B500971-1570-460F-81C3-22AC3B7764B9}.Release|Win32.Build.0 = Release|Win32 |
||||
EndGlobalSection |
||||
GlobalSection(SolutionProperties) = preSolution |
||||
HideSolutionNode = FALSE |
||||
EndGlobalSection |
||||
EndGlobal |
@ -1,107 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
||||
<ItemGroup Label="ProjectConfigurations"> |
||||
<ProjectConfiguration Include="Debug|Win32"> |
||||
<Configuration>Debug</Configuration> |
||||
<Platform>Win32</Platform> |
||||
</ProjectConfiguration> |
||||
<ProjectConfiguration Include="Release|Win32"> |
||||
<Configuration>Release</Configuration> |
||||
<Platform>Win32</Platform> |
||||
</ProjectConfiguration> |
||||
</ItemGroup> |
||||
<PropertyGroup Label="Globals"> |
||||
<ProjectGuid>{3B500971-1570-460F-81C3-22AC3B7764B9}</ProjectGuid> |
||||
<RootNamespace>OneWireIO</RootNamespace> |
||||
<ProjectName>OneWireIO</ProjectName> |
||||
</PropertyGroup> |
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> |
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> |
||||
<ConfigurationType>Application</ConfigurationType> |
||||
<UseDebugLibraries>true</UseDebugLibraries> |
||||
<PlatformToolset>v140</PlatformToolset> |
||||
<CharacterSet>MultiByte</CharacterSet> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> |
||||
<ConfigurationType>Application</ConfigurationType> |
||||
<UseDebugLibraries>false</UseDebugLibraries> |
||||
<PlatformToolset>v140</PlatformToolset> |
||||
<WholeProgramOptimization>true</WholeProgramOptimization> |
||||
<CharacterSet>MultiByte</CharacterSet> |
||||
</PropertyGroup> |
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> |
||||
<ImportGroup Label="ExtensionSettings"> |
||||
</ImportGroup> |
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |
||||
</ImportGroup> |
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |
||||
</ImportGroup> |
||||
<PropertyGroup Label="UserMacros" /> |
||||
<PropertyGroup /> |
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |
||||
<ClCompile> |
||||
<WarningLevel>Level3</WarningLevel> |
||||
<Optimization>Disabled</Optimization> |
||||
<SDLCheck>true</SDLCheck> |
||||
<AdditionalIncludeDirectories>D:\Outils\Arduino\hardware\arduino\avr\cores\arduino;D:\Outils\Arduino\hardware\tools\avr\avr\include;C:\Program Files %28x86%29\Arduino\hardware\arduino\avr\cores\arduino;C:\Program Files %28x86%29\Arduino\hardware\tools\avr\avr\include</AdditionalIncludeDirectories> |
||||
<PreprocessorDefinitions>_MBCS;%(PreprocessorDefinitions);ARDUINO=160;__AVR__;UBRRH;__AVR_ATmega328P__;VS_INTELLISENSE</PreprocessorDefinitions> |
||||
</ClCompile> |
||||
<Link> |
||||
<GenerateDebugInformation>true</GenerateDebugInformation> |
||||
</Link> |
||||
<PostBuildEvent> |
||||
<Command>if exist $(ProjectDir)$(IntDir)$(ProjectName).ino.elf ( |
||||
echo Elf generated |
||||
) else ( |
||||
echo no output |
||||
exit /B 1 |
||||
)</Command> |
||||
</PostBuildEvent> |
||||
<PostBuildEvent /> |
||||
<CustomBuild> |
||||
<Command> |
||||
</Command> |
||||
</CustomBuild> |
||||
</ItemDefinitionGroup> |
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |
||||
<ClCompile> |
||||
<WarningLevel>Level3</WarningLevel> |
||||
<Optimization>MaxSpeed</Optimization> |
||||
<FunctionLevelLinking>true</FunctionLevelLinking> |
||||
<IntrinsicFunctions>true</IntrinsicFunctions> |
||||
<SDLCheck>true</SDLCheck> |
||||
</ClCompile> |
||||
<Link> |
||||
<GenerateDebugInformation>true</GenerateDebugInformation> |
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding> |
||||
<OptimizeReferences>true</OptimizeReferences> |
||||
</Link> |
||||
</ItemDefinitionGroup> |
||||
<ItemGroup> |
||||
<CustomBuild Include="OneWireIO.ino"> |
||||
<FileType>Document</FileType> |
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</ExcludedFromBuild> |
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">if exist $(ProjectDir)$(IntDir)$(ProjectName).ino.elf del $(ProjectDir)$(IntDir)$(ProjectName).ino.elf |
||||
"C:\Program Files (x86)\Arduino\arduino.exe" --upload --pref build.path=$(ProjectDir)$(Configuration) %(FullPath) | more |
||||
</Command> |
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">always_build_$(ProjectConfiguration).dummy</Outputs> |
||||
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |
||||
</AdditionalInputs> |
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Building and uploading sketch...</Message> |
||||
</CustomBuild> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<ClCompile Include="OneWireSlave.cpp"> |
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> |
||||
</ClCompile> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<ClInclude Include="LowLevel.h" /> |
||||
<ClInclude Include="OneWireSlave.h" /> |
||||
</ItemGroup> |
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> |
||||
<ImportGroup Label="ExtensionTargets"> |
||||
</ImportGroup> |
||||
</Project> |
@ -1,13 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
||||
<ItemGroup> |
||||
<ClCompile Include="OneWireSlave.cpp" /> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<ClInclude Include="LowLevel.h" /> |
||||
<ClInclude Include="OneWireSlave.h" /> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<CustomBuild Include="OneWireIO.ino" /> |
||||
</ItemGroup> |
||||
</Project> |
@ -1,5 +1,4 @@
|
||||
#include "Arduino.h" |
||||
#include "LowLevel.h" |
||||
#include "OneWireSlave.h" |
||||
|
||||
// This is the pin that will be used for one-wire data (depending on your arduino model, you are limited to a few choices, because some pins don't have complete interrupt support)
|
@ -0,0 +1,16 @@
|
||||
This is a **DS18B20** emulator, i.e. it turns an Arduino Uno into a device roughly equivalent to an actual DS18B20 temperature sensor. Excepted in this sample it doesn't actually sense temperature (because the Arduino lacks the hardware for this), it just returns 42 as if that was the expected answer. |
||||
|
||||
To make it work, you will need to connect your Arduino Uno to a 1-wire master (for example an USB adapter on a computer). |
||||
|
||||
You can then connect: |
||||
|
||||
- a GND pin of your Uno to your 1-wire network ground. |
||||
- the pin "2" of your Uno to the data line of your 1-wire network. You may use "3" as well but need to change the code. |
||||
|
||||
You will see 28.000000000002 probe that always return 42 as temperature : |
||||
|
||||
$ cat 28.000000000002/temperature |
||||
42 |
||||
Conversion timing is emulated as well. |
||||
|
||||
If you don't use an Arduino Uno, you may need to adjust which pin you connect as the data line (it needs to have hardware interrupts), and make the corresponding change in the example source code. A few microcontrollers are compatible with the library, check the full list in [the documentation](../../extras/documentation.md). |
@ -0,0 +1,83 @@
|
||||
# OneWireSlave library documentation |
||||
|
||||
This library allows you to emulate existing 1-wire devices with an Arduino, or to create your own protocol. All low-level details are handled by the library, such as reset detection, ROM matching, byte sending and receiving. Look at the demo sketch to see an example. |
||||
|
||||
## Compatible boards |
||||
|
||||
If you have tested the library on another board, please send a pull-request (or just tell me which board) to update this list. |
||||
|
||||
### ATmega328 |
||||
|
||||
- Arduino Uno (tested by [neuoy](https://github.com/neuoy)) |
||||
|
||||
## Getting started |
||||
|
||||
See example "FakeDS18B20", and the associated [documentation](examples/FakeDS18B20/README.md), for a working use case of the library. |
||||
|
||||
## Library reference |
||||
|
||||
### setReceiveCallback |
||||
|
||||
`void setReceiveCallback(void(*callback)(ReceiveEvent evt, byte data))` |
||||
|
||||
Sets the function that will be called back when an event occurs, such as when a byte is received. |
||||
|
||||
### begin |
||||
|
||||
`void begin(byte* rom, byte pinNumber)` |
||||
|
||||
Starts the library, which will respond to the provided ROM (must be unique on your network) on the specified Arduino pin. The ROM is cloned by the library, so you can discard your buffer immediately if you want. |
||||
|
||||
### write |
||||
`bool write(const byte* bytes, short numBytes)` |
||||
|
||||
Writes the specified bytes synchronously. This function blocks until the write operation has finished. Do not call from an interrupt handler! Returns true in case of success, false if an error occurs. |
||||
|
||||
### beginWrite |
||||
`void beginWrite(const byte* bytes, short numBytes, void(*complete)(bool error))` |
||||
|
||||
Starts sending the specified bytes. They will be sent in the background, and the buffer must remain valid and unchanged until the write operation has finished or is cancelled. The optional callback is used to notify when the bytes are sent, or if an error occured. Callbacks are executed from interrupts and should be as short as possible. If `bytes` is null or `numBytes` is 0, nothing is sent, which is equivalent to calling `stopWrite`. In any case, calling the write function will cancel the previous write operation if it didn't complete yet. |
||||
|
||||
### setReceiveBitCallback |
||||
`void setReceiveBitCallback(void(*callback)(bool bit))` |
||||
|
||||
Sets (or replaces) a function to be called when a bit is received. The byte reception callback is called after that if the received bit was the last of a byte. The callback is executed from interrupts and should be as short as possible. Failure to return quickly can prevent the library from correctly reading the next bit. |
||||
|
||||
### writeBit |
||||
`bool writeBit(bool value)` |
||||
|
||||
Writes a single bit synchronously. This function blocks until the bit is sent. Do not call from an interrupt handler! Returns true in case of success, false if an error occurs. |
||||
|
||||
### beginWriteBit |
||||
`void beginWriteBit(bool value, bool repeat = false, void(*bitSent)(bool error) = 0)` |
||||
|
||||
Sets a bit that will be sent next time the master asks for one. Optionnaly, the repeat parameter can be set to true to continue sending the same bit each time. In both cases, the send operation can be canceled by calling `stopWrite`. |
||||
|
||||
### stopWrite |
||||
`void stopWrite()` |
||||
|
||||
Cancels any pending write operation, started by writeBit or write. If this function is called before the master asked for a bit, then nothing is sent to the master. |
||||
|
||||
### alarmed |
||||
`void alarmed(bool value)` |
||||
|
||||
Sets the alarmed state, that is used when the master makes a conditional search of alarmed devices. |
||||
|
||||
### setLogCallback(void(*callback)(const char* message)) |
||||
`void setLogCallback(void(*callback)(const char* message))` |
||||
|
||||
Sets (or replaces) a function to be called when the library has a message to log, if the functionality is enabled in OneWireSlave.cpp (uncomment line `#define ERROR_MESSAGES`). This is for debugging purposes. |
||||
|
||||
### end |
||||
`void end()` |
||||
|
||||
Stops all 1-wire activities, which frees hardware resources for other purposes. |
||||
|
||||
## Notes about the interrupt-based implementation |
||||
Since the library is implemented using interrupts, none of its functions will block: you can continue execute your code immediately. |
||||
|
||||
This also means callbacks are called from interrupt handlers, so you must make them very short to not block further communication. |
||||
|
||||
You must also be careful when you explicitely block interrupts, as the 1-wire protocol has very tight timings, especially when writing bytes (which also happens when searching for device ROMs): a delay of 3 microseconds (yes, microseconds, not milliseconds) can be enough for some (quite intolerant) masters to miss a bit. |
||||
|
||||
But if your code only blocks interrupts for reasonably short time, the probability to block exactly at the bad moment is low, so you can easily mitigate the issue by adding CRC checks in your high-level communication protocol, and retrying when an error is detected. This is an important thing to do anyway because 1-wire does not natively perform any error checking (excepted for ROM operations which already contain a CRC byte). Standard 1-wire devices also include CRC checks in their specific protocols. |
@ -0,0 +1,34 @@
|
||||
####################################### |
||||
# Syntax Coloring Map For OneWireSlave |
||||
####################################### |
||||
|
||||
####################################### |
||||
# Datatypes (KEYWORD1) |
||||
####################################### |
||||
|
||||
ReceiveEvent KEYWORD1 |
||||
OneWireSlave KEYWORD1 |
||||
Pin KEYWORD1 |
||||
OWSlave KEYWORD1 |
||||
|
||||
####################################### |
||||
# Methods and Functions (KEYWORD2) |
||||
####################################### |
||||
|
||||
begin KEYWORD2 |
||||
end KEYWORD2 |
||||
setReceiveCallback KEYWORD2 |
||||
setReceiveBitCallback KEYWORD2 |
||||
write KEYWORD2 |
||||
writeBit KEYWORD2 |
||||
stopWrite KEYWORD2 |
||||
alarmed KEYWORD2 |
||||
crc8 KEYWORD2 |
||||
|
||||
####################################### |
||||
# Constants (LITERAL1) |
||||
####################################### |
||||
|
||||
RE_Reset LITERAL1 |
||||
RE_Byte LITERAL1 |
||||
RE_Error LITERAL1 |
@ -0,0 +1,9 @@
|
||||
name=OneWireSlave |
||||
version=0.1 |
||||
author=Youen Toupin, aka neuoy |
||||
maintainer=Youen Toupin, aka neuoy |
||||
sentence=Communicate using the Dallas one-wire protocol, where the Arduino takes the role of a slave. |
||||
paragraph=This library allows you to emulate existing 1-wire devices with an Arduino, or to create your own protocol. All low-level details are handled by the library, such as reset detection, ROM matching, byte sending and receiving. |
||||
category=Signal Input/Output |
||||
url=https://github.com/neuoy/OneWireArduinoSlave |
||||
architectures=* |
Loading…
Reference in new issue