mirror of
https://gitlab.dit.htwk-leipzig.de/phillip.kuehne/dezibot.git
synced 2025-07-05 10:04:31 +02:00
adopted print method, changed stringtermination to \0 termination
This commit is contained in:
@ -1,4 +1,5 @@
|
||||
#include Display.h
|
||||
#include "Display.h"
|
||||
#include "CharTable.h"
|
||||
|
||||
void Display::sendDisplayCMD(uint8_t cmd){
|
||||
|
||||
@ -98,60 +99,62 @@ void Display::updateLine(int charAmount)
|
||||
|
||||
void Display::print(char *value){
|
||||
int i = 0;
|
||||
int charval;
|
||||
int nextchar;
|
||||
char nextchar;
|
||||
/* write data to the buffer */
|
||||
//check if input is a predefined cmd
|
||||
for(i=0;i<count;i++) //count-1 to prevent the terminate string to be send
|
||||
while(value && value != '\0') //check if pointer is still valid and string is not terminated
|
||||
{
|
||||
charval = procfs_buffer[i];
|
||||
if(charval=='/')
|
||||
//check if input is a predefined cmd
|
||||
if(*value=='/')
|
||||
{
|
||||
nextchar = procfs_buffer[i+1];
|
||||
nextchar = *value+1;
|
||||
if(nextchar=='c')
|
||||
{
|
||||
clearDisplay(display_i2c_client);
|
||||
currLine = 0;
|
||||
charsOnCurrLine = 0;
|
||||
Display::clearDisplay();
|
||||
this->currLine = 0;
|
||||
this->charsOnCurrLine = 0;
|
||||
}
|
||||
else if(nextchar=='n')
|
||||
{
|
||||
if(charsOnCurrLine==16)
|
||||
if(this->charsOnCurrLine==16)
|
||||
{
|
||||
currLine=currLine+1;
|
||||
charsOnCurrLine=0;
|
||||
this->currLine=currLine+1;
|
||||
this->charsOnCurrLine=0;
|
||||
}
|
||||
while(charsOnCurrLine<17)
|
||||
while(this->charsOnCurrLine<17)
|
||||
{
|
||||
i2c_master_send(display_i2c_client,font8x8_colwise[0],9);
|
||||
Wire.beginTransmission(Display_Adress);
|
||||
for(int i = 0;i<9;i++){
|
||||
Wire.write(font8x8_colwise[0][i]);
|
||||
}
|
||||
Wire.endTransmission();
|
||||
updateLine(1);
|
||||
if(charsOnCurrLine==16)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
}
|
||||
i=i+1;
|
||||
}
|
||||
else
|
||||
{
|
||||
updateLine(1);
|
||||
i2c_master_send(display_i2c_client,font8x8_colwise[charval],9);
|
||||
Wire.beginTransmission(DisplayAdress);
|
||||
for(int i = 0;i<9;i++){
|
||||
Wire.write(font8x8_colwise[*value][i]);
|
||||
}
|
||||
Wire.endTransmission();
|
||||
}
|
||||
|
||||
}
|
||||
// }
|
||||
|
||||
|
||||
|
||||
return procfs_buffer_size;
|
||||
}
|
||||
return;
|
||||
|
||||
};
|
||||
void Display::println(char *value){
|
||||
|
||||
};
|
||||
void Display::print(int value);
|
||||
void Display::print(int value){
|
||||
|
||||
};
|
Reference in New Issue
Block a user