-
Notifications
You must be signed in to change notification settings - Fork 127
/
Copy pathuser_main.c
45 lines (37 loc) · 1.04 KB
/
user_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
36
37
38
39
40
41
42
43
44
45
#include "ets_sys.h"
#include "osapi.h"
#include "gpio.h"
#include "os_type.h"
#include "user_config.h"
#include "user_interface.h"
#define user_procTaskPrio 0
#define user_procTaskQueueLen 1
os_event_t user_procTaskQueue[user_procTaskQueueLen];
static void loop(os_event_t *events);
// Required by SDK_v1.1.0
void user_rf_pre_init (void){}
//Main code function
static void ICACHE_FLASH_ATTR
loop(os_event_t *events)
{
os_printf("Hello\n\r");
os_delay_us(10000);
system_os_post(user_procTaskPrio, 0, 0 );
}
//Init function
void ICACHE_FLASH_ATTR
user_init()
{
char ssid[32] = SSID;
char password[64] = SSID_PASSWORD;
struct station_config stationConf;
//Set station mode
wifi_set_opmode( 0x1 );
//Set ap settings
os_memcpy(&stationConf.ssid, ssid, 32);
os_memcpy(&stationConf.password, password, 64);
wifi_station_set_config(&stationConf);
//Start os task
system_os_task(loop, user_procTaskPrio,user_procTaskQueue, user_procTaskQueueLen);
system_os_post(user_procTaskPrio, 0, 0 );
}