int main(int argc, char *argv[]) { GPIO_InitTypeDef GPIO_InitStructure; // GPIOC Periph clock enable RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOC, ENABLE); // Configure PC12 to mode: slow rise-time, pushpull output GPIO_InitStructure.GPIO_Pin = GPIO_Pin_12; // GPIO No. 12 GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz; // slow rise time GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; // push-pull output GPIO_Init(GPIOC, &GPIO_InitStructure); // GPIOC init //FLASH_ReadOutProtection_Enable(); // enable ReadOutProtection when running Release code while(1) { GPIOC->BSRR = GPIO_BSRR_BS12; // GPIO PC12 set, pin=high, LED STAT off //GPIO_WriteBit(GPIOC,GPIO_Pin_12,Bit_SET); // GPIO PC12 set, pin=high, LED STAT off DelayByDiv(); // delay --> not much compiler optimizer settings dependent GPIOC->BSRR = GPIO_BSRR_BR12; // GPIO PC12 reset, pin=low, LED STAT on //GPIO_WriteBit(GPIOC,GPIO_Pin_12,Bit_RESET); // GPIO PC12 reset, pin=low, LED STAT on DelayByDiv(); // delay --> not much compiler optimizer settings dependent } }
void BlinkLedOff ( void ) { volatile unsigned int * pioc_addr = ( unsigned int *)0x40011010; unsigned long ulReceivedValue; const unsigned long ulValueToSend = 100UL; while(1) { xQueueReceive( xQueueOff, &ulReceivedValue, portMAX_DELAY ); *pioc_addr = * pioc_addr | 0x20000000; DelayByDiv(); // delay --> not much compiler optimizer settings dependent xQueueSend( xQueueOn, &ulValueToSend, 0 ); } }