diff --git a/examples/vf6xx/colibri-vf61/gpio/Makefile b/examples/vf6xx/colibri-vf61/uart-gpio/Makefile
similarity index 97%
rename from examples/vf6xx/colibri-vf61/gpio/Makefile
rename to examples/vf6xx/colibri-vf61/uart-gpio/Makefile
index bf6884c..645d751 100644
--- a/examples/vf6xx/colibri-vf61/gpio/Makefile
+++ b/examples/vf6xx/colibri-vf61/uart-gpio/Makefile
@@ -18,7 +18,7 @@
## along with this library. If not, see .
##
-BINARY = gpio
+BINARY = uart-gpio
LDSCRIPT = ../colibri-vf61.ld
diff --git a/examples/vf6xx/colibri-vf61/gpio/gpio.c b/examples/vf6xx/colibri-vf61/uart-gpio/uart-gpio.c
similarity index 90%
rename from examples/vf6xx/colibri-vf61/gpio/gpio.c
rename to examples/vf6xx/colibri-vf61/uart-gpio/uart-gpio.c
index 7cbc933..0199043 100644
--- a/examples/vf6xx/colibri-vf61/gpio/gpio.c
+++ b/examples/vf6xx/colibri-vf61/uart-gpio/uart-gpio.c
@@ -34,7 +34,6 @@ static const uint32_t gpio_in = IOMUXC_PAD(MUX_MODE_ALT0, SPEED_LOW, \
DSE_150OHM, PUS_PU_100KOHM, IOMUXC_IBE);
int _write(int file, char *ptr, int len);
-void sys_tick_handler(void);
int _write(int file, char *ptr, int len)
{
@@ -50,7 +49,7 @@ int _write(int file, char *ptr, int len)
return -1;
}
-static void uart_init()
+static void uart_init(void)
{
ccm_clock_gate_enable(CG9_UART2);
uart_enable(UART2);
@@ -61,6 +60,8 @@ int main(void)
{
int old_state = -1;
int new_state = 0;
+ int i = 0;
+ float f = 0.0f;
/* Init Clock Control and UART */
@@ -79,14 +80,17 @@ int main(void)
/*
* Read input GPIO in a loop and print changes
* A jumper between PTC3<=> PTC2 can be used to set PTC2 to high
+ * print integer and floating point counters as well, just for fun.
*/
while (1) {
new_state = gpio_get(PTC2);
if (old_state != new_state) {
- printf("GPIO %d is %s\r\n", PTC2,
- new_state ? "high" : "low");
+ printf("loop: %d (step: %f) GPIO %d is %s\r\n",
+ i, f, PTC2, new_state ? "high" : "low");
old_state = new_state;
}
+ i++;
+ f += 0.01;
}
diff --git a/examples/vf6xx/colibri-vf61/uart/Makefile b/examples/vf6xx/colibri-vf61/uart/Makefile
deleted file mode 100644
index e104a74..0000000
--- a/examples/vf6xx/colibri-vf61/uart/Makefile
+++ /dev/null
@@ -1,26 +0,0 @@
-##
-## This file is part of the libopencm3 project.
-##
-## Copyright (C) 2009 Uwe Hermann
-## Copyright (C) 2014 Stefan Agner
-##
-## This library is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## This library is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with this library. If not, see .
-##
-
-BINARY = uart
-
-LDSCRIPT = ../colibri-vf61.ld
-
-include ../Makefile.include
-
diff --git a/examples/vf6xx/colibri-vf61/uart/uart.c b/examples/vf6xx/colibri-vf61/uart/uart.c
deleted file mode 100644
index 3f32908..0000000
--- a/examples/vf6xx/colibri-vf61/uart/uart.c
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * This file is part of the libopencm3 project.
- *
- * Copyright (C) 2009 Uwe Hermann
- * Copyright (C) 2014 Stefan Agner
- *
- * This library is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library. If not, see .
- */
-
-#include
-#include
-#include
-#include
-#include
-
-int _write(int file, char *ptr, int len);
-
-int _write(int file, char *ptr, int len)
-{
- int i;
-
- if (file == 1) {
- for (i = 0; i < len; i++)
- uart_send_blocking(UART2, ptr[i]);
- return i;
- }
-
- errno = EIO;
- return -1;
-}
-
-static void uart_init(void)
-{
- ccm_clock_gate_enable(CG9_UART2);
- uart_enable(UART2);
- uart_set_baudrate(UART2, 115200);
-}
-
-int main(void)
-{
- int counter = 0;
- float fcounter = 0.0;
- double dcounter = 0.0;
-
- ccm_calculate_clocks();
- uart_init();
-
- /*
- * Write Hello World an integer, float and double all over
- * again while incrementing the numbers.
- */
- while (1) {
- printf("Hello World! %i %f %f\r\n", counter, fcounter,
- dcounter);
- counter++;
- fcounter += 0.01;
- dcounter += 0.01;
- }
-
- return 0;
-}
-