Skip to content

Commit a6c183d

Browse files
committed
vf6xx: merge gpio/uart examples
The plain "uart" example was just a slightly less featured version. Compile tested only!
1 parent 1123768 commit a6c183d

File tree

4 files changed

+9
-104
lines changed

4 files changed

+9
-104
lines changed

examples/vf6xx/colibri-vf61/gpio/Makefile renamed to examples/vf6xx/colibri-vf61/uart-gpio/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
## along with this library. If not, see <http://www.gnu.org/licenses/>.
1919
##
2020

21-
BINARY = gpio
21+
BINARY = uart-gpio
2222

2323
LDSCRIPT = ../colibri-vf61.ld
2424

examples/vf6xx/colibri-vf61/gpio/gpio.c renamed to examples/vf6xx/colibri-vf61/uart-gpio/uart-gpio.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ static const uint32_t gpio_in = IOMUXC_PAD(MUX_MODE_ALT0, SPEED_LOW, \
3434
DSE_150OHM, PUS_PU_100KOHM, IOMUXC_IBE);
3535

3636
int _write(int file, char *ptr, int len);
37-
void sys_tick_handler(void);
3837

3938
int _write(int file, char *ptr, int len)
4039
{
@@ -50,7 +49,7 @@ int _write(int file, char *ptr, int len)
5049
return -1;
5150
}
5251

53-
static void uart_init()
52+
static void uart_init(void)
5453
{
5554
ccm_clock_gate_enable(CG9_UART2);
5655
uart_enable(UART2);
@@ -61,6 +60,8 @@ int main(void)
6160
{
6261
int old_state = -1;
6362
int new_state = 0;
63+
int i = 0;
64+
float f = 0.0f;
6465

6566

6667
/* Init Clock Control and UART */
@@ -79,14 +80,17 @@ int main(void)
7980
/*
8081
* Read input GPIO in a loop and print changes
8182
* A jumper between PTC3<=> PTC2 can be used to set PTC2 to high
83+
* print integer and floating point counters as well, just for fun.
8284
*/
8385
while (1) {
8486
new_state = gpio_get(PTC2);
8587
if (old_state != new_state) {
86-
printf("GPIO %d is %s\r\n", PTC2,
87-
new_state ? "high" : "low");
88+
printf("loop: %d (step: %f) GPIO %d is %s\r\n",
89+
i, f, PTC2, new_state ? "high" : "low");
8890
old_state = new_state;
8991
}
92+
i++;
93+
f += 0.01;
9094
}
9195

9296

examples/vf6xx/colibri-vf61/uart/Makefile

Lines changed: 0 additions & 26 deletions
This file was deleted.

examples/vf6xx/colibri-vf61/uart/uart.c

Lines changed: 0 additions & 73 deletions
This file was deleted.

0 commit comments

Comments
 (0)