Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "mem.h"
- #include "osapi.h"
- #include "os_type.h"
- #include "user_interface.h"
- os_event_t *queue;
- void get_status(os_event_t *e);
- ICACHE_FLASH_ATTR void my_init_done_cb() {
- struct station_config conf;
- strcpy(conf.ssid, "DeiWolke");
- strcpy(conf.password, "DeiWolke");
- //strcpy(conf.ssid, "TehCloud");
- //conf.password[0] = '\0';
- conf.bssid_set = 0;
- ETS_UART_INTR_DISABLE();
- wifi_station_set_config(&conf);
- wifi_station_connect();
- ETS_UART_INTR_ENABLE();
- wifi_station_dhcpc_start();
- queue = (os_event_t*) os_malloc(sizeof(os_event_t) * 5);
- system_os_task(get_status, 0, queue, 5);
- system_os_post(0, 0, 0);
- }
- int x = 0;
- ICACHE_FLASH_ATTR void get_status(os_event_t *e) {
- x++;
- if (x % 100 == 0) {
- int status = wifi_station_get_connect_status();
- int32 free = system_get_free_heap_size();
- os_printf("wifi status: %d %u\n", status, free);
- }
- os_delay_us(10000);
- system_os_post(0, 0, 0);
- }
- ICACHE_FLASH_ATTR void user_init() {
- wifi_set_opmode(STATION_MODE);
- wifi_station_set_auto_connect(FALSE);
- uart_div_modify(0, UART_CLK_FREQ / 115200);
- system_init_done_cb(my_init_done_cb);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement