Commit 820be504 authored by Andreas Werner's avatar Andreas Werner
Browse files

fix muxing and add gpio with blinki example

parent ab400818
......@@ -49,14 +49,20 @@ CONFIG_MACH_HEAP_SIZE=100
#
# Clock Configuation
#
# CONFIG_MACH_C28X_CLOCK_LOPCP_BY_4 is not set
CONFIG_MACH_C28X_CLOCK_LOPCP_BY_1=y
CONFIG_MACH_C28X_CLOCK_LOPCP_BY_4=y
# CONFIG_MACH_C28X_CLOCK_LOPCP_BY_1 is not set
# CONFIG_MACH_C28X_CLOCK_LOPCP_BY_2 is not set
CONFIG_MACH_C28X_OSCILLATOR_SPEED=20000000
CONFIG_MACH_C28X_PLL_MULL=18
# CONFIG_MACH_C28X_PLL_DIV_BY_1 is not set
# CONFIG_MACH_C28X_PLL_DIV_BY_2 is not set
CONFIG_MACH_C28X_PLL_DIV_BY_4=y
#
# GPIO Subsystem
#
CONFIG_MACH_C28x_GPIO=y
CONFIG_MACH_C28X_GPIO_PINS=2
CONFIG_MACH_C28X_RAM_DMA_OFF=y
# CONFIG_MACH_C28X_RAM_DMA_4 is not set
# CONFIG_MACH_C28X_RAM_DMA_1 is not set
......@@ -83,6 +89,8 @@ CONFIG_MACH_C28X_CPU_TIMER2=y
CONFIG_USE_STATIC=y
# CONFIG_GEN_VERSION is not set
# CONFIG_GCC is not set
CONFIG_GPIO=y
# CONFIG_GPIO_MULTI is not set
CONFIG_UART=y
CONFIG_UART_GENERIC_STRING=y
CONFIG_UART_GENERIC_BYTE=y
......
Subproject commit c51e7d67891bd3dd0f50341b5c0a971878435b28
Subproject commit f67ad20d2dd668c333ef7e18a53b45e5877ad3f1
......@@ -13,6 +13,8 @@
#include <devs.h>
#include <irq.h>
# define PRINTF(...) printf(__VA_ARGS__)
#include <gpio.h>
#include <iomux.h>
void vApplicationMallocFailedHook( void ) {
CONFIG_ASSERT(0);
......@@ -44,7 +46,22 @@ int stdio_dread(int dev_fd, char *buf, unsigned count) {
}
int stdio_dwrite(int dev_fd, const char *buf, unsigned count) {
return uart_write(stdio, buf, count, portMAX_DELAY);
int32_t ret;
int i = 0;
for (i = 0; i < count; i++) {
if (*buf == '\n') {
ret = uart_putc(stdio, '\r', portMAX_DELAY);
if (ret < 0) {
return -1;
}
}
ret = uart_putc(stdio, *buf, portMAX_DELAY);
if (ret < 0) {
return -1;
}
buf++;
}
return i;
}
off_t stdio_dlseek(int dev_fd, off_t offset, int origin) {
return 0;
......@@ -57,11 +74,20 @@ int stdio_drename(const char *old_name, const char *new_name) {
}
void testTask(void *data) {
struct gpio *gpio = gpio_init(GPIO_ID);
int i = 0;
struct gpio_pin *red = gpioPin_init(gpio, GPIO_50, GPIO_OUTPUT, GPIO_PULL_UP);
struct gpio_pin *green = gpioPin_init(gpio, GPIO_29, GPIO_OUTPUT, GPIO_PULL_UP);
CONFIG_ASSERT(red);
CONFIG_ASSERT(green);
gpioPin_setPin(red);
gpioPin_clearPin(green);
TickType_t pxPreviousWakeTime = xTaskGetTickCount();
for (;;) {
gpioPin_togglePin(red);
gpioPin_togglePin(green);
PRINTF("%d %lu\n", i++, pxPreviousWakeTime);
vTaskDelayUntil(&pxPreviousWakeTime, 100 / portTICK_PERIOD_MS);
vTaskDelayUntil(&pxPreviousWakeTime, 1000 / portTICK_PERIOD_MS);
}
}
......@@ -93,6 +119,5 @@ int main() {
PRINTF("Start Scheduler\n");
vTaskStartScheduler ();
for(;;);
return 0;
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment