47 lines
647 B
C
47 lines
647 B
C
#include <stdio.h>
|
|
|
|
#include "msp.h"
|
|
#include "Clock.h"
|
|
|
|
|
|
void systick_init(void) {
|
|
|
|
SysTick->LOAD = 0x00FFFFFF;
|
|
SysTick->CTRL = 0x00000005;
|
|
}
|
|
|
|
void systick_wait1ms() {
|
|
SysTick->LOAD = 48000;
|
|
SysTick->VAL = 0;
|
|
while((SysTick->CTRL & 0x00010000) == 0) {}
|
|
}
|
|
|
|
void systick_wait1s() {
|
|
int i;
|
|
int count = 1000;
|
|
for(i=0;i<count;i++) {
|
|
systick_wait1ms();
|
|
}
|
|
}
|
|
|
|
/**
|
|
* main.c
|
|
*/
|
|
void main(void)
|
|
{
|
|
Clock_Init48MHz();
|
|
printf("init started\n");
|
|
P2->SEL0 &= ~0x07;
|
|
P2->SEL1 &= ~0x07;
|
|
P2->DIR |= 0x07;
|
|
P2->OUT &= ~0x07;
|
|
|
|
printf("init end\n");
|
|
|
|
P2->OUT |= 0b00000111;
|
|
Clock_Delay1ms(10000);
|
|
|
|
|
|
|
|
}
|