Add complib client and TCP communication

This commit is contained in:
Konstantin Lampalzer 2022-05-22 23:00:57 +02:00
parent 1a033c8b03
commit a484bc2137
35 changed files with 815 additions and 232 deletions

View file

@ -1,9 +1,6 @@
#ifndef COMPLIB_SERVER_RESET_HPP
#define COMPLIB_SERVER_RESET_HPP
#include <pigpio.h>
#include <unistd.h>
#define RESET_PIN 23
#define BOOT_PIN 17
@ -11,21 +8,33 @@
#define RESET_STARTUP_SLEEP_TIME_US 1000 * 500
namespace Reset {
void reset_robot() {
gpioInitialise();
#ifdef IS_RASPI
gpioSetMode(BOOT_PIN, PI_OUTPUT);
gpioSetMode(RESET_PIN, PI_OUTPUT);
#include <pigpio.h>
#include <unistd.h>
gpioWrite(BOOT_PIN, 0);
gpioWrite(RESET_PIN, 0);
void reset_robot() {
gpioInitialise();
usleep(RESET_SLEEP_TIME_US);
gpioSetMode(BOOT_PIN, PI_OUTPUT);
gpioSetMode(RESET_PIN, PI_OUTPUT);
gpioWrite(RESET_PIN, 1);
gpioWrite(BOOT_PIN, 0);
gpioWrite(RESET_PIN, 0);
usleep(RESET_STARTUP_SLEEP_TIME_US);
}
usleep(RESET_SLEEP_TIME_US);
gpioWrite(RESET_PIN, 1);
usleep(RESET_STARTUP_SLEEP_TIME_US);
}
#else
void reset_robot() {
}
#endif
}