-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathcontrol.h
57 lines (46 loc) · 1.19 KB
/
control.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#include <stdint.h>
typedef enum {
// current switched off
OFF,
// constant current
CC,
// constant power
CP,
// constant resistance
CR,
// pulsed current
CM_PI
} EControlMode;
typedef struct {
int duration;
float current;
} TPulsedCurrent;
/**
* Initializes the control module.
*/
void ControlInit(void);
/**
* Sets the control mode.
* @param[in] newMode the new mode
* @param(in] newTarget the target value (e.g. current, power, resistance)
*/
void ControlSetMode(EControlMode newMode, float newTarget);
/**
* Configures and enabled pulsed current mode.
*
* @param[in] num number of (duration, current) pairs
* @param[in] the pulse current pairs
*/
void ControlSetPulsedMode(int num, TPulsedCurrent *pulses);
/**
* @return a string describing the current control mode
*/
const char *ControlGetModeString(void);
/**
* Updates the control module with new measurement values.
* @param[in] micros the current time in microseconds
* @param[in] current the actual current in amperes
* @param[in] voltage the actual voltage in volts
* @return the desired output current
*/
float ControlTick(uint32_t micros, float current, float voltage);