Skip to content

Commit

Permalink
Remove VS projects - move to CMakeLists instead
Browse files Browse the repository at this point in the history
  • Loading branch information
MaJerle committed Jul 31, 2022
1 parent 364acea commit da8e2bc
Show file tree
Hide file tree
Showing 110 changed files with 1,843 additions and 3,056 deletions.
10 changes: 10 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,15 @@
"CMAKE_BUILD_TYPE": "Debug"
}
}
],
"buildPresets": [
{
"name": "Win32-Debug",
"configurePreset": "Win32-Debug"
},
{
"name": "Win64-Debug",
"configurePreset": "Win64-Debug"
}
]
}
1 change: 1 addition & 0 deletions dev/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include "lwesp/lwesp.h"
#include "lwesp/apps/lwesp_mqtt_client_api.h"
#include "lwesp/apps/lwesp_cayenne.h"
#include "examples_common_lwesp_callback_func.h"

#include "mqtt_client.h"
#include "mqtt_client_api.h"
Expand Down
41 changes: 4 additions & 37 deletions examples/posix/sntp_rtos/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@
#include "lwesp/lwesp.h"
#include "station_manager.h"
#include "sntp.h"

static lwespr_t lwesp_callback_func(lwesp_evt_t* evt);
#include "examples_common_lwesp_callback_func.h"

