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.
69 lines
1.6 KiB
69 lines
1.6 KiB
/*
|
|
* Authors : Kerem Yollu & Edwin Koch
|
|
* Date : 07.03.2021
|
|
*
|
|
* Description :
|
|
* TODO : Write description or doxygene
|
|
*
|
|
*/
|
|
|
|
#include <iostream>
|
|
#include <stdint.h>
|
|
#include <unistd.h>
|
|
#include "./management/errorHandling.h"
|
|
#include "./management/commandManager.h"
|
|
#include "./drivers/bh1750/bh1750.h"
|
|
#include "./drivers/pf8574/pf8574lcd.h"
|
|
#include "./drivers/pca9685/pca9685.h"
|
|
|
|
ErrorHandler errorHandle;
|
|
CommandManager commander;
|
|
i2c_ch1_pImpL i2c(1, &errorHandle);
|
|
Bh1750 lightSens(&i2c);
|
|
Pca9685 pwmGenarator(&i2c, &errorHandle);
|
|
|
|
|
|
int initPlatform()
|
|
{
|
|
char char_array[TOTAL_CHAR_CAP];
|
|
uint8_t pos = 0;
|
|
lcd_init(&i2c);
|
|
strcpy(char_array, "Pwm Freq: ");
|
|
lcd_display_string(1,pos,char_array);
|
|
std::string Msg = std::to_string(pwmGenarator.getPwmFreq());
|
|
strcpy(char_array, Msg.c_str());
|
|
pos = strlen(char_array) + 1;
|
|
lcd_display_string(1,pos, char_array);
|
|
return 0;
|
|
}
|
|
|
|
void dummy()
|
|
{
|
|
/*
|
|
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);
|
|
usleep(150*1000);
|
|
}
|
|
*/
|
|
|
|
}
|
|
|
|
int main(int argc, char *argv[])
|
|
{
|
|
// Init
|
|
initPlatform();
|
|
std::cout << "Main" << std::endl;
|
|
// errorHandle.addNewError(-34,__FILE__,"Test eroor 2",KILL);
|
|
// errorHandle.handleError(-34,__FILE__);
|
|
pwmGenarator.setDutyRaw(0,0,atoi(argv[2]));
|
|
commander.addNewCommand("i2c", "The test command for testing the test", dummy);
|
|
commander(argv[1]);
|
|
|
|
return 1;
|
|
}
|