forked from MPaulHolmes/AC-Controller
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuart.h
53 lines (47 loc) · 1.35 KB
/
uart.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
// AC CONTROL/DRIVER BOARD 21
#ifndef UART4011_H
#define UART4011_H
#include "ACController.h"
#define MAX_COMMAND_LENGTH 40
typedef struct UARTCommand_typ {
volatile int i;
volatile int complete;
volatile char string[MAX_COMMAND_LENGTH];
volatile unsigned int number; // the number part of the command. Ex: kp 3000. string = {'k','p'}. number = 3000.
} UARTCommand;
typedef struct dataStreamTyp {
volatile unsigned int timeOfLastTransmission;
volatile unsigned int period;
volatile unsigned int startTime;
volatile unsigned int timer;
volatile int showStreamOnce;
volatile int Id_times10;
volatile int Iq_times10;
volatile int IdRef_times10;
volatile int IqRef_times10;
volatile int Vd;
volatile int Vq;
volatile int Ia_times10;
volatile int Ib_times10;
volatile int Ic_times10;
volatile int Va;
volatile int Vb;
volatile int Vc;
volatile int percentOfVoltageDiskBeingUsed;
volatile int batteryAmps_times10;
volatile int rawThrottle;
volatile int throttle;
volatile int temperature;
volatile int slipSpeedRPM;
volatile int electricalSpeedRPM;
volatile int mechanicalSpeedRPM;
} dataStream;
void InitUART2();
int TransmitReady();
int TransmitReadyAlt();
void SendCharacter(char ch);
int ReceiveBufferHasData();
unsigned char GetCharacter();
void ClearReceiveBuffer();
void __attribute__((__interrupt__, auto_psv)) _U2RXInterrupt(void);
#endif