intro/blinky/main.c

/*******************************************************************************
* # License
* Copyright 2019 Silicon Laboratories Inc. www.silabs.com
*******************************************************************************
*
* The licensor of this software is Silicon Laboratories Inc. Your use of this
* software is governed by the terms of Silicon Labs Master Software License
* Agreement (MSLA) available at
* www.silabs.com/about-us/legal/master-software-license-agreement. This
* software is distributed to you in Source Code format and is governed by the
* sections of the MSLA applicable to Source Code.
*
******************************************************************************/
/*
* Documentation for this app is available online.
* See https://docs.silabs.com/gecko-os/4/standard/latest/sdk/examples/intro/blinky
*/
#include "gos.h"
#define BLINK_PERIOD_MS 500
#define APPLICATION_START_LINE "\r\n\r\nStarting LED Blinking App"
static bool toggle;
/*************************************************************************************************/
void gos_app_init(void)
{
GOS_LOG(APPLICATION_START_LINE);
#ifdef PLATFORM_LED2
#endif
gos_event_register_periodic(blink_event_handler, NULL, BLINK_PERIOD_MS, GOS_EVENT_FLAG_NONE);
}
/*************************************************************************************************/
static void blink_event_handler(void *arg)
{
gos_gpio_set(PLATFORM_LED1, toggle);
#ifdef PLATFORM_LED2
gos_gpio_set(PLATFORM_LED2, !toggle);
#endif
toggle = !toggle;
}