-
Notifications
You must be signed in to change notification settings - Fork 39
/
main.c
36 lines (30 loc) · 1.01 KB
/
main.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
//#include "c_types.h"
#include "esp8266_auxrom.h"
#include "eagle_soc.h"
#include "nosdk8266.h"
//#include <math.h>
// TODO: Use float number (related to 8) to fix the drift
#define call_delay_us(time) { asm volatile("mov.n a2, %0\n_call0 delay4clk" : : "r"(time * (MAIN_MHZ / 8)) : "a2" ); }
int main() {
int i = 0;
nosdk8266_init();
// Configure GPIO5 (TX) and GPIO2 (LED)
PIN_FUNC_SELECT(PERIPHS_IO_MUX_GPIO2_U,FUNC_GPIO2);
PIN_FUNC_SELECT(PERIPHS_IO_MUX_GPIO5_U,FUNC_GPIO5);
PIN_DIR_OUTPUT = _BV(2); //Enable GPIO2 light off.
//call_delay_us( 3000000 );
//int j = 0;
//for (j = 0; j < 200; j++) {
// uart_div_modify(0, (j * 1000000) / 115200);
// printf("pllworkingfreq: %d ", j);
//}
while(1) {
PIN_OUT_SET = _BV(2); //Turn GPIO2 light off.
call_delay_us(1000000);
printf("Hello World %d\n", i);
//printf("PLL divider register values: (1)0x%x | (2)0x%x\n", rom_i2c_readReg(103, 4, 1), rom_i2c_readReg(103, 4, 2));
PIN_OUT_CLEAR = _BV(2); //Turn GPIO2 light off.
call_delay_us(1000000);
i++;
}
}