2010-10-16 12:34 PM
Hi, I'm new to the forum and the discovery board. Got it working with the test routines. Is it possible to switch a led, say LED5, connected to PC11, on and off using the routines in STM32_Discovery. If so how do I declare the led port?
Many thanks Alastair2010-10-16 07:40 PM
Hi, I'm new to the forum and the discovery board. Got it working with the test routines. Is it possible to switch a led, say LED5, connected to PC11, on and off using the routines in STM32_Discovery. If so how do I declare the led port?
Enumerate additional GPIO's in STM32vldiscovery.c/h, or just program them directly. void GPIOSetup(void) { GPIO_InitTypeDef GPIO_InitStructure; RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOC, ENABLE); /* Configure the PC.11 pin */ GPIO_InitStructure.GPIO_Pin = GPIO_Pin_11; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_Init(GPIOC, &GPIO_InitStructure); } void GPIOLed(int i) { if (i) GPIOC->BSRR = GPIO_Pin_11; // PC.11 On else GPIOC->BRR = GPIO_Pin_11; // PC.11 Off }
2010-10-18 01:26 AM
Many thanks, that worked a treat. I'd rather try and make use of the already written functions rather than try to rewrite them myself, particularly since I am on a learning curve.
Alastair