26 lines
663 B
C++
26 lines
663 B
C++
//
|
|
// Created by camer on 22/05/2020.
|
|
//
|
|
|
|
#include "../../include/I2CDevices/Keyboard.h"
|
|
|
|
Keyboard::Keyboard(): Device() {}
|
|
|
|
//void Keyboard::run() {}
|
|
bool Keyboard::saisie = false;
|
|
|
|
void Keyboard::run() {
|
|
while (1) {
|
|
if (saisie && i2cbus != NULL) {
|
|
cin >> buf;
|
|
while (!(i2cbus->isEmptyRegister(i2caddr))) {}
|
|
Device::i2cbus->write(i2caddr, buf, I2C_BUFFER_SIZE);
|
|
saisie = false;
|
|
} else if (i2cbus != NULL){
|
|
buf[0] = '\0';
|
|
while (!(i2cbus->isEmptyRegister(i2caddr))) {}
|
|
Device::i2cbus->write(i2caddr, buf, I2C_BUFFER_SIZE);
|
|
}
|
|
sleep(3);
|
|
}
|
|
}
|