23 lines
609 B
C
23 lines
609 B
C
|
#include "ESP8266.h"
|
||
|
#include "derivative.h"
|
||
|
#include "systick.h"
|
||
|
#include "uart.h"
|
||
|
#include <stdio.h>
|
||
|
#include <string.h>
|
||
|
|
||
|
int main(void) {
|
||
|
// Initialize
|
||
|
systick_init(CORCLK / 1000); // Period of systick timer : 1ms
|
||
|
uart_init(UART_MSG, 9600); // Initialize UART1 with PC
|
||
|
|
||
|
uart_printf(UART_MSG, "System Clock: %lu\r\n", CORCLK);
|
||
|
uart_printf(UART_MSG, "Bus Clock: %lu\r\n", BUSCLK);
|
||
|
|
||
|
uint32_t timer = 0;
|
||
|
for (;;) {
|
||
|
if (timer_expired(&timer, 1000)) {
|
||
|
uart_printf(UART_MSG, "LED: %d, tick: %lu\r\n", GPIOC->PDOR & BIT(12) ? 1 : 0, ms_ticks);
|
||
|
}
|
||
|
}
|
||
|
}
|