void io_off_unused(void) { GPIO_InitTypeDef GPIO_InitStructure; GPIO_StructInit(&GPIO_InitStructure); GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AN; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_40MHz; GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL; GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0 | GPIO_Pin_1 | GPIO_Pin_2 | GPIO_Pin_5 | GPIO_Pin_9 | GPIO_Pin_10; GPIO_Init(GPIOA, &GPIO_InitStructure); GPIO_PinLockConfig(GPIOA, GPIO_InitStructure.GPIO_Pin); GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0 | GPIO_Pin_1 | GPIO_Pin_2 | GPIO_Pin_10 | GPIO_Pin_11; GPIO_Init(GPIOB, &GPIO_InitStructure); GPIO_PinLockConfig(GPIOB, GPIO_InitStructure.GPIO_Pin); }
void SPI_f207GPIO_Config(void) { GPIO_InitTypeDef GPIO_InitStructure; RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOB, ENABLE); GPIO_InitStructure.GPIO_Pin = GPIO_Pin_3 | GPIO_Pin_4 | GPIO_Pin_5; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP; GPIO_Init(GPIOB, &GPIO_InitStructure); GPIO_PinAFConfig(GPIOB, GPIO_PinSource3, GPIO_AF_SPI3); GPIO_PinAFConfig(GPIOB, GPIO_PinSource4, GPIO_AF_SPI3); GPIO_PinAFConfig(GPIOB, GPIO_PinSource5, GPIO_AF_SPI3); GPIO_PinLockConfig(GPIOB,GPIO_Pin_3 | GPIO_Pin_4 | GPIO_Pin_5); }
//initialize the i2c periperal void init_i2c(void){ //RCC_APBPeriphClockCmd(RCC_APBPeriph_SYSCFG, ENABLE); //enable for i2c fast mode //SYSCFG_I2CFastModePlusConfig(SYSCFG_CFGR1_I2C_FMP_PB6|SYSCFG_CFGR1_I2C_FMP_PB7, ENABLE); RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOB, ENABLE); RCC_APB1PeriphClockCmd(RCC_APB1Periph_I2C1, ENABLE); RCC_I2CCLKConfig(RCC_I2C1CLK_SYSCLK); GPIO_PinAFConfig(GPIOB, GPIO_PinSource6, GPIO_AF_1); GPIO_PinAFConfig(GPIOB, GPIO_PinSource7, GPIO_AF_1); GPIO_InitTypeDef GPIOB_InitStruct = { .GPIO_Pin = GPIO_Pin_6|GPIO_Pin_7, .GPIO_Speed = GPIO_Speed_50MHz, .GPIO_Mode = GPIO_Mode_AF, .GPIO_OType = GPIO_OType_OD, .GPIO_PuPd = GPIO_PuPd_UP }; GPIO_Init(GPIOB, &GPIOB_InitStruct); GPIO_PinLockConfig(GPIOB, GPIO_PinSource6); GPIO_PinLockConfig(GPIOB, GPIO_PinSource7); I2C_InitTypeDef I2C_InitStructure = { //.I2C_Timing = 0x20310A0D, .I2C_Timing = 0x0010020A, .I2C_AnalogFilter = I2C_AnalogFilter_Enable, .I2C_DigitalFilter = 0x00, .I2C_Mode = I2C_Mode_I2C, .I2C_OwnAddress1 = 0x00, .I2C_Ack = I2C_Ack_Enable, .I2C_AcknowledgedAddress = I2C_AcknowledgedAddress_7bit }; I2C_Init(I2C1, &I2C_InitStructure); //I2C_ITConfig(USART1, I2C_IT_NACKI, ENABLE); //NVIC_EnableIRQ(I2C1_IRQn); I2C_Cmd(I2C1, ENABLE); } void I2C_WrReg(uint8_t Reg, uint8_t Val){ //Wait until I2C isn't busy while(I2C_GetFlagStatus(I2C1, I2C_FLAG_BUSY) == SET); //"Handle" a transfer - The STM32F0 series has a shocking I2C interface... //...Regardless! Send the address of the HMC sensor down the I2C Bus and generate //a start saying we're going to write one byte. I'll be completely honest, //the I2C peripheral doesn't make too much sense to me and a lot of the code is //from the Std peripheral library I2C_TransferHandling(I2C1, 0x78, 1, I2C_Reload_Mode, I2C_Generate_Start_Write); //Ensure the transmit interrupted flag is set while(I2C_GetFlagStatus(I2C1, I2C_FLAG_TXIS) == RESET); //Send the address of the register we wish to write to I2C_SendData(I2C1, Reg); //Ensure that the transfer complete reload flag is Set, essentially a standard //TC flag while(I2C_GetFlagStatus(I2C1, I2C_FLAG_TCR) == RESET); //Now that the HMC5883L knows which register we want to write to, send the address //again and ensure the I2C peripheral doesn't add any start or stop conditions I2C_TransferHandling(I2C1, 0x78, 1, I2C_AutoEnd_Mode, I2C_No_StartStop); //Again, wait until the transmit interrupted flag is set while(I2C_GetFlagStatus(I2C1, I2C_FLAG_TXIS) == RESET); //Send the value you wish you write to the register I2C_SendData(I2C1, Val); //Wait for the stop flag to be set indicating a stop condition has been sent while(I2C_GetFlagStatus(I2C1, I2C_FLAG_STOPF) == RESET); //Clear the stop flag for the next potential transfer I2C_ClearFlag(I2C1, I2C_FLAG_STOPF); } void i2c_out(uint8_t val){ //Wait until I2C isn't busy while(I2C_GetFlagStatus(I2C1, I2C_FLAG_BUSY) == SET); //"Handle" a transfer - The STM32F0 series has a shocking I2C interface... //...Regardless! Send the address of the HMC sensor down the I2C Bus and generate //a start saying we're going to write one byte. I'll be completely honest, //the I2C peripheral doesn't make too much sense to me and a lot of the code is //from the Std peripheral library I2C_TransferHandling(I2C1, 0x78, 1, I2C_Reload_Mode, I2C_Generate_Start_Write); //Ensure the transmit interrupted flag is set while(I2C_GetFlagStatus(I2C1, I2C_FLAG_TXIS) == RESET); //Send the address of the register we wish to write to I2C_SendData(I2C1, val); //Ensure that the transfer complete reload flag is Set, essentially a standard //TC flag while(I2C_GetFlagStatus(I2C1, I2C_FLAG_TCR) == RESET); //Clear the stop flag for the next potential transfer I2C_ClearFlag(I2C1, I2C_FLAG_STOPF); } void I2C_start(uint8_t i2caddress, uint8_t i2cdirection){ I2C_SlaveAddressConfig(I2C1, i2caddress); I2C_MasterRequestConfig(I2C1, i2cdirection); while(I2C_GetFlagStatus(I2C1, I2C_FLAG_BUSY) == SET); //"Handle" a transfer - The STM32F0 series has a shocking I2C interface... //...Regardless! Send the address of the HMC sensor down the I2C Bus and generate //a start saying we're going to write one byte. I'll be completely honest, //the I2C peripheral doesn't make too much sense to me and a lot of the code is //from the Std peripheral library I2C_TransferHandling(I2C1, i2caddress, 1, I2C_Reload_Mode, I2C_Generate_Start_Write); while(I2C_GetFlagStatus(I2C1, I2C_FLAG_TXIS) == RESET); }
void ZigBee_InitPins() { GPIO_InitTypeDef GPIO_InitStructure; RCC_AHBPeriphClockCmd(MAKENAME(RCC_AHBPeriph_GPIO,ZIGBEE_SCK_PORT), ENABLE); RCC_AHBPeriphClockCmd(MAKENAME(RCC_AHBPeriph_GPIO,ZIGBEE_MISO_PORT), ENABLE); RCC_AHBPeriphClockCmd(MAKENAME(RCC_AHBPeriph_GPIO,ZIGBEE_MOSI_PORT), ENABLE); RCC_AHBPeriphClockCmd(MAKENAME(RCC_AHBPeriph_GPIO,ZIGBEE_SS_PORT), ENABLE); //SCK GPIO_InitStructure.GPIO_Pin = MAKENAME(GPIO_Pin_,ZIGBEE_SCK_PIN); GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF; GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL; GPIO_Init(MAKENAME(GPIO,ZIGBEE_SCK_PORT), &GPIO_InitStructure); //MISO GPIO_InitStructure.GPIO_Pin = MAKENAME(GPIO_Pin_,ZIGBEE_MISO_PIN); GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF; GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL; GPIO_Init(MAKENAME(GPIO,ZIGBEE_MISO_PORT), &GPIO_InitStructure); //MOSI GPIO_InitStructure.GPIO_Pin = MAKENAME(GPIO_Pin_,ZIGBEE_MOSI_PIN); GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF; GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL; GPIO_Init(MAKENAME(GPIO,ZIGBEE_MOSI_PORT), &GPIO_InitStructure); // slave select PullUp(); GPIO_InitStructure.GPIO_Pin = MAKENAME(GPIO_Pin_,ZIGBEE_SS_PIN); GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT; GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL; GPIO_Init(MAKENAME(GPIO,ZIGBEE_SS_PORT), &GPIO_InitStructure); // Configure SPI pins: SCK, MISO and MOSI GPIO_PinAFConfig(MAKENAME(GPIO,ZIGBEE_SCK_PORT), MAKENAME(GPIO_PinSource,ZIGBEE_SCK_PIN), MAKENAME(GPIO_AF_,ZIGBEE_SCK_AF)); GPIO_PinAFConfig(MAKENAME(GPIO,ZIGBEE_MISO_PORT), MAKENAME(GPIO_PinSource,ZIGBEE_MISO_PIN), MAKENAME(GPIO_AF_,ZIGBEE_MISO_AF)); GPIO_PinAFConfig(MAKENAME(GPIO,ZIGBEE_MOSI_PORT), MAKENAME(GPIO_PinSource,ZIGBEE_MOSI_PIN), MAKENAME(GPIO_AF_,ZIGBEE_MOSI_AF)); #ifdef ZIGBEE_RESET_PIN RCC_AHBPeriphClockCmd(MAKENAME(RCC_AHBPeriph_GPIO,ZIGBEE_RESET_PORT), ENABLE); GPIO_InitStructure.GPIO_Pin = MAKENAME(GPIO_Pin_,ZIGBEE_RESET_PIN); GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT; GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL; GPIO_Init(MAKENAME(GPIO,ZIGBEE_RESET_PORT), &GPIO_InitStructure); #endif #ifdef ZIGBEE_HGM_PIN RCC_AHBPeriphClockCmd(MAKENAME(RCC_AHBPeriph_GPIO,ZIGBEE_HGM_PORT), ENABLE); GPIO_InitStructure.GPIO_Pin = 1<<ZIGBEE_HGM_PIN; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL; GPIO_Init(MAKENAME(GPIO,ZIGBEE_HGM_PORT), &GPIO_InitStructure); GPIO_PinLockConfig(MAKENAME(GPIO,ZIGBEE_HGM_PORT),1<<ZIGBEE_HGM_PIN); #endif }
/******************************************************************************* * Function Name : TIM1_PWM_Init * Description : It initializes PWM peripherals * Input : None * Output : None * Return : None *******************************************************************************/ void TIM1_PWM_Init(void) { GPIO_InitTypeDef GPIO_InitStructure; TIM_TimeBaseInitTypeDef TIM1_TimeBaseStructure; TIM_OCInitTypeDef TIM1_OCInitStructure; TIM_BDTRInitTypeDef TIM1_BDTRInitStructure; /* Enable TIM1 clock */ RCC_APB2PeriphClockCmd(RCC_APB2Periph_TIM1, ENABLE); RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO|RCC_APB2Periph_GPIOE, ENABLE); /*Timer1 alternate function full remapping*/ GPIO_PinRemapConfig(GPIO_FullRemap_TIM1,ENABLE); GPIO_StructInit(&GPIO_InitStructure); /* GPIOE Configuration: Channel 1, 1N, 2, 2N, 3, 3N and 4 Output */ GPIO_InitStructure.GPIO_Pin = GPIO_Pin_8 | GPIO_Pin_9 | GPIO_Pin_10 | GPIO_Pin_11 | GPIO_Pin_12 | GPIO_Pin_13 | GPIO_Pin_14; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_Init(GPIOE, &GPIO_InitStructure); /* Lock GPIOE Pin9 and Pin11 Pin 13 (High sides) */ GPIO_PinLockConfig(GPIOE, GPIO_Pin_9 | GPIO_Pin_11 | GPIO_Pin_13); GPIO_StructInit(&GPIO_InitStructure); /* GPIOE Configuration: BKIN pin */ GPIO_InitStructure.GPIO_Pin = GPIO_Pin_15; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING; GPIO_Init(GPIOE, &GPIO_InitStructure); /* TIM1 Peripheral Configuration -----------------------*/ /* TIM1 Registers reset */ TIM_DeInit(TIM1); TIM_TimeBaseStructInit(&TIM1_TimeBaseStructure); /* Time Base configuration */ TIM1_TimeBaseStructure.TIM_Prescaler = 0x0; TIM1_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_CenterAligned1; TIM1_TimeBaseStructure.TIM_Period = PWM_PERIOD; TIM1_TimeBaseStructure.TIM_ClockDivision = TIM_CKD_DIV2; // Initial condition is REP=0 to set the UPDATE only on the underflow TIM1_TimeBaseStructure.TIM_RepetitionCounter = REP_RATE; TIM_TimeBaseInit(TIM1, &TIM1_TimeBaseStructure); TIM_OCStructInit(&TIM1_OCInitStructure); /* Channel 1, 2,3 in PWM mode */ TIM1_OCInitStructure.TIM_OCMode = TIM_OCMode_PWM1; TIM1_OCInitStructure.TIM_OutputState = TIM_OutputState_Enable; TIM1_OCInitStructure.TIM_OutputNState = TIM_OutputNState_Enable; TIM1_OCInitStructure.TIM_Pulse = 0x505; //dummy value TIM1_OCInitStructure.TIM_OCPolarity = TIM_OCPolarity_High; TIM1_OCInitStructure.TIM_OCNPolarity = TIM_OCNPolarity_High; TIM1_OCInitStructure.TIM_OCIdleState = TIM_OCIdleState_Reset; TIM1_OCInitStructure.TIM_OCNIdleState = LOW_SIDE_POLARITY; TIM_OC1Init(TIM1, &TIM1_OCInitStructure); TIM_OC2Init(TIM1, &TIM1_OCInitStructure); TIM_OC3Init(TIM1, &TIM1_OCInitStructure); /* Channel 4 Configuration in OC */ TIM_OCStructInit(&TIM1_OCInitStructure); TIM1_OCInitStructure.TIM_OCMode = TIM_OCMode_PWM2; TIM1_OCInitStructure.TIM_OutputState = TIM_OutputState_Enable; TIM1_OCInitStructure.TIM_OutputNState = TIM_OutputNState_Disable; TIM1_OCInitStructure.TIM_Pulse = PWM_PERIOD - 1; TIM1_OCInitStructure.TIM_OCPolarity = TIM_OCPolarity_High; TIM1_OCInitStructure.TIM_OCNPolarity =TIM_OCNPolarity_Low; TIM1_OCInitStructure.TIM_OCIdleState = TIM_OCIdleState_Reset; TIM1_OCInitStructure.TIM_OCNIdleState = LOW_SIDE_POLARITY; TIM_OC4Init(TIM1, &TIM1_OCInitStructure); /* Enables the TIM1 Preload on CC1 Register */ TIM_OC1PreloadConfig(TIM1, TIM_OCPreload_Enable); /* Enables the TIM1 Preload on CC2 Register */ TIM_OC2PreloadConfig(TIM1, TIM_OCPreload_Enable); /* Enables the TIM1 Preload on CC3 Register */ TIM_OC3PreloadConfig(TIM1, TIM_OCPreload_Enable); /* Enables the TIM1 Preload on CC4 Register */ TIM_OC4PreloadConfig(TIM1, TIM_OCPreload_Enable); /* Automatic Output enable, Break, dead time and lock configuration*/ TIM1_BDTRInitStructure.TIM_OSSRState = TIM_OSSRState_Enable; TIM1_BDTRInitStructure.TIM_OSSIState = TIM_OSSIState_Enable; TIM1_BDTRInitStructure.TIM_LOCKLevel = TIM_LOCKLevel_1; TIM1_BDTRInitStructure.TIM_DeadTime = DEADTIME; TIM1_BDTRInitStructure.TIM_Break = TIM_Break_Enable; TIM1_BDTRInitStructure.TIM_BreakPolarity = TIM_BreakPolarity_Low;//0:刹车输入低电平有效;1:刹车输入高电平有效。由外部引脚电平从高到底,引起。 TIM1_BDTRInitStructure.TIM_AutomaticOutput = TIM_AutomaticOutput_Disable; //TIM_AutomaticOutput_Enable: 刹车后,刹车输入电平变为无效无效后,下一个脉冲周期,自动回复脉冲输出。 //TIM_AutomaticOutput_Disable: 刹车后,脉冲输出永久禁止,除非手动调用TIM_CtrlPWMOutputs(TIM1, ENABLE),否则不能启动pwm输出。 TIM_BDTRConfig(TIM1, &TIM1_BDTRInitStructure); TIM_SelectOutputTrigger(TIM1, TIM_TRGOSource_Update); TIM_ClearITPendingBit(TIM1, TIM_IT_Break); // TIM_ITConfig(TIM1, TIM_IT_Break,ENABLE); TIM_ITConfig(TIM1, TIM_IT_Break,DISABLE); /* TIM1 counter enable */ TIM_Cmd(TIM1, ENABLE); // Resynch to have the Update evend during Undeflow TIM_GenerateEvent(TIM1, TIM_EventSource_Update); //UG=1:重新初始化计数器,并产生一个更新事件加上REP=1,保证了在中心对齐模式下更新事件只发生向下溢出CNT=1处 // Clear Update Flag TIM_ClearFlag(TIM1, TIM_FLAG_Update); TIM_ITConfig(TIM1, TIM_IT_Update, DISABLE);//不允许更新中断, TIM_ITConfig(TIM1, TIM_IT_CC4,DISABLE);//不允许CC4捕获中断 }
/************************************************************* * GPIOB Initialization **************************************************************/ void GPIOB_Init() { #if(STRCMP($pin0Used$, DISABLE) == 0 || STRCMP($pin1Used$, DISABLE) == 0 || STRCMP($pin2Used$, DISABLE)== 0 ||\ STRCMP($pin3Used$, DISABLE) == 0 || STRCMP($pin4Used$, DISABLE) == 0 || STRCMP($pin5Used$, DISABLE)== 0 || \ STRCMP($pin6Used$, DISABLE) == 0 || STRCMP($pin7Used$, DISABLE) == 0 || STRCMP($pin8Used$, DISABLE)== 0 || \ STRCMP($pin9Used$, DISABLE) == 0 || STRCMP($pin10Used$, DISABLE) == 0 || STRCMP($pin11Used$, DISABLE)== 0 || \ STRCMP($pin12Used$, DISABLE) == 0 || STRCMP($pin13Used$, DISABLE) == 0 || STRCMP($pin14Used$, DISABLE)== 0 || \ STRCMP($pin15Used$, DISABLE) == 0) GPIO_InitTypeDef GPIO_InitStructure; #endif #if($pLockEn0$ || $pLockEn1$ || $pLockEn2$ || $pLockEn3$ || \ $pLockEn4$ || $pLockEn5$ || $pLockEn6$ || $pLockEn7$ || \ $pLockEn8$ || $pLockEn9$ || $pLockEn10$ || $pLockEn11$ || \ $pLockEn12$ || $pLockEn13$ || $pLockEn14$ || $pLockEn15$) uint16_t GPIO_LOCK_PIN; // // The locked pins of GPIOB // GPIO_LOCK_PIN = $pLockEn0$ | $pLockEn1$ << 1 | $pLockEn2$ << 2 | $pLockEn3$ << 3 | \ $pLockEn4$ << 4 | $pLockEn5$ << 5 | $pLockEn6$ << 6 | $pLockEn7$ << 7 | \ $pLockEn8$ << 8 | $pLockEn9$ << 9 | $pLockEn10$ << 10 | $pLockEn11$ << 11 |\ $pLockEn12$ << 12 | $pLockEn13$ << 13 | $pLockEn14$ << 14 | $pLockEn15$ << 15; #endif // // Enable GPIOB APB2PeriphClock // RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE); #if(STRCMP($pin0Used$, DISABLE) == 0) // // Set PB0 Pin Mode // GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0; GPIO_InitStructure.GPIO_Mode = $pin0Mode$; GPIO_InitStructure.GPIO_Speed = $pin0Speed$; GPIO_Init(GPIOB, &GPIO_InitStructure); #if(STRCMP($pin0Mode$, GPIO_Mode_Out_OD) != 0 || STRCMP($pin0Mode$, GPIO_Mode_Out_PP) != 0 || \ STRCMP($pin0Mode$, GPIO_Mode_AF_OD) != 0 || STRCMP($pin0Mode$, GPIO_Mode_AF_PP) != 0) #if(STRCMP($pinData0$, RESET) == 0) // // Set or Reset PB0 bits of output data // GPIO_SetBits(GPIOB, GPIO_Pin_0); #endif #if(STRCMP($pinData0$, SET) == 0) // // Set or Reset PB0 bits of output data // GPIO_ResetBits(GPIOB, GPIO_Pin_0); #endif #endif #endif #if(STRCMP($pin1Used$, DISABLE) == 0) // // Set PB1 Pin Mode // GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1; GPIO_InitStructure.GPIO_Mode = $pin1Mode$; GPIO_InitStructure.GPIO_Speed = $pin1Speed$; GPIO_Init(GPIOB, &GPIO_InitStructure); #if(STRCMP($pin1Mode$, GPIO_Mode_Out_OD) != 0 || STRCMP($pin1Mode$, GPIO_Mode_Out_PP) != 0 || \ STRCMP($pin1Mode$, GPIO_Mode_AF_OD) != 0 || STRCMP($pin1Mode$, GPIO_Mode_AF_PP) != 0) #if(STRCMP($pinData1$, RESET) == 0) // // Set or Reset PB1 bits of output data // GPIO_SetBits(GPIOB, GPIO_Pin_1); #endif #if(STRCMP($pinData1$, SET) == 0) // // Set or Reset PB1 bits of output data // GPIO_ResetBits(GPIOB, GPIO_Pin_1); #endif #endif #endif #if(STRCMP($pin2Used$, DISABLE) == 0) // // Set PB2 Pin Mode // GPIO_InitStructure.GPIO_Pin = GPIO_Pin_2; GPIO_InitStructure.GPIO_Mode = $pin2Mode$; GPIO_InitStructure.GPIO_Speed = $pin2Speed$; GPIO_Init(GPIOB, &GPIO_InitStructure); #if(STRCMP($pin2Mode$, GPIO_Mode_Out_OD) != 0 || STRCMP($pin2Mode$, GPIO_Mode_Out_PP) != 0 || \ STRCMP($pin2Mode$, GPIO_Mode_AF_OD) != 0 || STRCMP($pin2Mode$, GPIO_Mode_AF_PP) != 0) #if(STRCMP($pinData2$, RESET) == 0) // // Set or Reset PB2 bits of output data // GPIO_SetBits(GPIOB, GPIO_Pin_2); #endif #if(STRCMP($pinData2$, SET) == 0) // // Set or Reset PB2 bits of output data // GPIO_ResetBits(GPIOB, GPIO_Pin_2); #endif #endif #endif #if(STRCMP($pin3Used$, DISABLE) == 0) // // Set PB3 Pin Mode // GPIO_InitStructure.GPIO_Pin = GPIO_Pin_3; GPIO_InitStructure.GPIO_Mode = $pin3Mode$; GPIO_InitStructure.GPIO_Speed = $pin3Speed$; GPIO_Init(GPIOB, &GPIO_InitStructure); #if(STRCMP($pin3Mode$, GPIO_Mode_Out_OD) != 0 || STRCMP($pin3Mode$, GPIO_Mode_Out_PP) != 0 || \ STRCMP($pin3Mode$, GPIO_Mode_AF_OD) != 0 || STRCMP($pin3Mode$, GPIO_Mode_AF_PP) != 0) #if(STRCMP($pinData3$, RESET) == 0) // // Set or Reset PB3 bits of output data // GPIO_SetBits(GPIOB, GPIO_Pin_3); #endif #if(STRCMP($pinData3$, SET) == 0) // // Set or Reset PB3 bits of output data // GPIO_ResetBits(GPIOB, GPIO_Pin_3); #endif #endif #endif #if(STRCMP($pin4Used$, DISABLE) == 0) // // Set PB4 Pin Mode // GPIO_InitStructure.GPIO_Pin = GPIO_Pin_4; GPIO_InitStructure.GPIO_Mode = $pin4Mode$; GPIO_InitStructure.GPIO_Speed = $pin4Speed$; GPIO_Init(GPIOB, &GPIO_InitStructure); #if(STRCMP($pin4Mode$, GPIO_Mode_Out_OD) != 0 || STRCMP($pin4Mode$, GPIO_Mode_Out_PP) != 0 || \ STRCMP($pin4Mode$, GPIO_Mode_AF_OD) != 0 || STRCMP($pin4Mode$, GPIO_Mode_AF_PP) != 0) #if(STRCMP($pinData4$, RESET) == 0) // // Set or Reset PB4 bits of output data // GPIO_SetBits(GPIOB, GPIO_Pin_4); #endif #if(STRCMP($pinData4$, SET) == 0) // // Set or Reset PB4 bits of output data // GPIO_ResetBits(GPIOB, GPIO_Pin_4); #endif #endif #endif #if(STRCMP($pin5Used$, DISABLE) == 0) // // Set PB5 Pin Mode // GPIO_InitStructure.GPIO_Pin = GPIO_Pin_5; GPIO_InitStructure.GPIO_Mode = $pin5Mode$; GPIO_InitStructure.GPIO_Speed = $pin5Speed$; GPIO_Init(GPIOB, &GPIO_InitStructure); #if(STRCMP($pin5Mode$, GPIO_Mode_Out_OD) != 0 || STRCMP($pin5Mode$, GPIO_Mode_Out_PP) != 0 || \ STRCMP($pin5Mode$, GPIO_Mode_AF_OD) != 0 || STRCMP($pin5Mode$, GPIO_Mode_AF_PP) != 0) #if(STRCMP($pinData5$, RESET) == 0) // // Set or Reset PB5 bits of output data // GPIO_SetBits(GPIOB, GPIO_Pin_5); #endif #if(STRCMP($pinData5$, SET) == 0) // // Set or Reset PB5 bits of output data // GPIO_ResetBits(GPIOB, GPIO_Pin_5); #endif #endif #endif #if(STRCMP($pin6Used$, DISABLE) == 0) // // Set PB6 Pin Mode // GPIO_InitStructure.GPIO_Pin = GPIO_Pin_6; GPIO_InitStructure.GPIO_Mode = $pin6Mode$; GPIO_InitStructure.GPIO_Speed = $pin6Speed$; GPIO_Init(GPIOB, &GPIO_InitStructure); #if(STRCMP($pin6Mode$, GPIO_Mode_Out_OD) != 0 || STRCMP($pin6Mode$, GPIO_Mode_Out_PP) != 0 || \ STRCMP($pin6Mode$, GPIO_Mode_AF_OD) != 0 || STRCMP($pin6Mode$, GPIO_Mode_AF_PP) != 0) #if(STRCMP($pinData6$, RESET) == 0) // // Set or Reset PB6 bits of output data // GPIO_SetBits(GPIOB, GPIO_Pin_6); #endif #if(STRCMP($pinData6$, SET) == 0) // // Set or Reset PB6 bits of output data // GPIO_ResetBits(GPIOB, GPIO_Pin_6); #endif #endif #endif #if(STRCMP($pin7Used$, DISABLE) == 0) // // Set PB7 Pin Mode // GPIO_InitStructure.GPIO_Pin = GPIO_Pin_7; GPIO_InitStructure.GPIO_Mode = $pin7Mode$; GPIO_InitStructure.GPIO_Speed = $pin7Speed$; GPIO_Init(GPIOB, &GPIO_InitStructure); #if(STRCMP($pin7Mode$, GPIO_Mode_Out_OD) != 0 || STRCMP($pin7Mode$, GPIO_Mode_Out_PP) != 0 || \ STRCMP($pin7Mode$, GPIO_Mode_AF_OD) != 0 || STRCMP($pin7Mode$, GPIO_Mode_AF_PP) != 0) #if(STRCMP($pinData7$, RESET) == 0) // // Set or Reset PB7 bits of output data // GPIO_SetBits(GPIOB, GPIO_Pin_7); #endif #if(STRCMP($pinData7$, SET) == 0) // // Set or Reset PB7 bits of output data // GPIO_ResetBits(GPIOB, GPIO_Pin_7); #endif #endif #endif #if(STRCMP($pin8Used$, DISABLE) == 0) // // Set PB8 Pin Mode // GPIO_InitStructure.GPIO_Pin = GPIO_Pin_8; GPIO_InitStructure.GPIO_Mode = $pin8Mode$; GPIO_InitStructure.GPIO_Speed = $pin8Speed$; GPIO_Init(GPIOB, &GPIO_InitStructure); #if(STRCMP($pin8Mode$, GPIO_Mode_Out_OD) != 0 || STRCMP($pin8Mode$, GPIO_Mode_Out_PP) != 0 || \ STRCMP($pin8Mode$, GPIO_Mode_AF_OD) != 0 || STRCMP($pin8Mode$, GPIO_Mode_AF_PP) != 0) #if(STRCMP($pinData8$, RESET) == 0) // // Set or Reset PB8 bits of output data // GPIO_SetBits(GPIOB, GPIO_Pin_8); #endif #if(STRCMP($pinData8$, SET) == 0) // // Set or Reset PB8 bits of output data // GPIO_ResetBits(GPIOB, GPIO_Pin_8); #endif #endif #endif #if(STRCMP($pin9Used$, DISABLE) == 0) // // Set PB9 Pin Mode // GPIO_InitStructure.GPIO_Pin = GPIO_Pin_9; GPIO_InitStructure.GPIO_Mode = $pin9Mode$; GPIO_InitStructure.GPIO_Speed = $pin9Speed$; GPIO_Init(GPIOB, &GPIO_InitStructure); #if(STRCMP($pin9Mode$, GPIO_Mode_Out_OD) != 0 || STRCMP($pin9Mode$, GPIO_Mode_Out_PP) != 0 || \ STRCMP($pin9Mode$, GPIO_Mode_AF_OD) != 0 || STRCMP($pin9Mode$, GPIO_Mode_AF_PP) != 0) #if(STRCMP($pinData9$, RESET) == 0) // // Set or Reset PB9 bits of output data // GPIO_SetBits(GPIOB, GPIO_Pin_9); #endif #if(STRCMP($pinData9$, SET) == 0) // // Set or Reset PB9 bits of output data // GPIO_ResetBits(GPIOB, GPIO_Pin_9); #endif #endif #endif #if(STRCMP($pin10Used$, DISABLE) == 0) // // Set PB10 Pin Mode // GPIO_InitStructure.GPIO_Pin = GPIO_Pin_10; GPIO_InitStructure.GPIO_Mode = $pin10Mode$; GPIO_InitStructure.GPIO_Speed = $pin10Speed$; GPIO_Init(GPIOB, &GPIO_InitStructure); #if(STRCMP($pin10Mode$, GPIO_Mode_Out_OD) != 0 || STRCMP($pin10Mode$, GPIO_Mode_Out_PP) != 0 || \ STRCMP($pin10Mode$, GPIO_Mode_AF_OD) != 0 || STRCMP($pin10Mode$, GPIO_Mode_AF_PP) != 0) #if(STRCMP($pinData10$, RESET) == 0) // // Set or Reset PB10 bits of output data // GPIO_SetBits(GPIOB, GPIO_Pin_10); #endif #if(STRCMP($pinData10$, SET) == 0) // // Set or Reset PB10 bits of output data // GPIO_ResetBits(GPIOB, GPIO_Pin_10); #endif #endif #endif #if(STRCMP($pin11Used$, DISABLE) == 0) // // Set PB11 Pin Mode // GPIO_InitStructure.GPIO_Pin = GPIO_Pin_11; GPIO_InitStructure.GPIO_Mode = $pin11Mode$; GPIO_InitStructure.GPIO_Speed = $pin11Speed$; GPIO_Init(GPIOB, &GPIO_InitStructure); #if(STRCMP($pin11Mode$, GPIO_Mode_Out_OD) != 0 || STRCMP($pin11Mode$, GPIO_Mode_Out_PP) != 0 || \ STRCMP($pin11Mode$, GPIO_Mode_AF_OD) != 0 || STRCMP($pin11Mode$, GPIO_Mode_AF_PP) != 0) #if(STRCMP($pinData11$, RESET) == 0) // // Set or Reset PB11 bits of output data // GPIO_SetBits(GPIOB, GPIO_Pin_11); #endif #if(STRCMP($pinData11$, SET) == 0) // // Set or Reset PB11 bits of output data // GPIO_ResetBits(GPIOB, GPIO_Pin_11); #endif #endif #endif #if(STRCMP($pin12Used$, DISABLE) == 0) // // Set PB12 Pin Mode // GPIO_InitStructure.GPIO_Pin = GPIO_Pin_12; GPIO_InitStructure.GPIO_Mode = $pin12Mode$; GPIO_InitStructure.GPIO_Speed = $pin12Speed$; GPIO_Init(GPIOB, &GPIO_InitStructure); #if(STRCMP($pin12Mode$, GPIO_Mode_Out_OD) != 0 || STRCMP($pin12Mode$, GPIO_Mode_Out_PP) != 0 || \ STRCMP($pin12Mode$, GPIO_Mode_AF_OD) != 0 || STRCMP($pin12Mode$, GPIO_Mode_AF_PP) != 0) #if(STRCMP($pinData12$, RESET) == 0) // // Set or Reset PB12 bits of output data // GPIO_SetBits(GPIOB, GPIO_Pin_12); #endif #if(STRCMP($pinData12$, SET) == 0) // // Set or Reset PB12 bits of output data // GPIO_ResetBits(GPIOB, GPIO_Pin_12); #endif #endif #endif #if(STRCMP($pin13Used$, DISABLE) == 0) // // Set PB13 Pin Mode // GPIO_InitStructure.GPIO_Pin = GPIO_Pin_13; GPIO_InitStructure.GPIO_Mode = $pin13Mode$; GPIO_InitStructure.GPIO_Speed = $pin13Speed$; GPIO_Init(GPIOB, &GPIO_InitStructure); #if(STRCMP($pin13Mode$, GPIO_Mode_Out_OD) != 0 || STRCMP($pin13Mode$, GPIO_Mode_Out_PP) != 0 || \ STRCMP($pin13Mode$, GPIO_Mode_AF_OD) != 0 || STRCMP($pin13Mode$, GPIO_Mode_AF_PP) != 0) #if(STRCMP($pinData13$, RESET) == 0) // // Set or Reset PB13 bits of output data // GPIO_SetBits(GPIOB, GPIO_Pin_13); #endif #if(STRCMP($pinData13$, SET) == 0) // // Set or Reset PB13 bits of output data // GPIO_ResetBits(GPIOB, GPIO_Pin_13); #endif #endif #endif #if(STRCMP($pin14Used$, DISABLE) == 0) // // Set PB14 Pin Mode // GPIO_InitStructure.GPIO_Pin = GPIO_Pin_14; GPIO_InitStructure.GPIO_Mode = $pin14Mode$; GPIO_InitStructure.GPIO_Speed = $pin14Speed$; GPIO_Init(GPIOB, &GPIO_InitStructure); #if(STRCMP($pin14Mode$, GPIO_Mode_Out_OD) != 0 || STRCMP($pin14Mode$, GPIO_Mode_Out_PP) != 0 || \ STRCMP($pin14Mode$, GPIO_Mode_AF_OD) != 0 || STRCMP($pin14Mode$, GPIO_Mode_AF_PP) != 0) #if(STRCMP($pinData14$, RESET) == 0) // // Set or Reset PB14 bits of output data // GPIO_SetBits(GPIOB, GPIO_Pin_14); #endif #if(STRCMP($pinData14$, SET) == 0) // // Set or Reset PB14 bits of output data // GPIO_ResetBits(GPIOB, GPIO_Pin_14); #endif #endif #endif #if(STRCMP($pin15Used$, DISABLE) == 0) // // Set PB15 Pin Mode // GPIO_InitStructure.GPIO_Pin = GPIO_Pin_15; GPIO_InitStructure.GPIO_Mode = $pin15Mode$; GPIO_InitStructure.GPIO_Speed = $pin15Speed$; GPIO_Init(GPIOB, &GPIO_InitStructure); #if(STRCMP($pin15Mode$, GPIO_Mode_Out_OD) != 0 || STRCMP($pin15Mode$, GPIO_Mode_Out_PP) != 0 || \ STRCMP($pin15Mode$, GPIO_Mode_AF_OD) != 0 || STRCMP($pin15Mode$, GPIO_Mode_AF_PP) != 0) #if(STRCMP($pinData15$, RESET) == 0) // // Set or Reset PB15 bits of output data // GPIO_SetBits(GPIOB, GPIO_Pin_15); #endif #if(STRCMP($pinData15$, SET) == 0) // // Set or Reset PB15 bits of output data // GPIO_ResetBits(GPIOB, GPIO_Pin_15); #endif #endif #endif #if($pLockEn0$ | $pLockEn1$ | $pLockEn2$ | $pLockEn3$ | \ $pLockEn4$ | $pLockEn5$ | $pLockEn6$ | $pLockEn7$ | \ $pLockEn8$ | $pLockEn9$ | $pLockEn10$ | $pLockEn11$ | \ $pLockEn12$ | $pLockEn13$ | $pLockEn14$ | $pLockEn15$) //PUT_A_NEW_LINE_HERE // // Lock configuration of GPIO pins. // GPIO_PinLockConfig($GPIO_PORT$, GPIO_LOCK_PIN); #endif }