R2R
CurrentControl.h
Go to the documentation of this file.
1 
13 #ifndef CURRENT_CONTROL_H_
14 #define CURRENT_CONTROL_H_
15 
24 extern void CurrentControlIntHandler(void);
25 
36 void PI_controller(int motor, int reference, int actual);
37 
47 void setCurrent(int motor, int u);
48 
57 void get_mA(void);
66 void get_counts(void);
67 
68 
77 void get_current_gains(void);
78 
87 void set_current_gains(void);
88 
89 
98 int getCurrent(int motor);
99 
108 void reset_current_error(void);
109 
118 void counts_read(void);
119 
129 void AD0_read(int mux);
130 
131 
141 extern void currentControlInit(void);
142 
151 extern void setADCMux(int motor,int number);
152 
153 
154 
155 #endif /* CURRENT_CONTROL_H_ */
void get_mA(void)
Print the current in mA to UART.
Definition: CurrentControl.c:448
void get_counts(void)
Print the current counts to UART.
Definition: CurrentControl.c:464
void setADCMux(int motor, int number)
Sets the ADC MUX to read from either the current sense resistor 1, 2 or 3 from motor 1 or 2...
Definition: CurrentControl.c:481
void counts_read(void)
Reads the counts of the current to UART from an array.
Definition: CurrentControl.c:330
void currentControlInit(void)
Init ADC.
Definition: CurrentControl.c:41
void CurrentControlIntHandler(void)
The interrupt handler for the current control loop.
Definition: CurrentControl.c:88
void set_current_gains(void)
Sets the current gains by reading the UART buffer.
Definition: CurrentControl.c:281
void AD0_read(int mux)
Triggers the ADC reading and saves it to the TEMP array.
Definition: CurrentControl.c:431
void get_current_gains(void)
Print the current gains to UART.
Definition: CurrentControl.c:271
void reset_current_error(void)
Sets the current gains by reading the UART buffer.
Definition: CurrentControl.c:323
void PI_controller(int motor, int reference, int actual)
Simple PI controller that uses motorxControlPWM to control the motor output.
Definition: CurrentControl.c:250
int getCurrent(int motor)
Gets the motor current in counts (12 bit signed)
Definition: CurrentControl.c:308
void setCurrent(int motor, int u)
Sets the reference current for a given motor.
Definition: CurrentControl.c:295