Rework PID
This commit is contained in:
parent
5d8df998ae
commit
1fc400c695
9 changed files with 186 additions and 56 deletions
|
@ -1,6 +1,8 @@
|
|||
#ifndef COMPLIB_SERVER_SPI_HPP
|
||||
#define COMPLIB_SERVER_SPI_HPP
|
||||
|
||||
#include <mutex>
|
||||
|
||||
//SPI_MODE_0 (0,0) CPOL = 0, CPHA = 0, Clock idle low, data is clocked in on rising edge, output data (change) on falling edge
|
||||
//SPI_MODE_1 (0,1) CPOL = 0, CPHA = 1, Clock idle low, data is clocked in on falling edge, output data (change) on rising edge
|
||||
//SPI_MODE_2 (1,0) CPOL = 1, CPHA = 0, Clock idle high, data is clocked in on falling edge, output data (change) on rising edge
|
||||
|
@ -106,7 +108,17 @@ public:
|
|||
DISPLAY_LINE_1_C0 = 69,
|
||||
DISPLAY_LINE_2_C0 = 85,
|
||||
DISPLAY_LINE_3_C0 = 101,
|
||||
DISPLAY_LINE_4_C0 = 117
|
||||
DISPLAY_LINE_4_C0 = 117,
|
||||
|
||||
// Motor encoder velocities
|
||||
MOTOR_1_VEL_H = 118,
|
||||
MOTOR_1_VEL_L = 119,
|
||||
MOTOR_2_VEL_H = 120,
|
||||
MOTOR_2_VEL_L = 121,
|
||||
MOTOR_3_VEL_H = 122,
|
||||
MOTOR_3_VEL_L = 123,
|
||||
MOTOR_4_VEL_H = 124,
|
||||
MOTOR_4_VEL_L = 125
|
||||
};
|
||||
|
||||
private:
|
||||
|
@ -116,6 +128,8 @@ private:
|
|||
uint8_t tx_buffer[SPI_BUFFER_SIZE] = {0};
|
||||
uint8_t rx_buffer[SPI_BUFFER_SIZE] = {0};
|
||||
|
||||
std::recursive_mutex spi_mutex;
|
||||
|
||||
void transfer();
|
||||
void clear_buffers();
|
||||
|
||||
|
|
Reference in a new issue