Corrected led io for lisa/m v1.1 cleaned up some whitespace. Trying to get it to work...

This commit is contained in:
Piotr Esden-Tempski
2011-10-04 23:53:16 -07:00
parent 03a4a18ed6
commit 9e4522ad21

View File

@@ -2,6 +2,7 @@
* This file is part of the libopencm3 project. * This file is part of the libopencm3 project.
* *
* Copyright (C) 2010 Gareth McMullin <gareth@blacksphere.co.nz> * Copyright (C) 2010 Gareth McMullin <gareth@blacksphere.co.nz>
* Copyright (C) 2011 Piotr Esden-Tempski <piotr@esden.net>
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -238,6 +239,7 @@ static void hid_set_config(u16 wValue)
int main(void) int main(void)
{ {
int usb_connect_blink = 0;
rcc_clock_setup_in_hsi_out_48mhz(); rcc_clock_setup_in_hsi_out_48mhz();
@@ -254,23 +256,25 @@ int main(void)
GPIO_CNF_OUTPUT_PUSHPULL, GPIO15); GPIO_CNF_OUTPUT_PUSHPULL, GPIO15);
/* green LED off, as output */ /* green LED off, as output */
gpio_clear(GPIOC, GPIO13); gpio_set(GPIOC, GPIO2);
gpio_set_mode(GPIOC, GPIO_MODE_OUTPUT_2_MHZ, gpio_set_mode(GPIOC, GPIO_MODE_OUTPUT_2_MHZ,
GPIO_CNF_OUTPUT_PUSHPULL, GPIO13); GPIO_CNF_OUTPUT_PUSHPULL, GPIO2);
usbd_init(&stm32f103_usb_driver, &dev, &config, usb_strings); usbd_init(&stm32f107_usb_driver, &dev, &config, usb_strings);
usbd_register_set_config_callback(hid_set_config); usbd_register_set_config_callback(hid_set_config);
/* delay some seconds to show that pull-up switch works */ /* delay some seconds to show that pull-up switch works */
{int i; for (i=0;i<0x800000;i++);} {int i; for (i=0;i<0x800000;i++) asm("nop");}
/* wait for USB Vbus */ /* wait for USB Vbus */
while(gpio_get(GPIOA, GPIO8) == 0); while(gpio_get(GPIOA, GPIO8) == 0) asm("nop");
/* green LED on, connect USB */ /* green LED on, connect USB */
gpio_set(GPIOC, GPIO13); gpio_clear(GPIOC, GPIO2);
gpio_clear(GPIOC, GPIO15); gpio_set_mode(GPIOC, GPIO_MODE_INPUT,
GPIO_CNF_INPUT_FLOAT, GPIO15);
//gpio_clear(GPIOC, GPIO15);
while (1) while (1)
usbd_poll(); usbd_poll();