osd-contiki/platform/stm32f107_basic/contiki-main.c
Jeff Ciesielski 222f93f023 stm32f107_basic: Add support for a simple stm32f107 platform
This platform is a basic waveshare stm32f107 devkit which contains a
USART, USB device port, some buttons and some LEDs.  Unfortunately not
enough to bring up networking, but enough to test building and a
simple contiki shell
2013-02-06 15:43:25 -08:00

45 lines
897 B
C

#include <stdint.h>
#include <stdio.h>
#include <debug-uart.h>
#include <sys/process.h>
#include <sys/procinit.h>
#include <etimer.h>
#include <sys/autostart.h>
#include <clock.h>
#include <libopencm3/stm32/f1/rcc.h>
unsigned int idle_count = 0;
static void
configure_mcu_clocks(void)
{
rcc_clock_setup_in_hse_25mhz_out_72mhz();
/* GPIO Clocks */
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPAEN);
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_AFIOEN);
/* USART 1 */
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_USART1EN);
}
int
main()
{
configure_mcu_clocks();
uart_init(115200);
printf("Initialising\n");
clock_init();
process_init();
process_start(&etimer_process, NULL);
autostart_start(autostart_processes);
printf("Processes running\n");
while(1) {
do {
} while(process_run() > 0);
idle_count++;
}
return 0;
}