/* * Copyright (c) 2016 Intel Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include #include #include #include /* Change this if you have an LED connected to a custom port */ #define PORT LED0_GPIO_PORT /* Change this if you have an LED connected to a custom pin */ #define LED LED0_GPIO_PIN /* 1000 msec = 1 sec */ #define SLEEP_TIME 1000 void main(void) { int cnt = 0; struct device *dev; dev = device_get_binding(PORT); /* Set LED pin as output */ gpio_pin_configure(dev, LED, GPIO_DIR_OUT); while (1) { /* Set pin to HIGH/LOW every 1 second */ gpio_pin_write(dev, LED, cnt % 2); cnt++; k_sleep(SLEEP_TIME); } }