41 lines
644 B
C++
41 lines
644 B
C++
#ifndef COMPLIB_SERVER_RESET_HPP
|
|
#define COMPLIB_SERVER_RESET_HPP
|
|
|
|
#define RESET_PIN 23
|
|
#define BOOT_PIN 17
|
|
|
|
#define RESET_SLEEP_TIME_US 1000 * 100
|
|
#define RESET_STARTUP_SLEEP_TIME_US 1000 * 500
|
|
|
|
namespace Reset {
|
|
#ifdef IS_RASPI
|
|
|
|
#include <pigpio.h>
|
|
#include <unistd.h>
|
|
|
|
void reset_robot() {
|
|
gpioInitialise();
|
|
|
|
gpioSetMode(BOOT_PIN, PI_OUTPUT);
|
|
gpioSetMode(RESET_PIN, PI_OUTPUT);
|
|
|
|
gpioWrite(BOOT_PIN, 0);
|
|
gpioWrite(RESET_PIN, 0);
|
|
|
|
usleep(RESET_SLEEP_TIME_US);
|
|
|
|
gpioWrite(RESET_PIN, 1);
|
|
|
|
usleep(RESET_STARTUP_SLEEP_TIME_US);
|
|
}
|
|
|
|
#else
|
|
|
|
void reset_robot() {
|
|
}
|
|
|
|
#endif
|
|
}
|
|
|
|
|
|
#endif //COMPLIB_SERVER_RESET_HPP
|