This repository has been archived on 2025-06-01. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
compLIB/server_v2/include/reset.hpp
2022-05-22 23:00:57 +02:00

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