-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathapp.c
More file actions
78 lines (58 loc) · 1.87 KB
/
Copy pathapp.c
File metadata and controls
78 lines (58 loc) · 1.87 KB
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#include <stdbool.h>
#include <stdint.h>
#include "inc/hw_memmap.h"
#include "inc/hw_types.h"
#include "inc/hw_gpio.h"
#include "inc/hw_sysctl.h"
#include "driverlib/gpio.h"
#include "driverlib/pin_map.h"
#include "driverlib/sysctl.h"
#include "driverlib/systick.h"
#include "driverlib/timer.h"
#include "driverlib/usb.h"
#include "driverlib/flash.h"
#include "usblib/usblib.h"
#include "usblib/device/usbdevice.h"
#include "upcd.h"
#include "peripheral_desc.h"
#include "map.h"
#define RED_LED GPIO_PIN_1
#define BLUE_LED GPIO_PIN_2
#define GREEN_LED GPIO_PIN_3
#define SYSTICKS_PER_SECOND 100
#define SYSTICK_PERIOD_MS (1000/SYSTICKS_PER_SECOND)
#define FLASH_ADDR 0x0003FF00
uint32_t sysTick;
void SysTickIntHandler(void)
{
sysTick++;
}
extern upcd_device UPCDDev;
peripheral_desc desc;
int
main(void)
{
SysCtlClockSet(SYSCTL_SYSDIV_4|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ|
SYSCTL_OSC_MAIN);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD);
SysCtlPeripheralEnable(SYSCTL_PERIPH_EEPROM0);
GPIOPinTypeUSBAnalog(GPIO_PORTD_BASE, GPIO_PIN_4 | GPIO_PIN_5 );
SysTickPeriodSet(SysCtlClockGet()/SYSTICKS_PER_SECOND);
SysTickIntEnable();
SysTickEnable();
USBStackModeSet(0,eUSBModeForceDevice,0);
// desc.ioPin[0].pin = 3;
// SaveConfig();
peripheral_desc *fptr = (peripheral_desc *)FLASH_ADDR;
desc = *fptr;
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, RED_LED|BLUE_LED|GREEN_LED);
UPCDInit(0,&UPCDDev);
while(1)
{
// GPIOPinWrite(GPIO_PORTF_BASE, MapPin(desc.ioPin[0].pin) | MapPin(desc.ioPin[2].pin), 0xFF);
SysCtlDelay(5000000);
// GPIOPinWrite(GPIO_PORTF_BASE, MapPin(desc.ioPin[0].pin) | MapPin(desc.ioPin[2].pin) ,0x00);
SysCtlDelay(5000000);
}
}