PlayBack
Dependencies: TPixy-Interface
Fork of ObjectFollower by
Diff: PiControlThread.cpp
- Revision:
- 7:73fd05fe556a
- Parent:
- 6:e7ce340fe91e
- Child:
- 8:a0890fa79084
diff -r e7ce340fe91e -r 73fd05fe556a PiControlThread.cpp --- a/PiControlThread.cpp Sat Feb 10 19:35:21 2018 +0000 +++ b/PiControlThread.cpp Thu Feb 15 01:15:26 2018 +0000 @@ -3,7 +3,7 @@ #include "Drivers/motor_driver.h" #include "Drivers/DE0_driver.h" #include "PiControlThread.h" -#include "PiController.h" +#include "Drivers/PiController.h" extern int setpoint; @@ -34,7 +34,13 @@ DigitalOut led3(LED3); - +/******************************************************************************* +* @brief function that creates a thread for the PI controller. It initializes +* the PI controller's gains and initializes the DC Motor. It also +* initializes the PIControllerThread runs at 50ms period +* @param none +* @return none +*******************************************************************************/ void PiControlThreadInit() { DE0_init(); // initialize FPGA @@ -52,7 +58,10 @@ /******************************************************************************* -* ******** Periodic Timer Interrupt Thread ******** +* @brief This is the PI controller thread. It reads several values from the +* FPGA such as speed, time and other sensors data +* @param none +* @return none *******************************************************************************/ void PiControlThread(void const *argument) { @@ -77,16 +86,17 @@ else if (U < 0) { motorDriver_reverse(U); - } + } } } /******************************************************************************* -* the interrupt below occures every 250ms as setup in the main function during -* initialization -* ******** Period Timer Interrupt Handler ******** +* @brief The ISR below signals the PIControllerThread. it is setup to run +* every 50ms +* @param none +* @return none *******************************************************************************/ void PeriodicInterruptISR(void) {