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
pull/5/head
Youen Toupin 9 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(); led.writeLow();
// Setup the OneWire library // Setup the OneWire library
OneWire.setReceiveCallback(&owReceive); OWSlave.setReceiveCallback(&owReceive);
OneWire.begin(owROM, oneWireData.getPinNumber()); OWSlave.begin(owROM, oneWireData.getPinNumber());
} }
void loop() 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 // 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 // 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) // 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; break;

20
OneWireIO.vcxproj

@ -13,7 +13,7 @@
<PropertyGroup Label="Globals"> <PropertyGroup Label="Globals">
<ProjectGuid>{3B500971-1570-460F-81C3-22AC3B7764B9}</ProjectGuid> <ProjectGuid>{3B500971-1570-460F-81C3-22AC3B7764B9}</ProjectGuid>
<RootNamespace>OneWireIO</RootNamespace> <RootNamespace>OneWireIO</RootNamespace>
<ProjectName>OneWireIO_Demo</ProjectName> <ProjectName>OneWireIO</ProjectName>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
@ -45,14 +45,14 @@
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization> <Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck> <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> <PreprocessorDefinitions>_MBCS;%(PreprocessorDefinitions);ARDUINO=160;__AVR__;UBRRH;__AVR_ATmega328__</PreprocessorDefinitions>
</ClCompile> </ClCompile>
<Link> <Link>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
</Link> </Link>
<PostBuildEvent> <PostBuildEvent>
<Command>if exist $(ProjectDir)$(IntDir)$(ProjectName).cpp.elf ( <Command>if exist $(ProjectDir)$(IntDir)$(ProjectName).ino.elf (
echo Elf generated echo Elf generated
) else ( ) else (
echo no output echo no output
@ -61,12 +61,8 @@ exit /B 1
</PostBuildEvent> </PostBuildEvent>
<PostBuildEvent /> <PostBuildEvent />
<CustomBuild> <CustomBuild>
<Command>if exist $(ProjectDir)$(IntDir)$(ProjectName).cpp.elf ( <Command>
echo Elf generated </Command>
) else (
echo no output
exit /B 1
)</Command>
</CustomBuild> </CustomBuild>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
@ -84,11 +80,11 @@ exit /B 1
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>
<CustomBuild Include="OneWireIO_Demo.ino"> <CustomBuild Include="OneWireIO.ino">
<FileType>Document</FileType> <FileType>Document</FileType>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</ExcludedFromBuild> <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 <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">if exist $(ProjectDir)$(IntDir)$(ProjectName).ino.elf del $(ProjectDir)$(IntDir)$(ProjectName).ino.elf
D:\Outils\Arduino\arduino.exe --pref build.path=$(ProjectDir)$(IntDir) --upload %(FullPath) "C:\Program Files (x86)\Arduino\arduino.exe" --upload --pref build.path=$(ProjectDir)$(Configuration) %(FullPath) | more
</Command> </Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">always_build_$(ProjectConfiguration).dummy</Outputs> <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">always_build_$(ProjectConfiguration).dummy</Outputs>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">

2
OneWireSlave.cpp

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

2
OneWireSlave.h

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

Loading…
Cancel
Save