-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain_dsp_core2.c
58 lines (51 loc) · 1.64 KB
/
main_dsp_core2.c
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
54
55
56
57
58
#include <F28x_Project.h>
#include <F2837xD_Ipc_drivers.h>
#include <LCD.h>
#include "F2837xD_Examples.h"
extern volatile uint16_t LCD_interrupt;
extern uint16_t LCD_interrupt_occupied;
extern Point X_Y_Coordinates;
extern uint16_t LCD_TOUCHED;
extern int16 CPU2_CMD_MSG0, CPU2_CMD_MSG1, CPU2_CMD_MSG2;
extern uint16_t UpdateCPU1Flag;
extern float32 Spectrum[128];
int main(void) {
InitUserApp();
IpcRegs.IPCSET.bit.IPC4 = 1;
while(1) {
if (LCD_TOUCHED == 1) {
LCD_TOUCHED = 0;
// Do this to detemine what changed when a touch is occured.
Process_touch();
}
if (UpdateCPU1Flag == 1) {
UpdateCPU1Flag = 0;
IpcRegs.IPCSENDCOM = CPU2_CMD_MSG0;
IpcRegs.IPCSENDDATA = CPU2_CMD_MSG1;
IpcRegs.IPCSENDADDR = CPU2_CMD_MSG2;
//Signal CPU1 to read messages
IpcRegs.IPCSET.bit.IPC1 = 1;
//Wait for CPU1 to ACK messages
while(!IpcRegs.IPCSTS.bit.IPC3);
IpcRegs.IPCACK.bit.IPC3 = 1;
IpcRegs.IPCCLR.bit.IPC1 = 1;
}
if(IpcRegs.IPCSTS.bit.IPC2) {
IpcRegs.IPCACK.bit.IPC2 = 1;
IpcRegs.IPCCLR.bit.IPC4 = 1;
LCD_DrawSpectrum();
IpcRegs.IPCSET.bit.IPC4 = 1;
}
//Print Screen
updateScreen();
}
}
interrupt void LCD_TOUCH_ISR(void) {
//if (GpioDataRegs.GPDDAT.bit.GPIO97 == 1) {
if (LCD_interrupt_occupied == 0) {
LCD_interrupt = 1;
}
//}
PieCtrlRegs.PIEACK.all |= PIEACK_GROUP1;
IpcRegs.IPCACK.bit.IPC0 = 1;
}