zephyr/samples/basic/disco/src/main.c
David B. Kinder ac74d8b652 license: Replace Apache boilerplate with SPDX tag
Replace the existing Apache 2.0 boilerplate header with an SPDX tag
throughout the zephyr code tree. This patch was generated via a
script run over the master branch.

Also updated doc/porting/application.rst that had a dependency on
line numbers in a literal include.

Manually updated subsys/logging/sys_log.c that had a malformed
header in the original file.  Also cleanup several cases that already
had a SPDX tag and we either got a duplicate or missed updating.

Jira: ZEP-1457

Change-Id: I6131a1d4ee0e58f5b938300c2d2fc77d2e69572c
Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-01-19 03:50:58 +00:00

42 lines
708 B
C

/*
* Copyright (c) 2016 Open-RnD Sp. z o.o.
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <zephyr.h>
#include <device.h>
#include <gpio.h>
/**
* the demo assumes use of nucleo_f103rb board, adjust defines below
* to fit your board
*/
/* we're going to use PB8 and PB5 */
#define PORT "GPIOB"
/* PB5 */
#define LED1 5
/* PB8 */
#define LED2 8
#define SLEEP_TIME 500
void main(void)
{
int cnt = 0;
struct device *gpiob;
gpiob = device_get_binding(PORT);
gpio_pin_configure(gpiob, LED1, GPIO_DIR_OUT);
gpio_pin_configure(gpiob, LED2, GPIO_DIR_OUT);
while (1) {
gpio_pin_write(gpiob, LED1, cnt % 2);
gpio_pin_write(gpiob, LED2, (cnt + 1) % 2);
k_sleep(SLEEP_TIME);
cnt++;
}
}