You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
921 B
C
34 lines
921 B
C
|
5 years ago
|
#include "TM4C123GH6PM.h"
|
||
|
|
#include "bsp.h"
|
||
|
|
#include <intrinsics.h>
|
||
|
|
|
||
|
|
int main() {
|
||
|
|
SYSCTL->RCGCGPIO |= (1U << 5); /* enable Run mode for GPIOF */
|
||
|
|
SYSCTL->GPIOHBCTL |= (1U << 5); /* enable AHB for GPIOF */
|
||
|
4 years ago
|
|
||
|
|
/* make sure the Run Mode and AHB-enable take effects
|
||
|
|
* before accessing the peripherals
|
||
|
|
*/
|
||
|
|
__ISB(); /* Instruction Synchronization Barrier */
|
||
|
|
__DSB(); /* Data Memory Barrier */
|
||
|
|
|
||
|
5 years ago
|
GPIOF_AHB->DIR |= (LED_RED | LED_BLUE | LED_GREEN);
|
||
|
|
GPIOF_AHB->DEN |= (LED_RED | LED_BLUE | LED_GREEN);
|
||
|
|
|
||
|
4 years ago
|
/* turn all LEDs off */
|
||
|
|
GPIOF_AHB->DATA_Bits[LED_RED | LED_BLUE | LED_GREEN] = 0U;
|
||
|
|
|
||
|
5 years ago
|
SysTick->LOAD = SYS_CLOCK_HZ/2U - 1U;
|
||
|
|
SysTick->VAL = 0U;
|
||
|
|
SysTick->CTRL = (1U << 2) | (1U << 1) | 1U;
|
||
|
|
|
||
|
|
SysTick_Handler();
|
||
|
|
|
||
|
|
__enable_interrupt();
|
||
|
|
while (1) {
|
||
|
|
GPIOF_AHB->DATA_Bits[LED_GREEN] = LED_GREEN;
|
||
|
|
GPIOF_AHB->DATA_Bits[LED_GREEN] = 0U;
|
||
|
|
}
|
||
|
|
//return 0;
|
||
|
|
}
|