add libs
This commit is contained in:
29
lib_gpio/examples/app_gpio_flashing_leds/src/main.xc
Normal file
29
lib_gpio/examples/app_gpio_flashing_leds/src/main.xc
Normal file
@@ -0,0 +1,29 @@
|
||||
// Copyright 2014-2021 XMOS LIMITED.
|
||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||
#include <xs1.h>
|
||||
#include <gpio.h>
|
||||
|
||||
port p_led1 = XS1_PORT_1A;
|
||||
port p_led2 = XS1_PORT_1B;
|
||||
|
||||
void flash_leds(client output_gpio_if led1, client output_gpio_if led2)
|
||||
{
|
||||
while (1) {
|
||||
led1.output(1);
|
||||
led2.output(0);
|
||||
delay_milliseconds(200);
|
||||
led1.output(0);
|
||||
led2.output(1);
|
||||
delay_milliseconds(200);
|
||||
}
|
||||
}
|
||||
|
||||
int main() {
|
||||
interface output_gpio_if i_led1[1], i_led2[1];
|
||||
par {
|
||||
output_gpio(i_led1, 1, p_led1, null);
|
||||
output_gpio(i_led2, 1, p_led2, null);
|
||||
flash_leds(i_led1[0], i_led2[0]);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user