Ejemplo n.º 1
0
void setup()
{
	ebox_init();
	uart1.begin(115200);
	ret = sizeof(long);
	ret = sizeof(int);
	ret = sizeof(short int);
	ret = sizeof(short);

	w5500.begin(2,mac,ip,sub,gw,dns);

	
	attach_eth_to_socket(&w5500);
	
  w5500.getMAC (buf);
  uart1.printf("mac : %02x.%02x.%02x.%02x.%02x.%02x\r\n", buf[0],buf[1],buf[2],buf[3],buf[4],buf[5]);
  w5500.getIP (buf);
  uart1.printf("IP : %d.%d.%d.%d\r\n", buf[0],buf[1],buf[2],buf[3]);
  w5500.getSubnet(buf);
  uart1.printf("mask : %d.%d.%d.%d\r\n", buf[0],buf[1],buf[2],buf[3]);
  w5500.getGateway(buf);
  uart1.printf("GW : %d.%d.%d.%d\r\n", buf[0],buf[1],buf[2],buf[3]);
  uart1.printf("Network is ready.\r\n");
	
	ddns.begin(SOCKET1,3000);
	
	ret = ddns.query(name);
	if(ret == DNS_RET_SUCCESS) /*发送DNS请求*/
		uart1.printf("Get [%s]'s IP address [%d.%d.%d.%d] from %d.%d.%d.%d\r\n",name,ddns.domain_ip[0],ddns.domain_ip[1],ddns.domain_ip[2],ddns.domain_ip[3],dns[0],dns[1],dns[2],dns[3]);
	else if(ret == DNS_RET_FAIL)
    uart1.printf("获取超时\r\n");
	else
    uart1.printf("未知错误.\r\n");
}
Ejemplo n.º 2
0
void setup()
{
    ebox_init();
    uart1.begin(9600);
    lcd.begin();

}
Ejemplo n.º 3
0
void setup()
{
    ebox_init();
    uart1.begin(9600);

    w5500.begin(2,mac,lip,sub,gw);


    attach_eth_to_socket(&w5500);

    w5500.getMAC (ip);
    uart1.printf("mac : %02x.%02x.%02x.%02x.%02x.%02x\r\n", ip[0],ip[1],ip[2],ip[3],ip[4],ip[5]);
    w5500.getIP (ip);
    uart1.printf("IP : %d.%d.%d.%d\r\n", ip[0],ip[1],ip[2],ip[3]);
    w5500.getSubnet(ip);
    uart1.printf("mask : %d.%d.%d.%d\r\n", ip[0],ip[1],ip[2],ip[3]);
    w5500.getGateway(ip);
    uart1.printf("GW : %d.%d.%d.%d\r\n", ip[0],ip[1],ip[2],ip[3]);
    uart1.printf("Network is ready.\r\n");

    tcp.begin(SOCKET7,3000);
    tcp.connect(rip,8080);


}
Ejemplo n.º 4
0
void setup()
{
    ebox_init();
    uart1.begin(115200);
    uart1.printf("\r\nuart1 9600 ok!");

    w5500.begin(2, mac, lip, sub, gw, dns);

    attach_eth_to_socket(&w5500);

    w5500.getMAC (ip);
    uart1.printf("\r\nmac : %02x.%02x.%02x.%02x.%02x.%02x\r\n", ip[0], ip[1], ip[2], ip[3], ip[4], ip[5]);
    w5500.getIP (ip);
    uart1.printf("IP : %d.%d.%d.%d\r\n", ip[0], ip[1], ip[2], ip[3]);
    w5500.getSubnet(ip);
    uart1.printf("mask : %d.%d.%d.%d\r\n", ip[0], ip[1], ip[2], ip[3]);
    w5500.getGateway(ip);
    uart1.printf("GW : %d.%d.%d.%d\r\n", ip[0], ip[1], ip[2], ip[3]);
    uart1.printf("Network is ready.\r\n");

    if(udp1.begin(0, 30000) == 0)
        uart1.printf("\r\nudp1 server creat ok! listen on 30000");
    if(udp2.begin(1, 30001) == 0)
        uart1.printf("\r\nudp2 server creat ok! listen on 30001");

}
Ejemplo n.º 5
0
void setup()
{
    ebox_init();
    uart1.begin(115200);
    ee.begin(400000);


    PA7.mode(AIN);
}
Ejemplo n.º 6
0
void setup()
{
    ebox_init();
    uart1.begin(9600);
    uart1.attach_rx_interrupt(test);
    uart1.attach_tx_interrupt(test1);
    PB8.mode(OUTPUT_PP);
    PB8.reset();
}
Ejemplo n.º 7
0
void setup()
{
    ebox_init();
    uart1.begin(9600);
    btn.begin();
    PB8.mode(OUTPUT_PP);
    PB9.mode(OUTPUT_PP);
    PB10.mode(OUTPUT_PP);
}
Ejemplo n.º 8
0
void setup()
{
    ebox_init();
    uart1.begin(115200);
    uart1.printf("esp8266 basic at cmd test\r\n");
    uart1.printf("--------------\r\n");

    wifi.begin(&PA4, &uart2, 115200);

}
Ejemplo n.º 9
0
void setup()
{
    ebox_init();
    uart1.begin(115200);
    PB8.mode(OUTPUT_PP);
    ex.begin();
//    ex.attach(exit);
    ex.attach(&test,&Test::event);
    ex.interrupt(ENABLE);
}
Ejemplo n.º 10
0
void setup()
{
	ebox_init();
	uart1.begin(9600);
	ret = sd.begin();
	if(!ret)
		uart1.printf("\r\nsdcard init ok!");
	f_mount(0, &fs);

	w5500.begin(mac,lip,sub,gw);

	attachEthToSocket(&w5500);
	attachSDCardToFat(&sd);

  w5500.getMAC (ip);
  uart1.printf("\r\nmac : %02x.%02x.%02x.%02x.%02x.%02x\r\n", ip[0],ip[1],ip[2],ip[3],ip[4],ip[5]);
  w5500.getIP (ip);
  uart1.printf("IP : %d.%d.%d.%d\r\n", ip[0],ip[1],ip[2],ip[3]);
  w5500.getSubnet(ip);
  uart1.printf("mask : %d.%d.%d.%d\r\n", ip[0],ip[1],ip[2],ip[3]);
  w5500.getGateway(ip);
  uart1.printf("GW : %d.%d.%d.%d\r\n", ip[0],ip[1],ip[2],ip[3]);
  uart1.printf("Network is ready.\r\n");
	
	if(udp1.begin(0,30000) == 0)
		uart1.printf("\r\nudp1 server creat ok! listen on 30000");


	uart1.printf("\r\nret = %d",ret);
	ret = sd.getCID(buf);
	uart1.printf("\r\nret = %d",ret);
	uart1.printf((const char*)buf);

	ret = sd.getCSD(buf);
	uart1.printf("\r\nret = %d",ret);

	rl = sd.getCapacity();
	x = (float)rl;
	uart1.printf("\r\n容量 = %f",x/1024/1024);	
   
  res=f_getfree("/",&free_clust,&fss);
       uart1.printf("该分区所有扇区数为:%d\r\n",(fss->max_clust-2)*(fss->csize));
	if(res==FR_OK)
	{
		uart1.printf("该分区所有扇区数为:%d\r\n",(fss->max_clust-2)*(fss->csize));
		uart1.printf("该分区大小为:%dM\r\n",(fss->max_clust-2)*(fss->csize)/2048);
		uart1.printf("该分区空簇数为:%d\r\n",free_clust);
		uart1.printf("该分区空扇区数为:%d\r\n",free_clust*(fss->csize));
	}
	else
		uart1.printf("获取分区空簇失败\r\n,res = %d",res);
	uart1.printf("\r\n");

}
Ejemplo n.º 11
0
void setup()
{
	ebox_init();
	uart1.begin(9600);
		hsl.s = 0.5;
		hsl.l = 0.5;
	
		hsv.h = 2;
		hsv.s = 0.9;
		hsv.v = 0.5;

}
Ejemplo n.º 12
0
void setup()
{
	ebox_init();

	PPS_PIN.mode(OUTPUT_PP);
	pps_off();
	uart1.begin(115200);
	led.begin();
	btn.begin();
	date_time.begin(115200);

}
Ejemplo n.º 13
0
void setup()
{
	ebox_init();
	uart3.begin(9600);
	ds.begin(400000);
	
	t.year = 15;
	t.month = 7;
	t.date = 3;
	t.hour = 23;
	t.min = 59;
	t.sec = 55;
}
Ejemplo n.º 14
0
void setup()
{
	ebox_init();
	uart1.begin(9600);
	PB8.mode(OUTPUT_PP);
    
    p = 1;
    ic.begin(p);//初始化输入捕获参数,p分频
    ic.attch_ic_interrupt(mesure_frq);//绑定捕获中断事件函数
    ic.attch_update_interrupt(update_event);
    pwm1.begin(1,500);
    pwm1.set_oc_polarity(1);
   
}
Ejemplo n.º 15
0
void setup()
{
    ebox_init();
    uart1.begin(115200);
    uart1.printf("j:%d\r\n",ebox_get_free());
    uart1.printf("j:%d\r\n",ebox_get_free());
//    uart1.printf("1£º%d\r\n",mem_get_free_size(EN_SRAM_IN));
//	xx = (char *)mem_malloc(1024,EN_SRAM_IN);
//    uart1.printf("2£º%d\r\n",mem_get_free_size(EN_SRAM_IN));
//	xx = (char *)mem_malloc(1024,EN_SRAM_IN);
//    uart1.printf("2£º%d\r\n",mem_get_free_size(EN_SRAM_IN));

    PB8.mode(OUTPUT_PP);
	struct record fields[2]={
		{"zip",37.7668,-1.223959e+2,"","SAN FRANCISCO","CA","94107","US"},
		{"zip",37.371991,-1.22026e+2,"","SUNNYVALE","CA","94085","US"}};
	cJSON *root,*fmt,*img,*thm,*fld;char *out;int i;	/* declare a few. */

	root=cJSON_CreateArray();
	for (i=0;i<2;i++)
	{
		cJSON_AddItemToArray(root,fld=cJSON_CreateObject());
		cJSON_AddStringToObject(fld, "precision", fields[i].precision);
		cJSON_AddNumberToObject(fld, "Latitude", fields[i].lat);
		cJSON_AddNumberToObject(fld, "Longitude", fields[i].lon);
		cJSON_AddStringToObject(fld, "Address", fields[i].address);
		cJSON_AddStringToObject(fld, "City", fields[i].city);
		cJSON_AddStringToObject(fld, "State", fields[i].state);
		cJSON_AddStringToObject(fld, "Zip", fields[i].zip);
		cJSON_AddStringToObject(fld, "Country", fields[i].country);
	}
	
/*	cJSON_ReplaceItemInObject(cJSON_GetArrayItem(root,1),"City",cJSON_CreateIntArray(ids,4)); */
    uart1.printf("j:%d\r\n",ebox_get_free());
//	out = (char *)cjson_malloc(1000);
	out=cJSON_Print(root);	
    cJSON_Delete(root);	
    uart1.printf("%s\n",out);	
    uart1.printf("j:%d\r\n",ebox_get_free());
    ebox_free(out);
    uart1.printf("j:%d\r\n",ebox_get_free());
	
	for(;;)
	{
        uart1.printf_length("123456789\r\n",11);
        delay_ms(500);
    uart1.printf("j:%d\r\n",ebox_get_free());
	}
}
Ejemplo n.º 16
0
void setup()
{
	ebox_init();
	
	uart1.begin(9600);
	uart1.printf("\r\nuart1 9600 ok!");
    uart1.printf("\r\ncpu:%d",cpu_calculate_per_sec);
    PB8.mode(OUTPUT_PP);
	os_init();
	os_task_create(task_1,&TASK_1_STK[TASK_1_STK_SIZE-1],TASK1_PRIO);
	os_task_create(task_2,&TASK_2_STK[TASK_2_STK_SIZE-1],TASK2_PRIO);
	os_task_create(task_3,&TASK_3_STK[TASK_3_STK_SIZE-1],TASK3_PRIO);
	
	os_start();

}
Ejemplo n.º 17
0
void setup()
{
    ebox_init();
    uart1.begin(115200);
    uart1.printf("core:%d\r\n",cpu.clock.core);
    uart1.printf("hclk:%d\r\n",cpu.clock.hclk);
    uart1.printf("pclk1:%d\r\n",cpu.clock.pclk1);
    uart1.printf("pclk2:%d\r\n",cpu.clock.pclk2);

    ic0.begin(1);//初始化输入捕获参数,p分频
    ic0.attach(measure_0);//绑定捕获中断事件函数
    uart1.printf("timer source:%d\r\n",ic0.get_timer_source_clock());
    uart1.printf("max frq:%d\r\n",ic0.get_detect_max_frq());
    
    frq = 10000;
    pwm1.begin(frq, 500);

}
Ejemplo n.º 18
0
void setup()
{
    u8 ret;
    ebox_init();
    uart1.begin(115200);
    ret = sd.begin(3);
    if(ret == 0)
        uart1.printf("sdcard init ok!\r\n");
    else
        uart1.printf("sdcard init failed;err = %d\r\n",ret);
        
    attach_sd_to_fat(&sd);

    res = f_mount(&fs, "0", 1);
    if(res == FR_OK)
        uart1.printf("mount ok!\r\n", res);
    else
        uart1.printf("mount err!err = %d\r\n", res);

}
Ejemplo n.º 19
0
void setup()
{
    ebox_init();
    uart1.begin(115200);
    uart1.printf("core:%d\r\n",cpu.clock.core);
    uart1.printf("core:%d\r\n",cpu.clock.core);
    uart1.printf("hclk:%d\r\n",cpu.clock.hclk);
    uart1.printf("pclk1:%d\r\n",cpu.clock.pclk1);
    uart1.printf("pclk2:%d\r\n",cpu.clock.pclk2);
    
    pwm1.begin(1000, 900);
    pwm1.set_oc_polarity(1);
    pwm2.begin(1000, 800);
    pwm2.set_oc_polarity(1);

    
    uart1.printf("max frq = %dKhz\r\n",pwm1.get_max_frq()/1000);
    uart1.printf("max frq = %f\r\n",pwm1.get_accuracy());
    uart1.printf("max frq = %dKhz\r\n",pwm2.get_max_frq()/1000);
    uart1.printf("max frq = %f\r\n",pwm2.get_accuracy());
    PB9.mode(OUTPUT_PP);
}
Ejemplo n.º 20
0
void setup()
{
    ebox_init();
    PB8.mode(OUTPUT_PP);
    lcd.begin(1);
    lcd.clear(RED);
    uart1.begin(9600);
    
    lcd.column_order(1);
    lcd.row_order(1);

    lcd.front_color = RED;
    lcd.back_color = BLACK;
    hsv.s = 1;
    hsv.v = 0.5;
    hsv.h = 0;

    lcd.front_color = RED;
    if(index >= 0x50)index = 0x20;
    for(int i = 0; i < 160; i++){
        hsv.h = i*36/16;
        hsv.h %= 360;
        HSV_to_RGB(hsv,rgb);
        rgb_to_565(rgb,_color[i]);
       lcd.front_color = _color[i];
       lcd.draw_h_line(0,i,128);
    }
    lcd.disp_char8x16(0,0,index++);
    
    lcd.printf(2,2,"1231asddfgdsfgthkfhddddj2nhd");
    

    lcd.front_color = GREEN;
    lcd.draw_circle(50,50,50);
    lcd.draw_line(64,50,r,100);
    

}
Ejemplo n.º 21
0
void setup()
{
	ebox_init();
	PB8.mode(OUTPUT_PP);
}
Ejemplo n.º 22
0
void setup()
{
    ebox_init();
    oled.begin();
}
Ejemplo n.º 23
0
void setup()
{
    ebox_init();
    uart1.begin(9600);
    PB1.mode(AIN);
}
Ejemplo n.º 24
0
void setup()
{
	ebox_init();
	uart3.begin(9600);
	uart3.attach_rx_interrupt(test);
}
Ejemplo n.º 25
0
void setup()
{
	ebox_init();
	uart3.begin(9600);
	flash.begin(1);
}
Ejemplo n.º 26
0
void setup()
{
    ebox_init();

}
Ejemplo n.º 27
0
void setup(){
	ebox_init();
	ltc1.begin(1);
	uart1.begin(115200);	
}