parent
63b4c1a0e8
commit
cd82a567e8
@ -1 +1,2 @@
|
|||||||
*.o
|
*.o
|
||||||
|
runtest
|
||||||
|
@ -1,126 +0,0 @@
|
|||||||
/*
|
|
||||||
* Authors : Kerem Yollu & Edwin Koch
|
|
||||||
* Date : 07.03.2021
|
|
||||||
*
|
|
||||||
* Description :
|
|
||||||
* TODO : Write description or doxygene
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <bitset>
|
|
||||||
#include "./management/errorHandling.h"
|
|
||||||
#include "./management/commandManager.h"
|
|
||||||
//#include "./drivers/bh1750/bh1750.h"
|
|
||||||
//#include "./drivers/pf8574/pf8574lcd.h"
|
|
||||||
#include "./algorithms/bitgestion.h"
|
|
||||||
//#include "./periferals/i2c/i2c.hpp"
|
|
||||||
#include "./pimpl/implementation.hpp"
|
|
||||||
|
|
||||||
|
|
||||||
ErrorHandler errorHandle;
|
|
||||||
CommandManager commander;
|
|
||||||
|
|
||||||
Device pimplTest;
|
|
||||||
|
|
||||||
//i2c_ch1_pImpL i2c(1, &errorHandle);
|
|
||||||
|
|
||||||
/*
|
|
||||||
char char_array[TOTAL_CHAR_CAP];
|
|
||||||
int freq = 0;
|
|
||||||
|
|
||||||
int initPlatform()
|
|
||||||
{
|
|
||||||
lcd_init(&i2c);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void pca9685_test()
|
|
||||||
{
|
|
||||||
Pca9685 pwmGenarator(&i2c, &errorHandle);
|
|
||||||
pwmGenarator.setOnDutyPercent(0,50);
|
|
||||||
for(int i = 3 ; i <= 255; i++)
|
|
||||||
{
|
|
||||||
pwmGenarator.setPwmRaw(i);
|
|
||||||
strcpy(char_array, "Pwm Freq: ");
|
|
||||||
lcd_display_string(1,0,char_array,0);
|
|
||||||
std::string Msg = std::to_string(pwmGenarator.getPwmFreq());
|
|
||||||
strcpy(char_array, Msg.c_str());
|
|
||||||
lcd_display_string(1,10, char_array, 7);
|
|
||||||
strcpy(char_array, "Hz");
|
|
||||||
lcd_display_string(1,18, char_array, 7);
|
|
||||||
usleep(200000);
|
|
||||||
freq = getchar();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void bh1750_test()
|
|
||||||
{
|
|
||||||
Bh1750 lightSens(&i2c);
|
|
||||||
while(1)
|
|
||||||
{
|
|
||||||
// std::cout << "value "<< lightSens.continious(BH1750_CONTINUOUS_HIGH_RES_MODE_1,1) << " Lux" <<std::endl;
|
|
||||||
std::string Msg = std::to_string(lightSens.continious(BH1750_CONTINUOUS_HIGH_RES_MODE_1,1));
|
|
||||||
char char_array[TOTAL_CHAR_CAP];
|
|
||||||
strcpy(char_array, Msg.c_str());
|
|
||||||
lcd_display_string(2,0, char_array,5);
|
|
||||||
usleep(150*1000);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void dummy()
|
|
||||||
{
|
|
||||||
uint16_t conf = 0;
|
|
||||||
float conv = 0;
|
|
||||||
Ads1015 adc(&i2c,&errorHandle);
|
|
||||||
conf = adc.getConfig();
|
|
||||||
adc.setOperationMode(ADS1015_MODE_SINGLE);
|
|
||||||
adc.setMultiplexer(ADS1015_MUX_AIN0_GND);
|
|
||||||
adc.setGain(ADS1015_GAIN_6144);
|
|
||||||
adc.writeConfig();
|
|
||||||
adc.pointToConvReg();
|
|
||||||
conv = adc.getConversion();
|
|
||||||
conv = (5.0 * conv)/2047.0;
|
|
||||||
std::cout << "Convertion " << conv << std::endl;
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
|
||||||
{
|
|
||||||
// Init
|
|
||||||
initPlatform();
|
|
||||||
std::cout << "Main Begin" << std::endl;
|
|
||||||
commander.addNewCommand("bh1750", "The test command for testing the bh1750", bh1750_test);
|
|
||||||
commander.addNewCommand("pca9685", "The test command for testing the pca8695", pca9685_test);
|
|
||||||
commander.addNewCommand("dummy", "The test command for testing the test", dummy);
|
|
||||||
commander(argv[1]);
|
|
||||||
std::cout << "Main End" << std::endl;
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
int initPlatform()
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void dummy()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
|
||||||
{
|
|
||||||
// Init
|
|
||||||
initPlatform();
|
|
||||||
std::cout << "Main Begin" << std::endl;
|
|
||||||
commander.addNewCommand("dummy", "The test command for testing the test", dummy);
|
|
||||||
commander(argv[1]);
|
|
||||||
std::cout << "Main End" << std::endl;
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
Binary file not shown.
Loading…
Reference in new issue