Implemented basic example showing usage

This commit is contained in:
BlackMark 2020-02-21 17:35:59 +01:00
parent 623b968aff
commit eed7e91486
5 changed files with 28 additions and 4 deletions

3
.gitmodules vendored
View File

@ -1,3 +1,6 @@
[submodule "spi/spi"]
path = spi/spi
url = git@git.blackmark.me:avr/spi.git
[submodule "spi/io"]
path = spi/io
url = git@git.blackmark.me:avr/io.git

1
spi/io Submodule

@ -0,0 +1 @@
Subproject commit 80de36ee7ee3e6b0842d5eaee81d54062cb496b2

View File

@ -1,6 +1,19 @@
#include "clock.hpp"
void spiTest() {}
#include "spi/spi.hpp"
void spiTest()
{
using namespace spi;
using cfg = Config<ClockDiv::DIV_128, Mode::MODE_0, Side::MASTER, BitOrder::MSB_FIRST, false>;
using driver = Hardware<cfg>;
Spi<driver> spiDriver;
spiDriver.init();
spiDriver.select(true);
spiDriver.transfer(0xff);
}
int main()
{

@ -1 +1 @@
Subproject commit 7a1761e054faf44d168557406873434fff47a5ac
Subproject commit 70aabc07f64a33b04e3e9ee00627f5c120b1f9ef

View File

@ -179,17 +179,24 @@
<Compile Include="clock.hpp">
<SubType>compile</SubType>
</Compile>
<Compile Include="io\io.hpp">
<SubType>compile</SubType>
</Compile>
<Compile Include="main.cpp">
<SubType>compile</SubType>
</Compile>
<Compile Include="spi\spi.cpp">
<Compile Include="spi\config.hpp">
<SubType>compile</SubType>
</Compile>
<Compile Include="spi\spi.h">
<Compile Include="spi\hardware.hpp">
<SubType>compile</SubType>
</Compile>
<Compile Include="spi\spi.hpp">
<SubType>compile</SubType>
</Compile>
</ItemGroup>
<ItemGroup>
<Folder Include="io" />
<Folder Include="spi" />
</ItemGroup>
<Import Project="$(AVRSTUDIO_EXE_PATH)\\Vs\\Compiler.targets" />