You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
KED/main.cpp

80 lines
1.3 KiB

/*
* Authors : Kerem Yollu, Edwin Koch
* Date : 08.08.21
* Version : 0.1
* License : MIT-0
*
* Description : Entry to project
*
* TODO : ALL
*
*/
#include "main.hpp"
CommandManager commander;
Pin_Raspberry rpin;
Pin_PC pcpin;
// spi stuff
SPI_dummy spi;
Pin_PC chipSelectPin;
SPICH<Pin_PC, SPI_dummy> spiCH(chipSelectPin, spi);
// i2c stuff
I2CDummy dummyI2C;
template<typename derivation>
void baa(Pin<derivation>& p)
{
p.write(true);
}
void dummy()
{
rpin.write(1);
std::cout << "Dummy" << std::endl;
}
void foo()
{
uint8_t a[]= {1,2,3,4,5,6,7,8,9,10};
std::cout << "foo" << std::endl;
baa(rpin);
baa(pcpin);
std::cout << "SPI test:" << std::endl;
spiCH.read_write_u8(10);
spiCH.writeArray(10,a,sizeof(a));
std::cout << "I2C test:" << std::endl;
dummyI2C.writeWord(0xAE,0xFF,0x01);
}
void dac()
{
MCP4725<I2CDummy> dac(dummyI2C);
dac = 10;
dac = 10;
}
int main(int argc, char *argv[])
{
std::cout << "Main Begin" << std::endl;
commander.addNewCommand("dummy", "The test command for testing the test", dummy);
commander.addNewCommand("foo", "The test command for foo was called", foo);
commander.addNewCommand("dac", "The test command for dac was called", dac);
commander(argv[1]);
std::cout << "Main End" << std::endl;
return 1;
}