本文整理汇总了C++中RCC_APB1PeriphResetCmd函数的典型用法代码示例。如果您正苦于以下问题:C++ RCC_APB1PeriphResetCmd函数的具体用法?C++ RCC_APB1PeriphResetCmd怎么用?C++ RCC_APB1PeriphResetCmd使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了RCC_APB1PeriphResetCmd函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: SPDIFRX_DeInit
/**
* @brief Deinitialize the SPDIFRXx peripheral registers to their default reset values.
* @param void
* @retval None
*/
void SPDIFRX_DeInit(void)
{
/* Enable SPDIFRX reset state */
RCC_APB1PeriphResetCmd(RCC_APB1Periph_SPDIFRX, ENABLE);
/* Release SPDIFRX from reset state */
RCC_APB1PeriphResetCmd(RCC_APB1Periph_SPDIFRX, DISABLE);
}
开发者ID:YuraTest,项目名称:DemoProject,代码行数:12,代码来源:stm32f4xx_spdifrx.c
示例2: I2C_DeInit
/*******************************************************************************
* Function Name : I2C_DeInit
* Description : Deinitializes the I2Cx peripheral registers to their default
* reset values.
* Input : - I2Cx: where x can be 1 or 2 to select the I2C peripheral.
* Output : None
* Return : None
*******************************************************************************/
void I2C_DeInit(I2C_TypeDef* I2Cx)
{
/* Check the parameters */
assert_param(IS_I2C_ALL_PERIPH(I2Cx));
switch (*(u32*)&I2Cx)
{
case I2C1_BASE:
/* Enable I2C1 reset state */
RCC_APB1PeriphResetCmd(RCC_APB1Periph_I2C1, ENABLE);
/* Release I2C1 from reset state */
RCC_APB1PeriphResetCmd(RCC_APB1Periph_I2C1, DISABLE);
break;
case I2C2_BASE:
/* Enable I2C2 reset state */
RCC_APB1PeriphResetCmd(RCC_APB1Periph_I2C2, ENABLE);
/* Release I2C2 from reset state */
RCC_APB1PeriphResetCmd(RCC_APB1Periph_I2C2, DISABLE);
break;
default:
break;
}
}
开发者ID:Paolo-Maffei,项目名称:lxyppc-tetrix,代码行数:33,代码来源:stm32f10x_i2c.c
示例3: SPI_I2S_DeInit
/**
* @brief Deinitializes the SPIx peripheral registers to their default
* reset values (Affects also the I2Ss).
* @param SPIx: where x can be 1, 2 or 3 to select the SPI peripheral.
* @retval : None
*/
void SPI_I2S_DeInit(SPI_TypeDef* SPIx)
{
/* Check the parameters */
assert_param(IS_SPI_ALL_PERIPH(SPIx));
switch (*(uint32_t*)&SPIx)
{
case SPI1_BASE:
/* Enable SPI1 reset state */
RCC_APB2PeriphResetCmd(RCC_APB2Periph_SPI1, ENABLE);
/* Release SPI1 from reset state */
RCC_APB2PeriphResetCmd(RCC_APB2Periph_SPI1, DISABLE);
break;
case SPI2_BASE:
/* Enable SPI2 reset state */
RCC_APB1PeriphResetCmd(RCC_APB1Periph_SPI2, ENABLE);
/* Release SPI2 from reset state */
RCC_APB1PeriphResetCmd(RCC_APB1Periph_SPI2, DISABLE);
break;
case SPI3_BASE:
/* Enable SPI3 reset state */
RCC_APB1PeriphResetCmd(RCC_APB1Periph_SPI3, ENABLE);
/* Release SPI3 from reset state */
RCC_APB1PeriphResetCmd(RCC_APB1Periph_SPI3, DISABLE);
break;
default:
break;
}
}
开发者ID:2garryn,项目名称:sd_disk_learning,代码行数:35,代码来源:stm32f10x_spi.c
示例4: IOE_GPIO_Config
/**
* @brief Initializes the GPIO pins used by the IO expander.
* @param None
* @retval None
*/
static void IOE_GPIO_Config(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
/* Enable IOE_I2C and IOE_I2C_GPIO_PORT & Alternate Function clocks */
RCC_APB1PeriphClockCmd(IOE_I2C_CLK, ENABLE);
RCC_AHB1PeriphClockCmd(IOE_I2C_SCL_GPIO_CLK | IOE_I2C_SDA_GPIO_CLK |
IOE_IT_GPIO_CLK, ENABLE);
RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE);
/* Reset IOE_I2C IP */
RCC_APB1PeriphResetCmd(IOE_I2C_CLK, ENABLE);
/* Release reset signal of IOE_I2C IP */
RCC_APB1PeriphResetCmd(IOE_I2C_CLK, DISABLE);
/* Connect PXx to I2C_SCL*/
GPIO_PinAFConfig(IOE_I2C_SCL_GPIO_PORT, IOE_I2C_SCL_SOURCE, IOE_I2C_SCL_AF);
/* Connect PXx to I2C_SDA*/
GPIO_PinAFConfig(IOE_I2C_SDA_GPIO_PORT, IOE_I2C_SDA_SOURCE, IOE_I2C_SDA_AF);
/* IOE_I2C SCL and SDA pins configuration */
GPIO_InitStructure.GPIO_Pin = IOE_I2C_SCL_PIN;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_OType = GPIO_OType_OD;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_Init(IOE_I2C_SCL_GPIO_PORT, &GPIO_InitStructure);
GPIO_InitStructure.GPIO_Pin = IOE_I2C_SDA_PIN;
GPIO_Init(IOE_I2C_SDA_GPIO_PORT, &GPIO_InitStructure);
}
开发者ID:jfazli,项目名称:PE208,代码行数:37,代码来源:stm324x9i_eval_ioe8.c
示例5: CEC_DeInit
/**
* @brief Deinitializes the CEC peripheral registers to their default reset
* values.
* @param None
* @retval None
*/
void CEC_DeInit(void)
{
/* Enable CEC reset state */
RCC_APB1PeriphResetCmd(RCC_APB1Periph_CEC, ENABLE);
/* Release CEC from reset state */
RCC_APB1PeriphResetCmd(RCC_APB1Periph_CEC, DISABLE);
}
开发者ID:X-Ryl669,项目名称:wifi_display,代码行数:13,代码来源:stm32f10x_cec.c
示例6: number
/**
@brief Init I2C
@param[in] devnum I2C peripheral number (1 or 2)
@param[in] clkspd Baudrate (i.e. 100000 for 100kHz), F_CPU independent
*/
void i2c_init(uint8_t devnum, const uint32_t clkspd)
{
struct I2C_DevDef* pdef = i2c_get_pdef(devnum);
// Enable GPIO clocks
RCC_APB2PeriphClockCmd(pdef->gpio_clk, ENABLE);
// I2C1 clock enable
RCC_APB1PeriphClockCmd(pdef->i2c_clk, ENABLE);
// I2C1 SDA and SCL configuration
GPIO_InitTypeDef iotd;
iotd.GPIO_Pin = pdef->pin_sda | pdef->pin_scl;
iotd.GPIO_Speed = GPIO_Speed_50MHz;
iotd.GPIO_Mode = GPIO_Mode_AF_OD;
GPIO_Init(pdef->gpio, &iotd);
// I2C1 Reset
RCC_APB1PeriphResetCmd(pdef->i2c_clk, ENABLE);
RCC_APB1PeriphResetCmd(pdef->i2c_clk, DISABLE);
// Configure I2Cx
I2C_InitTypeDef i2td;
i2td.I2C_ClockSpeed = clkspd;
i2td.I2C_Mode = I2C_Mode_I2C;
i2td.I2C_DutyCycle = I2C_DutyCycle_2;
i2td.I2C_OwnAddress1 = 0;
i2td.I2C_Ack = I2C_Ack_Enable;
i2td.I2C_AcknowledgedAddress = I2C_AcknowledgedAddress_7bit;
I2C_Init(pdef->i2c, &i2td);
I2C_Cmd(pdef->i2c, ENABLE);
}
开发者ID:matejx,项目名称:stm32f10x_lib,代码行数:38,代码来源:i2c.c
示例7: jump_to_app
void jump_to_app()
{
const struct pios_board_info *bdinfo = &pios_board_info_blob;
PIOS_LED_On(PIOS_LED_HEARTBEAT);
// Look at cm3_vectors struct in startup. In a fw image the first uint32_t contains the address of the top of irqstack
uint32_t fwIrqStackBase = (*(__IO uint32_t *)bdinfo->fw_base) & 0xFFFE0000;
// Check for the two possible irqstack locations (sram or core coupled sram)
if (fwIrqStackBase == 0x20000000 || fwIrqStackBase == 0x10000000) {
/* Jump to user application */
FLASH_Lock();
RCC_APB2PeriphResetCmd(0xffffffff, ENABLE);
RCC_APB1PeriphResetCmd(0xffffffff, ENABLE);
RCC_APB2PeriphResetCmd(0xffffffff, DISABLE);
RCC_APB1PeriphResetCmd(0xffffffff, DISABLE);
#ifdef PIOS_INCLUDE_USB
PIOS_USBHOOK_Deactivate();
#endif
JumpAddress = *(__IO uint32_t *)(bdinfo->fw_base + 4);
Jump_To_Application = (pFunction)JumpAddress;
/* Initialize user application's Stack Pointer */
__set_MSP(*(__IO uint32_t *)bdinfo->fw_base);
Jump_To_Application();
} else {
DeviceState = failed_jump;
return;
}
}
开发者ID:dibalavs,项目名称:OpenPilotPort,代码行数:30,代码来源:main.c
示例8: MPU6050_I2C_Init
/**
* @brief Initializes the I2C peripheral used to drive the MPU6050
* @param None
* @return None
*/
void MPU6050_I2C_Init()
{
I2C_InitTypeDef I2C_InitStructure;
GPIO_InitTypeDef GPIO_InitStructure;
/* Enable I2C and GPIO clocks */
RCC_APB1PeriphClockCmd(MPU6050_I2C_RCC_Periph, ENABLE);
RCC_AHB1PeriphClockCmd(MPU6050_I2C_RCC_Port, ENABLE);
RCC_APB1PeriphResetCmd ( RCC_APB1Periph_I2C1, ENABLE );
RCC_APB1PeriphResetCmd ( RCC_APB1Periph_I2C1, DISABLE );
/* Configure I2C pins: SCL and SDA */
GPIO_InitStructure.GPIO_Pin = MPU6050_I2C_SCL_Pin | MPU6050_I2C_SDA_Pin;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
GPIO_InitStructure.GPIO_OType = GPIO_OType_OD;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;// this activates the pullup resistors on the IO pins
GPIO_Init(MPU6050_I2C_Port, &GPIO_InitStructure);
/*
00099 #define I2Cx I2C1
00100 #define I2Cx_CLK RCC_APB1Periph_I2C1
00101 #define I2Cx_SDA_GPIO_CLK RCC_AHB1Periph_GPIOB
00102 #define I2Cx_SDA_PIN GPIO_Pin_9
00103 #define I2Cx_SDA_GPIO_PORT GPIOB
00104 #define I2Cx_SDA_SOURCE GPIO_PinSource9
00105 #define I2Cx_SDA_AF GPIO_AF_I2C1
00106
00107 #define I2Cx_SCL_GPIO_CLK RCC_AHB1Periph_GPIOB
00108 #define I2Cx_SCL_PIN GPIO_Pin_6
00109 #define I2Cx_SCL_GPIO_PORT GPIOB
00110 #define I2Cx_SCL_SOURCE GPIO_PinSource6
00111 #define I2Cx_SCL_AF GPIO_AF_I2C1
*/
/* Connect PXx to I2C_SCL */
GPIO_PinAFConfig ( GPIOB, GPIO_PinSource6 /*MPU6050_I2C_SCL_Pin*/, GPIO_AF_I2C1/*I2C1_SCL_AF*/);
/* Connect PXx to I2C_SDA */
GPIO_PinAFConfig ( GPIOB, GPIO_PinSource7 /*MPU6050_I2C_SDA_Pin*/, GPIO_AF_I2C1/*I2C1_SDA_AF*/);
/* I2C configuration */
I2C_InitStructure.I2C_Mode = I2C_Mode_I2C;
I2C_InitStructure.I2C_DutyCycle = I2C_DutyCycle_2;
I2C_InitStructure.I2C_OwnAddress1 = MPU6050_DEFAULT_ADDRESS; // MPU6050 7-bit adress = 0x68, 8-bit adress = 0xD0;
I2C_InitStructure.I2C_Ack = I2C_Ack_Enable;
I2C_InitStructure.I2C_AcknowledgedAddress = I2C_AcknowledgedAddress_7bit;
I2C_InitStructure.I2C_ClockSpeed = MPU6050_I2C_Speed;
/* Apply I2C configuration after enabling it */
I2C_Init(MPU6050_I2C, &I2C_InitStructure);
/* I2C Peripheral Enable */
I2C_Cmd(MPU6050_I2C, ENABLE);
}
开发者ID:skeezix,项目名称:shadowcar,代码行数:65,代码来源:MPU6050.c
示例9: IOE_GPIO_Config
/**
* @brief Initializes the GPIO pins used by the IO expander.
* @param None
* @retval None
*/
static void IOE_GPIO_Config(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
/* Enable IOE_I2C and IOE_I2C_PORT & Alternate Function clocks */
RCC_APB1PeriphClockCmd(RCC_APB1Periph_IOE_I2C, ENABLE);
RCC_APB2PeriphClockCmd(RCC_APB_IOE_I2C_PORT | RCC_APB_GPIO_IOE_ITPORT | RCC_APB2Periph_AFIO, ENABLE);
/* Reset IOE_I2C IP */
RCC_APB1PeriphResetCmd(RCC_APB1Periph_IOE_I2C, ENABLE);
/* Release reset signal of IOE_I2C IP */
RCC_APB1PeriphResetCmd(RCC_APB1Periph_IOE_I2C, DISABLE);
/* IOE_I2C SCL and SDA pins configuration */
GPIO_InitStructure.GPIO_Pin = IOE_SCL_PIN | IOE_SDA_PIN;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_10MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_OD;
GPIO_Init(IOE_I2C_PORT, &GPIO_InitStructure);
/* Set EXTI pin as Input PullUp - IO_Expander_INT */
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_IOE_ITPIN;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPU;
GPIO_Init(GPIO_IOE_ITPORT, &GPIO_InitStructure);
/* Connect IO Expander IT line to EXTI line */
GPIO_EXTILineConfig(GPIO_PortSource_IOE_ITPORT, GPIO_PinSource_IOE_ITPIN);
}
开发者ID:Nihilus89,项目名称:ECG,代码行数:33,代码来源:stm3210c_eval_ioe.c
示例10: init_I2C1_lowlevel
void init_I2C1_lowlevel(void)
{
GPIO_InitTypeDef GPIO_InitStruct;
I2C_InitTypeDef I2C_InitStruct;
RCC_APB1PeriphClockCmd(RCC_APB1Periph_I2C1, ENABLE);
RCC_APB1PeriphResetCmd(RCC_APB1Periph_I2C1, ENABLE);
RCC_APB1PeriphResetCmd(RCC_APB1Periph_I2C1, DISABLE);
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOB, ENABLE);
GPIO_InitStruct.GPIO_Pin = GPIO_Pin_6 | GPIO_Pin_7;
GPIO_InitStruct.GPIO_Mode = GPIO_Mode_AF;
GPIO_InitStruct.GPIO_Speed = GPIO_Speed_100MHz;
GPIO_InitStruct.GPIO_OType = GPIO_OType_OD;
GPIO_InitStruct.GPIO_PuPd = GPIO_PuPd_UP;
GPIO_Init(GPIOB, &GPIO_InitStruct);
GPIO_PinAFConfig(GPIOB, GPIO_PinSource6, GPIO_AF_I2C1); // SCL pini
GPIO_PinAFConfig(GPIOB, GPIO_PinSource7, GPIO_AF_I2C1); // SDA pini
/* detail????????????? */
I2C_InitStruct.I2C_ClockSpeed = 100000; //?????????????????????????
I2C_InitStruct.I2C_Mode = I2C_Mode_I2C; //??????????????????
I2C_InitStruct.I2C_DutyCycle = I2C_DutyCycle_2; //???????????????
I2C_InitStruct.I2C_OwnAddress1 = 0x00; //???????????????????????
I2C_InitStruct.I2C_Ack = I2C_Ack_Enable; //?????????????????????????????????????
I2C_InitStruct.I2C_AcknowledgedAddress = I2C_AcknowledgedAddress_7bit; //??????????????????????
I2C_Init(I2C1, &I2C_InitStruct);
I2C_Cmd(I2C1, ENABLE);
}
开发者ID:LindaLovelace,项目名称:quadcopter,代码行数:32,代码来源:I2C.c
示例11: SPI_I2S_DeInit
/**
* @brief Deinitializes the SPIx peripheral registers to their default
* reset values (Affects also the I2Ss).
* @param SPIx: where x can be 1, 2 or 3 to select the SPI peripheral.
* @retval None
*/
void SPI_I2S_DeInit(SPI_TypeDef* SPIx)
{
/* Check the parameters */
assert_param(IS_SPI_ALL_PERIPH(SPIx));
if (SPIx == SPI1)
{
/* Enable SPI1 reset state */
RCC_APB2PeriphResetCmd(RCC_APB2Periph_SPI1, ENABLE);
/* Release SPI1 from reset state */
RCC_APB2PeriphResetCmd(RCC_APB2Periph_SPI1, DISABLE);
}
else if (SPIx == SPI2)
{
/* Enable SPI2 reset state */
RCC_APB1PeriphResetCmd(RCC_APB1Periph_SPI2, ENABLE);
/* Release SPI2 from reset state */
RCC_APB1PeriphResetCmd(RCC_APB1Periph_SPI2, DISABLE);
}
else
{
if (SPIx == SPI3)
{
/* Enable SPI3 reset state */
RCC_APB1PeriphResetCmd(RCC_APB1Periph_SPI3, ENABLE);
/* Release SPI3 from reset state */
RCC_APB1PeriphResetCmd(RCC_APB1Periph_SPI3, DISABLE);
}
}
}
开发者ID:003900107,项目名称:wpa900-ai,代码行数:36,代码来源:stm32f10x_spi.c
示例12: CAN_DeInit
/*******************************************************************************
* 函数名称: CAN_DeInit
* 功能描述: D将CAN外设寄存器复位为它们的默认值
* 输入参数: 无.
* 输出参数: 无.
* 返回参数: 无.
*******************************************************************************/
void CAN_DeInit(void)
{
/* Enable CAN reset state */
RCC_APB1PeriphResetCmd(RCC_APB1Periph_CAN, ENABLE);
/* Release CAN from reset state */
RCC_APB1PeriphResetCmd(RCC_APB1Periph_CAN, DISABLE);
}
开发者ID:WrongChao,项目名称:lammbo-fly,代码行数:14,代码来源:stm32f10x_can.c
示例13: LCD_Deinit
/* deinitialize lcd */
void LCD_Deinit(void)
{
/* Enable LCD reset state */
RCC_APB1PeriphResetCmd(APB1_LCD, ENABLE);
/* Release LCD from reset state */
RCC_APB1PeriphResetCmd(APB1_LCD, DISABLE);
}
开发者ID:agent-0007,项目名称:H4ck33D,代码行数:8,代码来源:lcd.c
示例14: i2c_config
void i2c_config()
{
// RCC
/* Enable GPIOB clock */
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE);
RCC_APB1PeriphClockCmd(RCC_APB1Periph_I2C1, ENABLE);
// GPIO
GPIO_InitTypeDef GPIO_InitStructure;
/* Configure I2C1 pins: SCL and SDA */
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_6 | GPIO_Pin_7;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_OD;
GPIO_Init(GPIOB, &GPIO_InitStructure);
/* Enable I2C1 reset state */
RCC_APB1PeriphResetCmd(RCC_APB1Periph_I2C1, ENABLE);
/* Release I2C1 from reset state */
RCC_APB1PeriphResetCmd(RCC_APB1Periph_I2C1, DISABLE);
I2C_DeInit(I2C1);
// I2C
/* Enable I2C1 */
I2C_Cmd(I2C1, ENABLE);
I2C_InitStructure.I2C_Mode = I2C_Mode_I2C;
I2C_InitStructure.I2C_DutyCycle = I2C_DutyCycle_2;
I2C_InitStructure.I2C_OwnAddress1 = ID;
I2C_InitStructure.I2C_Ack = I2C_Ack_Enable;
I2C_InitStructure.I2C_AcknowledgedAddress = I2C_AcknowledgedAddress_7bit;
I2C_InitStructure.I2C_ClockSpeed = ClockSpeed;
I2C_Init(I2C1, &I2C_InitStructure);
I2C_GeneralCallCmd(I2C1, ENABLE);
/* Enable Event IT needed for ADDR and STOPF events ITs */
I2C_ITConfig(I2C1, I2C_IT_EVT, ENABLE);
/* Enable Error IT */
I2C_ITConfig(I2C1, I2C_IT_ERR, ENABLE);
/* Enable Buffer IT (TXE and RXNE ITs) */
I2C_ITConfig(I2C1, I2C_IT_BUF, ENABLE);
// NVIC
/* 1 bit for pre-emption priority, 3 bits for subpriority */
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_4);
NVIC_SetPriority(I2C1_EV_IRQn, 0x00);
NVIC_EnableIRQ(I2C1_EV_IRQn);
NVIC_SetPriority(I2C1_ER_IRQn, 0x01);
NVIC_EnableIRQ(I2C1_ER_IRQn);
}
开发者ID:alecjacobson,项目名称:puppet,代码行数:57,代码来源:i2c_functions.c
示例15: i2c_reset
void i2c_reset(i2c_t *obj) {
if (obj->i2c == I2C_1) {
RCC_APB1PeriphResetCmd(RCC_APB1Periph_I2C1, ENABLE);
RCC_APB1PeriphResetCmd(RCC_APB1Periph_I2C1, DISABLE);
}
if (obj->i2c == I2C_2) {
RCC_APB1PeriphResetCmd(RCC_APB1Periph_I2C2, ENABLE);
RCC_APB1PeriphResetCmd(RCC_APB1Periph_I2C2, DISABLE);
}
}
开发者ID:23chrischen,项目名称:mbed,代码行数:10,代码来源:i2c_api.c
示例16: I2C_Config
/**
* @brief Enables the I2C Clock and configures the different GPIO ports.
* @param None
* @retval None
*/
static void I2C_Config(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
NVIC_InitTypeDef NVIC_InitStructure;
/* RCC Configuration */
/*I2C Peripheral clock enable */
RCC_APB1PeriphClockCmd(I2Cx_CLK, ENABLE);
/*SDA GPIO clock enable */
RCC_AHB1PeriphClockCmd(I2Cx_SDA_GPIO_CLK, ENABLE);
/*SCL GPIO clock enable */
RCC_AHB1PeriphClockCmd(I2Cx_SCL_GPIO_CLK, ENABLE);
/* Reset I2Cx IP */
RCC_APB1PeriphResetCmd(I2Cx_CLK, ENABLE);
/* Release reset signal of I2Cx IP */
RCC_APB1PeriphResetCmd(I2Cx_CLK, DISABLE);
/* GPIO Configuration */
/*Configure I2C SCL pin */
GPIO_InitStructure.GPIO_Pin = I2Cx_SCL_PIN;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_OType = GPIO_OType_OD;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_Init(I2Cx_SCL_GPIO_PORT, &GPIO_InitStructure);
/*Configure I2C SDA pin */
GPIO_InitStructure.GPIO_Pin = I2Cx_SDA_PIN;
GPIO_Init(I2Cx_SDA_GPIO_PORT, &GPIO_InitStructure);
/* Connect PXx to I2C_SCL */
GPIO_PinAFConfig(I2Cx_SCL_GPIO_PORT, I2Cx_SCL_SOURCE, I2Cx_SCL_AF);
/* Connect PXx to I2C_SDA */
GPIO_PinAFConfig(I2Cx_SDA_GPIO_PORT, I2Cx_SDA_SOURCE, I2Cx_SDA_AF);
/* NVIC configuration */
/* Configure the Priority Group to 1 bit */
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);
/* Configure the I2C event priority */
NVIC_InitStructure.NVIC_IRQChannel = I2Cx_EV_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
/* Configure I2C error interrupt to have the higher priority */
NVIC_InitStructure.NVIC_IRQChannel = I2Cx_ER_IRQn;
NVIC_Init(&NVIC_InitStructure);
}
开发者ID:szymon2103,项目名称:Stm32,代码行数:60,代码来源:main.c
示例17: Delay_Init
/*
函数功能:定时器6延时函数初始化
*/
void Delay_Init(void)
{
/*开始定时器6时钟*/
RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM6, ENABLE);
/*复位定时器6状态*/
RCC_APB1PeriphResetCmd(RCC_APB1Periph_TIM6, ENABLE);
RCC_APB1PeriphResetCmd(RCC_APB1Periph_TIM6, DISABLE);
/*关闭定时器6*/
TIM_Cmd(TIM6, DISABLE);
}
开发者ID:aiqin139company,项目名称:STM32-Order-System,代码行数:15,代码来源:delay.c
示例18: LPTIM_DeInit
/**
* @brief Deinitializes the LPTIMx peripheral registers to their default reset values.
* @param LPTIMx: where x can be 1.
* @retval None
*
*/
void LPTIM_DeInit(LPTIM_TypeDef* LPTIMx)
{
/* Check the parameters */
assert_param(IS_LPTIM_ALL_PERIPH(LPTIMx));
/* Deinitializes the LPTIM1 peripheral */
if(LPTIMx == LPTIM1)
{
RCC_APB1PeriphResetCmd(RCC_APB1Periph_LPTIM1, ENABLE);
RCC_APB1PeriphResetCmd(RCC_APB1Periph_LPTIM1, DISABLE);
}
}
开发者ID:Grigoryan1,项目名称:Test-Project,代码行数:18,代码来源:stm32f4xx_lptim.c
示例19: s_hal_spi_hw_init
static void s_hal_spi_hw_init(hal_spi_t id)
{
#if defined(HAL_USE_CPU_FAM_STM32F1) || defined(HAL_USE_CPU_FAM_STM32F4)
//uint32_t RCC_APB1Periph_SPIx = (hal_spi1 == id) ? (RCC_APB1Periph_SPI1) : (RCC_APB1Periph_SPI2); RCC_APB1Periph_SPI3
if(hal_spi1 == id)
{
// spi periph clock enable
RCC_APB2PeriphClockCmd(RCC_APB2Periph_SPI1, ENABLE);
// the reset and exit from reset is also done by SPI_I2S_DeInit() ..... thus it can be removed from here
// reset spi periph
RCC_APB2PeriphResetCmd(RCC_APB2Periph_SPI1, ENABLE);
// release reset
RCC_APB2PeriphResetCmd(RCC_APB2Periph_SPI1, DISABLE);
}
else
{
uint32_t RCC_APB1Periph_SPIx = s_hal_spi_hw_rcc[HAL_spi_id2index(id)];
// spi periph clock enable
RCC_APB1PeriphClockCmd(RCC_APB1Periph_SPIx, ENABLE);
// the reset and exit from reset is also done by SPI_I2S_DeInit() ..... thus it can be removed from here
// reset spi periph
RCC_APB1PeriphResetCmd(RCC_APB1Periph_SPIx, ENABLE);
// release reset
RCC_APB1PeriphResetCmd(RCC_APB1Periph_SPIx, DISABLE);
}
// // // system configuration controller clock
// #warning --> in stm32f4 removed "RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE);" from spi_hw_init() and it still works....
// // RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE);
//
// // spi periph clock enable
// RCC_APB1PeriphClockCmd(RCC_APB1Periph_SPIx, ENABLE);
//
// // reset spi periph
// RCC_APB1PeriphResetCmd(RCC_APB1Periph_SPIx, ENABLE);
//
// // release reset
// RCC_APB1PeriphResetCmd(RCC_APB1Periph_SPIx, DISABLE);
#else //defined(HAL_USE_CPU_FAM_*)
#error ERR --> choose a HAL_USE_CPU_FAM_*
#endif
}
开发者ID:Tarintote,项目名称:icub-firmware,代码行数:51,代码来源:hal_periph_spi.with.dma.c
示例20: init_SPI
void init_SPI(int spi_number){
SPI_InitTypeDef SPI_InitTypeDefStruct;
//SPI1 initialisieren
//Program the Polarity, Phase, First Data, Baud Rate Prescaler, Slave
//Management, Peripheral Mode and CRC Polynomial values
SPI_InitTypeDefStruct.SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_16;
SPI_InitTypeDefStruct.SPI_Direction = SPI_Direction_2Lines_FullDuplex;//bidirectional for read and write
SPI_InitTypeDefStruct.SPI_Mode = SPI_Mode_Master;//als master
SPI_InitTypeDefStruct.SPI_DataSize = SPI_DataSize_8b;
SPI_InitTypeDefStruct.SPI_NSS = SPI_NSS_Soft;//Chip select to Software
SPI_InitTypeDefStruct.SPI_FirstBit = SPI_FirstBit_MSB;
SPI_InitTypeDefStruct.SPI_CPOL = SPI_CPOL_High;//clock auf steigende Flanke?
SPI_InitTypeDefStruct.SPI_CPHA = SPI_CPHA_2Edge;
//Enable peripheral clock
switch(spi_number){
case SPI_1:
RCC_APB2PeriphClockCmd(RCC_APB2Periph_SPI1, ENABLE);// for SPI1
//SPI1 mit struct initialisieren
SPI_Init(SPI1, &SPI_InitTypeDefStruct);
SPI_Cmd(SPI1, ENABLE);
break;
case SPI_2:
RCC_APB1PeriphClockCmd(RCC_APB1Periph_SPI2, ENABLE);// for SPI2
SPI_Init(SPI2, &SPI_InitTypeDefStruct);
SPI_Cmd(SPI2, ENABLE);
break;
case SPI_3:
RCC_APB1PeriphResetCmd(RCC_APB1Periph_SPI3, ENABLE);// for SPI3
SPI_Init(SPI3, &SPI_InitTypeDefStruct);
SPI_Cmd(SPI3, ENABLE);
break;
case SPI_4:
RCC_APB1PeriphResetCmd(RCC_APB1Periph_SPI3, ENABLE);// for SPI4
SPI_Init(SPI4, &SPI_InitTypeDefStruct);
SPI_Cmd(SPI4, ENABLE);
break;
case SPI_5:
RCC_APB1PeriphResetCmd(RCC_APB1Periph_SPI3, ENABLE);// for SPI5
SPI_Init(SPI5, &SPI_InitTypeDefStruct);
SPI_Cmd(SPI5, ENABLE);
break;
case SPI_6:
RCC_APB1PeriphResetCmd(RCC_APB1Periph_SPI3, ENABLE);// for SPI6
SPI_Init(SPI6, &SPI_InitTypeDefStruct);
SPI_Cmd(SPI6, ENABLE);
break;
}
}
开发者ID:EAH-Jena,项目名称:asuromote,代码行数:49,代码来源:SPI.c
注:本文中的RCC_APB1PeriphResetCmd函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论