@ -1,60 +0,0 @@
|
||||
#include "main.h"
|
||||
|
||||
#include "terminal.h"
|
||||
#include "menuBar.h"
|
||||
|
||||
// INFO: wgetch(win); or getch(); // getch will make a refresh for us.
|
||||
|
||||
int main(int argv, char ** argc)
|
||||
{
|
||||
//Variables
|
||||
int xMax, yMax, xMouse, yMouse= 0;
|
||||
char pressed;
|
||||
|
||||
std::string menu1[4]={"New","Open","Save","Exit"};
|
||||
std::string menu2[3]={"Copy","Cut","Paste"};
|
||||
std::string menu3[5]={"Terminal","Help","Info","Update","Manual"};
|
||||
|
||||
// Second stage declarations
|
||||
Menu menus[3]={ // init the menus
|
||||
Menu("File", 0, 0, 'f', menu1, 4),
|
||||
Menu("Edit", 1, 0, 'e', menu2, 3),
|
||||
Menu("Options", 2, 0, 'o', menu3, 5),
|
||||
};
|
||||
|
||||
Terminal terminal;
|
||||
MenuBar menuBar = MenuBar(menus,1,5,5,3);
|
||||
|
||||
xMax = terminal.getXMax();
|
||||
yMax = terminal.getYMax();
|
||||
|
||||
std::string termToPrint = "Terminal with ";
|
||||
termToPrint += std::to_string(xMax);
|
||||
termToPrint += "x";
|
||||
termToPrint += std::to_string(yMax);
|
||||
termToPrint += " is drawn";
|
||||
|
||||
terminal.draw(1,1,termToPrint);
|
||||
terminal.draw(1,3,"Press f For Files e For Edit and o for Options");
|
||||
terminal.draw(1,2,"Press K to kill the menu");
|
||||
|
||||
terminal.endDraw();
|
||||
menuBar.drawBox();
|
||||
menuBar.drawMenus();
|
||||
|
||||
while(pressed != 'k')
|
||||
{
|
||||
pressed = menuBar.getKey();
|
||||
menuBar.handleTrigger(pressed);
|
||||
menuBar.drawMenus();
|
||||
terminal.endDraw();
|
||||
}
|
||||
menuBar.~MenuBar();
|
||||
|
||||
terminal.draw(1,2,"Press any key to exit the application");
|
||||
terminal.endDraw();
|
||||
terminal.getKey();
|
||||
terminal.tearDown();
|
||||
|
||||
return 0;
|
||||
}
|
@ -1,4 +0,0 @@
|
||||
#include <ncurses.h>
|
||||
#include <string>
|
||||
|
||||
#define ctrl(x) (x & 0x1F) // Detection of ctrl+x presses please do not forget that in unix ctrl+c and ctrl+z are special commands.
|
@ -1,194 +0,0 @@
|
||||
#include "main.h"
|
||||
#ifndef _MENU_H_
|
||||
#define _MENU_H_
|
||||
|
||||
class Menu
|
||||
{
|
||||
public:
|
||||
Menu(std::string name, int menuNo, int direction, char trigger, std::string *items, int itemCount);
|
||||
~Menu();
|
||||
void draw();
|
||||
void nextItem();
|
||||
void prevItem();
|
||||
int getSelectedItem();
|
||||
void setSelectedItem();
|
||||
void setPosX(int x);
|
||||
void setPosY(int y);
|
||||
int getPosX();
|
||||
int getPosY();
|
||||
void setMenuBarBegX(int x); // it must be indicated from menu bar so that we can print the box on the right place
|
||||
void setMenuBarBegY(int y); // it must be indicated from menu bar so that we can print the box on the right place
|
||||
void setMenuBarSizeX(int x); // it must be indicated from menu bar so that we can print the box on the right place
|
||||
std::string getName();
|
||||
int getNameLenght();
|
||||
int getLongestItemLenght();
|
||||
char getTrigger();
|
||||
void drawBox();
|
||||
void drawItems();
|
||||
int getBoxBegY();
|
||||
int getBoxBegX();
|
||||
void eraseBox();
|
||||
bool isBoxCreated();
|
||||
|
||||
private:
|
||||
WINDOW * menuItemsWin;
|
||||
std::string name;
|
||||
std::string *items;
|
||||
int menuNo, currPos, direction= 0;
|
||||
int posX, xSize, menuBarBegX = 0;
|
||||
int posY, ySize, menuBarBegY = 0;
|
||||
int menuBarSizeX = 0;
|
||||
int selected_item = 0;
|
||||
int itemCount = 0;
|
||||
int itemLenght = 0;
|
||||
char trigger;
|
||||
bool boxIsCreated = false;
|
||||
};
|
||||
|
||||
Menu::Menu(std::string name, int menuNo, int direction, char trigger, std::string *items, int itemCount)
|
||||
{
|
||||
this->name = name; //Name of the menu
|
||||
this->menuNo = menuNo; //No of the menu so that we can index it with the menuBar.handdleTrigger option.
|
||||
this->direction = direction; //Direction o the menu Bar Horizontal = 0, vertical = 1
|
||||
this->trigger = trigger; //The trigger for the given menu
|
||||
this->items = items; //Items present in thei menu
|
||||
this->itemCount = itemCount; //Nouber of item present in this menu
|
||||
|
||||
//To be sure
|
||||
xSize = 0;
|
||||
ySize = 0;
|
||||
selected_item = -1; // No menus are selected a the beggining
|
||||
boxIsCreated = false;
|
||||
|
||||
// Vertical Alignment
|
||||
if(direction)
|
||||
{
|
||||
}
|
||||
else // Horizontal Alignment -> The Deffault
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Menu::~Menu()
|
||||
{
|
||||
werase(menuItemsWin);
|
||||
wclear(menuItemsWin);
|
||||
wrefresh(menuItemsWin);
|
||||
boxIsCreated = false;
|
||||
}
|
||||
|
||||
void Menu::eraseBox()
|
||||
{
|
||||
werase(menuItemsWin);
|
||||
wclear(menuItemsWin);
|
||||
wrefresh(menuItemsWin);
|
||||
boxIsCreated = false;
|
||||
}
|
||||
|
||||
void Menu::setPosX(int x)
|
||||
{
|
||||
this->posX = x;
|
||||
}
|
||||
|
||||
void Menu::setPosY(int y)
|
||||
{
|
||||
this->posY = y;
|
||||
}
|
||||
|
||||
int Menu::getPosX()
|
||||
{
|
||||
return posX;
|
||||
}
|
||||
|
||||
int Menu::getPosY()
|
||||
{
|
||||
return posY;
|
||||
}
|
||||
|
||||
void Menu::setMenuBarBegX(int x)
|
||||
{
|
||||
this->menuBarBegX = x;
|
||||
}
|
||||
|
||||
void Menu::setMenuBarBegY(int y)
|
||||
{
|
||||
this->menuBarBegY = y;
|
||||
}
|
||||
|
||||
void Menu::setMenuBarSizeX(int x)
|
||||
{
|
||||
this->menuBarSizeX = x;
|
||||
}
|
||||
std::string Menu::getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
int Menu::getNameLenght()
|
||||
{
|
||||
return name.length();
|
||||
}
|
||||
|
||||
int Menu::getLongestItemLenght()
|
||||
{
|
||||
return xSize;
|
||||
}
|
||||
|
||||
char Menu::getTrigger()
|
||||
{
|
||||
return trigger;
|
||||
}
|
||||
|
||||
int Menu::getBoxBegX()
|
||||
{
|
||||
// Vertical Alignment
|
||||
if(direction)
|
||||
{
|
||||
return menuBarSizeX+posX+menuBarBegX-1;
|
||||
}
|
||||
else // Horizontal Alignment -> The Deffault
|
||||
{
|
||||
return menuBarSizeX+posX+menuBarBegX-1;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
int Menu::getBoxBegY()
|
||||
{
|
||||
// Vertical Alignment
|
||||
if(direction)
|
||||
{
|
||||
return posY+menuBarBegY-1;
|
||||
}
|
||||
else // Horizontal Alignment -> The Deffault
|
||||
{
|
||||
return posY+menuBarBegY-1;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
bool Menu::isBoxCreated()
|
||||
{
|
||||
return boxIsCreated;
|
||||
}
|
||||
|
||||
|
||||
void Menu::drawBox()
|
||||
{
|
||||
// Creates a box with caclulated dimention xSize & ySize and user given position
|
||||
/*menuItemsWin = newwin(20, 20, getBoxBegY(), getBoxBegX());
|
||||
boxIsCreated = true;
|
||||
box(menuItemsWin ,0,0); //Here we can define other cahr insterad of 0,0
|
||||
mvwprintw(menuItemsWin,1,1,"PosY:%d PosX:%d",getBoxBegY(), getBoxBegX());
|
||||
wrefresh(menuItemsWin); //Refresh so that we can see it
|
||||
*/
|
||||
}
|
||||
|
||||
void Menu::drawItems()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
#endif
|
@ -1,180 +0,0 @@
|
||||
#include "main.h"
|
||||
#include "menu.h"
|
||||
|
||||
#ifndef _MENU_BAR_H_
|
||||
#define _MENU_BAR_H_
|
||||
|
||||
class MenuBar
|
||||
{
|
||||
public:
|
||||
MenuBar(Menu *menus, int direction, int xBeg, int yBeg, int menuCount);
|
||||
~MenuBar();
|
||||
void drawBox();
|
||||
void drawMenus();
|
||||
void handleTrigger(char trig);
|
||||
char getKey();
|
||||
void reset();
|
||||
int getPosX();
|
||||
int getPosY();
|
||||
int getSizeX();
|
||||
int getSizeY();
|
||||
private:
|
||||
int i, xSize, ySize, xBeg, yBeg, menuCount, direction, currPos = 0;
|
||||
int selected_menu = -1;
|
||||
int prevSelected_menu = -1;
|
||||
char currIndex;
|
||||
Menu *menus;
|
||||
WINDOW *menuBarWin;
|
||||
};
|
||||
|
||||
MenuBar::MenuBar(Menu *menus, int direction, int xBeg, int yBeg, int menuCount)
|
||||
{
|
||||
this->menus = menus; // All the menu class
|
||||
this->direction = direction; // Direction o the menu Bar Horizontal = 0, vertical = 1
|
||||
this->xSize = xSize; // Size x of the menuBar box
|
||||
this->ySize = ySize; // Size y of the menuBar box
|
||||
this->xBeg = xBeg; // beginnin x Coordinate for the menuBar Box
|
||||
this->yBeg = yBeg; // beginnin y Coordinate for the menuBar Box
|
||||
this->menuCount = menuCount; // Total Menu class element count
|
||||
|
||||
// Jsut to be sure
|
||||
xSize = 0;
|
||||
ySize = 0;
|
||||
selected_menu = -1; // No menus are selected a the beggining
|
||||
prevSelected_menu = - 1; // Deselect for the next itteration. (unless handleTrigger has a new trigger)
|
||||
|
||||
|
||||
// Vertical Alignment
|
||||
if(direction)
|
||||
{
|
||||
currPos = 1; // So that it doesn write the first item on the top border
|
||||
// Finding the longest word between the disponible menus
|
||||
for(i = 0; i < menuCount ; i ++)
|
||||
{
|
||||
if(xSize < this->menus[i].getNameLenght())
|
||||
{
|
||||
xSize = this->menus[i].getNameLenght()+2; // +1 for left +1 lor right = +2
|
||||
}
|
||||
}
|
||||
|
||||
// Defining vertical separations
|
||||
for(i = 0; i < menuCount ; i ++)
|
||||
{
|
||||
this->menus[i].setPosY(currPos);
|
||||
this->menus[i].setPosX(1); // So tha it write in the middle
|
||||
currPos ++;
|
||||
|
||||
this->menus[i].setMenuBarBegX(xBeg);
|
||||
this->menus[i].setMenuBarBegY(yBeg);
|
||||
this->menus[i].setMenuBarSizeX(xSize);
|
||||
}
|
||||
ySize = menuCount + 2;
|
||||
}
|
||||
else // Horizontal Alignment -> The Deffault
|
||||
{
|
||||
currPos = 1; // So that it doesn write the first item on the left border
|
||||
for(i = 0; i < menuCount ; i ++) // Defining horizontal distances
|
||||
{
|
||||
this->menus[i].setPosX(currPos);
|
||||
this->menus[i].setPosY(1); // So tha it write in the middle
|
||||
currPos += this->menus[i].getNameLenght() + 1;
|
||||
|
||||
this->menus[i].setMenuBarBegX(xBeg);
|
||||
this->menus[i].setMenuBarBegY(yBeg);
|
||||
this->menus[i].setMenuBarSizeX(xSize);
|
||||
}
|
||||
xSize = currPos;
|
||||
ySize = 3;
|
||||
}
|
||||
}
|
||||
|
||||
MenuBar::~MenuBar()
|
||||
{
|
||||
werase(menuBarWin);
|
||||
wrefresh(menuBarWin);
|
||||
}
|
||||
|
||||
void MenuBar::drawBox()
|
||||
{
|
||||
// Creates a box with caclulated dimention xSize & ySize and user given position
|
||||
menuBarWin = newwin(ySize, xSize, yBeg, xBeg);
|
||||
box(menuBarWin,0,0); //Here we can define other cahr insterad of 0,0
|
||||
wrefresh(menuBarWin); //Refresh so that we can see it
|
||||
}
|
||||
|
||||
// Draws menus and highlight the selected one selection in made on the handdleTrigger() Function
|
||||
void MenuBar::drawMenus()
|
||||
{
|
||||
for(i = 0; i < menuCount ; i ++)
|
||||
{
|
||||
if(i == selected_menu) // If the iterration come to the selected menu than it will highlight it
|
||||
{
|
||||
prevSelected_menu = i;
|
||||
wattron(menuBarWin, A_STANDOUT);
|
||||
mvwprintw(menuBarWin, menus[i].getPosY(),menus[i].getPosX(), menus[i].getName().c_str());
|
||||
wattroff(menuBarWin, A_STANDOUT);
|
||||
//menus[i].drawBox(); // Draws the lesefted Menus Items
|
||||
}
|
||||
else // Otherwise do not hightlight
|
||||
{
|
||||
if(menus[i].isBoxCreated())
|
||||
{
|
||||
//menus[i].eraseBox(); // Draws the lesefted Menus Items
|
||||
}
|
||||
mvwprintw(menuBarWin, menus[i].getPosY(),menus[i].getPosX(), menus[i].getName().c_str());
|
||||
}
|
||||
}
|
||||
selected_menu = - 1; // Deselect for the next itteration. (unless handleTrigger has a new trigger)
|
||||
prevSelected_menu = - 1; // Deselect for the next itteration. (unless handleTrigger has a new trigger)
|
||||
wrefresh(menuBarWin); // so we can see it
|
||||
}
|
||||
|
||||
// recieves a char an checks it fo ot corrensponds to a Menu Trigger
|
||||
void MenuBar::handleTrigger(char trig)
|
||||
{
|
||||
for(i = 0; i < menuCount ; i ++)
|
||||
{
|
||||
if(trig == this->menus[i].getTrigger()) // If the recieved trigger matches the one from a menu
|
||||
{
|
||||
selected_menu = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
char MenuBar::getKey()
|
||||
{
|
||||
return wgetch(menuBarWin);
|
||||
}
|
||||
|
||||
// Will draw the menu as for the first time
|
||||
void MenuBar::reset()
|
||||
{
|
||||
for(i = 0; i < menuCount ; i ++)
|
||||
{
|
||||
mvwprintw(menuBarWin, menus[i].getPosY(),menus[i].getPosX(), menus[i].getName().c_str());
|
||||
}
|
||||
selected_menu = - 1; // Deselect for the next itteration. (unless handleTrigger has a new trigger)
|
||||
wrefresh(menuBarWin); // so we can see it
|
||||
}
|
||||
|
||||
int MenuBar::getPosX()
|
||||
{
|
||||
return xBeg;
|
||||
}
|
||||
|
||||
int MenuBar::getPosY()
|
||||
{
|
||||
return yBeg;
|
||||
}
|
||||
|
||||
int MenuBar::getSizeX()
|
||||
{
|
||||
return xSize;
|
||||
}
|
||||
|
||||
int MenuBar::getSizeY()
|
||||
{
|
||||
return ySize;
|
||||
}
|
||||
|
||||
#endif
|
@ -1,9 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
clear
|
||||
|
||||
rm menu
|
||||
|
||||
g++ main.cpp -o menu -lncurses
|
||||
|
||||
./menu
|
@ -1,194 +0,0 @@
|
||||
#include "main.h"
|
||||
#ifndef _MENU_H_
|
||||
#define _MENU_H_
|
||||
|
||||
class Menu
|
||||
{
|
||||
public:
|
||||
Menu(std::string name, int menuNo, int direction, char trigger, std::string *items, int itemCount);
|
||||
~Menu();
|
||||
void draw();
|
||||
void nextItem();
|
||||
void prevItem();
|
||||
int getSelectedItem();
|
||||
void setSelectedItem();
|
||||
void setPosX(int x);
|
||||
void setPosY(int y);
|
||||
int getPosX();
|
||||
int getPosY();
|
||||
void setMenuBarBegX(int x); // it must be indicated from menu bar so that we can print the box on the right place
|
||||
void setMenuBarBegY(int y); // it must be indicated from menu bar so that we can print the box on the right place
|
||||
void setMenuBarSizeX(int x); // it must be indicated from menu bar so that we can print the box on the right place
|
||||
std::string getName();
|
||||
int getNameLenght();
|
||||
int getLongestItemLenght();
|
||||
char getTrigger();
|
||||
void drawBox();
|
||||
void drawItems();
|
||||
int getBoxBegY();
|
||||
int getBoxBegX();
|
||||
void eraseBox();
|
||||
bool isBoxCreated();
|
||||
|
||||
private:
|
||||
WINDOW * menuItemsWin;
|
||||
std::string name;
|
||||
std::string *items;
|
||||
int menuNo, currPos, direction= 0;
|
||||
int posX, xSize, menuBarBegX = 0;
|
||||
int posY, ySize, menuBarBegY = 0;
|
||||
int menuBarSizeX = 0;
|
||||
int selected_item = 0;
|
||||
int itemCount = 0;
|
||||
int itemLenght = 0;
|
||||
char trigger;
|
||||
bool boxIsCreated = false;
|
||||
};
|
||||
|
||||
Menu::Menu(std::string name, int menuNo, int direction, char trigger, std::string *items, int itemCount)
|
||||
{
|
||||
this->name = name; //Name of the menu
|
||||
this->menuNo = menuNo; //No of the menu so that we can index it with the menuBar.handdleTrigger option.
|
||||
this->direction = direction; //Direction o the menu Bar Horizontal = 0, vertical = 1
|
||||
this->trigger = trigger; //The trigger for the given menu
|
||||
this->items = items; //Items present in thei menu
|
||||
this->itemCount = itemCount; //Nouber of item present in this menu
|
||||
|
||||
//To be sure
|
||||
xSize = 0;
|
||||
ySize = 0;
|
||||
selected_item = -1; // No menus are selected a the beggining
|
||||
boxIsCreated = false;
|
||||
|
||||
// Vertical Alignment
|
||||
if(direction)
|
||||
{
|
||||
}
|
||||
else // Horizontal Alignment -> The Deffault
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Menu::~Menu()
|
||||
{
|
||||
werase(menuItemsWin);
|
||||
wclear(menuItemsWin);
|
||||
wrefresh(menuItemsWin);
|
||||
boxIsCreated = false;
|
||||
}
|
||||
|
||||
void Menu::eraseBox()
|
||||
{
|
||||
werase(menuItemsWin);
|
||||
wclear(menuItemsWin);
|
||||
wrefresh(menuItemsWin);
|
||||
boxIsCreated = false;
|
||||
}
|
||||
|
||||
void Menu::setPosX(int x)
|
||||
{
|
||||
this->posX = x;
|
||||
}
|
||||
|
||||
void Menu::setPosY(int y)
|
||||
{
|
||||
this->posY = y;
|
||||
}
|
||||
|
||||
int Menu::getPosX()
|
||||
{
|
||||
return posX;
|
||||
}
|
||||
|
||||
int Menu::getPosY()
|
||||
{
|
||||
return posY;
|
||||
}
|
||||
|
||||
void Menu::setMenuBarBegX(int x)
|
||||
{
|
||||
this->menuBarBegX = x;
|
||||
}
|
||||
|
||||
void Menu::setMenuBarBegY(int y)
|
||||
{
|
||||
this->menuBarBegY = y;
|
||||
}
|
||||
|
||||
void Menu::setMenuBarSizeX(int x)
|
||||
{
|
||||
this->menuBarSizeX = x;
|
||||
}
|
||||
std::string Menu::getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
int Menu::getNameLenght()
|
||||
{
|
||||
return name.length();
|
||||
}
|
||||
|
||||
int Menu::getLongestItemLenght()
|
||||
{
|
||||
return xSize;
|
||||
}
|
||||
|
||||
char Menu::getTrigger()
|
||||
{
|
||||
return trigger;
|
||||
}
|
||||
|
||||
int Menu::getBoxBegX()
|
||||
{
|
||||
// Vertical Alignment
|
||||
if(direction)
|
||||
{
|
||||
return menuBarSizeX+posX+menuBarBegX-1;
|
||||
}
|
||||
else // Horizontal Alignment -> The Deffault
|
||||
{
|
||||
return menuBarSizeX+posX+menuBarBegX-1;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
int Menu::getBoxBegY()
|
||||
{
|
||||
// Vertical Alignment
|
||||
if(direction)
|
||||
{
|
||||
return posY+menuBarBegY-1;
|
||||
}
|
||||
else // Horizontal Alignment -> The Deffault
|
||||
{
|
||||
return posY+menuBarBegY-1;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
bool Menu::isBoxCreated()
|
||||
{
|
||||
return boxIsCreated;
|
||||
}
|
||||
|
||||
|
||||
void Menu::drawBox()
|
||||
{
|
||||
// Creates a box with caclulated dimention xSize & ySize and user given position
|
||||
/*menuItemsWin = newwin(20, 20, getBoxBegY(), getBoxBegX());
|
||||
boxIsCreated = true;
|
||||
box(menuItemsWin ,0,0); //Here we can define other cahr insterad of 0,0
|
||||
mvwprintw(menuItemsWin,1,1,"PosY:%d PosX:%d",getBoxBegY(), getBoxBegX());
|
||||
wrefresh(menuItemsWin); //Refresh so that we can see it
|
||||
*/
|
||||
}
|
||||
|
||||
void Menu::drawItems()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
#endif
|
@ -1,76 +0,0 @@
|
||||
#include "main.h"
|
||||
|
||||
#ifndef _ITEM_H_
|
||||
#define _ITEM_H_
|
||||
|
||||
#define BRD_SPC 1
|
||||
class Item
|
||||
{
|
||||
public:
|
||||
Item(std::string name, char trigger);
|
||||
~Item();
|
||||
|
||||
//Getters
|
||||
int getPosX();
|
||||
int getPosY();
|
||||
int getLength();
|
||||
char getTrigger();
|
||||
std::string getName();
|
||||
|
||||
//Setters
|
||||
void setPosX(int x);
|
||||
void setPosY(int y);
|
||||
|
||||
private:
|
||||
std::string name; // Name of the item
|
||||
int xPos, yPos = 0; // Coordinates of the item
|
||||
int itemLength = 0; //Lenght of the item
|
||||
char trigger; // trigger to select this item
|
||||
};
|
||||
|
||||
Item::Item(std::string name, char trigger)
|
||||
{
|
||||
this->name = name;
|
||||
this->trigger = trigger;
|
||||
}
|
||||
|
||||
Item::~Item()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//Getters
|
||||
int Item::getPosX()
|
||||
{
|
||||
return xPos;
|
||||
}
|
||||
int Item::getPosY()
|
||||
{
|
||||
return yPos;
|
||||
}
|
||||
int Item::getLength()
|
||||
{
|
||||
return name.length();
|
||||
}
|
||||
|
||||
char Item::getTrigger()
|
||||
{
|
||||
return trigger;
|
||||
}
|
||||
|
||||
std::string Item::getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
//Setters
|
||||
void Item::setPosX(int x)
|
||||
{
|
||||
this->xPos = x;
|
||||
}
|
||||
|
||||
void Item::setPosY(int y)
|
||||
{
|
||||
this->yPos = y;
|
||||
}
|
||||
|
||||
#endif
|
@ -1,65 +0,0 @@
|
||||
#include "main.h"
|
||||
#include "terminal.h"
|
||||
#include "menu.h"
|
||||
#include <cstring>
|
||||
|
||||
#define HORIZONTAL 0
|
||||
#define VERTICAL 1
|
||||
#define LINK_MAIN 1
|
||||
|
||||
int main(int argv, char ** argc)
|
||||
{
|
||||
//Variables
|
||||
int xMax, yMax = 0;
|
||||
char pressed;
|
||||
|
||||
Item devices[3] = {
|
||||
Item("Stm32f042",'q'),
|
||||
Item("Stm32g441",'w'),
|
||||
Item("Raspberry",'e'),
|
||||
};
|
||||
|
||||
Item mainMenu[3] = {
|
||||
Item("Devices",'d'),
|
||||
Item("Configrations",'c'),
|
||||
Item("Help",'h'),
|
||||
};
|
||||
|
||||
Terminal terminal = Terminal();
|
||||
Menu menu = Menu("Main", mainMenu, 0, 0, LINK_MAIN, HORIZONTAL, 5,5,3);
|
||||
Menu menuDevices = Menu("Devices", devices, 1, 1, LINK_MAIN, VERTICAL, 5,5,3);
|
||||
|
||||
init_pair(2, COLOR_CYAN, COLOR_BLACK);
|
||||
xMax = terminal.getXMax();
|
||||
yMax = terminal.getYMax();
|
||||
|
||||
attron(COLOR_PAIR(2));
|
||||
terminal.draw(1,yMax-2,"Press x to Exit");
|
||||
attroff(COLOR_PAIR(2));
|
||||
|
||||
terminal.endDraw();
|
||||
|
||||
while(pressed != 'x')
|
||||
{
|
||||
menu.printMenu();
|
||||
pressed = terminal.getKey();
|
||||
menu.handleTrigger(pressed);
|
||||
if(menu.isActive())
|
||||
{
|
||||
terminal.draw(1,yMax-4,"Main Menu Is Active");
|
||||
terminal.endDraw();
|
||||
}
|
||||
else
|
||||
{
|
||||
terminal.draw(1,yMax-4,"Main Menu is Inactive");
|
||||
}
|
||||
|
||||
terminal.endDraw();
|
||||
}
|
||||
|
||||
terminal.endDraw();
|
||||
terminal.draw(1,yMax-3,"The window should be deleted");
|
||||
terminal.tearDown();
|
||||
|
||||
return 0;
|
||||
}
|
@ -1,4 +0,0 @@
|
||||
#include <ncurses.h>
|
||||
#include <string>
|
||||
|
||||
#define ctrl(x) (x & 0x1F) // Detection of ctrl+x presses please do not forget that in unix ctrl+c and ctrl+z are special commands.
|
@ -1,305 +0,0 @@
|
||||
#include "main.h"
|
||||
#include "item.h"
|
||||
|
||||
#ifndef _MENU_H_
|
||||
#define _MENU_H_
|
||||
|
||||
#define BRD_SPC 1
|
||||
class Menu
|
||||
{
|
||||
public:
|
||||
Menu( std::string name,
|
||||
Item *items,
|
||||
int level, int no, int link,
|
||||
int orientation,
|
||||
int xBeg, int yBeg,
|
||||
int itemCount);
|
||||
~Menu();
|
||||
|
||||
//Functions
|
||||
void initBox(); // Inits the box dimentions and sets it up with basic parameters
|
||||
void drawBox();
|
||||
void deleteMenu();
|
||||
void startDraw();
|
||||
void endDraw();
|
||||
void update();
|
||||
void printItems();
|
||||
void selectItem();
|
||||
void findTheLongestItem();
|
||||
void printMenu();
|
||||
void handleTrigger(char ch);
|
||||
bool isActive();
|
||||
|
||||
//Getters
|
||||
int getSizeX();
|
||||
int getSizeY();
|
||||
int getBegX();
|
||||
int getBegY();
|
||||
int getLongestItem();
|
||||
int getSelectedItem();
|
||||
int getOrientation();
|
||||
char getKey();
|
||||
|
||||
//Setters
|
||||
void setBegX(int x);
|
||||
void setBegY(int y);
|
||||
void setTopLine(char ch);
|
||||
void setBottomLine(char ch);
|
||||
void setLeftLine(char ch);
|
||||
void setRightLine(char ch);
|
||||
void setActive();
|
||||
void setInactive();
|
||||
|
||||
private:
|
||||
WINDOW *menuWin; // window fo this menu
|
||||
std::string name; // Name of the menu
|
||||
Item *items; // Items plresent for this menu
|
||||
int orientation = 0; // 0 = Horizontal 1 = Vertical
|
||||
int level = 0; // Hierarchical level of the menu 0 is the top one
|
||||
int no = 0; // To be able to track echa menu indvidualy
|
||||
int xBeg, yBeg = 0; // Beginning coordinates of the menu window
|
||||
int xSize, ySize = 0; // Size of the menu window
|
||||
int itemCount = 0; // Number of elents in this menu
|
||||
int selectedItem = 0; // Currenlty selected Item on the menu
|
||||
int link = 0; //If this menu is linked to anothar one // level 0 menus can not be linked
|
||||
int longestItem = 0; //Lenght Of the Longest item
|
||||
int i, pos = 0;
|
||||
bool activeMenu = false;
|
||||
};
|
||||
|
||||
Menu::Menu( std::string name,
|
||||
Item *items,
|
||||
int level, int no, int link,
|
||||
int orientation,
|
||||
int xBeg, int yBeg,
|
||||
int itemCount)
|
||||
{
|
||||
this->name = name;
|
||||
this->items = items;
|
||||
this->level = level;
|
||||
this->no = no;
|
||||
this->link = link;
|
||||
this->orientation = orientation;
|
||||
this->xBeg = xBeg;
|
||||
this->yBeg = yBeg;
|
||||
this->itemCount = itemCount;
|
||||
|
||||
longestItem = 0;
|
||||
xSize = 0;
|
||||
ySize = 0;
|
||||
selectedItem = - 1;
|
||||
activeMenu = false;
|
||||
|
||||
initBox();
|
||||
}
|
||||
|
||||
//TODO: The correct way to end or erase s window is still unclear
|
||||
Menu::~Menu()
|
||||
{
|
||||
deleteMenu();
|
||||
werase(menuWin);
|
||||
}
|
||||
|
||||
void Menu::initBox()
|
||||
{
|
||||
pos = 1; // So that it doesn write over the border
|
||||
|
||||
findTheLongestItem();
|
||||
|
||||
// if Horizontal aligment else vertical
|
||||
if(orientation)
|
||||
{
|
||||
xSize = longestItem + 2;
|
||||
|
||||
for(i = 0; i < itemCount ; i ++)
|
||||
{
|
||||
this->items[i].setPosY(pos);
|
||||
this->items[i].setPosX(1); // So tha it write in the middle
|
||||
pos ++;
|
||||
}
|
||||
ySize = itemCount + 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
for(i = 0; i < itemCount ; i ++)
|
||||
{
|
||||
items[i].setPosX(pos);
|
||||
items[i].setPosY(1);
|
||||
pos += this->items[i].getLength() + 1;
|
||||
}
|
||||
xSize = pos;
|
||||
ySize = 3;
|
||||
}
|
||||
|
||||
// Creates a box with caclulated dimention xSize & ySize and user given position
|
||||
menuWin = newwin(ySize, xSize, yBeg, xBeg);
|
||||
}
|
||||
|
||||
//Functions
|
||||
void Menu::drawBox()
|
||||
{
|
||||
//menuWin = newwin(5, 5, 5, 5);
|
||||
box(menuWin,0,0); //Here we can define other cahr insterad of 0,0
|
||||
wrefresh(menuWin); //Refresh so that we can see it
|
||||
}
|
||||
|
||||
|
||||
//TODO: The correct way to end or erase s window is still unclear
|
||||
void Menu::deleteMenu()
|
||||
{
|
||||
wclear(menuWin);
|
||||
endDraw();
|
||||
}
|
||||
|
||||
void Menu::startDraw()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Menu::endDraw()
|
||||
{
|
||||
wrefresh(menuWin); //Refresh so that we can see it
|
||||
}
|
||||
|
||||
void Menu::update()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Menu::printItems()
|
||||
{
|
||||
for(i=0 ; i < itemCount; i++)
|
||||
{
|
||||
if(i == selectedItem)
|
||||
{
|
||||
wattron(menuWin, A_STANDOUT);
|
||||
mvwprintw(menuWin, items[i].getPosY(),items[i].getPosX(), items[i].getName().c_str());
|
||||
wattroff(menuWin, A_STANDOUT);
|
||||
}
|
||||
else
|
||||
{
|
||||
mvwprintw(menuWin, items[i].getPosY(),items[i].getPosX(), items[i].getName().c_str());
|
||||
}
|
||||
}
|
||||
selectedItem = -1; // Deselcting the item
|
||||
}
|
||||
|
||||
void Menu::selectItem()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Menu::findTheLongestItem()
|
||||
{
|
||||
for(i=0; i < itemCount; i++)
|
||||
{
|
||||
if(longestItem < items[i].getLength())
|
||||
{
|
||||
longestItem = items[i].getLength();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Menu::printMenu()
|
||||
{
|
||||
drawBox();
|
||||
printItems();
|
||||
wrefresh(menuWin); //Refresh so that we can see it
|
||||
}
|
||||
|
||||
// Handles user input but there shoud be a way to register the selection.
|
||||
void Menu::handleTrigger(char ch)
|
||||
{
|
||||
for(i=0; i < itemCount; i++)
|
||||
{
|
||||
if(ch == items[i].getTrigger())
|
||||
{
|
||||
selectedItem = i;
|
||||
activeMenu = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
activeMenu = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool Menu::isActive()
|
||||
{
|
||||
return activeMenu;
|
||||
}
|
||||
|
||||
//Getters
|
||||
int Menu::getSizeX()
|
||||
{
|
||||
return xSize;
|
||||
}
|
||||
|
||||
int Menu::getSizeY()
|
||||
{
|
||||
return ySize;
|
||||
}
|
||||
|
||||
int Menu::getBegX()
|
||||
{
|
||||
return xBeg;
|
||||
}
|
||||
|
||||
int Menu::getBegY()
|
||||
{
|
||||
return yBeg;
|
||||
}
|
||||
|
||||
int Menu::getLongestItem()
|
||||
{
|
||||
return longestItem;
|
||||
}
|
||||
|
||||
int Menu::getSelectedItem()
|
||||
{
|
||||
return selectedItem;
|
||||
}
|
||||
|
||||
int Menu::getOrientation()
|
||||
{
|
||||
return orientation;
|
||||
}
|
||||
|
||||
|
||||
//Setters
|
||||
void Menu::setBegX(int x)
|
||||
{
|
||||
this-> xBeg = x;
|
||||
}
|
||||
|
||||
void Menu::setBegY(int y)
|
||||
{
|
||||
this-> yBeg = y;
|
||||
}
|
||||
|
||||
void Menu::setTopLine(char ch)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Menu::setBottomLine(char ch)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Menu::setLeftLine(char ch)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Menu::setRightLine(char ch)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
char Menu::getKey()
|
||||
{
|
||||
return wgetch(menuWin);
|
||||
}
|
||||
|
||||
#endif
|
@ -1,110 +0,0 @@
|
||||
#include "main.h"
|
||||
|
||||
#ifndef _TEMINAL_H_
|
||||
#define _TEMINAL_H_
|
||||
|
||||
|
||||
// This calls is used to initilaize ncurses terminal the correct way depending of the terminalk
|
||||
class Terminal
|
||||
{
|
||||
public:
|
||||
// Constuctor & Destructor
|
||||
Terminal();
|
||||
~Terminal();
|
||||
|
||||
//Functions
|
||||
int setup();
|
||||
void tearDown();
|
||||
int getKey();
|
||||
int getXMax();
|
||||
int getYMax();
|
||||
void startDraw();
|
||||
void endDraw();
|
||||
bool isDone();
|
||||
void quit();
|
||||
void draw(int x, int y, const std::string& toDraw);
|
||||
|
||||
private:
|
||||
int xMax, yMax, mouseX, mouseY = 0;
|
||||
bool m_done = false;
|
||||
};
|
||||
|
||||
|
||||
Terminal::Terminal()
|
||||
{
|
||||
setup();
|
||||
}
|
||||
|
||||
Terminal::~Terminal()
|
||||
{
|
||||
tearDown();
|
||||
}
|
||||
|
||||
int Terminal::setup()
|
||||
{
|
||||
initscr(); // Inits ncurses screen in memory
|
||||
raw(); // raw input sor ctrl-c and ctrl-z wont work
|
||||
noecho(); // don't show the user inputs
|
||||
curs_set(0); // Cursor won't show up
|
||||
getmaxyx(stdscr, yMax, xMax);
|
||||
box(stdscr,0,0);
|
||||
if(!has_colors()) // If the terminal doesn't have colors
|
||||
{
|
||||
tearDown(); // Destroys the mains window
|
||||
printf("This menu is not supported by terminals without colors\n");
|
||||
return -1; // Return an error.
|
||||
}
|
||||
|
||||
getyx(stdscr, mouseY, mouseX);
|
||||
start_color(); // Otherwise init colors
|
||||
return 0;
|
||||
}
|
||||
|
||||
void Terminal::tearDown()
|
||||
{
|
||||
endwin();
|
||||
}
|
||||
|
||||
|
||||
int Terminal::getKey()
|
||||
{
|
||||
return getch();
|
||||
}
|
||||
|
||||
int Terminal::getXMax()
|
||||
{
|
||||
return xMax;
|
||||
}
|
||||
|
||||
int Terminal::getYMax()
|
||||
{
|
||||
return yMax;
|
||||
}
|
||||
|
||||
void Terminal::startDraw()
|
||||
{
|
||||
clear();
|
||||
}
|
||||
|
||||
void Terminal::endDraw()
|
||||
{
|
||||
refresh();
|
||||
}
|
||||
|
||||
bool Terminal::isDone()
|
||||
{
|
||||
return m_done;
|
||||
}
|
||||
|
||||
void Terminal::quit()
|
||||
{
|
||||
m_done = true;
|
||||
}
|
||||
|
||||
void Terminal::draw(int x, int y, const std::string& toDraw)
|
||||
{
|
||||
mvprintw(y,x,toDraw.c_str());
|
||||
}
|
||||
|
||||
|
||||
#endif
|
@ -1,5 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
gcc main.c -o menu -lncurses
|
||||
|
||||
./menu
|
@ -1,300 +0,0 @@
|
||||
/**
|
||||
* This is a menu made with ncurses, i wil do my best to comment every aspect of it
|
||||
**/
|
||||
|
||||
#include <ncurses.h>
|
||||
//#include <string>
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
int i, xBeg, yBeg, std_xMax, std_yMax = 0;
|
||||
int choices, highlight = 0;
|
||||
char* menu_items[3]={"Menu1", "menu2", "Menu3"};
|
||||
|
||||
// start of ncurses
|
||||
initscr();
|
||||
noecho();
|
||||
cbreak();
|
||||
|
||||
getmaxyx(stdscr, std_yMax, std_xMax);
|
||||
|
||||
WINDOW * menu_win = newwin(6,std_xMax-5,std_yMax-8,5);
|
||||
keypad(menu_win, true); // so that we can use the arrow keys
|
||||
box(menu_win,0,0);
|
||||
refresh();
|
||||
wrefresh(menu_win);
|
||||
|
||||
while(1)
|
||||
{
|
||||
for(i = 0; i<3; i++)
|
||||
{
|
||||
if(i==highlight)
|
||||
{
|
||||
wattron(menu_win, A_REVERSE);
|
||||
}
|
||||
|
||||
mvwprintw(menu_win, i+1, 1,menu_items[i]);
|
||||
wattroff(menu_win, A_REVERSE);
|
||||
}
|
||||
|
||||
choices = wgetch(menu_win);
|
||||
|
||||
switch(choices)
|
||||
{
|
||||
case KEY_UP:
|
||||
highlight --;
|
||||
if(highlight == -1)
|
||||
highlight = 0;
|
||||
break;
|
||||
|
||||
case KEY_DOWN:
|
||||
highlight ++;
|
||||
if(highlight == 3)
|
||||
highlight = 2;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if(choices == 10)// 10 = enter in asci
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
printw("your choice was : %s", menu_items[highlight]);
|
||||
getch();
|
||||
endwin();
|
||||
}
|
||||
|
||||
int tutorial_0_1() // Hello Word and user input
|
||||
{
|
||||
int c,y,x = 0;
|
||||
|
||||
y=10;
|
||||
x=10;
|
||||
|
||||
//Init sequence. to set up the screen and init the memory usage
|
||||
initscr(); // inits the screen and sets up the screen
|
||||
|
||||
move(y,x);// Moving to the given coordinates
|
||||
|
||||
printw("Hello World!");
|
||||
//Refeshes the screen to match what is in the memory
|
||||
refresh();
|
||||
|
||||
// Gets the user input
|
||||
c = getch();
|
||||
|
||||
// Clreasthe screen
|
||||
clear();
|
||||
|
||||
move(0,0);
|
||||
printw("You pressed %d", c);
|
||||
|
||||
// Gets the user input before quiting
|
||||
getch();
|
||||
|
||||
// Delocates memory and ends ncurses
|
||||
endwin();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int tutorial_2() // create a box and write into it
|
||||
{
|
||||
// VAriable declarations
|
||||
int height, width, start_y, start_x = 0;
|
||||
height = 10;
|
||||
width = 30;
|
||||
start_y = 10;
|
||||
start_x = 10;
|
||||
|
||||
//Init sequence. to set up the screen and init the memory usage
|
||||
initscr(); // inits the screen and sets up the screen
|
||||
|
||||
// Creating a window
|
||||
WINDOW * win= newwin(height,width,start_y, start_x);
|
||||
//This refresh will initialize the base screen.
|
||||
refresh();
|
||||
|
||||
// Making a box out of the window
|
||||
box(win,0,0);
|
||||
|
||||
// this will print on 0,0 coordinate of rhtis window
|
||||
wprintw(win,"this is an new window");
|
||||
|
||||
//and this refresh will only refresh the created window
|
||||
wrefresh(win);
|
||||
|
||||
//this will moove inside of the window an print to tth given coordinate
|
||||
mvwprintw(win,5,5,"Content of the box");
|
||||
|
||||
//and this refresh will only refresh the created window
|
||||
wrefresh(win);
|
||||
|
||||
// Gets the user input before quiting
|
||||
getch();
|
||||
|
||||
// Delocates memory and ends ncurses
|
||||
endwin();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int tuttorial_3 () // Customize the windows/boxes
|
||||
{
|
||||
// Variable declarations
|
||||
int height, width, start_y, start_x = 0;
|
||||
height = 10;
|
||||
width = 30;
|
||||
start_y = 10;
|
||||
start_x = 10;
|
||||
|
||||
//Init sequence. to set up the screen and init the memory usage
|
||||
initscr(); // inits the screen and sets up the screen
|
||||
|
||||
// To use the standart linux bash commanc lije ctrl-c ctrl-x and so on : Is active as default
|
||||
cbreak();
|
||||
|
||||
// To use every input as raw input and not a command
|
||||
//raw();
|
||||
|
||||
// Doesn't show the pressed char in the scrren
|
||||
noecho();
|
||||
|
||||
// Creating a window
|
||||
WINDOW * win= newwin(height,width,start_y, start_x);
|
||||
//This refresh will initialize the base screen.
|
||||
refresh();
|
||||
|
||||
// Making a box out of the window
|
||||
box(win,'|','#');
|
||||
|
||||
// this will print on 0,0 coordinate of rhtis window
|
||||
wprintw(win,"this is an new window");
|
||||
|
||||
//and this refresh will only refresh the created window
|
||||
wrefresh(win);
|
||||
|
||||
getch();
|
||||
|
||||
// Adwanced border customization variables
|
||||
int left, right, top, bottom, tlc, trc, blc, brc = 0;
|
||||
left = '|'; // Left side of the box
|
||||
right = '/'; // Right side of the box
|
||||
top = '#'; // Top side of the box
|
||||
bottom = '-'; // Bottom side of the box
|
||||
tlc = '0'; // Top Left Corner of the box
|
||||
trc = '1'; // Top Roght Corner of the box
|
||||
blc = '2'; // Bottom Left Corner of the box
|
||||
brc = '3'; // Bottom Right Corner of the box
|
||||
|
||||
// Adwanced border customization function call
|
||||
wborder(win, left, right, top, bottom, tlc, trc, blc, brc);
|
||||
|
||||
//and this refresh will only refresh the created window
|
||||
wrefresh(win);
|
||||
|
||||
//this will moove inside of the window an print to tth given coordinate
|
||||
mvwprintw(win,5,5,"Content of the box");
|
||||
|
||||
//and this refresh will only refresh the created window
|
||||
wrefresh(win);
|
||||
|
||||
// Gets the user input before quiting
|
||||
getch();
|
||||
|
||||
// Delocates memory and ends ncurses
|
||||
endwin();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int tuttorial_4() // Ncurses Tutorial 4 - Attributes and Colors (attron, attroff, has_colors, start_color, init_pair)
|
||||
{
|
||||
//Init sequence. to set up the screen and init the memory usage
|
||||
initscr(); // inits the screen and sets up the screen
|
||||
|
||||
// To use the standart linux bash commanc lije ctrl-c ctrl-x and so on : Is active as default
|
||||
cbreak();
|
||||
|
||||
// Doesn't show the pressed char in the scrren
|
||||
noecho();
|
||||
|
||||
if(!has_colors())
|
||||
{
|
||||
printw("Terminal has no colorsupport");
|
||||
getch();
|
||||
return -1;
|
||||
}
|
||||
start_color();
|
||||
init_pair(1, COLOR_BLUE, COLOR_RED);
|
||||
init_pair(2, COLOR_BLUE, COLOR_YELLOW);
|
||||
|
||||
attron(COLOR_PAIR(2));
|
||||
printw("Hello wold");
|
||||
attroff(COLOR_PAIR(2));
|
||||
|
||||
// Gets the user input before quiting
|
||||
getch();
|
||||
|
||||
// Delocates memory and ends ncurses
|
||||
endwin();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int tuttorial_5() // Get position
|
||||
{
|
||||
int x, y, xBeg, yBeg, xMax, yMax = 0;
|
||||
// start of ncurses
|
||||
initscr();
|
||||
noecho();
|
||||
cbreak();
|
||||
|
||||
WINDOW * win = newwin(10,20,10,10);
|
||||
getyx(stdscr, y, x);
|
||||
getbegyx(win, yBeg, xBeg);
|
||||
getmaxyx(stdscr, yMax, xMax);
|
||||
|
||||
printw("x:%d y:%d xBeg:%d yBeg:%d xMax:%d yMax:%d",x,y,xBeg,yBeg,xMax,yMax);
|
||||
mvprintw(yMax/2, xMax/2, "Hello from the middle");
|
||||
|
||||
getch();
|
||||
endwin();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int tutorial_6() // user inputs
|
||||
{
|
||||
int c, x, y, xBeg, yBeg, xMax, yMax = 0;
|
||||
// start of ncurses
|
||||
initscr();
|
||||
noecho();
|
||||
cbreak();
|
||||
|
||||
getmaxyx(stdscr, yMax, xMax);
|
||||
getyx(stdscr, y, x);
|
||||
|
||||
WINDOW * input_win = newwin(3,xMax-12,yMax-5,5);
|
||||
|
||||
box(input_win,0,0);
|
||||
keypad(input_win, true);
|
||||
refresh();
|
||||
wrefresh(input_win);
|
||||
c = wgetch(input_win);
|
||||
if(c == 'j')
|
||||
{
|
||||
mvwprintw(input_win,1,1,"you have pressed j! now press the up arrow key");
|
||||
wrefresh(input_win);
|
||||
}
|
||||
|
||||
c = wgetch(input_win);
|
||||
if(c == KEY_UP)
|
||||
{
|
||||
mvwprintw(input_win,1,1," ");
|
||||
wrefresh(input_win);
|
||||
mvwprintw(input_win,1,1,"you have pressed key up");
|
||||
wrefresh(input_win);
|
||||
}
|
||||
getch();
|
||||
endwin();
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
g++ main.cpp -o menu -lncurses
|
||||
|
||||
./menu
|
@ -1,53 +0,0 @@
|
||||
#include <ncurses.h>
|
||||
|
||||
#define ctrl(x) (x & 0x1F) // Detection of ctrl+x presses please do not forget that in unix ctrl+c and ctrl+z are special commands.
|
||||
|
||||
|
||||
int main(int argv, char ** argc)
|
||||
{
|
||||
//Init Ncurses
|
||||
initscr();
|
||||
noecho();
|
||||
cbreak();
|
||||
|
||||
if(has_colors() == FALSE)
|
||||
{
|
||||
printf("Colors cnat be used in this terminal\n");
|
||||
endwin();
|
||||
}
|
||||
|
||||
start_color();
|
||||
|
||||
init_pair(1, COLOR_YELLOW, COLOR_BLACK);
|
||||
init_pair(2, COLOR_RED, COLOR_BLACK);
|
||||
init_pair(3, COLOR_BLUE, COLOR_WHITE);
|
||||
|
||||
// You can cumulate attributes in this speacil variable
|
||||
attr_t emphasis = A_REVERSE | COLOR_PAIR(1);
|
||||
attr_t console = A_REVERSE | COLOR_PAIR(3);
|
||||
// Hee is the example use case if that given variable
|
||||
attron(emphasis);
|
||||
mvprintw(1,0,"emphasis with reversed color pair 1");
|
||||
attroff(emphasis);
|
||||
|
||||
char c;
|
||||
//Nwo if we want to create a char with attirbites on it ?
|
||||
chtype cht = 'a' | A_UNDERLINE | COLOR_PAIR(2);
|
||||
|
||||
attron(console);
|
||||
mvprintw(4,0,"Every char for ncurses is a chtype");
|
||||
attroff(console);
|
||||
mvaddch(5,0,cht);
|
||||
|
||||
while(c = getch())
|
||||
{
|
||||
attron(console);
|
||||
mvprintw(10,0,"KEY Name : %s - 0x%02x\n", keyname(c), c);
|
||||
if(c == ctrl('a'))
|
||||
{
|
||||
mvprintw(9,0,"ctrl-a detected");
|
||||
}
|
||||
}
|
||||
|
||||
endwin();
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
rm menu
|
||||
|
||||
g++ main.cpp -o menu -lncurses
|
||||
|
||||
./menu
|
@ -1,58 +0,0 @@
|
||||
#include <ncurses.h>
|
||||
#include "menu.h"
|
||||
|
||||
#define ctrl(x) (x & 0x1F) // Detection of ctrl+x presses please do not forget that in unix ctrl+c and ctrl+z are special commands.
|
||||
|
||||
// INFO: wgetch(win); or getch(); // getch will make a refresh for us.
|
||||
|
||||
int main(int argv, char ** argc)
|
||||
{
|
||||
//Variables
|
||||
int xMax, yMax = 0;
|
||||
char pressed;
|
||||
|
||||
j
|
||||
//Init Ncurses
|
||||
initscr();
|
||||
|
||||
if(has_colors() == false) // If the terminal does have colors
|
||||
{
|
||||
printf("This menu is not supported by terminals without colors\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
start_color();
|
||||
|
||||
noecho();
|
||||
curs_set(0); // Cursor won't show up
|
||||
getmaxyx(stdscr, yMax, xMax);
|
||||
// size y size x pos y pos x
|
||||
WINDOW *win = newwin(yMax/2, xMax/2, yMax/4, xMax/4);
|
||||
box(win,0,0);
|
||||
|
||||
//Setc colors
|
||||
init_pair(1, COLOR_WHITE, COLOR_BLUE);
|
||||
|
||||
std::string menu1[4]={"New","Open","Save","Exit"};
|
||||
std::string menu2[3]={"Copy","Cut","Paste"};
|
||||
std::string menu3[5]={"Terminal","Help","Info","Update","Manual"};
|
||||
|
||||
// Second stage declarations
|
||||
Menu menus[3]={ // init the menus
|
||||
Menu("File", 'f', menu1, 4),
|
||||
Menu("Edit", 'e', menu2, 3),
|
||||
Menu("Options", 'o', menu3, 5),
|
||||
};
|
||||
|
||||
MenuBar menuBar = MenuBar(win, menus, 3); // init the menu bar
|
||||
menuBar.draw();
|
||||
|
||||
while(pressed = wgetch(win))
|
||||
{
|
||||
menuBar.handleTrigger(pressed);
|
||||
menuBar.draw();
|
||||
}
|
||||
|
||||
endwin();
|
||||
return 0;
|
||||
}
|
@ -1,180 +0,0 @@
|
||||
#include <curses.h>
|
||||
#include <string>
|
||||
|
||||
#ifndef _MENU_H_
|
||||
#define _MENU_H_
|
||||
|
||||
class Menu
|
||||
{
|
||||
public:
|
||||
Menu(std::string name, char trigger, std::string *items, int itemCount);
|
||||
void selectNextItem();
|
||||
void selectPrevItem();
|
||||
|
||||
int startX, startY;
|
||||
std::string name;
|
||||
char trigger;
|
||||
int selectedItem = 0; // alyas have the first one selected
|
||||
std::string *items;
|
||||
int itemCount=0;
|
||||
};
|
||||
|
||||
Menu::Menu(std::string name, char trigger, std::string *items, int itemCount)
|
||||
{
|
||||
this->name = name;
|
||||
this->trigger = trigger;
|
||||
this->items = items;
|
||||
this->itemCount = itemCount;
|
||||
}
|
||||
|
||||
void Menu::selectNextItem()
|
||||
{
|
||||
selectedItem ++;
|
||||
if(selectedItem >= itemCount)
|
||||
{
|
||||
selectedItem = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void Menu::selectPrevItem()
|
||||
{
|
||||
selectedItem--;
|
||||
if(selectedItem < 0)
|
||||
{
|
||||
selectedItem = itemCount-1;
|
||||
}
|
||||
}
|
||||
|
||||
class MenuBar
|
||||
{
|
||||
public:
|
||||
MenuBar(WINDOW * win, Menu * menus, int menuCnt);
|
||||
void draw();
|
||||
void handleTrigger(char trigger);
|
||||
void reset();
|
||||
void drawMenu(Menu menu, int currIndex);
|
||||
void drawMenuItems(Menu menu);
|
||||
|
||||
WINDOW * win;
|
||||
WINDOW * menuwin;
|
||||
Menu * menus;
|
||||
int menuCnt;
|
||||
int i =0;
|
||||
int selected_menu = 90;
|
||||
int start_pos = 0;
|
||||
std::string name;
|
||||
};
|
||||
|
||||
MenuBar::MenuBar(WINDOW * win, Menu * menus, int menuCnt)
|
||||
{
|
||||
this->win = win;
|
||||
this->menus = menus;
|
||||
this->menuCnt = menuCnt;
|
||||
int currPos = 2;
|
||||
|
||||
//Initialize the menu window
|
||||
int xMax, yMax, xBeg, yBeg = 0;
|
||||
getmaxyx(win, yMax, xMax);
|
||||
getbegyx(win, yBeg, xBeg);
|
||||
|
||||
menuwin = newwin(yMax-2, xMax-2, yBeg+1, xBeg+1);
|
||||
keypad(menuwin, true);
|
||||
wrefresh(menuwin);
|
||||
|
||||
for(i = 0; i < menuCnt ; i ++)
|
||||
{
|
||||
this->menus[i].startX = currPos;
|
||||
currPos += this->menus[i].name.length() + 1;
|
||||
}
|
||||
}
|
||||
|
||||
void MenuBar::draw()
|
||||
{
|
||||
for(i = 0; i < menuCnt ; i ++)
|
||||
{
|
||||
drawMenu(menus[i], i);
|
||||
}
|
||||
selected_menu = -1;
|
||||
}
|
||||
|
||||
void MenuBar::drawMenu(Menu menu,int currIndex)
|
||||
{
|
||||
start_pos = menu.startX;
|
||||
name = menu.name;
|
||||
if(currIndex == selected_menu)
|
||||
{
|
||||
wattron(win, A_STANDOUT);
|
||||
}
|
||||
mvwprintw(win, 0, start_pos, name.c_str());
|
||||
wattroff(win, A_STANDOUT);
|
||||
wrefresh(win);
|
||||
|
||||
int ch = 0;
|
||||
|
||||
drawMenuItems(menu);
|
||||
|
||||
while(currIndex == selected_menu && (ch = wgetch(menuwin)))
|
||||
{
|
||||
switch(ch)
|
||||
{
|
||||
case KEY_UP:
|
||||
menu.selectPrevItem();
|
||||
break;
|
||||
case KEY_DOWN:
|
||||
menu.selectNextItem();
|
||||
break;
|
||||
default:
|
||||
currIndex = -1;
|
||||
break;
|
||||
}
|
||||
drawMenuItems(menu);
|
||||
}
|
||||
werase(menuwin);
|
||||
wrefresh(menuwin);
|
||||
reset();
|
||||
}
|
||||
|
||||
void MenuBar::drawMenuItems(Menu menu)
|
||||
{
|
||||
int yMax, xMax;
|
||||
getmaxyx(menuwin, yMax, xMax);
|
||||
|
||||
for(i=0; i < menu.itemCount ; i ++)
|
||||
{
|
||||
mvwprintw(menuwin,i,0,menu.items[i].c_str());
|
||||
if(menu.selectedItem == i)
|
||||
{
|
||||
//if selected change to color pair 1
|
||||
mvwchgat(menuwin,i,0,xMax,A_NORMAL,1, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Not selected but we still want it to be reversed
|
||||
mvwchgat(menuwin,i,0,xMax,A_STANDOUT,0, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MenuBar::reset()
|
||||
{
|
||||
for(i = 0; i < menuCnt ; i ++)
|
||||
{
|
||||
start_pos = this->menus[i].startX;
|
||||
name = this->menus[i].name;
|
||||
mvwprintw(win, 0, start_pos, name.c_str());
|
||||
}
|
||||
wrefresh(win);
|
||||
}
|
||||
|
||||
void MenuBar::handleTrigger(char trigger)
|
||||
{
|
||||
for(i = 0; i < menuCnt ; i ++)
|
||||
{
|
||||
if(trigger == this->menus[i].trigger)
|
||||
{
|
||||
selected_menu = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
@ -1,5 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
g++ main.cpp -o menu -lncurses
|
||||
|
||||
./menu
|
@ -1,32 +0,0 @@
|
||||
#include <ncurses.h>
|
||||
#include "player.hpp"
|
||||
|
||||
int main(int argv, char ** argc)
|
||||
{
|
||||
//variables
|
||||
int i,std_xMax, std_yMax = 0;
|
||||
|
||||
//Init Ncurses
|
||||
initscr();
|
||||
noecho();
|
||||
cbreak();
|
||||
|
||||
getmaxyx(stdscr, std_yMax, std_xMax);
|
||||
|
||||
WINDOW * play_win = newwin(20, 50, std_yMax/2-10, 10);
|
||||
keypad(play_win, true); // so that we can use the arrow keys
|
||||
box(play_win,0,0);
|
||||
|
||||
Player *player = new Player(play_win, 1, 1, '#');
|
||||
printw("Press x to quit");
|
||||
printw("\nPress arrow keys to move");
|
||||
refresh();
|
||||
wrefresh(play_win);
|
||||
|
||||
do{
|
||||
player->display();
|
||||
wrefresh(play_win);
|
||||
}while(player->getMv()!='x');
|
||||
|
||||
endwin();
|
||||
}
|
@ -1,102 +0,0 @@
|
||||
#ifndef _PLAYER_H_
|
||||
#define _PLAYER_H_
|
||||
|
||||
class Player
|
||||
{
|
||||
public:
|
||||
Player(WINDOW* win, int y, int x, char c);
|
||||
void mvUp();
|
||||
void mvDown();
|
||||
void mvLeft();
|
||||
void mvRight();
|
||||
int getMv();
|
||||
void display();
|
||||
|
||||
private:
|
||||
int xLoc, yLoc, xMax, yMax;
|
||||
char playerChar;
|
||||
WINDOW * curWin;
|
||||
};
|
||||
|
||||
|
||||
Player::Player(WINDOW* win, int y, int x, char c)
|
||||
{
|
||||
curWin = win;
|
||||
xLoc = x;
|
||||
yLoc = y;
|
||||
getmaxyx(curWin, yMax, xMax);
|
||||
keypad(curWin, true);
|
||||
playerChar = c;
|
||||
}
|
||||
|
||||
void Player::mvUp()
|
||||
{
|
||||
mvwaddch(curWin,yLoc, xLoc, '.');
|
||||
yLoc --;
|
||||
if(yLoc < 1)
|
||||
{
|
||||
yLoc = 1;
|
||||
}
|
||||
}
|
||||
|
||||
void Player::mvDown()
|
||||
{
|
||||
mvwaddch(curWin,yLoc, xLoc, '.');
|
||||
yLoc ++;
|
||||
if(yLoc > yMax-2)
|
||||
{
|
||||
yLoc = yMax-2;
|
||||
}
|
||||
}
|
||||
|
||||
void Player::mvLeft()
|
||||
{
|
||||
mvwaddch(curWin,yLoc, xLoc, '.');
|
||||
xLoc --;
|
||||
if(xLoc < 1)
|
||||
{
|
||||
xLoc = 1;
|
||||
}
|
||||
}
|
||||
|
||||
void Player::mvRight()
|
||||
{
|
||||
mvwaddch(curWin,yLoc, xLoc, '.');
|
||||
xLoc ++;
|
||||
if(xLoc > xMax-2)
|
||||
{
|
||||
xLoc = xMax-2;
|
||||
}
|
||||
}
|
||||
|
||||
int Player::getMv()
|
||||
{
|
||||
int choice = wgetch(curWin);
|
||||
switch(choice)
|
||||
{
|
||||
case KEY_UP:
|
||||
mvUp();
|
||||
break;
|
||||
case KEY_DOWN:
|
||||
mvDown();
|
||||
break;
|
||||
case KEY_LEFT:
|
||||
mvLeft();
|
||||
break;
|
||||
case KEY_RIGHT:
|
||||
mvRight();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return choice;
|
||||
}
|
||||
|
||||
void Player::display()
|
||||
{
|
||||
mvwaddch(curWin,yLoc, xLoc, playerChar);
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif
|
@ -1,7 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
rm ./menu
|
||||
|
||||
gcc main.c -o menu -lmenu -lncurses
|
||||
|
||||
./menu
|
@ -1,100 +0,0 @@
|
||||
#include <curses.h>
|
||||
#include <menu.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
|
||||
#define CTRLD 4
|
||||
|
||||
char *choices[] = {
|
||||
"Choice 1", "Choice 2", "Choice 3", "Choice 4", "Choice 5",
|
||||
"Choice 6", "Choice 7", "Choice 8", "Choice 9", "Choice 10",
|
||||
"Choice 11", "Choice 12", "Choice 13", "Choice 14", "Choice 15",
|
||||
"Choice 16", "Choice 17", "Choice 18", "Choice 19", "Choice 20",
|
||||
"Exit",
|
||||
(char *)NULL,
|
||||
};
|
||||
|
||||
int main()
|
||||
{ ITEM **my_items;
|
||||
int c;
|
||||
MENU *my_menu;
|
||||
WINDOW *my_menu_win;
|
||||
int n_choices, i;
|
||||
|
||||
/* Initialize curses */
|
||||
initscr();
|
||||
start_color();
|
||||
cbreak();
|
||||
noecho();
|
||||
keypad(stdscr, TRUE);
|
||||
init_pair(1, COLOR_RED, COLOR_BLACK);
|
||||
init_pair(2, COLOR_CYAN, COLOR_BLACK);
|
||||
|
||||
/* Create items */
|
||||
n_choices = ARRAY_SIZE(choices);
|
||||
my_items = (ITEM **)calloc(n_choices, sizeof(ITEM *));
|
||||
for(i = 0; i < n_choices; ++i)
|
||||
my_items[i] = new_item(choices[i], choices[i]);
|
||||
|
||||
/* Crate menu */
|
||||
my_menu = new_menu((ITEM **)my_items);
|
||||
|
||||
/* Set menu option not to show the description */
|
||||
menu_opts_off(my_menu, O_SHOWDESC);
|
||||
|
||||
/* Create the window to be associated with the menu */
|
||||
my_menu_win = newwin(10, 70, 4, 4);
|
||||
keypad(my_menu_win, TRUE);
|
||||
|
||||
/* Set main window and sub window */
|
||||
set_menu_win(my_menu, my_menu_win);
|
||||
set_menu_sub(my_menu, derwin(my_menu_win, 6, 68, 3, 1));
|
||||
set_menu_format(my_menu, 5, 3);
|
||||
set_menu_mark(my_menu, " * ");
|
||||
|
||||
/* Print a border around the main window and print a title */
|
||||
box(my_menu_win, 0, 0);
|
||||
|
||||
attron(COLOR_PAIR(2));
|
||||
mvprintw(LINES - 3, 0, "Use PageUp and PageDown to scroll");
|
||||
mvprintw(LINES - 2, 0, "Use Arrow Keys to navigate (F1 to Exit)");
|
||||
attroff(COLOR_PAIR(2));
|
||||
refresh();
|
||||
|
||||
/* Post the menu */
|
||||
post_menu(my_menu);
|
||||
wrefresh(my_menu_win);
|
||||
|
||||
while((c = wgetch(my_menu_win)) != KEY_F(1))
|
||||
{ switch(c)
|
||||
{ case KEY_DOWN:
|
||||
menu_driver(my_menu, REQ_DOWN_ITEM);
|
||||
break;
|
||||
case KEY_UP:
|
||||
menu_driver(my_menu, REQ_UP_ITEM);
|
||||
break;
|
||||
case KEY_LEFT:
|
||||
menu_driver(my_menu, REQ_LEFT_ITEM);
|
||||
break;
|
||||
case KEY_RIGHT:
|
||||
menu_driver(my_menu, REQ_RIGHT_ITEM);
|
||||
break;
|
||||
case KEY_NPAGE:
|
||||
menu_driver(my_menu, REQ_SCR_DPAGE);
|
||||
break;
|
||||
case KEY_PPAGE:
|
||||
menu_driver(my_menu, REQ_SCR_UPAGE);
|
||||
break;
|
||||
}
|
||||
wrefresh(my_menu_win);
|
||||
}
|
||||
|
||||
/* Unpost and free all the memory taken up */
|
||||
unpost_menu(my_menu);
|
||||
free_menu(my_menu);
|
||||
for(i = 0; i < n_choices; ++i)
|
||||
free_item(my_items[i]);
|
||||
endwin();
|
||||
}
|
@ -1,102 +0,0 @@
|
||||
#ifndef _PLAYER_H_
|
||||
#define _PLAYER_H_
|
||||
|
||||
class Player
|
||||
{
|
||||
public:
|
||||
Player(WINDOW* win, int y, int x, char c);
|
||||
void mvUp();
|
||||
void mvDown();
|
||||
void mvLeft();
|
||||
void mvRight();
|
||||
int getMv();
|
||||
void display();
|
||||
|
||||
private:
|
||||
int xLoc, yLoc, xMax, yMax;
|
||||
char playerChar;
|
||||
WINDOW * curWin;
|
||||
};
|
||||
|
||||
|
||||
Player::Player(WINDOW* win, int y, int x, char c)
|
||||
{
|
||||
curWin = win;
|
||||
xLoc = x;
|
||||
yLoc = y;
|
||||
getmaxyx(curWin, yMax, xMax);
|
||||
keypad(curWin, true);
|
||||
playerChar = c;
|
||||
}
|
||||
|
||||
void Player::mvUp()
|
||||
{
|
||||
mvwaddch(curWin,yLoc, xLoc, '.');
|
||||
yLoc --;
|
||||
if(yLoc < 1)
|
||||
{
|
||||
yLoc = 1;
|
||||
}
|
||||
}
|
||||
|
||||
void Player::mvDown()
|
||||
{
|
||||
mvwaddch(curWin,yLoc, xLoc, '.');
|
||||
yLoc ++;
|
||||
if(yLoc > yMax-2)
|
||||
{
|
||||
yLoc = yMax-2;
|
||||
}
|
||||
}
|
||||
|
||||
void Player::mvLeft()
|
||||
{
|
||||
mvwaddch(curWin,yLoc, xLoc, '.');
|
||||
xLoc --;
|
||||
if(xLoc < 1)
|
||||
{
|
||||
xLoc = 1;
|
||||
}
|
||||
}
|
||||
|
||||
void Player::mvRight()
|
||||
{
|
||||
mvwaddch(curWin,yLoc, xLoc, '.');
|
||||
xLoc ++;
|
||||
if(xLoc > xMax-2)
|
||||
{
|
||||
xLoc = xMax-2;
|
||||
}
|
||||
}
|
||||
|
||||
int Player::getMv()
|
||||
{
|
||||
int choice = wgetch(curWin);
|
||||
switch(choice)
|
||||
{
|
||||
case KEY_UP:
|
||||
mvUp();
|
||||
break;
|
||||
case KEY_DOWN:
|
||||
mvDown();
|
||||
break;
|
||||
case KEY_LEFT:
|
||||
mvLeft();
|
||||
break;
|
||||
case KEY_RIGHT:
|
||||
mvRight();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return choice;
|
||||
}
|
||||
|
||||
void Player::display()
|
||||
{
|
||||
mvwaddch(curWin,yLoc, xLoc, playerChar);
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif
|
@ -1,10 +0,0 @@
|
||||
# test cmake test
|
||||
|
||||
|
||||
cmake_minimum_required(VERSION 3.13)
|
||||
|
||||
project(Tutorial VERSION 1.0)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED True)
|
||||
|
@ -1,4 +0,0 @@
|
||||
int main()
|
||||
{
|
||||
return 0;
|
||||
}
|
@ -1,66 +0,0 @@
|
||||
#include "errorHandling.h"
|
||||
|
||||
ErrorHandler::ErrorHandler(): emptyIndex(0)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void ErrorHandler::handleError(int errNo, std::string source)
|
||||
{
|
||||
int index = 0;
|
||||
|
||||
index = getLookUpIndex(errNo, source);
|
||||
|
||||
if(index < 0)
|
||||
{
|
||||
std::cout << "The given error number does not exist\n" << "Tipp: use \"addNewError(Integer, String)\""<< std::endl;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
std::cout << ">> Error << | " << errorLookup[index].errSource << " | " << errNo << " | \"" << errorLookup[index].errMessage << "\""<<std::endl;
|
||||
|
||||
if(errorLookup[index].errExit)
|
||||
{
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
void ErrorHandler::addNewError(const int& no, const std::string& source, const std::string& message, const unsigned char kill)
|
||||
{
|
||||
if(emptyIndex >= MAX_NUMBER_OF_ERRORS) // Check if list is full
|
||||
{
|
||||
std::cout << "Error | Ultimate | List is full" << std::endl;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if(getLookUpIndex(no, source) >= 0) // Check if Error No already exists
|
||||
{
|
||||
std::cout << "Error | Intern | Error No: "<< no << " From Source: "<< source <<" Exists ! PLease choose a different number !" << std::endl;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
errorLookup[emptyIndex].errNo = no;
|
||||
errorLookup[emptyIndex].errSource = source;
|
||||
errorLookup[emptyIndex].errMessage = message;
|
||||
errorLookup[emptyIndex].errExit = kill;
|
||||
emptyIndex++;
|
||||
}
|
||||
|
||||
//
|
||||
// Privat memeber functions
|
||||
|
||||
int ErrorHandler::getLookUpIndex(int errNo, std::string source)
|
||||
{
|
||||
int i = 0;
|
||||
for(i = 0; i < emptyIndex; i++)
|
||||
{
|
||||
if(errNo == errorLookup[i].errNo)
|
||||
{
|
||||
if(source == errorLookup[i].errSource)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
@ -1,44 +0,0 @@
|
||||
/*
|
||||
* Authors : Kerem Yollu & Edwin Koch
|
||||
* Date : 07.03.2021
|
||||
*
|
||||
* Description :
|
||||
* TODO : Inplement singleton pattern
|
||||
* TODO : Write description
|
||||
* TODO : Comment the code wiht odxygen
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _ERRORHANDLIG_H_
|
||||
#define _ERRORHANDLIG_H_
|
||||
|
||||
#include <iostream>
|
||||
#include <array>
|
||||
#include <string>
|
||||
|
||||
#define MAX_NUMBER_OF_ERRORS 255
|
||||
#define KILL 1
|
||||
#define SPARE 0
|
||||
|
||||
class ErrorHandler
|
||||
{
|
||||
public:
|
||||
ErrorHandler();
|
||||
void addNewError(const int& no, const std::string& source, const std::string& message, const unsigned char kill);
|
||||
void handleError(int no, std::string source);
|
||||
private:
|
||||
|
||||
struct error_t { //Struture of error entry for the errorLookup table
|
||||
int errNo;
|
||||
std::string errMessage;
|
||||
std::string errSource;
|
||||
unsigned char errExit;
|
||||
};
|
||||
|
||||
unsigned int emptyIndex; // Indicates the next empty slot in the errorLookup table.
|
||||
std::array <error_t,MAX_NUMBER_OF_ERRORS> errorLookup; // Where the errors go.
|
||||
int getLookUpIndex(int errNo, std::string source); // If error number exists returns the index otherwise -1
|
||||
};
|
||||
|
||||
#endif // _ERRORHANDLIG_H_
|
@ -1,40 +0,0 @@
|
||||
#ifndef _I2C_H_
|
||||
#define _I2C_H_
|
||||
|
||||
#include <unistd.h>
|
||||
#include <stdint.h>
|
||||
#include <memory>
|
||||
#include <ostream>
|
||||
#include <iostream>
|
||||
#include "../../config.h"
|
||||
|
||||
class I2C
|
||||
{
|
||||
public:
|
||||
enum errors
|
||||
{
|
||||
noError,
|
||||
writeFailed,
|
||||
readFailed,
|
||||
bufferFull,
|
||||
fasleAddrs,
|
||||
initFailed
|
||||
};
|
||||
|
||||
I2C();
|
||||
~I2C();
|
||||
uint8_t readByte(const uint8_t& address, const uint8_t& reg);
|
||||
uint16_t readWord(const uint8_t& address, const uint8_t& reg);
|
||||
uint8_t writeByte(const uint8_t& address, const uint8_t& data);
|
||||
uint8_t writeWord(const uint8_t& address, const uint8_t& reg, const uint8_t& data);
|
||||
uint8_t writeBuffer(const uint8_t& address, const uint8_t& buffer, uint8_t len);
|
||||
uint8_t readBuffer(const uint8_t& address, const uint8_t& buffer, uint8_t len);
|
||||
int8_t getError();
|
||||
|
||||
private:
|
||||
struct i2cImpl;
|
||||
std::unique_ptr<i2cImpl> i2cPimpl;
|
||||
|
||||
};
|
||||
#endif // _I2C_H_
|
||||
#define _I2C_H_
|
@ -1,52 +0,0 @@
|
||||
#include "i2c.hpp"
|
||||
|
||||
/*
|
||||
#if PLATFORM == LINUX
|
||||
#include "i2c_linux.hpp"
|
||||
#endif
|
||||
|
||||
#if PLATFORM == LINUX
|
||||
#include "i2c_stm.hpp"
|
||||
#endif
|
||||
*/
|
||||
|
||||
#include "i2c_linux.hpp"
|
||||
|
||||
I2C::I2C():i2cPimpl(new i2cImpl()){}
|
||||
|
||||
I2C::~I2C(){}
|
||||
|
||||
uint8_t I2C::readByte(const uint8_t& address, const uint8_t& reg)
|
||||
{
|
||||
return i2cPimpl->readByte(address,reg);
|
||||
}
|
||||
|
||||
uint16_t I2C::readWord(const uint8_t& address, const uint8_t& reg)
|
||||
{
|
||||
return i2cPimpl->readWord(address,reg);
|
||||
}
|
||||
|
||||
uint8_t I2C::writeByte(const uint8_t& address, const uint8_t& data)
|
||||
{
|
||||
return i2cPimpl->writeByte(address,data);
|
||||
}
|
||||
|
||||
uint8_t I2C::writeWord(const uint8_t& address, const uint8_t& reg, const uint8_t& data)
|
||||
{
|
||||
return i2cPimpl->writeWord(address,reg,data);
|
||||
}
|
||||
|
||||
void I2C::writeBuffer(const uint8_t& address, const uint8_t* buffer, uint8_t len)
|
||||
{
|
||||
return i2cPimpl->writeBuffer(address,buffer,len);
|
||||
}
|
||||
|
||||
void I2C::readBuffer(const uint8_t& address, const uint8_t* buffer, uint8_t len)
|
||||
{
|
||||
return i2cPimpl->readBuffer(address,buffer,len);
|
||||
}
|
||||
|
||||
void I2C::throwError(I2C::errors errNo)
|
||||
{
|
||||
i2cPimpl->throwError(errNo);
|
||||
}
|
@ -1,39 +0,0 @@
|
||||
#ifndef _I2C_H_
|
||||
#define _I2C_H_
|
||||
|
||||
#include <unistd.h>
|
||||
#include <stdint.h>
|
||||
#include <memory>
|
||||
#include <ostream>
|
||||
#include <iostream>
|
||||
#include "../../config.h"
|
||||
|
||||
class I2C
|
||||
{
|
||||
public:
|
||||
enum errors
|
||||
{
|
||||
noError,
|
||||
writeFailed,
|
||||
readFailed,
|
||||
bufferFull,
|
||||
falseAddrs,
|
||||
initFailed
|
||||
};
|
||||
|
||||
I2C();
|
||||
~I2C();
|
||||
uint8_t readByte(const uint8_t& address, const uint8_t& reg);
|
||||
uint16_t readWord(const uint8_t& address, const uint8_t& reg);
|
||||
uint8_t writeByte(const uint8_t& address, const uint8_t& data);
|
||||
uint8_t writeWord(const uint8_t& address, const uint8_t& reg, const uint8_t& data);
|
||||
void writeBuffer(const uint8_t& address, const uint8_t* buffer, uint8_t len);
|
||||
void readBuffer(const uint8_t& address, const uint8_t* buffer, uint8_t len);
|
||||
|
||||
private:
|
||||
void throwError(errors errNo);
|
||||
struct i2cImpl;
|
||||
std::unique_ptr<i2cImpl> i2cPimpl;
|
||||
};
|
||||
#endif // _I2C_H_
|
||||
#define _I2C_H_
|
@ -1,136 +0,0 @@
|
||||
#ifndef _I2C_LINUX_H_
|
||||
#define _I2C_LINUX_H_
|
||||
#include "i2c.hpp"
|
||||
|
||||
#include <linux/i2c-dev.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
struct I2C::i2cImpl
|
||||
{
|
||||
int16_t deviceDescriptor;
|
||||
uint8_t device_address;
|
||||
uint8_t send_buffer[32];
|
||||
uint8_t recieve_buffer[32];
|
||||
uint8_t blocks;
|
||||
uint8_t channel;
|
||||
uint8_t mode;
|
||||
uint8_t status;
|
||||
i2cImpl()
|
||||
{
|
||||
char filename[20];
|
||||
|
||||
snprintf(filename, 19, "/dev/i2c-%d", 1);
|
||||
|
||||
deviceDescriptor = open(filename, O_RDWR);
|
||||
if (deviceDescriptor < 0) {
|
||||
throwError(initFailed);
|
||||
}
|
||||
}
|
||||
uint8_t readByte(const uint8_t& address, const uint8_t& reg)
|
||||
{
|
||||
if (ioctl(deviceDescriptor, I2C_SLAVE, address) < 0)
|
||||
{
|
||||
throwError(falseAddrs);
|
||||
}
|
||||
|
||||
writeByte(address,reg); //Initiate a write to indicate the desired register to read
|
||||
|
||||
if (read(deviceDescriptor, recieve_buffer, 1) != 1) // An then initare a read request of 1 byte
|
||||
{
|
||||
throwError(writeFailed);
|
||||
}
|
||||
return recieve_buffer[0] ;
|
||||
}
|
||||
|
||||
uint16_t readWord(const uint8_t& address, const uint8_t& reg)
|
||||
{
|
||||
uint16_t result = 0 ;
|
||||
if (ioctl(deviceDescriptor, I2C_SLAVE, address) < 0)
|
||||
{
|
||||
throwError(falseAddrs);
|
||||
}
|
||||
|
||||
writeByte(address,reg); //Initiate a write to indicate the desired register to read
|
||||
|
||||
if (read(deviceDescriptor, recieve_buffer, 2) != 2) // An then initare a read request of 2 bytes
|
||||
{
|
||||
throwError(writeFailed);
|
||||
}
|
||||
result = (recieve_buffer[0] << 8) + recieve_buffer[1] ;
|
||||
return result ;
|
||||
}
|
||||
|
||||
uint8_t writeByte(const uint8_t& address, const uint8_t& data)
|
||||
{
|
||||
if (ioctl(deviceDescriptor, I2C_SLAVE, address) < 0)
|
||||
{
|
||||
throwError(falseAddrs);
|
||||
}
|
||||
|
||||
send_buffer[0] = data;
|
||||
|
||||
if ((write(deviceDescriptor, send_buffer, 1)) != 1)
|
||||
{
|
||||
throwError(writeFailed);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint8_t writeWord(const uint8_t& address, const uint8_t& reg, const uint8_t& data)
|
||||
{
|
||||
if (ioctl(deviceDescriptor, I2C_SLAVE, address) < 0)
|
||||
{
|
||||
throwError(falseAddrs);
|
||||
}
|
||||
|
||||
send_buffer[0] = reg;
|
||||
send_buffer[1] = data;
|
||||
|
||||
if ((write(deviceDescriptor, send_buffer, 2)) != 2)
|
||||
{
|
||||
throwError(writeFailed);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void writeBuffer(const uint8_t& address, const uint8_t* buffer, uint8_t len)
|
||||
{
|
||||
if (ioctl(deviceDescriptor, I2C_SLAVE, address) < 0)
|
||||
{
|
||||
throwError(falseAddrs);
|
||||
}
|
||||
|
||||
if ((write(deviceDescriptor,buffer, len)) != len)
|
||||
{
|
||||
throwError(writeFailed);
|
||||
}
|
||||
}
|
||||
|
||||
void readBuffer(const uint8_t& address, const uint8_t* buffer, uint8_t len)
|
||||
{
|
||||
uint16_t result = 0 ;
|
||||
if (ioctl(deviceDescriptor, I2C_SLAVE, address) < 0)
|
||||
{
|
||||
throwError(falseAddrs);
|
||||
}
|
||||
|
||||
writeByte(address,buffer[0]); //Initiate a write to indicate the desired register to read
|
||||
|
||||
if (read(deviceDescriptor, recieve_buffer, len) != len) // An then initare a read request of 2 bytes
|
||||
{
|
||||
throwError(writeFailed);
|
||||
}
|
||||
}
|
||||
|
||||
void throwError(I2C::errors errNo)
|
||||
{
|
||||
#ifdef LINUX
|
||||
std::cout << "Linux i2c Error" << std::endl;
|
||||
exit(1);
|
||||
#endif
|
||||
}
|
||||
};
|
||||
#endif // _I2C_LINUX_H_
|
@ -1,20 +0,0 @@
|
||||
#ifndef _IMPLEMENTATION_H_
|
||||
#define _IMPLEMENTATION_H_
|
||||
|
||||
#include "interface.hpp"
|
||||
#include <iostream>
|
||||
#include <unistd.h>
|
||||
|
||||
struct Device::deviceImpl
|
||||
{
|
||||
deviceImpl()
|
||||
{
|
||||
std::cout << "Device implementation Constarctor For Liunx "<< std::endl;
|
||||
}
|
||||
void printNumber(const uint8_t& no)
|
||||
{
|
||||
std::cout << "selected no: "<< unsigned(no*2) << std::endl;
|
||||
}
|
||||
};
|
||||
|
||||
#endif // _IMPLEMENTATION_H_
|
@ -1,20 +0,0 @@
|
||||
#ifndef _IMPLEMENTATION2_H_
|
||||
#define _IMPLEMENTATION2_H_
|
||||
|
||||
#include "interface.hpp"
|
||||
#include <iostream>
|
||||
#include <unistd.h>
|
||||
|
||||
struct Device::deviceImpl
|
||||
{
|
||||
deviceImpl()
|
||||
{
|
||||
std::cout << "Device implementation Constarctor For STM "<< std::endl;
|
||||
}
|
||||
void printNumber(const uint8_t& no)
|
||||
{
|
||||
std::cout << "selected no: "<< unsigned(no) << std::endl;
|
||||
}
|
||||
};
|
||||
|
||||
#endif // _IMPLEMENTATION2_H_
|
@ -1,24 +0,0 @@
|
||||
#include "interface.hpp"
|
||||
|
||||
#if PLATFORM == STM
|
||||
#include "implementations2.hpp"
|
||||
#endif
|
||||
|
||||
#if PLATFORM == LINUX
|
||||
#include "implementations.hpp"
|
||||
#endif
|
||||
|
||||
Device::Device()
|
||||
:pImpl(new deviceImpl())
|
||||
{
|
||||
}
|
||||
|
||||
void Device::printNumber(const uint8_t& no)
|
||||
{
|
||||
pImpl->printNumber(no);
|
||||
}
|
||||
|
||||
Device::~Device()
|
||||
{
|
||||
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
#ifndef _INTERFACE_H_
|
||||
#define _INTERFACE_H_
|
||||
|
||||
#include "../config.h"
|
||||
#include <stdint.h>
|
||||
#include <memory>
|
||||
|
||||
class Device
|
||||
{
|
||||
public:
|
||||
Device();
|
||||
~Device();
|
||||
void printNumber(const uint8_t& no);
|
||||
|
||||
private:
|
||||
struct deviceImpl;
|
||||
std::unique_ptr<deviceImpl> pImpl;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif // _INTERFACE_H_
|
@ -1,20 +0,0 @@
|
||||
cpp_src = $(wildcard *.cpp)
|
||||
|
||||
cpp_obj = $(cpp_src:.cpp=.o)
|
||||
c_obj = $(c_src:.c=.o)
|
||||
CC = g++
|
||||
CFLAGS = -Wall -pedantic -li2c
|
||||
LDFLAGS =
|
||||
EXEC = runtest
|
||||
|
||||
|
||||
all : $(EXEC)
|
||||
|
||||
$(EXEC): $(cpp_obj) $(c_obj)
|
||||
$(CC) -o $@ $^ $(LDFLAGS)
|
||||
|
||||
clean:
|
||||
rm -rf $(c_obj) $(cpp_obj) $(EXEC)
|
||||
|
||||
cleanall:
|
||||
rm -rf $(c_obj) $(cpp_obj) $(EXEC)
|
@ -1,66 +0,0 @@
|
||||
#include <stdint.h>
|
||||
#include <unistd.h>
|
||||
#include <iostream>
|
||||
#include <functional>
|
||||
|
||||
class Device
|
||||
{
|
||||
public:
|
||||
// cllback type
|
||||
typedef std::function<unsigned int(unsigned int)> cb_t;
|
||||
|
||||
Device(cb_t cb) : cb(cb)//Device(cp_t cb) : cb(cb)
|
||||
{
|
||||
|
||||
};
|
||||
|
||||
void do_something(void)
|
||||
{
|
||||
unsigned int return_value;
|
||||
return_value = cb(1);
|
||||
|
||||
std::cout << return_value << std::endl;
|
||||
};
|
||||
|
||||
private:
|
||||
cb_t cb;
|
||||
};
|
||||
|
||||
|
||||
class Interface
|
||||
{
|
||||
public:
|
||||
|
||||
Interface()
|
||||
{
|
||||
std::cout << "created interface object" << std::endl;
|
||||
};
|
||||
|
||||
unsigned int read_write(unsigned int input)
|
||||
{
|
||||
std:: cout << "calling read_write"<< std::endl;
|
||||
std::cout << input << std::endl;
|
||||
return 5;
|
||||
};
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
int main(void)
|
||||
{
|
||||
//using namespace std::placeholders; // for _1, _2, ...
|
||||
std::cout << "callback_example" << std::endl;
|
||||
|
||||
Interface iface;
|
||||
|
||||
//unsigned int ret = iface.read_write(1);
|
||||
|
||||
//std::cout << ret << std::endl;
|
||||
//auto cb = std::bind(&Interface::read_write, &iface,_1);
|
||||
auto cb = std::bind(&Interface::read_write, &iface, std::placeholders::_1);
|
||||
|
||||
Device device(cb);
|
||||
|
||||
device.do_something();
|
||||
return 0;
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
cpp_src = $(wildcard *.cpp)
|
||||
|
||||
cpp_obj = $(cpp_src:.cpp=.o)
|
||||
c_obj = $(c_src:.c=.o)
|
||||
CC = g++
|
||||
CFLAGS = -Wall -pedantic -li2c
|
||||
LDFLAGS =
|
||||
EXEC = runtest
|
||||
|
||||
|
||||
all : $(EXEC)
|
||||
|
||||
$(EXEC): $(cpp_obj) $(c_obj)
|
||||
$(CC) -o $@ $^ $(LDFLAGS)
|
||||
|
||||
clean:
|
||||
rm -rf $(c_obj) $(cpp_obj) $(EXEC)
|
||||
|
||||
cleanall:
|
||||
rm -rf $(c_obj) $(cpp_obj) $(EXEC)
|
@ -1,21 +0,0 @@
|
||||
#include "comstack.hpp"
|
||||
|
||||
|
||||
Comstack::Comstack() :
|
||||
counter(0)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
void Comstack::input(uint8_t value)
|
||||
{
|
||||
for(;counter < nBytes; counter ++) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,22 +0,0 @@
|
||||
#ifndef _COMSTACK_HPP_
|
||||
#define _COMSTACK_HPP_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
class Comstack
|
||||
{
|
||||
public:
|
||||
Comstack();
|
||||
|
||||
void input(uint8_t value);
|
||||
|
||||
|
||||
private:
|
||||
|
||||
uint8_t counter;
|
||||
const uint8_t nBytes = 5;
|
||||
|
||||
};
|
||||
|
||||
#endif // _COMSTACK_HPP_
|
@ -1,12 +0,0 @@
|
||||
#include <iostream>
|
||||
|
||||
|
||||
int main(void)
|
||||
{
|
||||
std::cout << "comstack test" << std::endl;
|
||||
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
cpp_src = $(wildcard *.cpp) $(wildcard ./drivers/bh1750/*.cpp) $(wildcard ./management/*.cpp) $(wildcard ./systems/*.cpp) $(wildcard ./periferals/i2c/*.cpp)
|
||||
|
||||
c_src = $(wildcard ./drivers/pf8574/*.c)
|
||||
|
||||
cpp_obj = $(cpp_src:.cpp=.o)
|
||||
c_obj = $(c_src:.c=.o)
|
||||
CC = g++
|
||||
CFLAGS = -Wall -pedantic -li2c
|
||||
LDFLAGS =
|
||||
EXEC = runtest
|
||||
|
||||
|
||||
all : $(EXEC)
|
||||
|
||||
$(EXEC): $(cpp_obj) $(c_obj)
|
||||
$(CC) -o $@ $^ $(LDFLAGS)
|
||||
|
||||
clean:
|
||||
rm -rf $(c_obj) $(cpp_obj) $(EXEC)
|
||||
|
||||
cleanall:
|
||||
rm -rf $(c_obj) $(cpp_obj) $(EXEC)
|
@ -1,61 +0,0 @@
|
||||
#include "bh1750.h"
|
||||
|
||||
|
||||
|
||||
Bh1750::Bh1750(i2c_ch1_pImpL *i2c)
|
||||
{
|
||||
i2c_bh1750 = i2c;
|
||||
currentMode = 0; // no mode selected
|
||||
}
|
||||
|
||||
uint8_t Bh1750::sleep()
|
||||
{
|
||||
i2c_bh1750->writeByte(BH1750_ADDR,BH1750_POWER_DOWN);
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint8_t Bh1750::wake()
|
||||
{
|
||||
i2c_bh1750->writeByte(BH1750_ADDR,BH1750_POWER_ON);
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint8_t Bh1750::reset()
|
||||
{
|
||||
i2c_bh1750->writeByte(BH1750_ADDR,BH1750_RESET);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
float Bh1750::oneShot(uint8_t mode)
|
||||
{
|
||||
if(mode > 0)
|
||||
{
|
||||
if( mode == BH1750_ONE_TIME_HIGH_RES_MODE_1 ||
|
||||
mode == BH1750_ONE_TIME_HIGH_RES_MODE_2 ||
|
||||
mode == BH1750_ONE_TIME_LOW_RES_MODE)
|
||||
{
|
||||
return i2c_bh1750->readWord(BH1750_ADDR,mode) / 1.2 ;
|
||||
|
||||
}
|
||||
}
|
||||
std::cout<< "please seelct a one shot mode "<< std::endl;
|
||||
exit(1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
float Bh1750::continious(uint8_t mode, uint8_t delayMs)
|
||||
{
|
||||
if(mode > 0)
|
||||
{
|
||||
if( mode == BH1750_CONTINUOUS_HIGH_RES_MODE_1 ||
|
||||
mode == BH1750_CONTINUOUS_HIGH_RES_MODE_2 ||
|
||||
mode == BH1750_CONTINUOUS_LOW_RES_MODE)
|
||||
{
|
||||
return i2c_bh1750->readWord(BH1750_ADDR,mode) / 1.2;
|
||||
}
|
||||
}
|
||||
std::cout<< "please seelct a continious mode "<< std::endl;
|
||||
exit(1);
|
||||
return 0;
|
||||
}
|
@ -1,50 +0,0 @@
|
||||
|
||||
#ifndef _BH1750_H_
|
||||
#define _BH1750_H_
|
||||
|
||||
#include <iostream>
|
||||
#include <array>
|
||||
#include <string>
|
||||
#include "../../periferals/i2c/i2c_ch1_pImpL.hpp"
|
||||
|
||||
|
||||
//Start measurement at 4lx resolution. Time typically 16ms.
|
||||
#define BH1750_CONTINUOUS_LOW_RES_MODE 0x13
|
||||
//Start measurement at 1lx resolution. Time typically 120ms
|
||||
#define BH1750_CONTINUOUS_HIGH_RES_MODE_1 0x10
|
||||
//Start measurement at 0.5lx resolution. Time typically 120ms
|
||||
#define BH1750_CONTINUOUS_HIGH_RES_MODE_2 0x11
|
||||
//Start measurement at 1lx resolution. Time typically 120ms
|
||||
//Device is automatically set to Power Down after measurement.
|
||||
#define BH1750_ONE_TIME_HIGH_RES_MODE_1 0x20
|
||||
//Start measurement at 0.5lx resolution. Time typically 120ms
|
||||
//Device is automatically set to Power Down after measurement.
|
||||
#define BH1750_ONE_TIME_HIGH_RES_MODE_2 0x21
|
||||
//Start measurement at 1lx resolution. Time typically 120ms
|
||||
//Device is automatically set to Power Down after measurement.
|
||||
#define BH1750_ONE_TIME_LOW_RES_MODE 0x23
|
||||
|
||||
#define BH1750_POWER_DOWN 0x00 // No active state
|
||||
#define BH1750_POWER_ON 0x01 // Power on
|
||||
#define BH1750_RESET 0x07 // Reset data register value
|
||||
|
||||
#define BH1750_ADDR 0x23 // Device Adress
|
||||
|
||||
class Bh1750
|
||||
{
|
||||
public:
|
||||
Bh1750(i2c_ch1_pImpL *i2c);
|
||||
uint8_t sleep(); // To be testes
|
||||
uint8_t wake(); // To be tested
|
||||
uint8_t reset(); // To be tested
|
||||
float oneShot(uint8_t mode); // ok
|
||||
float continious(uint8_t mode, uint8_t delayMs); // IMplment delay or make a delay class ???
|
||||
private:
|
||||
i2c_ch1_pImpL* i2c_bh1750;
|
||||
uint8_t high;
|
||||
uint8_t low;
|
||||
uint8_t currentMode;
|
||||
uint8_t currentState;
|
||||
};
|
||||
|
||||
#endif // _BH1750_H_
|
@ -1,69 +0,0 @@
|
||||
#!/usr/bin/python
|
||||
#---------------------------------------------------------------------
|
||||
# ___ ___ _ ____
|
||||
# / _ \/ _ \(_) __/__ __ __
|
||||
# / , _/ ___/ /\ \/ _ \/ // /
|
||||
# /_/|_/_/ /_/___/ .__/\_, /
|
||||
# /_/ /___/
|
||||
#
|
||||
# bh1750.py
|
||||
# Read data from a BH1750 digital light sensor.
|
||||
#
|
||||
# Author : Matt Hawkins
|
||||
# Date : 26/06/2018
|
||||
#
|
||||
# For more information please visit :
|
||||
# https://www.raspberrypi-spy.co.uk/?s=bh1750
|
||||
#
|
||||
#---------------------------------------------------------------------
|
||||
import smbus
|
||||
import time
|
||||
|
||||
# Define some constants from the datasheet
|
||||
|
||||
DEVICE = 0x23 # Default device I2C address
|
||||
|
||||
POWER_DOWN = 0x00 # No active state
|
||||
POWER_ON = 0x01 # Power on
|
||||
RESET = 0x07 # Reset data register value
|
||||
|
||||
# Start measurement at 4lx resolution. Time typically 16ms.
|
||||
CONTINUOUS_LOW_RES_MODE = 0x13
|
||||
# Start measurement at 1lx resolution. Time typically 120ms
|
||||
CONTINUOUS_HIGH_RES_MODE_1 = 0x10
|
||||
# Start measurement at 0.5lx resolution. Time typically 120ms
|
||||
CONTINUOUS_HIGH_RES_MODE_2 = 0x11
|
||||
# Start measurement at 1lx resolution. Time typically 120ms
|
||||
# Device is automatically set to Power Down after measurement.
|
||||
ONE_TIME_HIGH_RES_MODE_1 = 0x20
|
||||
# Start measurement at 0.5lx resolution. Time typically 120ms
|
||||
# Device is automatically set to Power Down after measurement.
|
||||
ONE_TIME_HIGH_RES_MODE_2 = 0x21
|
||||
# Start measurement at 1lx resolution. Time typically 120ms
|
||||
# Device is automatically set to Power Down after measurement.
|
||||
ONE_TIME_LOW_RES_MODE = 0x23
|
||||
|
||||
#bus = smbus.SMBus(0) # Rev 1 Pi uses 0
|
||||
bus = smbus.SMBus(1) # Rev 2 Pi uses 1
|
||||
|
||||
def convertToNumber(data):
|
||||
# Simple function to convert 2 bytes of data
|
||||
# into a decimal number. Optional parameter 'decimals'
|
||||
# will round to specified number of decimal places.
|
||||
result=(data[1] + (256 * data[0])) / 1.2
|
||||
return (result)
|
||||
|
||||
def readLight(addr=DEVICE):
|
||||
# Read data from I2C interface
|
||||
data = bus.read_i2c_block_data(addr,ONE_TIME_HIGH_RES_MODE_1)
|
||||
return convertToNumber(data)
|
||||
|
||||
def main():
|
||||
|
||||
while True:
|
||||
lightLevel=readLight()
|
||||
print("Light Level : " + format(lightLevel,'.2f') + " lx")
|
||||
time.sleep(0.5)
|
||||
|
||||
if __name__=="__main__":
|
||||
main()
|
@ -1,135 +0,0 @@
|
||||
//////////////////////////////////////////////////////////
|
||||
// Created by : Kerem Yollu
|
||||
// Project : Multiprise conectée
|
||||
// Nom : lcd.c
|
||||
// Header : lcd.h
|
||||
//_________________________Info_________________________
|
||||
//
|
||||
// Libraire pour le control d'un ecran lcd stadard (HD44780)
|
||||
// controlée par un expandeur de port PCF8574 en I2C.
|
||||
//
|
||||
//////////////////////////////////////////////////////////
|
||||
|
||||
#include "pf8574lcd.h"
|
||||
|
||||
i2c_ch1_pImpL *i2c_pf8574;
|
||||
|
||||
// Fonction pour initialiser l'écran vide en mode 4 bits
|
||||
int lcd_init(i2c_ch1_pImpL* i2c)
|
||||
{
|
||||
i2c_pf8574 = i2c;
|
||||
lcd_write(0x03,CMD_MODE); // Mise en mode 4 bit avec 4 essai conssecutif
|
||||
lcd_write(0x03,CMD_MODE);
|
||||
lcd_write(0x03,CMD_MODE);
|
||||
lcd_write(0x02,CMD_MODE);
|
||||
lcd_write(LCD_FUNCTIONSET | LCD_2LINE | LCD_5x8DOTS | LCD_4BITMODE ,CMD_MODE);
|
||||
lcd_write(LCD_DISPLAYCONTROL| LCD_DISPLAYON ,CMD_MODE);
|
||||
lcd_write(LCD_CLEARDISPLAY ,CMD_MODE);
|
||||
lcd_write(LCD_ENTRYMODESET | LCD_ENTRYLEFT ,CMD_MODE);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
// Fonction qui vas afficher une pharse sur la ligne et colone qui lui est indiquée
|
||||
// Attention la fonction est capable de calculer la liongeure d0ubn phrase mais il ne
|
||||
// faut pas dépasser la limite d'une ligne totale qui est de 20 charactères max
|
||||
//
|
||||
// LCD 20x4
|
||||
// -------------------------------------------
|
||||
// ||# # # # # # # # # # # # # # # # # # # #||
|
||||
// ||# # # # # # # # # # # # # # # # # # # #||
|
||||
// ||# # # # # # # # # # # # # # # # # # # #||
|
||||
// ||# # # # # # # # # # # # # # # # # # # #||
|
||||
// -------------------------------------------
|
||||
void lcd_display_string(char line, char pos, char* charvalue)
|
||||
{
|
||||
char setPosition = 0;
|
||||
int i, S_length = 0;
|
||||
char buf[TOTAL_CHAR_CAP]; // buffer contenant la quantité de char dissponible sur une ligne
|
||||
|
||||
|
||||
S_length = strlen(charvalue);
|
||||
if (S_length > TOTAL_CHAR_CAP)
|
||||
{
|
||||
printf("LCD.C :\t La phrase est trop longue => %d MAX: %d \n", S_length, TOTAL_CHAR_CAP);
|
||||
exit(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy(buf, charvalue);
|
||||
S_length = strlen(buf);
|
||||
|
||||
#ifdef LCD_DEBUG
|
||||
printf("LCD.C :\t Longeure de la prhase => %d \n", S_length);
|
||||
printf("LCD.C :\t Ligne selectionee => %d \n", line);
|
||||
#endif
|
||||
|
||||
if(line == 1) // Selection de la ligne d'écriture
|
||||
{
|
||||
setPosition = pos;
|
||||
}
|
||||
else if(line ==2)
|
||||
{
|
||||
setPosition = 0x40 + pos;
|
||||
}
|
||||
else if(line ==3)
|
||||
{
|
||||
setPosition = 0x14 + pos;
|
||||
}
|
||||
else if(line ==4)
|
||||
{
|
||||
setPosition = 0x54 + pos;
|
||||
}
|
||||
else
|
||||
{
|
||||
setPosition = -1;
|
||||
}
|
||||
|
||||
if(setPosition >= 0)
|
||||
{
|
||||
lcd_write(LCD_SETDDRAMADDR + setPosition, CMD_MODE);
|
||||
|
||||
for(i = 0; i < S_length; i++ )
|
||||
{
|
||||
lcd_write(buf[i],RS);
|
||||
}
|
||||
|
||||
#ifdef LCD_DEBUG
|
||||
printf("LCD.C :\t Ectiture reussit => %s \n", buf);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("LCD.C :\t Mauvais numéro de ligne => %d MAX:4 Min:1 \n", line);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Cette focntion nous pernet de faire pulser la ppin EN du lcd afin qu'il puisse
|
||||
// enregistrer les donées qui lui sont envoyées
|
||||
void ldc_pulse_En(char data)
|
||||
{
|
||||
|
||||
i2c_pf8574->writeByte(LCD_ADDRS,data | EN | LCD_BACKLIGHT);
|
||||
usleep(100);
|
||||
i2c_pf8574->writeByte(LCD_ADDRS,((data & ~EN) | LCD_BACKLIGHT));
|
||||
usleep(500);
|
||||
}
|
||||
|
||||
// Cette fonction nous permet d'envoyer un information de 8 bits sous format
|
||||
// de 2x4 bites. Celà est necessaire du au fonctionnement de l'expendeur de port PCF8574
|
||||
// qui est branché sur l'écran de facon a ce qu'il communiquer en 4 bits.
|
||||
void lcd_write(char cmd, char mode)
|
||||
{
|
||||
lcd_write_4bits(mode | (cmd & 0xF0));
|
||||
lcd_write_4bits(mode | ((cmd << 4) & 0xF0));
|
||||
}
|
||||
|
||||
// Fonction nous permettant d'nevoyer 4 bits dinformation sur le PC8574 ainsi que
|
||||
// le rétroéclairage.
|
||||
void lcd_write_4bits(char data)
|
||||
{
|
||||
i2c_pf8574->writeByte(LCD_ADDRS,data | LCD_BACKLIGHT);
|
||||
ldc_pulse_En(data);
|
||||
}
|
@ -1,80 +0,0 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/time.h>
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
#include <limits.h>
|
||||
#include "../../periferals/i2c/i2c_ch1_pImpL.hpp"
|
||||
|
||||
//#include "i2c_ch1_pImpL.cpp"
|
||||
|
||||
// commandes
|
||||
#define LCD_CLEARDISPLAY 0x01
|
||||
#define LCD_RETURNHOME 0x02
|
||||
#define LCD_ENTRYMODESET 0x04
|
||||
#define LCD_DISPLAYCONTROL 0x08
|
||||
#define LCD_CURSORSHIFT 0x10
|
||||
#define LCD_FUNCTIONSET 0x20
|
||||
#define LCD_SETCGRAMADDR 0x40
|
||||
#define LCD_SETDDRAMADDR 0x80
|
||||
|
||||
// flags pour mode d'ecriture
|
||||
#define LCD_ENTRYRIGHT 0x00
|
||||
#define LCD_ENTRYLEFT 0x02
|
||||
#define LCD_ENTRYSHIFTINCREMENT 0x01
|
||||
#define LCD_ENTRYSHIFTDECREMENT 0x00
|
||||
|
||||
// flags pour ecran on/off control
|
||||
#define LCD_DISPLAYON 0x04
|
||||
#define LCD_DISPLAYOFF 0x00
|
||||
#define LCD_CURSORON 0x02
|
||||
#define LCD_CURSOROFF 0x00
|
||||
#define LCD_BLINKON 0x01
|
||||
#define LCD_BLINKOFF 0x00
|
||||
|
||||
// flags pour display/decalage curseurr
|
||||
#define LCD_DISPLAYMOVE 0x08
|
||||
#define LCD_CURSORMOVE 0x00
|
||||
#define LCD_MOVERIGHT 0x04
|
||||
#define LCD_MOVELEFT 0x00
|
||||
|
||||
// flags pour function set
|
||||
#define LCD_8BITMODE 0x10
|
||||
#define LCD_4BITMODE 0x00
|
||||
#define LCD_2LINE 0x08
|
||||
#define LCD_1LINE 0x00
|
||||
#define LCD_5x1DOTS 0x04
|
||||
#define LCD_5x8DOTS 0x00
|
||||
|
||||
//flags pour le rétroeclairage
|
||||
#define LCD_BACKLIGHT 0x08
|
||||
#define LCD_NOBACKLIGHT 0x00
|
||||
|
||||
//Pins de gestion de donées.
|
||||
#define EN 0x04 // Enable bit
|
||||
#define RW 0x02 // Read/Write bit
|
||||
#define RS 0x01 // Register select bit
|
||||
|
||||
|
||||
//DIfferents mode enre commande est ecriture
|
||||
#define CMD_MODE 0x00
|
||||
#define CHAR_MODE 0x01
|
||||
|
||||
//adresse I2C du controlleur pour LCD
|
||||
#define LCD_ADDRS 0x27
|
||||
|
||||
//Nombre max de char sur une ligne
|
||||
#define TOTAL_CHAR_CAP 20
|
||||
|
||||
|
||||
int lcd_init(i2c_ch1_pImpL* i2c);
|
||||
void lcd_write_char( char charvalue);
|
||||
void lcd_display_string(char line, char pos, char* charvalue);
|
||||
void ldc_pulse_En(char data);
|
||||
void lcd_write(char cmd, char mode);
|
||||
void lcd_write_4bits(char data);
|
||||
|
||||
|
@ -1,62 +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 "./management/errorHandling.h"
|
||||
#include "./management/commandManager.h"
|
||||
#include "./drivers/bh1750/bh1750.h"
|
||||
#include "./drivers/pf8574/pf8574lcd.h"
|
||||
|
||||
unsigned int miliSecond = 1000;
|
||||
|
||||
|
||||
ErrorHandler errorHandle;
|
||||
CommandManager commander;
|
||||
i2c_ch1_pImpL i2c(1);
|
||||
|
||||
Bh1750 lightSens(&i2c);
|
||||
|
||||
|
||||
|
||||
int initPlatform()
|
||||
{
|
||||
char* Msg = "hello";
|
||||
lcd_init(&i2c);
|
||||
lcd_display_string(1,1,Msg);
|
||||
// Dev. Module initialisation "Ex i2c_init() ...."
|
||||
return 0;
|
||||
}
|
||||
|
||||
void dummy()
|
||||
{
|
||||
while(1)
|
||||
{
|
||||
std::cout << "value "<< lightSens.continious(BH1750_CONTINUOUS_HIGH_RES_MODE_1,1) << " Lux" <<std::endl;
|
||||
usleep(150*miliSecond);
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
// Init
|
||||
initPlatform();
|
||||
std::cout << "Main" << std::endl;
|
||||
//errorHandle.addNewError(-34,"Test eroor 1");
|
||||
//errorHandle.handleError(-34);
|
||||
//commander.addNewCommand("test", "The test command for testing the test", dummy);
|
||||
//commander(argv[1]);
|
||||
|
||||
commander.addNewCommand("i2c", "The test command for testing the test", dummy);
|
||||
commander(argv[1]);
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
@ -1,97 +0,0 @@
|
||||
/*
|
||||
* Authors : Kerem Yollu & Edwin Koch
|
||||
* Date : 07.03.2021
|
||||
*
|
||||
* Description :
|
||||
* TODO : Inplement singleton pattern
|
||||
* TODO : Write description
|
||||
* TODO : Comment the code wiht odxygen
|
||||
*
|
||||
*/
|
||||
|
||||
#include "commandManager.h"
|
||||
|
||||
|
||||
CommandManager::CommandManager():emptyIndex(0)
|
||||
{
|
||||
}
|
||||
|
||||
void CommandManager::addNewCommand( const std::string& commmand,
|
||||
const std::string& description,
|
||||
commanCallback_t callBack)
|
||||
{
|
||||
if(emptyIndex >= MAX_MUNBER_OF_COMMANDS) // Check if the command list is full
|
||||
{
|
||||
std::cout << "Error | Intern | Command list is full!" << std::endl;
|
||||
exit(1);
|
||||
}
|
||||
if(getLookUpIndex(commmand) >= 0) // Chek for command duplicats
|
||||
{
|
||||
std::cout << "Error | Intern | Command already exitst!" << std::endl;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
commandLookup[emptyIndex].commmand = commmand;
|
||||
commandLookup[emptyIndex].description = description;
|
||||
commandLookup[emptyIndex].callBack = callBack;
|
||||
emptyIndex++;
|
||||
}
|
||||
|
||||
void CommandManager::operator()(const std::string cmdName)
|
||||
{
|
||||
int index = 0;
|
||||
|
||||
if(cmdName == "help" || cmdName == "Help")
|
||||
{
|
||||
printHelp();
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if(cmdName == "-h" || cmdName == "-H")
|
||||
{
|
||||
printCommads();
|
||||
exit(1);
|
||||
}
|
||||
|
||||
index = getLookUpIndex(cmdName);
|
||||
|
||||
if(index < 0)
|
||||
{
|
||||
std::cout << "Error | Intern | Invalid Command!" << std::endl;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
commandLookup[index].callBack();
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Privat memeber functions
|
||||
//
|
||||
|
||||
|
||||
int CommandManager::getLookUpIndex(const std::string& cmd)
|
||||
{
|
||||
int index = 0;
|
||||
for (index = 0; index < emptyIndex; index++)
|
||||
{
|
||||
if(commandLookup[index].commmand == cmd)
|
||||
{
|
||||
return index;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
void CommandManager::printHelp()
|
||||
{
|
||||
std::cout << "Function : printHelp is under construction" << std::endl;
|
||||
}
|
||||
|
||||
void CommandManager::printCommads()
|
||||
{
|
||||
std::cout << "Function : printCommads is under construction" << std::endl;
|
||||
}
|
||||
|
@ -1,53 +0,0 @@
|
||||
/*
|
||||
* Authors : Kerem Yollu & Edwin Koch
|
||||
* Date : 07.03.2021
|
||||
*
|
||||
* Description :
|
||||
* TODO : Inplement singleton pattern
|
||||
* TODO : Write description
|
||||
* TODO : Comment the code wiht odxygen
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _COMMMANDMANAGER_H_
|
||||
#define _COMMMANDMANAGER_H_
|
||||
|
||||
#include <iostream>
|
||||
#include <array>
|
||||
#include <string>
|
||||
#include <functional>
|
||||
|
||||
#define MAX_MUNBER_OF_COMMANDS 4
|
||||
|
||||
class CommandManager
|
||||
{
|
||||
public:
|
||||
typedef std::function<void(void)> commanCallback_t;
|
||||
CommandManager();
|
||||
void addNewCommand( const std::string& commmand,
|
||||
const std::string& description,
|
||||
commanCallback_t callBack);
|
||||
|
||||
void operator()(const std::string cmdName);
|
||||
|
||||
|
||||
private:
|
||||
unsigned int emptyIndex;
|
||||
|
||||
struct commant_t{
|
||||
std::string commmand;
|
||||
std::string description;
|
||||
commanCallback_t callBack; // The Callback function could only be a void returning a void.
|
||||
};
|
||||
|
||||
std::array <commant_t, MAX_MUNBER_OF_COMMANDS> commandLookup;
|
||||
int getLookUpIndex(const std::string& cmd); // If command exists retunrs the index otherwise -1
|
||||
void printHelp(); // Prints all awailbale commands and their description.
|
||||
void printCommads(); // Prints all awailable commnads without description.
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _COMMMANDMANAGER_H_
|
@ -1,58 +0,0 @@
|
||||
#include "errorHandling.h"
|
||||
|
||||
ErrorHandler::ErrorHandler(): emptyIndex(0)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void ErrorHandler::handleError(int errNo)
|
||||
{
|
||||
int index = 0;
|
||||
|
||||
index = getLookUpIndex(errNo);
|
||||
|
||||
if(index < 0)
|
||||
{
|
||||
std::cout << "The given error number does not exist\n" << "Tipp: use \"addNewError(Integer, String)\""<< std::endl;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
std::cout << "Error | " << errNo << " | \"" << errorLookup[index].errMessage << "\""<<std::endl;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
void ErrorHandler::addNewError(const int& no, const std::string& message)
|
||||
{
|
||||
if(emptyIndex >= MAX_NUMBER_OF_ERRORS) // Check if list is full
|
||||
{
|
||||
std::cout << "Error | Ultimate | List is full" << std::endl;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if(getLookUpIndex(no) >= 0) // Check if Error No already exists
|
||||
{
|
||||
std::cout << "Error | Intern | Error No: "<< no << " Exists ! PLease choose a different number !" << std::endl;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
errorLookup[emptyIndex].errNo = no;
|
||||
errorLookup[emptyIndex].errMessage = message;
|
||||
emptyIndex++;
|
||||
}
|
||||
|
||||
//
|
||||
// Privat memeber functions
|
||||
//
|
||||
|
||||
int ErrorHandler::getLookUpIndex(int errNo)
|
||||
{
|
||||
int i = 0;
|
||||
for(i = 0; i < emptyIndex; i++)
|
||||
{
|
||||
if(errNo == errorLookup[i].errNo)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
@ -1,41 +0,0 @@
|
||||
/*
|
||||
* Authors : Kerem Yollu & Edwin Koch
|
||||
* Date : 07.03.2021
|
||||
*
|
||||
* Description :
|
||||
* TODO : Inplement singleton pattern
|
||||
* TODO : Write description
|
||||
* TODO : Comment the code wiht odxygen
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _ERRORHANDLIG_H_
|
||||
#define _ERRORHANDLIG_H_
|
||||
|
||||
#include <iostream>
|
||||
#include <array>
|
||||
#include <string>
|
||||
|
||||
#define MAX_NUMBER_OF_ERRORS 255
|
||||
|
||||
|
||||
class ErrorHandler
|
||||
{
|
||||
public:
|
||||
ErrorHandler();
|
||||
void addNewError(const int& no, const std::string& message);
|
||||
void handleError(int no);
|
||||
private:
|
||||
|
||||
struct error_t { //Struture of error entry for the errorLookup table
|
||||
int errNo;
|
||||
std::string errMessage;
|
||||
};
|
||||
|
||||
unsigned int emptyIndex; // Indicates the next empty slot in the errorLookup table.
|
||||
std::array <error_t,MAX_NUMBER_OF_ERRORS> errorLookup; // Where the errors go.
|
||||
int getLookUpIndex(int errNo); // If error number exists returns the index otherwise -1
|
||||
};
|
||||
|
||||
#endif // _ERRORHANDLIG_H_
|
@ -1,96 +0,0 @@
|
||||
#ifndef _I2C_H_
|
||||
#define _I2C_H_
|
||||
|
||||
namespace serial
|
||||
{
|
||||
enum i2c_id
|
||||
{
|
||||
i2c_ch0,
|
||||
i2c_ch1
|
||||
};
|
||||
|
||||
//
|
||||
// Base template class
|
||||
//
|
||||
|
||||
template<i2c_id id>
|
||||
class I2C
|
||||
{
|
||||
public:
|
||||
I2C(const uint8_t& mode); // Mode : Master or Slave
|
||||
uint8_t readByte(const uint8_t& address, const uint8_t& reg);
|
||||
uint16_t readWord(const uint8_t& address, const uint8_t& reg);
|
||||
uint8_t writeByte(const uint8_t& address, const uint8_t& data);
|
||||
uint8_t writeWord(const uint8_t& address, const uint8_t& reg, const uint16_t& data);
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
//
|
||||
// Template for channel 0
|
||||
//
|
||||
template<>
|
||||
class I2C <i2c_ch0>
|
||||
{
|
||||
public:
|
||||
I2C(const uint8_t& mode):pImpL(mode)
|
||||
{
|
||||
}
|
||||
uint8_t readByte(const uint8_t& address, const uint8_t& reg)
|
||||
{
|
||||
return pImpL -> readByte(address, reg);
|
||||
}
|
||||
uint16_t readWord(const uint8_t& address, const uint8_t& reg)
|
||||
{
|
||||
return pImpL -> readWord(address,reg);
|
||||
}
|
||||
uint8_t writeByte(const uint8_t& address, const uint8_t& data)
|
||||
{
|
||||
return pImpL -> writeByte(address, data);
|
||||
}
|
||||
uint8_t writeWord(const uint8_t& address, const uint8_t& reg, const uint16_t& data)
|
||||
{
|
||||
return pImpL -> writeWord(address, reg, data);
|
||||
}
|
||||
|
||||
private:
|
||||
class i2c_ch0_pImpL;
|
||||
std::unique_ptr<i2c_ch0_pImpL> pImpL;
|
||||
};
|
||||
|
||||
//
|
||||
// Template for channel 1
|
||||
//
|
||||
template<>
|
||||
class I2C <i2c_ch1>
|
||||
{
|
||||
public:
|
||||
I2C(const uint8_t& mode):pImpL(mode)
|
||||
{
|
||||
}
|
||||
uint8_t readByte(const uint8_t& address, const uint8_t& reg)
|
||||
{
|
||||
return pImpL -> readByte(address, reg);
|
||||
}
|
||||
uint16_t readWord(const uint8_t& address, const uint8_t& reg)
|
||||
{
|
||||
return pImpL -> readWord(address,reg);
|
||||
}
|
||||
uint8_t writeByte(const uint8_t& address, const uint8_t& data)
|
||||
{
|
||||
return pImpL -> writeByte(address, data);
|
||||
}
|
||||
uint8_t writeWord(const uint8_t& address, const uint8_t& reg, const uint16_t& data)
|
||||
{
|
||||
return pImpL -> writeWord(address, reg, data);
|
||||
}
|
||||
|
||||
private:
|
||||
class i2c_ch1_pImpL;
|
||||
std::unique_ptr<i2c_ch1_pImpL> pImpL;
|
||||
};
|
||||
|
||||
}// Namespace serial
|
||||
|
||||
|
||||
#endif // _I2C_H_
|
@ -1,106 +0,0 @@
|
||||
#include "i2c_ch0_pImpL.h"
|
||||
|
||||
#include <cstdio>
|
||||
#include <ostream>
|
||||
#include <iostream>
|
||||
#include <linux/i2c-dev.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
|
||||
#define PORT_I2C "/dev/i2c-1"
|
||||
|
||||
// some curious things https://www.john.geek.nz/2012/12/update-reading-data-from-a-bosch-bmp085-with-a-raspberry-pi/
|
||||
|
||||
|
||||
i2c_ch0_pImpL::i2c_ch0_pImpL(const uint8_t& mode)
|
||||
{
|
||||
char filename[20];
|
||||
snprintf(filename, 19, "/dev/i2c-%d", 0);
|
||||
|
||||
deviceDescriptor = open(filename, O_RDWR);
|
||||
if (deviceDescriptor < 0) {
|
||||
std::cout << "unable to open : "<< deviceDescriptor << " ! quiting" << std::endl;
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t i2c_ch0_pImpL::writeByte(const uint8_t& address, const uint8_t& data) // retuns 0 when a sucsessful transation ocures
|
||||
{
|
||||
if (ioctl(deviceDescriptor, I2C_SLAVE, address) < 0)
|
||||
{
|
||||
std::cout << "Unable to reach device : "<< address << " ! quiting" << std::endl;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
send_buffer[0] = data;
|
||||
|
||||
if ((write(deviceDescriptor, send_buffer, 1)) != 1)
|
||||
{
|
||||
std::cout << "Unable to write quiting" << std::endl;
|
||||
exit(0);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint8_t i2c_ch0_pImpL::readByte(const uint8_t& address, const uint8_t& reg)
|
||||
{
|
||||
if (ioctl(deviceDescriptor, I2C_SLAVE, address) < 0)
|
||||
{
|
||||
std::cout << "Unable to reach device : "<< address << " ! quiting" << std::endl;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
writeByte(address,reg); //Initiate a write to indicate the desired register to read
|
||||
|
||||
if (read(deviceDescriptor, recieve_buffer, 1) != 1) // An then initare a read request of 1 byte
|
||||
{
|
||||
std::cout << "Unable to read quiting" << std::endl;
|
||||
exit(1);
|
||||
}
|
||||
return recieve_buffer[0] ;
|
||||
}
|
||||
|
||||
|
||||
uint8_t i2c_ch0_pImpL::writeWord(const uint8_t& address, const uint8_t& reg, const uint16_t& data) // retuns 0 when a sucsessful transation ocures
|
||||
{
|
||||
|
||||
if (ioctl(deviceDescriptor, I2C_SLAVE, address) < 0)
|
||||
{
|
||||
std::cout << "Unable to reach device : "<< address << " ! quiting" << std::endl;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
send_buffer[0] = reg;
|
||||
send_buffer[1] = data;
|
||||
|
||||
if ((write(deviceDescriptor, send_buffer, 2)) != 2)
|
||||
{
|
||||
std::cout << "Unable to write quiting" << std::endl;
|
||||
exit(0);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint16_t i2c_ch0_pImpL::readWord(const uint8_t& address, const uint8_t& reg)
|
||||
{
|
||||
uint16_t result = 0 ;
|
||||
if (ioctl(deviceDescriptor, I2C_SLAVE, address) < 0)
|
||||
{
|
||||
std::cout << "Unable to reach device : "<< address << " ! quiting" << std::endl;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
writeByte(address,reg); //Initiate a write to indicate the desired register to read
|
||||
|
||||
if (read(deviceDescriptor, recieve_buffer, 2) != 2) // An then initare a read request of 2 bytes
|
||||
{
|
||||
std::cout << "Unable to read quiting" << std::endl;
|
||||
exit(1);
|
||||
}
|
||||
result = (recieve_buffer[0] << 8) + recieve_buffer[1] ;
|
||||
return result ;
|
||||
}
|
@ -1,32 +0,0 @@
|
||||
#ifndef _I2C_CH0_PIMPL_H_
|
||||
#define _I2C_CH0_PIMPL_H_
|
||||
|
||||
#include <stdint.h>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include "../../management/errorHandling.h"
|
||||
#include "../../systems/systemCall.h"
|
||||
|
||||
class i2c_ch0_pImpL
|
||||
{
|
||||
public:
|
||||
i2c_ch0_pImpL(const uint8_t& mode); // Mode : Master or Slave
|
||||
uint8_t readByte(const uint8_t& address, const uint8_t& reg);
|
||||
uint16_t readWord(const uint8_t& address, const uint8_t& reg);
|
||||
uint8_t writeByte(const uint8_t& address, const uint8_t& data);
|
||||
uint8_t writeWord(const uint8_t& address, const uint8_t& reg, const uint16_t& data);
|
||||
|
||||
|
||||
private:
|
||||
int16_t deviceDescriptor;
|
||||
uint8_t device_address;
|
||||
uint8_t device_reg;
|
||||
uint8_t send_buffer[32];
|
||||
uint8_t recieve_buffer[32];
|
||||
uint8_t blocks;
|
||||
uint8_t channel;
|
||||
uint8_t mode;
|
||||
};
|
||||
|
||||
|
||||
#endif // _I2C_CH0_PIMPL_H_
|
@ -1,106 +0,0 @@
|
||||
#include "i2c_ch1_pImpL.hpp"
|
||||
|
||||
#include <cstdio>
|
||||
#include <ostream>
|
||||
#include <iostream>
|
||||
#include <linux/i2c-dev.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
|
||||
#define PORT_I2C "/dev/i2c-1"
|
||||
|
||||
// some curious things https://www.john.geek.nz/2012/12/update-reading-data-from-a-bosch-bmp085-with-a-raspberry-pi/
|
||||
|
||||
|
||||
i2c_ch1_pImpL::i2c_ch1_pImpL(const uint8_t& mode)
|
||||
{
|
||||
char filename[20];
|
||||
snprintf(filename, 19, "/dev/i2c-%d", 1);
|
||||
|
||||
deviceDescriptor = open(filename, O_RDWR);
|
||||
if (deviceDescriptor < 0) {
|
||||
std::cout << "unable to open : "<< deviceDescriptor << " ! quiting" << std::endl;
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t i2c_ch1_pImpL::writeByte(const uint8_t& address, const uint8_t& data) // retuns 0 when a sucsessful transation ocures
|
||||
{
|
||||
if (ioctl(deviceDescriptor, I2C_SLAVE, address) < 0)
|
||||
{
|
||||
std::cout << "Unable to reach device : "<< address << " ! quiting" << std::endl;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
send_buffer[0] = data;
|
||||
|
||||
if ((write(deviceDescriptor, send_buffer, 1)) != 1)
|
||||
{
|
||||
std::cout << "Unable to write quiting" << std::endl;
|
||||
exit(0);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint8_t i2c_ch1_pImpL::readByte(const uint8_t& address, const uint8_t& reg)
|
||||
{
|
||||
if (ioctl(deviceDescriptor, I2C_SLAVE, address) < 0)
|
||||
{
|
||||
std::cout << "Unable to reach device : "<< address << " ! quiting" << std::endl;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
writeByte(address,reg); //Initiate a write to indicate the desired register to read
|
||||
|
||||
if (read(deviceDescriptor, recieve_buffer, 1) != 1) // An then initare a read request of 1 byte
|
||||
{
|
||||
std::cout << "Unable to read quiting" << std::endl;
|
||||
exit(1);
|
||||
}
|
||||
return recieve_buffer[0] ;
|
||||
}
|
||||
|
||||
|
||||
uint8_t i2c_ch1_pImpL::writeWord(const uint8_t& address, const uint8_t& reg, const uint16_t& data) // retuns 0 when a sucsessful transation ocures
|
||||
{
|
||||
|
||||
if (ioctl(deviceDescriptor, I2C_SLAVE, address) < 0)
|
||||
{
|
||||
std::cout << "Unable to reach device : "<< address << " ! quiting" << std::endl;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
send_buffer[0] = reg;
|
||||
send_buffer[1] = data;
|
||||
|
||||
if ((write(deviceDescriptor, send_buffer, 2)) != 2)
|
||||
{
|
||||
std::cout << "Unable to write quiting" << std::endl;
|
||||
exit(0);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint16_t i2c_ch1_pImpL::readWord(const uint8_t& address, const uint8_t& reg)
|
||||
{
|
||||
uint16_t result = 0 ;
|
||||
if (ioctl(deviceDescriptor, I2C_SLAVE, address) < 0)
|
||||
{
|
||||
std::cout << "Unable to reach device : "<< address << " ! quiting" << std::endl;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
writeByte(address,reg); //Initiate a write to indicate the desired register to read
|
||||
|
||||
if (read(deviceDescriptor, recieve_buffer, 2) != 2) // An then initare a read request of 2 bytes
|
||||
{
|
||||
std::cout << "Unable to read quiting" << std::endl;
|
||||
exit(1);
|
||||
}
|
||||
result = (recieve_buffer[0] << 8) + recieve_buffer[1] ;
|
||||
return result ;
|
||||
}
|
@ -1,32 +0,0 @@
|
||||
#ifndef _I2C_CH1_PIMPL_H_
|
||||
#define _I2C_CH1_PIMPL_H_
|
||||
|
||||
#include <stdint.h>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include "../../systems/systemCall.h"
|
||||
#include "../../management/errorHandling.h"
|
||||
|
||||
class i2c_ch1_pImpL
|
||||
{
|
||||
public:
|
||||
i2c_ch1_pImpL(const uint8_t& mode); // Mode : Master or Slave
|
||||
uint8_t readByte(const uint8_t& address, const uint8_t& reg);
|
||||
uint16_t readWord(const uint8_t& address, const uint8_t& reg);
|
||||
uint8_t writeByte(const uint8_t& address, const uint8_t& data);
|
||||
uint8_t writeWord(const uint8_t& address, const uint8_t& reg, const uint16_t& data);
|
||||
|
||||
|
||||
private:
|
||||
int16_t deviceDescriptor;
|
||||
uint8_t device_address;
|
||||
uint8_t device_reg;
|
||||
uint8_t send_buffer[32];
|
||||
uint8_t recieve_buffer[32];
|
||||
uint8_t blocks;
|
||||
uint8_t channel;
|
||||
uint8_t mode;
|
||||
};
|
||||
|
||||
|
||||
#endif // _I2C_CH1_PIMPL_H_
|
@ -1,106 +0,0 @@
|
||||
#include "i2c_driver.h"
|
||||
|
||||
#include <cstdio>
|
||||
#include <ostream>
|
||||
#include <iostream>
|
||||
#include <linux/i2c-dev.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
|
||||
#define PORT_I2C "/dev/i2c-1"
|
||||
|
||||
// some curious things https://www.john.geek.nz/2012/12/update-reading-data-from-a-bosch-bmp085-with-a-raspberry-pi/
|
||||
|
||||
|
||||
I2C_Driver::I2C_Driver(const uint8_t& channel, const uint8_t& mode)
|
||||
{
|
||||
char filename[20];
|
||||
snprintf(filename, 19, "/dev/i2c-%d", channel);
|
||||
|
||||
deviceDescriptor = open(filename, O_RDWR);
|
||||
if (deviceDescriptor < 0) {
|
||||
std::cout << "unable to open : "<< deviceDescriptor << " ! quiting" << std::endl;
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t I2C_Driver::writeByte(const uint8_t& address, const uint8_t& data) // retuns 0 when a sucsessful transation ocures
|
||||
{
|
||||
if (ioctl(deviceDescriptor, I2C_SLAVE, address) < 0)
|
||||
{
|
||||
std::cout << "Unable to reach device : "<< address << " ! quiting" << std::endl;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
send_buffer[0] = data;
|
||||
|
||||
if ((write(deviceDescriptor, send_buffer, 1)) != 1)
|
||||
{
|
||||
std::cout << "Unable to write quiting" << std::endl;
|
||||
exit(0);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint8_t I2C_Driver::readByte(const uint8_t& address, const uint8_t& reg)
|
||||
{
|
||||
if (ioctl(deviceDescriptor, I2C_SLAVE, address) < 0)
|
||||
{
|
||||
std::cout << "Unable to reach device : "<< address << " ! quiting" << std::endl;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
writeByte(address,reg); //Initiate a write to indicate the desired register to read
|
||||
|
||||
if (read(deviceDescriptor, recieve_buffer, 1) != 1) // An then initare a read request of 1 byte
|
||||
{
|
||||
std::cout << "Unable to read quiting" << std::endl;
|
||||
exit(1);
|
||||
}
|
||||
return recieve_buffer[0] ;
|
||||
}
|
||||
|
||||
|
||||
uint8_t I2C_Driver::writeWord(const uint8_t& address, const uint8_t& reg, const uint16_t& data) // retuns 0 when a sucsessful transation ocures
|
||||
{
|
||||
|
||||
if (ioctl(deviceDescriptor, I2C_SLAVE, address) < 0)
|
||||
{
|
||||
std::cout << "Unable to reach device : "<< address << " ! quiting" << std::endl;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
send_buffer[0] = reg;
|
||||
send_buffer[1] = data;
|
||||
|
||||
if ((write(deviceDescriptor, send_buffer, 2)) != 2)
|
||||
{
|
||||
std::cout << "Unable to write quiting" << std::endl;
|
||||
exit(0);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint16_t I2C_Driver::readWord(const uint8_t& address, const uint8_t& reg)
|
||||
{
|
||||
uint16_t result = 0 ;
|
||||
if (ioctl(deviceDescriptor, I2C_SLAVE, address) < 0)
|
||||
{
|
||||
std::cout << "Unable to reach device : "<< address << " ! quiting" << std::endl;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
writeByte(address,reg); //Initiate a write to indicate the desired register to read
|
||||
|
||||
if (read(deviceDescriptor, recieve_buffer, 2) != 2) // An then initare a read request of 2 bytes
|
||||
{
|
||||
std::cout << "Unable to read quiting" << std::endl;
|
||||
exit(1);
|
||||
}
|
||||
result = (recieve_buffer[0] << 8) + recieve_buffer[1] ;
|
||||
return result ;
|
||||
}
|
@ -1,28 +0,0 @@
|
||||
#include <stdint.h>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include "../../management/errorHandling.h"
|
||||
#include "../../systems/systemCall.h"
|
||||
|
||||
class I2C_Driver
|
||||
{
|
||||
public:
|
||||
I2C_Driver(const uint8_t& channel, const uint8_t& mode);
|
||||
uint8_t readByte(const uint8_t& address, const uint8_t& reg);
|
||||
uint16_t readWord(const uint8_t& address, const uint8_t& reg);
|
||||
uint8_t writeByte(const uint8_t& address, const uint8_t& data);
|
||||
uint8_t writeWord(const uint8_t& address, const uint8_t& reg, const uint16_t& data);
|
||||
|
||||
|
||||
private:
|
||||
int16_t deviceDescriptor;
|
||||
uint8_t device_address;
|
||||
uint8_t device_reg;
|
||||
uint8_t send_buffer[32];
|
||||
uint8_t recieve_buffer[32];
|
||||
uint8_t blocks;
|
||||
uint8_t channel;
|
||||
uint8_t mode;
|
||||
};
|
||||
|
||||
|
@ -1,15 +0,0 @@
|
||||
#include "systemCall.h"
|
||||
|
||||
|
||||
std::string execBash(const char* cmd) {
|
||||
std::array<char, 128> buffer;
|
||||
std::string result;
|
||||
std::unique_ptr<FILE, decltype(&pclose)> pipe(popen(cmd, "r"), pclose);
|
||||
if (!pipe) {
|
||||
throw std::runtime_error("popen() failed!");
|
||||
}
|
||||
while (fgets(buffer.data(), buffer.size(), pipe.get()) != nullptr) {
|
||||
result += buffer.data();
|
||||
}
|
||||
return result;
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
#ifndef _SYSTEMCALL_H_
|
||||
#define _SYSTEMCALL_H_
|
||||
|
||||
#include <cstdio>
|
||||
#include <iostream>
|
||||
#include <memory>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include <array>
|
||||
|
||||
// Ide from : https://stackoverflow.com/questions/478898/how-do-i-execute-a-command-and-get-the-output-of-the-command-within-c-using-po
|
||||
std::string execBash(const char* cmd);
|
||||
|
||||
#endif // _SYSTEMCALL_H_
|
@ -1,68 +0,0 @@
|
||||
/**
|
||||
* \class Device
|
||||
*
|
||||
* \ingroup Devices
|
||||
*
|
||||
* \brief Device driver
|
||||
*
|
||||
* This class is meant as an example. It is not useful by itself
|
||||
* rather its usefulness is only a function of how much it helps
|
||||
* the reader. It is in a sense defined by the person who reads it
|
||||
* and otherwise does not exist in any real form.
|
||||
*
|
||||
* \note We are triying somthing
|
||||
*
|
||||
* \author (last to touch it) $Kerem : bv $
|
||||
*
|
||||
* \version $Revision: 1.5 $
|
||||
*
|
||||
* \date $Date: 2021/04/09 $
|
||||
*
|
||||
* Contact: yokyok
|
||||
*
|
||||
* Created on: Wed Apr 13 18:39:37 2005
|
||||
*
|
||||
* $Id: doxygen-howto.html,v 1.5 2005/04/14 14:16:20 bv Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef _DEVICE_H_
|
||||
#define _DEVICE_H_
|
||||
|
||||
#include <iostream>
|
||||
#include <stdint.h>
|
||||
#include <unistd.h>
|
||||
|
||||
/**
|
||||
* @brief Device Class
|
||||
* this calss defines a device.
|
||||
* @author Edwin
|
||||
* @date 2021 / 04 / 09
|
||||
* @version 1.0158
|
||||
*/
|
||||
|
||||
class Device{
|
||||
|
||||
public:
|
||||
Device();
|
||||
~Device();
|
||||
|
||||
|
||||
/**
|
||||
* @brief It \f$ \sum_{k=1}^n \f$ dose something \n it adds two thing together
|
||||
* @author Kerem
|
||||
* @date 2021 / 04 / 09
|
||||
* @version 1.0
|
||||
* @param uint8_t thing
|
||||
* @return uint8_t retunrs thing + foo
|
||||
*/
|
||||
uint8_t doSomething(uint8_t thing);
|
||||
|
||||
private:
|
||||
uint8_t foo;
|
||||
};
|
||||
|
||||
|
||||
#endif // _DEVICE_H_
|
@ -1,20 +0,0 @@
|
||||
cpp_src = $(wildcard *.cpp)
|
||||
|
||||
cpp_obj = $(cpp_src:.cpp=.o)
|
||||
c_obj = $(c_src:.c=.o)
|
||||
CC = g++
|
||||
CFLAGS = -Wall -pedantic -li2c
|
||||
LDFLAGS =
|
||||
EXEC = runtest
|
||||
|
||||
|
||||
all : $(EXEC)
|
||||
|
||||
$(EXEC): $(cpp_obj) $(c_obj)
|
||||
$(CC) -o $@ $^ $(LDFLAGS)
|
||||
|
||||
clean:
|
||||
rm -rf $(c_obj) $(cpp_obj) $(EXEC)
|
||||
|
||||
cleanall:
|
||||
rm -rf $(c_obj) $(cpp_obj) $(EXEC)
|
@ -1,13 +0,0 @@
|
||||
#include "device.hpp"
|
||||
|
||||
Device::Device():
|
||||
foo(1)
|
||||
{
|
||||
std::cout << "Init ok" << std::endl;
|
||||
}
|
||||
|
||||
uint8_t Device::doSomething(uint8_t thing)
|
||||
{
|
||||
std::cout << "Addition complete" << std::endl;
|
||||
return foo + thing;
|
||||
}
|
@ -1,68 +0,0 @@
|
||||
/**
|
||||
* \class Device
|
||||
*
|
||||
* \ingroup Devices
|
||||
*
|
||||
* \brief Device driver
|
||||
*
|
||||
* This class is meant as an example. It is not useful by itself
|
||||
* rather its usefulness is only a function of how much it helps
|
||||
* the reader. It is in a sense defined by the person who reads it
|
||||
* and otherwise does not exist in any real form.
|
||||
*
|
||||
* \note We are triying somthing
|
||||
*
|
||||
* \author (last to touch it) $Kerem : bv $
|
||||
*
|
||||
* \version $Revision: 1.5 $
|
||||
*
|
||||
* \date $Date: 2021/04/09 $
|
||||
*
|
||||
* Contact: yokyok
|
||||
*
|
||||
* Created on: Wed Apr 13 18:39:37 2005
|
||||
*
|
||||
* $Id: doxygen-howto.html,v 1.5 2005/04/14 14:16:20 bv Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef _DEVICE_H_
|
||||
#define _DEVICE_H_
|
||||
|
||||
#include <iostream>
|
||||
#include <stdint.h>
|
||||
#include <unistd.h>
|
||||
|
||||
/**
|
||||
* @brief Device Class
|
||||
* this calss defines a device.
|
||||
* @author Edwin
|
||||
* @date 2021 / 04 / 09
|
||||
* @version 1.0158
|
||||
*/
|
||||
|
||||
class Device{
|
||||
|
||||
public:
|
||||
Device();
|
||||
~Device();
|
||||
|
||||
|
||||
/**
|
||||
* @brief It \f[ \sum_{k=1}^n \f] dose something \n it adds two thing together
|
||||
* @author Kerem
|
||||
* @date 2021 / 04 / 09
|
||||
* @version 1.0
|
||||
* @param uint8_t thing
|
||||
* @return uint8_t retunrs thing + foo
|
||||
*/
|
||||
uint8_t doSomething(uint8_t thing);
|
||||
|
||||
private:
|
||||
uint8_t foo;
|
||||
};
|
||||
|
||||
|
||||
#endif // _DEVICE_H_
|
@ -1,8 +0,0 @@
|
||||
\documentclass{article}
|
||||
\usepackage{epsfig}
|
||||
\pagestyle{empty}
|
||||
\begin{document}
|
||||
\[ \sum_{k=1}^n \]
|
||||
\pagebreak
|
||||
|
||||
\end{document}
|
@ -1,78 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
|
||||
<meta name="generator" content="Doxygen 1.8.13"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||
<title>HEllo: Class List</title>
|
||||
<link href="tabs.css" rel="stylesheet" type="text/css"/>
|
||||
<script type="text/javascript" src="jquery.js"></script>
|
||||
<script type="text/javascript" src="dynsections.js"></script>
|
||||
<link href="search/search.css" rel="stylesheet" type="text/css"/>
|
||||
<script type="text/javascript" src="search/searchdata.js"></script>
|
||||
<script type="text/javascript" src="search/search.js"></script>
|
||||
<link href="doxygen.css" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
|
||||
<div id="titlearea">
|
||||
<table cellspacing="0" cellpadding="0">
|
||||
<tbody>
|
||||
<tr style="height: 56px;">
|
||||
<td id="projectalign" style="padding-left: 0.5em;">
|
||||
<div id="projectname">HEllo
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<!-- end header part -->
|
||||
<!-- Generated by Doxygen 1.8.13 -->
|
||||
<script type="text/javascript">
|
||||
var searchBox = new SearchBox("searchBox", "search",false,'Search');
|
||||
</script>
|
||||
<script type="text/javascript" src="menudata.js"></script>
|
||||
<script type="text/javascript" src="menu.js"></script>
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
initMenu('',true,false,'search.php','Search');
|
||||
$(document).ready(function() { init_search(); });
|
||||
});
|
||||
</script>
|
||||
<div id="main-nav"></div>
|
||||
</div><!-- top -->
|
||||
<!-- window showing the filter options -->
|
||||
<div id="MSearchSelectWindow"
|
||||
onmouseover="return searchBox.OnSearchSelectShow()"
|
||||
onmouseout="return searchBox.OnSearchSelectHide()"
|
||||
onkeydown="return searchBox.OnSearchSelectKey(event)">
|
||||
</div>
|
||||
|
||||
<!-- iframe showing the search results (closed by default) -->
|
||||
<div id="MSearchResultsWindow">
|
||||
<iframe src="javascript:void(0)" frameborder="0"
|
||||
name="MSearchResults" id="MSearchResults">
|
||||
</iframe>
|
||||
</div>
|
||||
|
||||
<div class="header">
|
||||
<div class="headertitle">
|
||||
<div class="title">Class List</div> </div>
|
||||
</div><!--header-->
|
||||
<div class="contents">
|
||||
<div class="textblock">Here are the classes, structs, unions and interfaces with brief descriptions:</div><div class="directory">
|
||||
<table class="directory">
|
||||
<tr id="row_0_" class="even"><td class="entry"><span style="width:16px;display:inline-block;"> </span><span class="icona"><span class="icon">C</span></span><a class="el" href="classDevice.html" target="_self">Device</a></td><td class="desc"><a class="el" href="classDevice.html" title="Device Class this calss defines a device. ">Device</a> Class this calss defines a device </td></tr>
|
||||
</table>
|
||||
</div><!-- directory -->
|
||||
</div><!-- contents -->
|
||||
<!-- start footer part -->
|
||||
<hr class="footer"/><address class="footer"><small>
|
||||
Generated by  <a href="http://www.doxygen.org/index.html">
|
||||
<img class="footer" src="doxygen.png" alt="doxygen"/>
|
||||
</a> 1.8.13
|
||||
</small></address>
|
||||
</body>
|
||||
</html>
|
Before Width: | Height: | Size: 676 B |
Before Width: | Height: | Size: 147 B |
@ -1,79 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
|
||||
<meta name="generator" content="Doxygen 1.8.13"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||
<title>HEllo: Member List</title>
|
||||
<link href="tabs.css" rel="stylesheet" type="text/css"/>
|
||||
<script type="text/javascript" src="jquery.js"></script>
|
||||
<script type="text/javascript" src="dynsections.js"></script>
|
||||
<link href="search/search.css" rel="stylesheet" type="text/css"/>
|
||||
<script type="text/javascript" src="search/searchdata.js"></script>
|
||||
<script type="text/javascript" src="search/search.js"></script>
|
||||
<link href="doxygen.css" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
|
||||
<div id="titlearea">
|
||||
<table cellspacing="0" cellpadding="0">
|
||||
<tbody>
|
||||
<tr style="height: 56px;">
|
||||
<td id="projectalign" style="padding-left: 0.5em;">
|
||||
<div id="projectname">HEllo
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<!-- end header part -->
|
||||
<!-- Generated by Doxygen 1.8.13 -->
|
||||
<script type="text/javascript">
|
||||
var searchBox = new SearchBox("searchBox", "search",false,'Search');
|
||||
</script>
|
||||
<script type="text/javascript" src="menudata.js"></script>
|
||||
<script type="text/javascript" src="menu.js"></script>
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
initMenu('',true,false,'search.php','Search');
|
||||
$(document).ready(function() { init_search(); });
|
||||
});
|
||||
</script>
|
||||
<div id="main-nav"></div>
|
||||
<!-- window showing the filter options -->
|
||||
<div id="MSearchSelectWindow"
|
||||
onmouseover="return searchBox.OnSearchSelectShow()"
|
||||
onmouseout="return searchBox.OnSearchSelectHide()"
|
||||
onkeydown="return searchBox.OnSearchSelectKey(event)">
|
||||
</div>
|
||||
|
||||
<!-- iframe showing the search results (closed by default) -->
|
||||
<div id="MSearchResultsWindow">
|
||||
<iframe src="javascript:void(0)" frameborder="0"
|
||||
name="MSearchResults" id="MSearchResults">
|
||||
</iframe>
|
||||
</div>
|
||||
|
||||
</div><!-- top -->
|
||||
<div class="header">
|
||||
<div class="headertitle">
|
||||
<div class="title">Device Member List</div> </div>
|
||||
</div><!--header-->
|
||||
<div class="contents">
|
||||
|
||||
<p>This is the complete list of members for <a class="el" href="classDevice.html">Device</a>, including all inherited members.</p>
|
||||
<table class="directory">
|
||||
<tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>Device</b>() (defined in <a class="el" href="classDevice.html">Device</a>)</td><td class="entry"><a class="el" href="classDevice.html">Device</a></td><td class="entry"></td></tr>
|
||||
<tr><td class="entry"><a class="el" href="classDevice.html#aa83f583c01faf8da986b08d7ba65d537">doSomething</a>(uint8_t thing)</td><td class="entry"><a class="el" href="classDevice.html">Device</a></td><td class="entry"></td></tr>
|
||||
<tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>~Device</b>() (defined in <a class="el" href="classDevice.html">Device</a>)</td><td class="entry"><a class="el" href="classDevice.html">Device</a></td><td class="entry"></td></tr>
|
||||
</table></div><!-- contents -->
|
||||
<!-- start footer part -->
|
||||
<hr class="footer"/><address class="footer"><small>
|
||||
Generated by  <a href="http://www.doxygen.org/index.html">
|
||||
<img class="footer" src="doxygen.png" alt="doxygen"/>
|
||||
</a> 1.8.13
|
||||
</small></address>
|
||||
</body>
|
||||
</html>
|
@ -1,147 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
|
||||
<meta name="generator" content="Doxygen 1.8.13"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||
<title>HEllo: Device Class Reference</title>
|
||||
<link href="tabs.css" rel="stylesheet" type="text/css"/>
|
||||
<script type="text/javascript" src="jquery.js"></script>
|
||||
<script type="text/javascript" src="dynsections.js"></script>
|
||||
<link href="search/search.css" rel="stylesheet" type="text/css"/>
|
||||
<script type="text/javascript" src="search/searchdata.js"></script>
|
||||
<script type="text/javascript" src="search/search.js"></script>
|
||||
<link href="doxygen.css" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
|
||||
<div id="titlearea">
|
||||
<table cellspacing="0" cellpadding="0">
|
||||
<tbody>
|
||||
<tr style="height: 56px;">
|
||||
<td id="projectalign" style="padding-left: 0.5em;">
|
||||
<div id="projectname">HEllo
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<!-- end header part -->
|
||||
<!-- Generated by Doxygen 1.8.13 -->
|
||||
<script type="text/javascript">
|
||||
var searchBox = new SearchBox("searchBox", "search",false,'Search');
|
||||
</script>
|
||||
<script type="text/javascript" src="menudata.js"></script>
|
||||
<script type="text/javascript" src="menu.js"></script>
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
initMenu('',true,false,'search.php','Search');
|
||||
$(document).ready(function() { init_search(); });
|
||||
});
|
||||
</script>
|
||||
<div id="main-nav"></div>
|
||||
<!-- window showing the filter options -->
|
||||
<div id="MSearchSelectWindow"
|
||||
onmouseover="return searchBox.OnSearchSelectShow()"
|
||||
onmouseout="return searchBox.OnSearchSelectHide()"
|
||||
onkeydown="return searchBox.OnSearchSelectKey(event)">
|
||||
</div>
|
||||
|
||||
<!-- iframe showing the search results (closed by default) -->
|
||||
<div id="MSearchResultsWindow">
|
||||
<iframe src="javascript:void(0)" frameborder="0"
|
||||
name="MSearchResults" id="MSearchResults">
|
||||
</iframe>
|
||||
</div>
|
||||
|
||||
</div><!-- top -->
|
||||
<div class="header">
|
||||
<div class="summary">
|
||||
<a href="#pub-methods">Public Member Functions</a> |
|
||||
<a href="classDevice-members.html">List of all members</a> </div>
|
||||
<div class="headertitle">
|
||||
<div class="title">Device Class Reference</div> </div>
|
||||
</div><!--header-->
|
||||
<div class="contents">
|
||||
|
||||
<p><a class="el" href="classDevice.html" title="Device Class this calss defines a device. ">Device</a> Class this calss defines a device.
|
||||
<a href="classDevice.html#details">More...</a></p>
|
||||
|
||||
<p><code>#include <<a class="el" href="device_8hpp_source.html">device.hpp</a>></code></p>
|
||||
<table class="memberdecls">
|
||||
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
|
||||
Public Member Functions</h2></td></tr>
|
||||
<tr class="memitem:aa83f583c01faf8da986b08d7ba65d537"><td class="memItemLeft" align="right" valign="top">uint8_t </td><td class="memItemRight" valign="bottom"><a class="el" href="classDevice.html#aa83f583c01faf8da986b08d7ba65d537">doSomething</a> (uint8_t thing)</td></tr>
|
||||
<tr class="memdesc:aa83f583c01faf8da986b08d7ba65d537"><td class="mdescLeft"> </td><td class="mdescRight">It </p><p class="formulaDsp">
|
||||
<img class="formulaDsp" alt="\[ \sum_{k=1}^n \]" src="form_0.png"/>
|
||||
</p>
|
||||
<p> dose something <br />
|
||||
it adds two thing together. <a href="#aa83f583c01faf8da986b08d7ba65d537">More...</a><br /></td></tr>
|
||||
<tr class="separator:aa83f583c01faf8da986b08d7ba65d537"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
</table>
|
||||
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
|
||||
<div class="textblock"><p><a class="el" href="classDevice.html" title="Device Class this calss defines a device. ">Device</a> Class this calss defines a device. </p>
|
||||
<p><a class="el" href="classDevice.html" title="Device Class this calss defines a device. ">Device</a> driver.</p>
|
||||
<dl class="section author"><dt>Author</dt><dd>Edwin </dd></dl>
|
||||
<dl class="section date"><dt>Date</dt><dd>2021 / 04 / 09 </dd></dl>
|
||||
<dl class="section version"><dt>Version</dt><dd>1.0158</dd></dl>
|
||||
<p>This class is meant as an example. It is not useful by itself rather its usefulness is only a function of how much it helps the reader. It is in a sense defined by the person who reads it and otherwise does not exist in any real form.</p>
|
||||
<dl class="section note"><dt>Note</dt><dd>We are triying somthing</dd></dl>
|
||||
<dl class="section author"><dt>Author</dt><dd>(last to touch it) $Kerem : bv $</dd></dl>
|
||||
<dl class="section version"><dt>Version</dt><dd></dd></dl>
|
||||
<dl class="section rcs"><dt>Revision</dt><dd>1.5 </dd></dl>
|
||||
<dl class="section date"><dt>Date</dt><dd></dd></dl>
|
||||
<dl class="section rcs"><dt>Date</dt><dd>2021/04/09 </dd></dl>
|
||||
<p>Contact: yokyok</p>
|
||||
<p>Created on: Wed Apr 13 18:39:37 2005</p>
|
||||
<dl class="section rcs"><dt>Id</dt><dd>doxygen-howto.html,v 1.5 2005/04/14 14:16:20 bv Exp </dd></dl>
|
||||
</div><h2 class="groupheader">Member Function Documentation</h2>
|
||||
<a id="aa83f583c01faf8da986b08d7ba65d537"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#aa83f583c01faf8da986b08d7ba65d537">◆ </a></span>doSomething()</h2>
|
||||
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
<table class="memname">
|
||||
<tr>
|
||||
<td class="memname">uint8_t Device::doSomething </td>
|
||||
<td>(</td>
|
||||
<td class="paramtype">uint8_t </td>
|
||||
<td class="paramname"><em>thing</em></td><td>)</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>It </p><p class="formulaDsp">
|
||||
<img class="formulaDsp" alt="\[ \sum_{k=1}^n \]" src="form_0.png"/>
|
||||
</p>
|
||||
<p> dose something <br />
|
||||
it adds two thing together. </p>
|
||||
<dl class="section author"><dt>Author</dt><dd>Kerem </dd></dl>
|
||||
<dl class="section date"><dt>Date</dt><dd>2021 / 04 / 09 </dd></dl>
|
||||
<dl class="section version"><dt>Version</dt><dd>1.0 </dd></dl>
|
||||
<dl class="params"><dt>Parameters</dt><dd>
|
||||
<table class="params">
|
||||
<tr><td class="paramname">uint8_t</td><td>thing </td></tr>
|
||||
</table>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl class="section return"><dt>Returns</dt><dd>uint8_t retunrs thing + foo </dd></dl>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<hr/>The documentation for this class was generated from the following files:<ul>
|
||||
<li><a class="el" href="device_8hpp_source.html">device.hpp</a></li>
|
||||
<li>device.cpp</li>
|
||||
</ul>
|
||||
</div><!-- contents -->
|
||||
<!-- start footer part -->
|
||||
<hr class="footer"/><address class="footer"><small>
|
||||
Generated by  <a href="http://www.doxygen.org/index.html">
|
||||
<img class="footer" src="doxygen.png" alt="doxygen"/>
|
||||
</a> 1.8.13
|
||||
</small></address>
|
||||
</body>
|
||||
</html>
|
@ -1,82 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
|
||||
<meta name="generator" content="Doxygen 1.8.13"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||
<title>HEllo: Class Index</title>
|
||||
<link href="tabs.css" rel="stylesheet" type="text/css"/>
|
||||
<script type="text/javascript" src="jquery.js"></script>
|
||||
<script type="text/javascript" src="dynsections.js"></script>
|
||||
<link href="search/search.css" rel="stylesheet" type="text/css"/>
|
||||
<script type="text/javascript" src="search/searchdata.js"></script>
|
||||
<script type="text/javascript" src="search/search.js"></script>
|
||||
<link href="doxygen.css" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
|
||||
<div id="titlearea">
|
||||
<table cellspacing="0" cellpadding="0">
|
||||
<tbody>
|
||||
<tr style="height: 56px;">
|
||||
<td id="projectalign" style="padding-left: 0.5em;">
|
||||
<div id="projectname">HEllo
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<!-- end header part -->
|
||||
<!-- Generated by Doxygen 1.8.13 -->
|
||||
<script type="text/javascript">
|
||||
var searchBox = new SearchBox("searchBox", "search",false,'Search');
|
||||
</script>
|
||||
<script type="text/javascript" src="menudata.js"></script>
|
||||
<script type="text/javascript" src="menu.js"></script>
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
initMenu('',true,false,'search.php','Search');
|
||||
$(document).ready(function() { init_search(); });
|
||||
});
|
||||
</script>
|
||||
<div id="main-nav"></div>
|
||||
</div><!-- top -->
|
||||
<!-- window showing the filter options -->
|
||||
<div id="MSearchSelectWindow"
|
||||
onmouseover="return searchBox.OnSearchSelectShow()"
|
||||
onmouseout="return searchBox.OnSearchSelectHide()"
|
||||
onkeydown="return searchBox.OnSearchSelectKey(event)">
|
||||
</div>
|
||||
|
||||
<!-- iframe showing the search results (closed by default) -->
|
||||
<div id="MSearchResultsWindow">
|
||||
<iframe src="javascript:void(0)" frameborder="0"
|
||||
name="MSearchResults" id="MSearchResults">
|
||||
</iframe>
|
||||
</div>
|
||||
|
||||
<div class="header">
|
||||
<div class="headertitle">
|
||||
<div class="title">Class Index</div> </div>
|
||||
</div><!--header-->
|
||||
<div class="contents">
|
||||
<div class="qindex"><a class="qindex" href="#letter_d">d</a></div>
|
||||
<table class="classindex">
|
||||
<tr><td rowspan="2" valign="bottom"><a name="letter_d"></a><table border="0" cellspacing="0" cellpadding="0"><tr><td><div class="ah">  d  </div></td></tr></table>
|
||||
</td><td></td></tr>
|
||||
<tr><td></td></tr>
|
||||
<tr><td valign="top"><a class="el" href="classDevice.html">Device</a>   </td><td></td></tr>
|
||||
<tr><td></td><td></td></tr>
|
||||
</table>
|
||||
<div class="qindex"><a class="qindex" href="#letter_d">d</a></div>
|
||||
</div><!-- contents -->
|
||||
<!-- start footer part -->
|
||||
<hr class="footer"/><address class="footer"><small>
|
||||
Generated by  <a href="http://www.doxygen.org/index.html">
|
||||
<img class="footer" src="doxygen.png" alt="doxygen"/>
|
||||
</a> 1.8.13
|
||||
</small></address>
|
||||
</body>
|
||||
</html>
|
Before Width: | Height: | Size: 132 B |
@ -1,75 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
|
||||
<meta name="generator" content="Doxygen 1.8.13"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||
<title>HEllo: device.hpp Source File</title>
|
||||
<link href="tabs.css" rel="stylesheet" type="text/css"/>
|
||||
<script type="text/javascript" src="jquery.js"></script>
|
||||
<script type="text/javascript" src="dynsections.js"></script>
|
||||
<link href="search/search.css" rel="stylesheet" type="text/css"/>
|
||||
<script type="text/javascript" src="search/searchdata.js"></script>
|
||||
<script type="text/javascript" src="search/search.js"></script>
|
||||
<link href="doxygen.css" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
|
||||
<div id="titlearea">
|
||||
<table cellspacing="0" cellpadding="0">
|
||||
<tbody>
|
||||
<tr style="height: 56px;">
|
||||
<td id="projectalign" style="padding-left: 0.5em;">
|
||||
<div id="projectname">HEllo
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<!-- end header part -->
|
||||
<!-- Generated by Doxygen 1.8.13 -->
|
||||
<script type="text/javascript">
|
||||
var searchBox = new SearchBox("searchBox", "search",false,'Search');
|
||||
</script>
|
||||
<script type="text/javascript" src="menudata.js"></script>
|
||||
<script type="text/javascript" src="menu.js"></script>
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
initMenu('',true,false,'search.php','Search');
|
||||
$(document).ready(function() { init_search(); });
|
||||
});
|
||||
</script>
|
||||
<div id="main-nav"></div>
|
||||
</div><!-- top -->
|
||||
<!-- window showing the filter options -->
|
||||
<div id="MSearchSelectWindow"
|
||||
onmouseover="return searchBox.OnSearchSelectShow()"
|
||||
onmouseout="return searchBox.OnSearchSelectHide()"
|
||||
onkeydown="return searchBox.OnSearchSelectKey(event)">
|
||||
</div>
|
||||
|
||||
<!-- iframe showing the search results (closed by default) -->
|
||||
<div id="MSearchResultsWindow">
|
||||
<iframe src="javascript:void(0)" frameborder="0"
|
||||
name="MSearchResults" id="MSearchResults">
|
||||
</iframe>
|
||||
</div>
|
||||
|
||||
<div class="header">
|
||||
<div class="headertitle">
|
||||
<div class="title">device.hpp</div> </div>
|
||||
</div><!--header-->
|
||||
<div class="contents">
|
||||
<div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> </div><div class="line"><a name="l00031"></a><span class="lineno"> 31</span> <span class="preprocessor">#ifndef _DEVICE_H_</span></div><div class="line"><a name="l00032"></a><span class="lineno"> 32</span> <span class="preprocessor">#define _DEVICE_H_</span></div><div class="line"><a name="l00033"></a><span class="lineno"> 33</span> </div><div class="line"><a name="l00034"></a><span class="lineno"> 34</span> <span class="preprocessor">#include <iostream></span></div><div class="line"><a name="l00035"></a><span class="lineno"> 35</span> <span class="preprocessor">#include <stdint.h></span></div><div class="line"><a name="l00036"></a><span class="lineno"> 36</span> <span class="preprocessor">#include <unistd.h></span></div><div class="line"><a name="l00037"></a><span class="lineno"> 37</span> </div><div class="line"><a name="l00046"></a><span class="lineno"><a class="line" href="classDevice.html"> 46</a></span> <span class="keyword">class </span><a class="code" href="classDevice.html">Device</a>{</div><div class="line"><a name="l00047"></a><span class="lineno"> 47</span> </div><div class="line"><a name="l00048"></a><span class="lineno"> 48</span>  <span class="keyword">public</span>: </div><div class="line"><a name="l00049"></a><span class="lineno"> 49</span>  <a class="code" href="classDevice.html">Device</a>(); </div><div class="line"><a name="l00050"></a><span class="lineno"> 50</span>  ~<a class="code" href="classDevice.html">Device</a>(); </div><div class="line"><a name="l00051"></a><span class="lineno"> 51</span>  </div><div class="line"><a name="l00052"></a><span class="lineno"> 52</span>  </div><div class="line"><a name="l00061"></a><span class="lineno"> 61</span>  uint8_t <a class="code" href="classDevice.html#aa83f583c01faf8da986b08d7ba65d537">doSomething</a>(uint8_t thing); </div><div class="line"><a name="l00062"></a><span class="lineno"> 62</span> </div><div class="line"><a name="l00063"></a><span class="lineno"> 63</span>  <span class="keyword">private</span>: </div><div class="line"><a name="l00064"></a><span class="lineno"> 64</span>  uint8_t foo; </div><div class="line"><a name="l00065"></a><span class="lineno"> 65</span> };</div><div class="line"><a name="l00066"></a><span class="lineno"> 66</span> </div><div class="line"><a name="l00067"></a><span class="lineno"> 67</span> </div><div class="line"><a name="l00068"></a><span class="lineno"> 68</span> <span class="preprocessor">#endif // _DEVICE_H_</span></div><div class="ttc" id="classDevice_html"><div class="ttname"><a href="classDevice.html">Device</a></div><div class="ttdoc">Device Class this calss defines a device. </div><div class="ttdef"><b>Definition:</b> device.hpp:46</div></div>
|
||||
<div class="ttc" id="classDevice_html_aa83f583c01faf8da986b08d7ba65d537"><div class="ttname"><a href="classDevice.html#aa83f583c01faf8da986b08d7ba65d537">Device::doSomething</a></div><div class="ttdeci">uint8_t doSomething(uint8_t thing)</div><div class="ttdoc">It dose something it adds two thing together. </div><div class="ttdef"><b>Definition:</b> device.cpp:9</div></div>
|
||||
</div><!-- fragment --></div><!-- contents -->
|
||||
<!-- start footer part -->
|
||||
<hr class="footer"/><address class="footer"><small>
|
||||
Generated by  <a href="http://www.doxygen.org/index.html">
|
||||
<img class="footer" src="doxygen.png" alt="doxygen"/>
|
||||
</a> 1.8.13
|
||||
</small></address>
|
||||
</body>
|
||||
</html>
|
Before Width: | Height: | Size: 746 B |
Before Width: | Height: | Size: 3.7 KiB |
@ -1,97 +0,0 @@
|
||||
function toggleVisibility(linkObj)
|
||||
{
|
||||
var base = $(linkObj).attr('id');
|
||||
var summary = $('#'+base+'-summary');
|
||||
var content = $('#'+base+'-content');
|
||||
var trigger = $('#'+base+'-trigger');
|
||||
var src=$(trigger).attr('src');
|
||||
if (content.is(':visible')===true) {
|
||||
content.hide();
|
||||
summary.show();
|
||||
$(linkObj).addClass('closed').removeClass('opened');
|
||||
$(trigger).attr('src',src.substring(0,src.length-8)+'closed.png');
|
||||
} else {
|
||||
content.show();
|
||||
summary.hide();
|
||||
$(linkObj).removeClass('closed').addClass('opened');
|
||||
$(trigger).attr('src',src.substring(0,src.length-10)+'open.png');
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function updateStripes()
|
||||
{
|
||||
$('table.directory tr').
|
||||
removeClass('even').filter(':visible:even').addClass('even');
|
||||
}
|
||||
|
||||
function toggleLevel(level)
|
||||
{
|
||||
$('table.directory tr').each(function() {
|
||||
var l = this.id.split('_').length-1;
|
||||
var i = $('#img'+this.id.substring(3));
|
||||
var a = $('#arr'+this.id.substring(3));
|
||||
if (l<level+1) {
|
||||
i.removeClass('iconfopen iconfclosed').addClass('iconfopen');
|
||||
a.html('▼');
|
||||
$(this).show();
|
||||
} else if (l==level+1) {
|
||||
i.removeClass('iconfclosed iconfopen').addClass('iconfclosed');
|
||||
a.html('►');
|
||||
$(this).show();
|
||||
} else {
|
||||
$(this).hide();
|
||||
}
|
||||
});
|
||||
updateStripes();
|
||||
}
|
||||
|
||||
function toggleFolder(id)
|
||||
{
|
||||
// the clicked row
|
||||
var currentRow = $('#row_'+id);
|
||||
|
||||
// all rows after the clicked row
|
||||
var rows = currentRow.nextAll("tr");
|
||||
|
||||
var re = new RegExp('^row_'+id+'\\d+_$', "i"); //only one sub
|
||||
|
||||
// only match elements AFTER this one (can't hide elements before)
|
||||
var childRows = rows.filter(function() { return this.id.match(re); });
|
||||
|
||||
// first row is visible we are HIDING
|
||||
if (childRows.filter(':first').is(':visible')===true) {
|
||||
// replace down arrow by right arrow for current row
|
||||
var currentRowSpans = currentRow.find("span");
|
||||
currentRowSpans.filter(".iconfopen").removeClass("iconfopen").addClass("iconfclosed");
|
||||
currentRowSpans.filter(".arrow").html('►');
|
||||
rows.filter("[id^=row_"+id+"]").hide(); // hide all children
|
||||
} else { // we are SHOWING
|
||||
// replace right arrow by down arrow for current row
|
||||
var currentRowSpans = currentRow.find("span");
|
||||
currentRowSpans.filter(".iconfclosed").removeClass("iconfclosed").addClass("iconfopen");
|
||||
currentRowSpans.filter(".arrow").html('▼');
|
||||
// replace down arrows by right arrows for child rows
|
||||
var childRowsSpans = childRows.find("span");
|
||||
childRowsSpans.filter(".iconfopen").removeClass("iconfopen").addClass("iconfclosed");
|
||||
childRowsSpans.filter(".arrow").html('►');
|
||||
childRows.show(); //show all children
|
||||
}
|
||||
updateStripes();
|
||||
}
|
||||
|
||||
|
||||
function toggleInherit(id)
|
||||
{
|
||||
var rows = $('tr.inherit.'+id);
|
||||
var img = $('tr.inherit_header.'+id+' img');
|
||||
var src = $(img).attr('src');
|
||||
if (rows.filter(':first').is(':visible')===true) {
|
||||
rows.css('display','none');
|
||||
$(img).attr('src',src.substring(0,src.length-8)+'closed.png');
|
||||
} else {
|
||||
rows.css('display','table-row'); // using show() causes jump in firefox
|
||||
$(img).attr('src',src.substring(0,src.length-10)+'open.png');
|
||||
}
|
||||
}
|
||||
|
@ -1,78 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
|
||||
<meta name="generator" content="Doxygen 1.8.13"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||
<title>HEllo: File List</title>
|
||||
<link href="tabs.css" rel="stylesheet" type="text/css"/>
|
||||
<script type="text/javascript" src="jquery.js"></script>
|
||||
<script type="text/javascript" src="dynsections.js"></script>
|
||||
<link href="search/search.css" rel="stylesheet" type="text/css"/>
|
||||
<script type="text/javascript" src="search/searchdata.js"></script>
|
||||
<script type="text/javascript" src="search/search.js"></script>
|
||||
<link href="doxygen.css" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
|
||||
<div id="titlearea">
|
||||
<table cellspacing="0" cellpadding="0">
|
||||
<tbody>
|
||||
<tr style="height: 56px;">
|
||||
<td id="projectalign" style="padding-left: 0.5em;">
|
||||
<div id="projectname">HEllo
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<!-- end header part -->
|
||||
<!-- Generated by Doxygen 1.8.13 -->
|
||||
<script type="text/javascript">
|
||||
var searchBox = new SearchBox("searchBox", "search",false,'Search');
|
||||
</script>
|
||||
<script type="text/javascript" src="menudata.js"></script>
|
||||
<script type="text/javascript" src="menu.js"></script>
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
initMenu('',true,false,'search.php','Search');
|
||||
$(document).ready(function() { init_search(); });
|
||||
});
|
||||
</script>
|
||||
<div id="main-nav"></div>
|
||||
</div><!-- top -->
|
||||
<!-- window showing the filter options -->
|
||||
<div id="MSearchSelectWindow"
|
||||
onmouseover="return searchBox.OnSearchSelectShow()"
|
||||
onmouseout="return searchBox.OnSearchSelectHide()"
|
||||
onkeydown="return searchBox.OnSearchSelectKey(event)">
|
||||
</div>
|
||||
|
||||
<!-- iframe showing the search results (closed by default) -->
|
||||
<div id="MSearchResultsWindow">
|
||||
<iframe src="javascript:void(0)" frameborder="0"
|
||||
name="MSearchResults" id="MSearchResults">
|
||||
</iframe>
|
||||
</div>
|
||||
|
||||
<div class="header">
|
||||
<div class="headertitle">
|
||||
<div class="title">File List</div> </div>
|
||||
</div><!--header-->
|
||||
<div class="contents">
|
||||
<div class="textblock">Here is a list of all documented files with brief descriptions:</div><div class="directory">
|
||||
<table class="directory">
|
||||
<tr id="row_0_" class="even"><td class="entry"><span style="width:16px;display:inline-block;"> </span><a href="device_8hpp_source.html"><span class="icondoc"></span></a><b>device.hpp</b></td><td class="desc"></td></tr>
|
||||
</table>
|
||||
</div><!-- directory -->
|
||||
</div><!-- contents -->
|
||||
<!-- start footer part -->
|
||||
<hr class="footer"/><address class="footer"><small>
|
||||
Generated by  <a href="http://www.doxygen.org/index.html">
|
||||
<img class="footer" src="doxygen.png" alt="doxygen"/>
|
||||
</a> 1.8.13
|
||||
</small></address>
|
||||
</body>
|
||||
</html>
|
Before Width: | Height: | Size: 616 B |
Before Width: | Height: | Size: 597 B |
@ -1,74 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
|
||||
<meta name="generator" content="Doxygen 1.8.13"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||
<title>HEllo: Class Members</title>
|
||||
<link href="tabs.css" rel="stylesheet" type="text/css"/>
|
||||
<script type="text/javascript" src="jquery.js"></script>
|
||||
<script type="text/javascript" src="dynsections.js"></script>
|
||||
<link href="search/search.css" rel="stylesheet" type="text/css"/>
|
||||
<script type="text/javascript" src="search/searchdata.js"></script>
|
||||
<script type="text/javascript" src="search/search.js"></script>
|
||||
<link href="doxygen.css" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
|
||||
<div id="titlearea">
|
||||
<table cellspacing="0" cellpadding="0">
|
||||
<tbody>
|
||||
<tr style="height: 56px;">
|
||||
<td id="projectalign" style="padding-left: 0.5em;">
|
||||
<div id="projectname">HEllo
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<!-- end header part -->
|
||||
<!-- Generated by Doxygen 1.8.13 -->
|
||||
<script type="text/javascript">
|
||||
var searchBox = new SearchBox("searchBox", "search",false,'Search');
|
||||
</script>
|
||||
<script type="text/javascript" src="menudata.js"></script>
|
||||
<script type="text/javascript" src="menu.js"></script>
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
initMenu('',true,false,'search.php','Search');
|
||||
$(document).ready(function() { init_search(); });
|
||||
});
|
||||
</script>
|
||||
<div id="main-nav"></div>
|
||||
</div><!-- top -->
|
||||
<!-- window showing the filter options -->
|
||||
<div id="MSearchSelectWindow"
|
||||
onmouseover="return searchBox.OnSearchSelectShow()"
|
||||
onmouseout="return searchBox.OnSearchSelectHide()"
|
||||
onkeydown="return searchBox.OnSearchSelectKey(event)">
|
||||
</div>
|
||||
|
||||
<!-- iframe showing the search results (closed by default) -->
|
||||
<div id="MSearchResultsWindow">
|
||||
<iframe src="javascript:void(0)" frameborder="0"
|
||||
name="MSearchResults" id="MSearchResults">
|
||||
</iframe>
|
||||
</div>
|
||||
|
||||
<div class="contents">
|
||||
<div class="textblock">Here is a list of all documented class members with links to the class documentation for each member:</div><ul>
|
||||
<li>doSomething()
|
||||
: <a class="el" href="classDevice.html#aa83f583c01faf8da986b08d7ba65d537">Device</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div><!-- contents -->
|
||||
<!-- start footer part -->
|
||||
<hr class="footer"/><address class="footer"><small>
|
||||
Generated by  <a href="http://www.doxygen.org/index.html">
|
||||
<img class="footer" src="doxygen.png" alt="doxygen"/>
|
||||
</a> 1.8.13
|
||||
</small></address>
|
||||
</body>
|
||||
</html>
|
@ -1,74 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
|
||||
<meta name="generator" content="Doxygen 1.8.13"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||
<title>HEllo: Class Members - Functions</title>
|
||||
<link href="tabs.css" rel="stylesheet" type="text/css"/>
|
||||
<script type="text/javascript" src="jquery.js"></script>
|
||||
<script type="text/javascript" src="dynsections.js"></script>
|
||||
<link href="search/search.css" rel="stylesheet" type="text/css"/>
|
||||
<script type="text/javascript" src="search/searchdata.js"></script>
|
||||
<script type="text/javascript" src="search/search.js"></script>
|
||||
<link href="doxygen.css" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
|
||||
<div id="titlearea">
|
||||
<table cellspacing="0" cellpadding="0">
|
||||
<tbody>
|
||||
<tr style="height: 56px;">
|
||||
<td id="projectalign" style="padding-left: 0.5em;">
|
||||
<div id="projectname">HEllo
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<!-- end header part -->
|
||||
<!-- Generated by Doxygen 1.8.13 -->
|
||||
<script type="text/javascript">
|
||||
var searchBox = new SearchBox("searchBox", "search",false,'Search');
|
||||
</script>
|
||||
<script type="text/javascript" src="menudata.js"></script>
|
||||
<script type="text/javascript" src="menu.js"></script>
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
initMenu('',true,false,'search.php','Search');
|
||||
$(document).ready(function() { init_search(); });
|
||||
});
|
||||
</script>
|
||||
<div id="main-nav"></div>
|
||||
</div><!-- top -->
|
||||
<!-- window showing the filter options -->
|
||||
<div id="MSearchSelectWindow"
|
||||
onmouseover="return searchBox.OnSearchSelectShow()"
|
||||
onmouseout="return searchBox.OnSearchSelectHide()"
|
||||
onkeydown="return searchBox.OnSearchSelectKey(event)">
|
||||
</div>
|
||||
|
||||
<!-- iframe showing the search results (closed by default) -->
|
||||
<div id="MSearchResultsWindow">
|
||||
<iframe src="javascript:void(0)" frameborder="0"
|
||||
name="MSearchResults" id="MSearchResults">
|
||||
</iframe>
|
||||
</div>
|
||||
|
||||
<div class="contents">
|
||||
 <ul>
|
||||
<li>doSomething()
|
||||
: <a class="el" href="classDevice.html#aa83f583c01faf8da986b08d7ba65d537">Device</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div><!-- contents -->
|
||||
<!-- start footer part -->
|
||||
<hr class="footer"/><address class="footer"><small>
|
||||
Generated by  <a href="http://www.doxygen.org/index.html">
|
||||
<img class="footer" src="doxygen.png" alt="doxygen"/>
|
||||
</a> 1.8.13
|
||||
</small></address>
|
||||
</body>
|
||||
</html>
|
@ -1,22 +0,0 @@
|
||||
digraph "Graph Legend"
|
||||
{
|
||||
edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"];
|
||||
node [fontname="Helvetica",fontsize="10",shape=record];
|
||||
Node9 [shape="box",label="Inherited",fontsize="10",height=0.2,width=0.4,fontname="Helvetica",fillcolor="grey75",style="filled" fontcolor="black"];
|
||||
Node10 -> Node9 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"];
|
||||
Node10 [shape="box",label="PublicBase",fontsize="10",height=0.2,width=0.4,fontname="Helvetica",color="black",URL="$classPublicBase.html"];
|
||||
Node11 -> Node10 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"];
|
||||
Node11 [shape="box",label="Truncated",fontsize="10",height=0.2,width=0.4,fontname="Helvetica",color="red",URL="$classTruncated.html"];
|
||||
Node13 -> Node9 [dir="back",color="darkgreen",fontsize="10",style="solid",fontname="Helvetica"];
|
||||
Node13 [shape="box",label="ProtectedBase",fontsize="10",height=0.2,width=0.4,fontname="Helvetica",color="black",URL="$classProtectedBase.html"];
|
||||
Node14 -> Node9 [dir="back",color="firebrick4",fontsize="10",style="solid",fontname="Helvetica"];
|
||||
Node14 [shape="box",label="PrivateBase",fontsize="10",height=0.2,width=0.4,fontname="Helvetica",color="black",URL="$classPrivateBase.html"];
|
||||
Node15 -> Node9 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"];
|
||||
Node15 [shape="box",label="Undocumented",fontsize="10",height=0.2,width=0.4,fontname="Helvetica",color="grey75"];
|
||||
Node16 -> Node9 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"];
|
||||
Node16 [shape="box",label="Templ< int >",fontsize="10",height=0.2,width=0.4,fontname="Helvetica",color="black",URL="$classTempl.html"];
|
||||
Node17 -> Node16 [dir="back",color="orange",fontsize="10",style="dashed",label="< int >",fontname="Helvetica"];
|
||||
Node17 [shape="box",label="Templ< T >",fontsize="10",height=0.2,width=0.4,fontname="Helvetica",color="black",URL="$classTempl.html"];
|
||||
Node18 -> Node9 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label="m_usedClass",fontname="Helvetica"];
|
||||
Node18 [shape="box",label="Used",fontsize="10",height=0.2,width=0.4,fontname="Helvetica",color="black",URL="$classUsed.html"];
|
||||
}
|
@ -1,102 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
|
||||
<meta name="generator" content="Doxygen 1.8.13"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||
<title>HEllo: Graph Legend</title>
|
||||
<link href="tabs.css" rel="stylesheet" type="text/css"/>
|
||||
<script type="text/javascript" src="jquery.js"></script>
|
||||
<script type="text/javascript" src="dynsections.js"></script>
|
||||
<link href="search/search.css" rel="stylesheet" type="text/css"/>
|
||||
<script type="text/javascript" src="search/searchdata.js"></script>
|
||||
<script type="text/javascript" src="search/search.js"></script>
|
||||
<link href="doxygen.css" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
|
||||
<div id="titlearea">
|
||||
<table cellspacing="0" cellpadding="0">
|
||||
<tbody>
|
||||
<tr style="height: 56px;">
|
||||
<td id="projectalign" style="padding-left: 0.5em;">
|
||||
<div id="projectname">HEllo
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<!-- end header part -->
|
||||
<!-- Generated by Doxygen 1.8.13 -->
|
||||
<script type="text/javascript">
|
||||
var searchBox = new SearchBox("searchBox", "search",false,'Search');
|
||||
</script>
|
||||
<script type="text/javascript" src="menudata.js"></script>
|
||||
<script type="text/javascript" src="menu.js"></script>
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
initMenu('',true,false,'search.php','Search');
|
||||
$(document).ready(function() { init_search(); });
|
||||
});
|
||||
</script>
|
||||
<div id="main-nav"></div>
|
||||
</div><!-- top -->
|
||||
<!-- window showing the filter options -->
|
||||
<div id="MSearchSelectWindow"
|
||||
onmouseover="return searchBox.OnSearchSelectShow()"
|
||||
onmouseout="return searchBox.OnSearchSelectHide()"
|
||||
onkeydown="return searchBox.OnSearchSelectKey(event)">
|
||||
</div>
|
||||
|
||||
<!-- iframe showing the search results (closed by default) -->
|
||||
<div id="MSearchResultsWindow">
|
||||
<iframe src="javascript:void(0)" frameborder="0"
|
||||
name="MSearchResults" id="MSearchResults">
|
||||
</iframe>
|
||||
</div>
|
||||
|
||||
<div class="header">
|
||||
<div class="headertitle">
|
||||
<div class="title">Graph Legend</div> </div>
|
||||
</div><!--header-->
|
||||
<div class="contents">
|
||||
<p>This page explains how to interpret the graphs that are generated by doxygen.</p>
|
||||
<p>Consider the following example: </p><div class="fragment"><div class="line">/*! Invisible class because of truncation */</div><div class="line">class Invisible { };</div><div class="line"></div><div class="line">/*! Truncated class, inheritance relation is hidden */</div><div class="line">class Truncated : public Invisible { };</div><div class="line"></div><div class="line">/* Class not documented with doxygen comments */</div><div class="line">class Undocumented { };</div><div class="line"></div><div class="line">/*! Class that is inherited using public inheritance */</div><div class="line">class PublicBase : public Truncated { };</div><div class="line"></div><div class="line">/*! A template class */</div><div class="line">template<class T> class Templ { };</div><div class="line"></div><div class="line">/*! Class that is inherited using protected inheritance */</div><div class="line">class ProtectedBase { };</div><div class="line"></div><div class="line">/*! Class that is inherited using private inheritance */</div><div class="line">class PrivateBase { };</div><div class="line"></div><div class="line">/*! Class that is used by the Inherited class */</div><div class="line">class Used { };</div><div class="line"></div><div class="line">/*! Super class that inherits a number of other classes */</div><div class="line">class Inherited : public PublicBase,</div><div class="line"> protected ProtectedBase,</div><div class="line"> private PrivateBase,</div><div class="line"> public Undocumented,</div><div class="line"> public Templ<int></div><div class="line">{</div><div class="line"> private:</div><div class="line"> Used *m_usedClass;</div><div class="line">};</div></div><!-- fragment --><p> This will result in the following graph:</p>
|
||||
<center><div class="image">
|
||||
<img src="graph_legend.png"/>
|
||||
</div>
|
||||
</center><p>The boxes in the above graph have the following meaning: </p>
|
||||
<ul>
|
||||
<li>
|
||||
A filled gray box represents the struct or class for which the graph is generated. </li>
|
||||
<li>
|
||||
A box with a black border denotes a documented struct or class. </li>
|
||||
<li>
|
||||
A box with a gray border denotes an undocumented struct or class. </li>
|
||||
<li>
|
||||
A box with a red border denotes a documented struct or class forwhich not all inheritance/containment relations are shown. A graph is truncated if it does not fit within the specified boundaries. </li>
|
||||
</ul>
|
||||
<p>The arrows have the following meaning: </p>
|
||||
<ul>
|
||||
<li>
|
||||
A dark blue arrow is used to visualize a public inheritance relation between two classes. </li>
|
||||
<li>
|
||||
A dark green arrow is used for protected inheritance. </li>
|
||||
<li>
|
||||
A dark red arrow is used for private inheritance. </li>
|
||||
<li>
|
||||
A purple dashed arrow is used if a class is contained or used by another class. The arrow is labelled with the variable(s) through which the pointed class or struct is accessible. </li>
|
||||
<li>
|
||||
A yellow dashed arrow denotes a relation between a template instance and the template class it was instantiated from. The arrow is labelled with the template parameters of the instance. </li>
|
||||
</ul>
|
||||
</div><!-- contents -->
|
||||
<!-- start footer part -->
|
||||
<hr class="footer"/><address class="footer"><small>
|
||||
Generated by  <a href="http://www.doxygen.org/index.html">
|
||||
<img class="footer" src="doxygen.png" alt="doxygen"/>
|
||||
</a> 1.8.13
|
||||
</small></address>
|
||||
</body>
|
||||
</html>
|
@ -1 +0,0 @@
|
||||
387ff8eb65306fa251338d3c9bd7bfff
|
@ -1,73 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
|
||||
<meta name="generator" content="Doxygen 1.8.13"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||
<title>HEllo: Main Page</title>
|
||||
<link href="tabs.css" rel="stylesheet" type="text/css"/>
|
||||
<script type="text/javascript" src="jquery.js"></script>
|
||||
<script type="text/javascript" src="dynsections.js"></script>
|
||||
<link href="search/search.css" rel="stylesheet" type="text/css"/>
|
||||
<script type="text/javascript" src="search/searchdata.js"></script>
|
||||
<script type="text/javascript" src="search/search.js"></script>
|
||||
<link href="doxygen.css" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
|
||||
<div id="titlearea">
|
||||
<table cellspacing="0" cellpadding="0">
|
||||
<tbody>
|
||||
<tr style="height: 56px;">
|
||||
<td id="projectalign" style="padding-left: 0.5em;">
|
||||
<div id="projectname">HEllo
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<!-- end header part -->
|
||||
<!-- Generated by Doxygen 1.8.13 -->
|
||||
<script type="text/javascript">
|
||||
var searchBox = new SearchBox("searchBox", "search",false,'Search');
|
||||
</script>
|
||||
<script type="text/javascript" src="menudata.js"></script>
|
||||
<script type="text/javascript" src="menu.js"></script>
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
initMenu('',true,false,'search.php','Search');
|
||||
$(document).ready(function() { init_search(); });
|
||||
});
|
||||
</script>
|
||||
<div id="main-nav"></div>
|
||||
</div><!-- top -->
|
||||
<!-- window showing the filter options -->
|
||||
<div id="MSearchSelectWindow"
|
||||
onmouseover="return searchBox.OnSearchSelectShow()"
|
||||
onmouseout="return searchBox.OnSearchSelectHide()"
|
||||
onkeydown="return searchBox.OnSearchSelectKey(event)">
|
||||
</div>
|
||||
|
||||
<!-- iframe showing the search results (closed by default) -->
|
||||
<div id="MSearchResultsWindow">
|
||||
<iframe src="javascript:void(0)" frameborder="0"
|
||||
name="MSearchResults" id="MSearchResults">
|
||||
</iframe>
|
||||
</div>
|
||||
|
||||
<div class="header">
|
||||
<div class="headertitle">
|
||||
<div class="title">HEllo Documentation</div> </div>
|
||||
</div><!--header-->
|
||||
<div class="contents">
|
||||
</div><!-- contents -->
|
||||
<!-- start footer part -->
|
||||
<hr class="footer"/><address class="footer"><small>
|
||||
Generated by  <a href="http://www.doxygen.org/index.html">
|
||||
<img class="footer" src="doxygen.png" alt="doxygen"/>
|
||||
</a> 1.8.13
|
||||
</small></address>
|
||||
</body>
|
||||
</html>
|
@ -1,26 +0,0 @@
|
||||
function initMenu(relPath,searchEnabled,serverSide,searchPage,search) {
|
||||
function makeTree(data,relPath) {
|
||||
var result='';
|
||||
if ('children' in data) {
|
||||
result+='<ul>';
|
||||
for (var i in data.children) {
|
||||
result+='<li><a href="'+relPath+data.children[i].url+'">'+
|
||||
data.children[i].text+'</a>'+
|
||||
makeTree(data.children[i],relPath)+'</li>';
|
||||
}
|
||||
result+='</ul>';
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
$('#main-nav').append(makeTree(menudata,relPath));
|
||||
$('#main-nav').children(':first').addClass('sm sm-dox').attr('id','main-menu');
|
||||
if (searchEnabled) {
|
||||
if (serverSide) {
|
||||
$('#main-menu').append('<li style="float:right"><div id="MSearchBox" class="MSearchBoxInactive"><div class="left"><form id="FSearchBox" action="'+searchPage+'" method="get"><img id="MSearchSelect" src="'+relPath+'search/mag.png" alt=""/><input type="text" id="MSearchField" name="query" value="'+search+'" size="20" accesskey="S" onfocus="searchBox.OnSearchFieldFocus(true)" onblur="searchBox.OnSearchFieldFocus(false)"></form></div><div class="right"></div></div></li>');
|
||||
} else {
|
||||
$('#main-menu').append('<li style="float:right"><div id="MSearchBox" class="MSearchBoxInactive"><span class="left"><img id="MSearchSelect" src="'+relPath+'search/mag_sel.png" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" alt=""/><input type="text" id="MSearchField" value="'+search+'" accesskey="S" onfocus="searchBox.OnSearchFieldFocus(true)" onblur="searchBox.OnSearchFieldFocus(false)" onkeyup="searchBox.OnSearchFieldChange(event)"/></span><span class="right"><a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="'+relPath+'search/close.png" alt=""/></a></span></div></li>');
|
||||
}
|
||||
}
|
||||
$('#main-menu').smartmenus();
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
var menudata={children:[
|
||||
{text:"Main Page",url:"index.html"},
|
||||
{text:"Classes",url:"annotated.html",children:[
|
||||
{text:"Class List",url:"annotated.html"},
|
||||
{text:"Class Index",url:"classes.html"},
|
||||
{text:"Class Members",url:"functions.html",children:[
|
||||
{text:"All",url:"functions.html"},
|
||||
{text:"Functions",url:"functions_func.html"}]}]},
|
||||
{text:"Files",url:"files.html",children:[
|
||||
{text:"File List",url:"files.html"}]}]}
|
Before Width: | Height: | Size: 153 B |
Before Width: | Height: | Size: 95 B |