Browse Source

- breaking change: global instance of OneWireSlave renamed from "OneWire" to "OWSlave" to avoid conflict with the OneWire master library in case someone wants both libraries in the same sketch

- upgrade to visual 2015 and arduino IDE 1.6.6
timer1
Youen Toupin 8 years ago
parent
commit
b97a643227
  1. 6
      OneWireIO.ino
  2. 20
      OneWireIO.vcxproj
  3. 2
      OneWireSlave.cpp
  4. 2
      OneWireSlave.h

6
OneWireIO_Demo.ino → OneWireIO.ino

@ -26,8 +26,8 @@ void setup()
led.writeLow();
// Setup the OneWire library
OneWire.setReceiveCallback(&owReceive);
OneWire.begin(owROM, oneWireData.getPinNumber());
OWSlave.setReceiveCallback(&owReceive);
OWSlave.begin(owROM, oneWireData.getPinNumber());
}
void loop()
@ -63,7 +63,7 @@ void owReceive(OneWireSlave::ReceiveEvent evt, byte data)
// in this simple example we just reply with one byte to say we've processed the command
// a real application should have a CRC system to ensure messages are not corrupt, for both directions
// you can use the static OneWireSlave::crc8 method to add CRC checks in your communication protocol (it conforms to standard one-wire CRC checks, that is used to compute the ROM last byte for example)
OneWire.write(&acknowledge, 1, NULL);
OWSlave.write(&acknowledge, 1, NULL);
break;

20
OneWireIO.vcxproj

@ -13,7 +13,7 @@
<PropertyGroup Label="Globals">
<ProjectGuid>{3B500971-1570-460F-81C3-22AC3B7764B9}</ProjectGuid>
<RootNamespace>OneWireIO</RootNamespace>
<ProjectName>OneWireIO_Demo</ProjectName>
<ProjectName>OneWireIO</ProjectName>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
@ -45,14 +45,14 @@
<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</AdditionalIncludeDirectories>
<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_ATmega328__</PreprocessorDefinitions>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
<PostBuildEvent>
<Command>if exist $(ProjectDir)$(IntDir)$(ProjectName).cpp.elf (
<Command>if exist $(ProjectDir)$(IntDir)$(ProjectName).ino.elf (
echo Elf generated
) else (
echo no output
@ -61,12 +61,8 @@ exit /B 1
</PostBuildEvent>
<PostBuildEvent />
<CustomBuild>
<Command>if exist $(ProjectDir)$(IntDir)$(ProjectName).cpp.elf (
echo Elf generated
) else (
echo no output
exit /B 1
)</Command>
<Command>
</Command>
</CustomBuild>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
@ -84,11 +80,11 @@ exit /B 1
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<CustomBuild Include="OneWireIO_Demo.ino">
<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).cpp.elf del $(ProjectDir)$(IntDir)$(ProjectName).cpp.elf
D:\Outils\Arduino\arduino.exe --pref build.path=$(ProjectDir)$(IntDir) --upload %(FullPath)
<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'">

2
OneWireSlave.cpp

@ -26,7 +26,7 @@ namespace
void(*timerEvent)() = 0;
}
OneWireSlave OneWire;
OneWireSlave OWSlave;
byte OneWireSlave::rom_[8];
byte OneWireSlave::scratchpad_[8];

2
OneWireSlave.h

@ -104,6 +104,6 @@ private:
static void(*clientReceiveCallback_)(ReceiveEvent evt, byte data);
};
extern OneWireSlave OneWire;
extern OneWireSlave OWSlave;
#endif

Loading…
Cancel
Save