/**
* \brief Program entry point
Expand All @@ -44,7 +43,7 @@ int
main(void) {
printf("Starting ESP application!\r\n");

/* Initialize ESP with default callback function */
/* Initialize ESP with common callback for all examples */
printf("Initializing LwESP\r\n");
if (lwesp_init(lwesp_callback_func, 1) != lwespOK) {
printf("Cannot initialize LwESP!\r\n");
Expand All @@ -55,10 +54,10 @@ main(void) {
/*
* Connect to access point.
*
* Try unlimited time until access point accepts up.
* Try unlimited time until access point accepts us.
* Check for station_manager.c to define preferred access points ESP should connect to
*/
connect_to_preferred_access_point(1);
station_manager_connect_to_preferred_access_point(1);

/* Start SNTP */
sntp_gettime();
Expand All @@ -70,35 +69,3 @@ main(void) {

return 0;
}

/**
* \brief Event callback function for ESP stack
* \param[in] evt: Event information with data
* \return \ref lwespOK on success, member of \ref lwespr_t otherwise
*/
static lwespr_t
lwesp_callback_func(lwesp_evt_t* evt) {
switch (lwesp_evt_get_type(evt)) {
case LWESP_EVT_AT_VERSION_NOT_SUPPORTED: {
lwesp_sw_version_t v_min, v_curr;

lwesp_get_min_at_fw_version(&v_min);
lwesp_get_current_at_fw_version(&v_curr);

printf("Current ESP8266 AT version is not supported by library!\r\n");
printf("Minimum required AT version is: %d.%d.%d\r\n", (int)v_min.major, (int)v_min.minor, (int)v_min.patch);
printf("Current AT version is: %d.%d.%d\r\n", (int)v_curr.major, (int)v_curr.minor, (int)v_curr.patch);
break;
}
case LWESP_EVT_INIT_FINISH: {
printf("Library initialized!\r\n");
break;
}
case LWESP_EVT_RESET_DETECTED: {
printf("Device reset detected!\r\n");
break;
}
default: break;
}
return lwespOK;
}
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ set(src_lwesp_ll_SRCS
${PROJ_PATH}/../../../lwesp/src/system/lwesp_sys_cmsis_os.c)

set(src_lwesp_snippets_SRCS
${PROJ_PATH}/../../../snippets/examples_common_lwesp_callback_func.c
${PROJ_PATH}/../../../snippets/mqtt_client_api_cayenne.c
${PROJ_PATH}/../../../snippets/station_manager.c
${PROJ_PATH}/../../../snippets/utils.c)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,11 @@
<type>1</type>
<locationURI>PARENT-4-PROJECT_LOC/lwesp/src/system/lwesp_sys_cmsis_os.c</locationURI>
</link>
<link>
<name>lwesp_snippets/examples_common_lwesp_callback_func.c</name>
<type>1</type>
<locationURI>PARENT-4-PROJECT_LOC/snippets/examples_common_lwesp_callback_func.c</locationURI>
</link>
<link>
<name>lwesp_snippets/mqtt_client_api_cayenne.c</name>
<type>1</type>
Expand Down
43 changes: 5 additions & 38 deletions examples/stm32/mqtt_client_api_rtos_stm32f429zi_nucleo/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,14 @@
#include "lwesp/lwesp.h"
#include "station_manager.h"
#include "mqtt_client_api.h"
#include "examples_common_lwesp_callback_func.h"

static void LL_Init(void);
void SystemClock_Config(void);
static void USART_Printf_Init(void);

static void init_thread(void* arg);

static lwespr_t lwesp_callback_func(lwesp_evt_t* evt);

/**
* \brief Program entry point
*/
Expand Down Expand Up @@ -72,9 +71,9 @@ main(void) {
*/
static void
init_thread(void* arg) {
/* Initialize ESP with default callback function */
/* Initialize ESP with common callback for all examples */
printf("Initializing LwESP\r\n");
if (lwesp_init(lwesp_callback_func, 1) != lwespOK) {
if (lwesp_init(examples_common_lwesp_callback_func, 1) != lwespOK) {
printf("Cannot initialize LwESP!\r\n");
} else {
printf("LwESP initialized!\r\n");
Expand All @@ -83,48 +82,16 @@ init_thread(void* arg) {
/*
* Connect to access point.
*
* Try unlimited time until access point accepts up.
* Try unlimited time until access point accepts us.
* Check for station_manager.c to define preferred access points ESP should connect to
*/
connect_to_preferred_access_point(1);
station_manager_connect_to_preferred_access_point(1);

/* Create a MQTT API thread */
lwesp_sys_thread_create(NULL, "netconn_client", (lwesp_sys_thread_fn)mqtt_client_api_cayenne_thread, NULL, LWESP_SYS_THREAD_SS, LWESP_SYS_THREAD_PRIO);
osThreadExit();
}

/**
* \brief Event callback function for ESP stack
* \param[in] evt: Event information with data
* \return \ref lwespOK on success, member of \ref lwespr_t otherwise
*/
static lwespr_t
lwesp_callback_func(lwesp_evt_t* evt) {
switch (lwesp_evt_get_type(evt)) {
case LWESP_EVT_AT_VERSION_NOT_SUPPORTED: {
lwesp_sw_version_t v_min, v_curr;

lwesp_get_min_at_fw_version(&v_min);
lwesp_get_current_at_fw_version(&v_curr);

printf("Current ESP8266 AT version is not supported by library!\r\n");
printf("Minimum required AT version is: %d.%d.%d\r\n", (int)v_min.major, (int)v_min.minor, (int)v_min.patch);
printf("Current AT version is: %d.%d.%d\r\n", (int)v_curr.major, (int)v_curr.minor, (int)v_curr.patch);
break;
}
case LWESP_EVT_INIT_FINISH: {
printf("Library initialized!\r\n");
break;
}
case LWESP_EVT_RESET_DETECTED: {
printf("Device reset detected!\r\n");
break;
}
default: break;
}
return lwespOK;
}

/**
* \brief Low-Layer initialization
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ set(src_lwesp_ll_SRCS
${PROJ_PATH}/../../../lwesp/src/system/lwesp_sys_cmsis_os.c)

set(src_lwesp_snippets_SRCS
${PROJ_PATH}/../../../snippets/examples_common_lwesp_callback_func.c
${PROJ_PATH}/../../../snippets/netconn_client.c
${PROJ_PATH}/../../../snippets/station_manager.c
${PROJ_PATH}/../../../snippets/utils.c)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,11 @@
<type>1</type>
<locationURI>PARENT-4-PROJECT_LOC/lwesp/src/system/lwesp_sys_cmsis_os.c</locationURI>
</link>
<link>
<name>lwesp_snippets/examples_common_lwesp_callback_func.c</name>
<type>1</type>
<locationURI>PARENT-4-PROJECT_LOC/snippets/examples_common_lwesp_callback_func.c</locationURI>
</link>
<link>
<name>lwesp_snippets/netconn_client.c</name>
<type>1</type>
Expand Down
49 changes: 5 additions & 44 deletions examples/stm32/netconn_client_rtos_stm32l496g_discovery/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,14 @@
#include "lwesp/lwesp.h"
#include "station_manager.h"
#include "netconn_client.h"
#include "examples_common_lwesp_callback_func.h"

static void LL_Init(void);
void SystemClock_Config(void);
static void USART_Printf_Init(void);

static void init_thread(void* arg);

static lwespr_t lwesp_callback_func(lwesp_evt_t* evt);

/**
* \brief Program entry point
*/
Expand Down Expand Up @@ -72,9 +71,9 @@ main(void) {
*/
static void
init_thread(void* arg) {
/* Initialize ESP with default callback function */
/* Initialize ESP with common callback for all examples */
printf("Initializing LwESP\r\n");
if (lwesp_init(lwesp_callback_func, 1) != lwespOK) {
if (lwesp_init(examples_common_lwesp_callback_func, 1) != lwespOK) {
printf("Cannot initialize LwESP!\r\n");
} else {
printf("LwESP initialized!\r\n");
Expand All @@ -89,53 +88,15 @@ init_thread(void* arg) {
/*
* Connect to access point.
*
* Try unlimited time until access point accepts up.
* Try unlimited time until access point accepts us.
* Check for station_manager.c to define preferred access points ESP should connect to
*/
connect_to_preferred_access_point(1);
station_manager_connect_to_preferred_access_point(1);
}
osDelay(1000);
}
}

/**
* \brief Event callback function for ESP stack
* \param[in] evt: Event information with data
* \return \ref lwespOK on success, member of \ref lwespr_t otherwise
*/
static lwespr_t
lwesp_callback_func(lwesp_evt_t* evt) {
switch (lwesp_evt_get_type(evt)) {
case LWESP_EVT_AT_VERSION_NOT_SUPPORTED: {
lwesp_sw_version_t v_min, v_curr;

lwesp_get_min_at_fw_version(&v_min);
lwesp_get_current_at_fw_version(&v_curr);

printf("Current ESP8266 AT version is not supported by library!\r\n");
printf("Minimum required AT version is: %d.%d.%d\r\n", (int)v_min.major, (int)v_min.minor, (int)v_min.patch);
printf("Current AT version is: %d.%d.%d\r\n", (int)v_curr.major, (int)v_curr.minor, (int)v_curr.patch);
break;
}
case LWESP_EVT_INIT_FINISH: {
printf("Library initialized!\r\n");
break;
}
case LWESP_EVT_RESET_DETECTED: {
printf("Device reset detected!\r\n");
break;
}
case LWESP_EVT_WIFI_IP_ACQUIRED: { /* We have IP address and we are fully ready to work */
if (lwesp_sta_is_joined()) { /* Check if joined on any network */
lwesp_sys_thread_create(NULL, "netconn_client", (lwesp_sys_thread_fn)netconn_client_thread, NULL, 512, LWESP_SYS_THREAD_PRIO);
}
break;
}
default: break;
}
return lwespOK;
}

/**
* \brief Low-Layer initialization
*/
Expand Down
13 changes: 13 additions & 0 deletions examples/win32/access_point_rtos/.vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"version": 4,
"configurations": [
{
"name": "Win32",
"compilerPath": "c:\\msys64\\mingw64\\bin\\gcc.exe",
"cStandard": "gnu17",
"cppStandard": "gnu++14",
"intelliSenseMode": "windows-gcc-x86",
"configurationProvider": "ms-vscode.cmake-tools"
}
]
}
7 changes: 7 additions & 0 deletions examples/win32/access_point_rtos/.vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"recommendations": [
"ms-vscode.cpptools",
"ms-vscode.cmake-tools",
"twxs.cmake",
]
}
19 changes: 19 additions & 0 deletions examples/win32/access_point_rtos/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "(Windows) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${command:cmake.launchTargetPath}",
"miDebuggerPath": "c:\\msys64\\mingw64\\bin\\gdb.exe",
"args": [],
"stopAtEntry": false,
"cwd": "${fileDirname}",
"environment": []
}
]
}
13 changes: 13 additions & 0 deletions examples/win32/access_point_rtos/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"files.associations": {
"lwevt_types.h": "c",
"lwevt_type.h": "c",
"lwevt.h": "c",
"string.h": "c",
"lwevt_opt.h": "c",
"cli.h": "c",
"windows.h": "c",
"lwesp_private.h": "c"
},
"esbonio.sphinx.confDir": ""
}

0 comments on commit da8e2bc

Please sign in to comment.