Skip to content

Instantly share code, notes, and snippets.

/app_main.c Secret

Created September 14, 2016 08:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/c6c76cd25e780950b0240766ee9a0de0 to your computer and use it in GitHub Desktop.
Save anonymous/c6c76cd25e780950b0240766ee9a0de0 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include "common/platform.h"
#include "fw/src/sj_app.h"
#include "fw/src/sj_gpio.h"
#include "fw/src/sj_sys_config.h"
#include "app_task.h"
#if CS_PLATFORM == CS_P_ESP_LWIP
#define GPIO 12
#elif CS_PLATFORM == CS_P_CC3200
#define GPIO 64 /* The red LED on LAUNCHXL */
#else
#error Unknown platform
#endif
OsiMsgQ_t *app_queue;
enum mg_app_init_result sj_app_init(void) {
{ /* Print a message using a value from config. */
printf("Hello, %s!\n", get_cfg()->hello.who);
}
{ /* Turn on LED. */
sj_gpio_set_mode(GPIO, GPIO_MODE_OUTPUT, GPIO_PULL_FLOAT);
sj_gpio_write(GPIO, GPIO_LEVEL_LOW);
}
app_queue = apptask_start();
if (app_queue == NULL) {
LOG(LL_ERROR, ("unable to spawn app_task"));
while (1);
}
apptask_msg();
return MG_APP_INIT_SUCCESS;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment