• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ CLK_PeripheralClockConfig函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中CLK_PeripheralClockConfig函数的典型用法代码示例。如果您正苦于以下问题:C++ CLK_PeripheralClockConfig函数的具体用法?C++ CLK_PeripheralClockConfig怎么用?C++ CLK_PeripheralClockConfig使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了CLK_PeripheralClockConfig函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: sEE_LowLevel_Init

/**
  * @brief  Initializes peripherals used by the I2C EEPROM driver.
  * @param  None
  * @retval None
  */
void sEE_LowLevel_Init(void)
{
  /*!< sEE_I2C Periph clock enable */
  CLK_PeripheralClockConfig(sEE_I2C_CLK, ENABLE);

  /*!< Enable the DMA clock */
  CLK_PeripheralClockConfig(CLK_Peripheral_DMA1, ENABLE);

  /* I2C TX DMA Channel configuration */
  DMA_DeInit(sEE_I2C_DMA_CHANNEL_TX);
  DMA_Init(sEE_I2C_DMA_CHANNEL_TX,
           0, /* This parameter will be configured durig communication */
           sEE_I2C_DR_Address,
           0xFF, /* This parameter will be configured durig communication */
           DMA_DIR_PeripheralToMemory,/* This parameter will be configured durig communication */
           DMA_Mode_Normal,
           DMA_MemoryIncMode_Inc,
           DMA_Priority_VeryHigh,
           DMA_MemoryDataSize_Byte);

  /* I2C RX DMA Channel configuration */
  DMA_DeInit(sEE_I2C_DMA_CHANNEL_RX);
  DMA_Init(sEE_I2C_DMA_CHANNEL_RX, 0, /* This parameter will be configured durig communication */
           sEE_I2C_DR_Address,
           0xFF, /* This parameter will be configured durig communication */
           DMA_DIR_PeripheralToMemory,/* This parameter will be configured durig communication */
           DMA_Mode_Normal,
           DMA_MemoryIncMode_Inc,
           DMA_Priority_VeryHigh,
           DMA_MemoryDataSize_Byte);


}
开发者ID:fm0597,项目名称:WSN_NodeDriver,代码行数:38,代码来源:stm8l1528_eval.c


示例2: Halt_Init

/**
  * @brief This function initializes in Ultra Low Power mode, 
	*				disable the LCD, LSE and configures the unused IOs 
	*				in output push-pull
	* @caller main and ADC_Icc_Test
  * @param None
  * @retval None
  */ 
void Halt_Init(void)
{

/* Set STM8 in low power */
  PWR->CSR2 = 0x2;
  
  LCD_Cmd(DISABLE);

  /* To wait LCD disable */
  while ((LCD->CR3 & 0x40) != 0x00);
  
/* Set GPIO in low power*/	
  GPIO_LowPower_Config();
  
/* Stop RTC Source clock */
  CLK_RTCClockConfig(CLK_RTCCLKSource_Off, CLK_RTCCLKDiv_1);
  
  #ifdef USE_LSE
    CLK_LSEConfig(CLK_LSE_OFF);
    while ((CLK->ECKCR & 0x04) != 0x00);
  #else
    CLK_LSICmd(DISABLE);
    while ((CLK->ICKCR & 0x04) != 0x00);
  #endif
  
  /* Stop clock RTC and LCD */ 	
  CLK_PeripheralClockConfig(CLK_Peripheral_RTC, DISABLE);
  CLK_PeripheralClockConfig(CLK_Peripheral_LCD, DISABLE);
}
开发者ID:david1mdavis,项目名称:SnapOnControls,代码行数:37,代码来源:vcc_measure.c


示例3: main

/*主程序*/
void main()
{	
	CLK_Config();

	CLK_PeripheralClockConfig(CLK_PERIPHERAL_TIMER2, ENABLE);	
	CLK_PeripheralClockConfig(CLK_PERIPHERAL_TIMER3, ENABLE);	

	/* Check if the system has resumed from IWDG reset */
	if (RST_GetFlagStatus(RST_FLAG_IWDGF) != RESET)
	{
	  /* Clear IWDGF Flag */
	  RST_ClearFlag(RST_FLAG_IWDGF);
	}
	
	/*通信串口初始化*/
	DBG_Config();
	
	IR_Init();
	
	printf("starting...\n");

	/*打开全局中断*/
	enableInterrupts();    

	while (1)
	{
		IR_Process();
	}
		
}
开发者ID:chalot,项目名称:360_MBoard,代码行数:31,代码来源:main.c


示例4: sampleADC

char sampleADC(void)
{
    char res = 0x0;

    CLK_PeripheralClockConfig(CLK_Peripheral_ADC1, ENABLE);
    ADC_DeInit(ADC1);

    ADC_VrefintCmd(ENABLE);
    delay_10us(3);

    ADC_Cmd(ADC1, ENABLE);
    ADC_Init(ADC1, ADC_ConversionMode_Single,
             ADC_Resolution_6Bit, ADC_Prescaler_1);

    ADC_SamplingTimeConfig(ADC1, ADC_Group_SlowChannels, ADC_SamplingTime_9Cycles);
    ADC_ChannelCmd(ADC1, ADC_Channel_0, ENABLE);
    delay_10us(3);

    ADC_SoftwareStartConv(ADC1);
    while( ADC_GetFlagStatus(ADC1, ADC_FLAG_EOC) == 0);
    res = (char)ADC_GetConversionValue(ADC1);

    ADC_VrefintCmd(DISABLE);
    ADC_DeInit(ADC1);

    /* disable SchmittTrigger for ADC_Channel_24, to save power */
    //ADC_SchmittTriggerConfig(ADC1, ADC_Channel_24, DISABLE);

    CLK_PeripheralClockConfig(CLK_Peripheral_ADC1, DISABLE);
    ADC_ChannelCmd(ADC1, ADC_Channel_0, DISABLE);

    return res;
}
开发者ID:david1mdavis,项目名称:SnapOnControls,代码行数:33,代码来源:main.c


示例5: ADC_Config

void ADC_Config(void)
{
	CLK_PeripheralClockConfig(CLK_Peripheral_ADC1, ENABLE);
	CLK_PeripheralClockConfig(CLK_Peripheral_DMA1, ENABLE);
	
	ADC_Init(ADC1, ADC_ConversionMode_Continuous, ADC_Resolution_12Bit, ADC_Prescaler_2);
	ADC_SamplingTimeConfig(ADC1, ADC_Group_SlowChannels, ADC_SamplingTime_384Cycles);
	ADC_Cmd(ADC1, ENABLE);
	
	ADC_ChannelCmd(ADC1, ADC_Channel_24, ENABLE); //设置ADC通道
	
	SYSCFG_REMAPDMAChannelConfig(REMAP_DMA1Channel_ADC1ToChannel0);
	
	DMA_Init(DMA1_Channel0, 
		BUFFER_ADDRESS,
		ADC1_DR_ADDRESS,
		BUFFER_SIZE,
		DMA_DIR_PeripheralToMemory,
		DMA_Mode_Circular,
		DMA_MemoryIncMode_Inc,
		DMA_Priority_High,
		DMA_MemoryDataSize_HalfWord);
	
	DMA_Cmd(DMA1_Channel0, ENABLE);
	DMA_ITConfig(DMA1_Channel0, DMA_ITx_TC, ENABLE);
	DMA_GlobalCmd(ENABLE);
}        
开发者ID:devinzhang91,项目名称:TinyECG,代码行数:27,代码来源:adc.c


示例6: delay_ms

/**
  * @brief  delay for some time in ms unit
  * @param  n_ms is how many ms of time to delay
  * @retval None
  */
void delay_ms(u16 n_ms)
{
/* Init TIMER 4 */
  CLK_PeripheralClockConfig(CLK_Peripheral_TIM4, ENABLE);

/* Init TIMER 4 prescaler: TIM4_Prescaler_1: 38KHz / 1 = 38KHz */
  TIM4->PSCR = 0;

/* LSI 38KHz --> Auto-Reload value: 38KHz / 1 = 38KHz, 38KHz / 1k = 38 */
  TIM4->ARR = 38;
  
/* Counter value: 4, to compensate the initialization of TIMER*/
    
  TIM4->CNTR = 4;  //value may have to be changed

/* clear update flag */
  TIM4->SR1 &= (u8)(~TIM4_FLAG_Update);

/* Enable Counter */
  TIM4->CR1 |= TIM4_CR1_CEN;

  while(n_ms--)
  {
    while((TIM4->SR1 & TIM4_FLAG_Update) == 0);
    TIM4->SR1 &= (u8)(~TIM4_FLAG_Update);
  }

/* Disable Counter */
  TIM4->CR1 &= (u8)(~TIM4_CR1_CEN);
  CLK_PeripheralClockConfig(CLK_Peripheral_TIM4, DISABLE);
}
开发者ID:cristi85,项目名称:PCRemote,代码行数:36,代码来源:delay.c


示例7: delay_ms

/**
  * @brief  delay for some time in ms unit
  * @caller auto_test
  * @param  n_ms is how many ms of time to delay
  * @retval None
  */
static void delay_ms(u16 n_ms)
{
	/* Init TIMER 4 */
	CLK_PeripheralClockConfig(CLK_Peripheral_TIM2, ENABLE);

	/* Init TIMER 4 prescaler: / (2^6) = /64 */
	TIM2->PSCR = 6;

	/* HSI div by 1 --> Auto-Reload value: 16M / 64 = 1/4M, 1/4M / 1k = 250*/
	TIM2->ARRH = 0;
	TIM2->ARRL = 250;

	/* Counter value: 2, to compensate the initialization of TIMER*/

	TIM2->CNTRH = 0;
	TIM2->CNTRL = 2;

	/* clear update flag */
	TIM2->SR1 &= ~TIM_SR1_UIF;

	/* Enable Counter */
	TIM2->CR1 |= TIM_CR1_CEN;

	while(n_ms--)
	{
	while((TIM2->SR1 & TIM_SR1_UIF) == 0) ;
	TIM2->SR1 &= ~TIM_SR1_UIF;
	}

	/* Disable Counter */
	TIM2->CR1 &= ~TIM_CR1_CEN;
	CLK_PeripheralClockConfig(CLK_Peripheral_TIM2, DISABLE);
}
开发者ID:alex-altay,项目名称:smartchair,代码行数:39,代码来源:delay.c


示例8: delay_10us

/**
  * @brief  delay for some time in 10us unit(partial accurate)
  * @caller auto_test
  * @param n_10us is how many 10us of time to delay
  * @retval None
  */
static void delay_10us(u16 n_10us)
{
	/* Init TIMER 4 */
	CLK_PeripheralClockConfig(CLK_Peripheral_TIM2, ENABLE);

	/* prescaler: / (2^0) = /1 */
	TIM2->PSCR = 0;

	/* SYS_CLK_HSI_DIV1 Auto-Reload value: 16M / 1 = 16M, 16M / 100k = 160 */
	TIM2->ARRH = 0;
	TIM2->ARRL = 160;

	/* Counter value: 10, to compensate the initialization of TIMER */
	TIM2->CNTRH = 0;
	TIM2->CNTRL = 10;

	/* clear update flag */
	TIM2->SR1 &= ~TIM_SR1_UIF;

	/* Enable Counter */
	TIM2->CR1 |= TIM_CR1_CEN;

	while(n_10us--)
	{
		while((TIM2->SR1 & TIM_SR1_UIF) == 0) ;
		TIM2->SR1 &= ~TIM_SR1_UIF;
	}

	/* Disable Counter */
	TIM2->CR1 &= ~TIM_CR1_CEN;
	CLK_PeripheralClockConfig(CLK_Peripheral_TIM2, DISABLE);

}
开发者ID:alex-altay,项目名称:smartchair,代码行数:39,代码来源:delay.c


示例9: Delay_Seconds

/**
  * @brief  Delay x sec
  * @param  Seconds : number of seconds to delay
  * @retval None.
  * Note : TIM4 is configured for a system clock = 2MHz
  */
void Delay_Seconds(uint8_t Seconds)
{
  uint8_t i = 0;

  /* Enable TIM4 Clock */
  CLK_PeripheralClockConfig(CLK_Peripheral_TIM4, ENABLE);

  /* Configure TIM4 to generate an update event each 1 s */
  TIM4_TimeBaseInit(TIM4_Prescaler_16384, 123);

  /* Enable TIM4 */
  TIM4_Cmd(ENABLE);

  /* Clear the Flag */
  TIM4_ClearFlag(TIM4_FLAG_Update);

  for (i = 0; i < Seconds; i++)
  {
    /* Wait 1 sec */
    while ( TIM4_GetFlagStatus(TIM4_FLAG_Update) == RESET )
    {}

    /* Clear the Flag */
    TIM4_ClearFlag(TIM4_FLAG_Update);
  }

  /* Disable TIM4 */
  TIM4_Cmd(DISABLE);

  /* Disable TIM4 Clock */
  CLK_PeripheralClockConfig(CLK_Peripheral_TIM4, DISABLE);
}
开发者ID:glockwork,项目名称:ev-stm8l151k6-emotor,代码行数:38,代码来源:main.c


示例10: CLK_Config

/**
  * @brief  Configure peripherals clock 
  * @param  None
  * @retval None
  */
static void CLK_Config(void)
{
  /* Enable ADC1 clock */
  CLK_PeripheralClockConfig(CLK_Peripheral_ADC1, ENABLE);
  
  /* Enable COMP clock */
  CLK_PeripheralClockConfig(CLK_Peripheral_COMP, ENABLE);
}
开发者ID:avr-master,项目名称:Healty_Beck,代码行数:13,代码来源:main.c


示例11: CLK_Config

/**
  * @brief  Configure peripherals Clock   
  * @param  None
  * @retval None
  */
static void CLK_Config(void)
{
  /* Enable TIM1 clock */
  CLK_PeripheralClockConfig(CLK_Peripheral_TIM1, ENABLE);
  /* Enable TIM2 clock */
  CLK_PeripheralClockConfig(CLK_Peripheral_TIM2, ENABLE);
  /* Enable TIM3 clock */
  CLK_PeripheralClockConfig(CLK_Peripheral_TIM3, ENABLE);
}
开发者ID:glockwork,项目名称:ev-stm8l151k6-emotor,代码行数:14,代码来源:main.c


示例12: ADC_Supply

/**
  * @brief  Read ADC1
	* @caller several functions
  * @param None
  * @retval ADC value
  */ 
u16 ADC_Supply(void)
{
	uint8_t i;
	uint16_t res;

/* Enable ADC clock */
  CLK_PeripheralClockConfig(CLK_Peripheral_ADC1, ENABLE);

/* de-initialize ADC */
  ADC_DeInit(ADC1);

/*ADC configuration
  ADC configured as follow:
  - Channel VREF
  - Mode = Single ConversionMode(ContinuousConvMode disabled)
  - Resolution = 12Bit
  - Prescaler = /1
  - sampling time 9 */
  
  ADC_VrefintCmd(ENABLE);
  delay_10us(3);
  
  
  ADC_Cmd(ADC1, ENABLE);	 
  ADC_Init(ADC1, ADC_ConversionMode_Single,
  ADC_Resolution_12Bit, ADC_Prescaler_1);
  
  ADC_SamplingTimeConfig(ADC1, ADC_Group_FastChannels, ADC_SamplingTime_9Cycles);
  ADC_ChannelCmd(ADC1, ADC_Channel_Vrefint, ENABLE);
  delay_10us(3);

/* initialize result */
  res = 0;
  for(i=8; i>0; i--)
  {
/* start ADC convertion by software */
    ADC_SoftwareStartConv(ADC1);
/* wait until end-of-covertion */
    while( ADC_GetFlagStatus(ADC1, ADC_FLAG_EOC) == 0 );
/* read ADC convertion result */
    res += ADC_GetConversionValue(ADC1);
  }
	
/* de-initialize ADC */
  ADC_VrefintCmd(DISABLE);

  ADC_DeInit(ADC1);
 
 /* disable SchmittTrigger for ADC_Channel_24, to save power */
  ADC_SchmittTriggerConfig(ADC1, ADC_Channel_24, DISABLE);
	
  CLK_PeripheralClockConfig(CLK_Peripheral_ADC1, DISABLE);
  ADC_ChannelCmd(ADC1, ADC_Channel_Vrefint, DISABLE);
	
  return (res>>3);
}
开发者ID:david1mdavis,项目名称:SnapOnControls,代码行数:62,代码来源:vcc_measure.c


示例13: Battery_Int_Measure

void Battery_Int_Measure(float * p_bat_voltage)
{
	float voltage_shift = 0;
	float voltage_VCC = 0;
	
	#ifdef BATTERY_DEBUG
		printf("[Battery] Start measuring battery ...\r\n");
	#endif

	result = 0;
	GPIO_Init(GPIO_PORT_ADC_OUT, GPIO_PIN_ADC_OUT, GPIO_Mode_Out_PP_High_Fast);
	GPIO_Init(GPIO_PORT_VTEST_5V, GPIO_PIN_VTEST_5V, GPIO_Mode_In_FL_No_IT);

	/* Enable ADC1 clock */
    CLK_PeripheralClockConfig(CLK_Peripheral_ADC1, ENABLE);

    ADC_Config();

    /* Infinite loop*/
    for(uint8_t i = 0;i < BUFFER_SIZE;i ++)
    {
        /* Start ADC1 Conversion using Software trigger*/
        ADC_SoftwareStartConv(ADC1);

        /* Wait until ADC Channel 15 end of conversion */
        while (ADC_GetFlagStatus(ADC1, ADC_FLAG_EOC) == RESET)
        {}
        
        /* read ADC convertion result */
        adc_value[i] = ADC_GetConversionValue(ADC1);
		result += adc_value[i];
    }

	voltage_shift = (result * 3.6) / (BUFFER_SIZE * 4096);
	voltage_VCC = (voltage_shift * (BAT_INT_SHIFT_PULLDOWN_RES + BAT_INT_SHIFT_PULLUP_RES)) / BAT_INT_SHIFT_PULLDOWN_RES;

	/* Disable ADC1 */
    ADC_Cmd(ADC1, DISABLE);

	/* Disable ADC1 clock */
    CLK_PeripheralClockConfig(CLK_Peripheral_ADC1, DISABLE);
	
	GPIO_Init(GPIO_PORT_ADC_OUT, GPIO_PIN_ADC_OUT, GPIO_Mode_Out_PP_Low_Fast);
	GPIO_Init(GPIO_PORT_VTEST_5V, GPIO_PIN_VTEST_5V, GPIO_Mode_Out_PP_Low_Fast);

	*p_bat_voltage = voltage_VCC;
	
	#ifdef BATTERY_DEBUG
		for (uint8_t i = 0; i < BUFFER_SIZE; i++)
        {
            printf("[Battery] voltage is 0x%04x\r\n",adc_value[i]);
		}
	#endif
}
开发者ID:glocklueng,项目名称:SmartAmmeter_STM8L,代码行数:54,代码来源:battery.c


示例14: CLK_Config

/**
  * @brief  Configure peripherals clock 
  * @param  None
  * @retval None
  */
static void CLK_Config(void)
{
  /* Enable ADC1 clock */
  CLK_PeripheralClockConfig(CLK_Peripheral_ADC1, ENABLE);

  /* Enable TIM1 clock */
  CLK_PeripheralClockConfig(CLK_Peripheral_TIM1, ENABLE);

  /* Enable DMA1 clock */
  CLK_PeripheralClockConfig(CLK_Peripheral_DMA1, ENABLE);
}
开发者ID:avr-master,项目名称:Healty_Beck,代码行数:16,代码来源:main.c


示例15: I2C_RTC_Init

/*
名称: void I2C_RTC_Init(void)
功能: 硬件IIC初始化
形参: 无
返回值:无
*/ 
void IIC_RTC_Init(void)
{
  I2C_Cmd(DISABLE);
  I2C_DeInit();
  CLK_PeripheralClockConfig(CLK_PERIPHERAL_I2C, DISABLE);
  GPIO_Init(GPIOE, GPIO_PIN_1, GPIO_MODE_IN_PU_NO_IT);
  GPIO_Init(GPIOE, GPIO_PIN_2, GPIO_MODE_IN_PU_NO_IT);
  CLK_PeripheralClockConfig(CLK_PERIPHERAL_I2C, ENABLE);
  I2C_Cmd( ENABLE);
  I2C_Init(400000, 0xA0, I2C_DUTYCYCLE_2, I2C_ACK_CURR, 
           I2C_ADDMODE_7BIT, 16);
}
开发者ID:glockwork,项目名称:stm8s_project,代码行数:18,代码来源:iic_rt8563.c


示例16: LCD_HardwareInit

void LCD_HardwareInit(void)
{
  unsigned long segments = S8 | S9 | S10 | S11 | S12 | S13 | S14 | S15 | S16 | S17 | S18 | S19;
  CLK_RTCClockConfig(CLK_RTCCLKSource_LSI, CLK_RTCCLKDiv_2);
  CLK_PeripheralClockConfig(CLK_Peripheral_RTC, ENABLE);
  
  CLK_PeripheralClockConfig(CLK_Peripheral_LCD, ENABLE);
  LCD_Init(LCD_Prescaler_4, LCD_Divider_24, LCD_Duty_1_3, LCD_Bias_1_3, LCD_VoltageSource_External);
  LCD_PortMaskConfig(LCD_PortMaskRegister_1, (uint8_t)(segments >> 8));
  LCD_PortMaskConfig(LCD_PortMaskRegister_2, (uint8_t)(segments >> 16));
  LCD_PortMaskConfig(LCD_PortMaskRegister_3, (uint8_t)(segments >> 24));
  LCD_PulseOnDurationConfig(LCD_PulseOnDuration_0);
  LCD_ContrastConfig(LCD_Contrast_Level_7);
  LCD_Cmd(ENABLE);
}
开发者ID:nikitakonan,项目名称:Meteo_STM8L152,代码行数:15,代码来源:68ps_display.c


示例17: User_WriteFirmwareVersion

/**
  * @brief this function checks if a NDEF message is available in the M24LR04E-R EEPROM
	* @par PayloadLength : the number of byte of the NDEF message
  * @retval SUCCESS : A NDEF message has been found
	* @retval ERROR :  a NDEF message doens't have been found
  */
static int8_t User_WriteFirmwareVersion ( void )			
{
uint8_t *OneByte = 0x00;
uint16_t WriteAddr = 0x01FC;				
	
		
	M24LR04E_Init();
		
	M24LR04E_WriteOneByte (M24LR16_EEPROM_ADDRESS_USER, WriteAddr++, FirmwareVersion [0]);			

	
	I2C_Cmd(M24LR04E_I2C, DISABLE);			
		
	CLK_PeripheralClockConfig(CLK_Peripheral_I2C1, DISABLE);	
	
	GPIO_HIGH(M24LR04E_I2C_SCL_GPIO_PORT,M24LR04E_I2C_SCL_PIN);	
	GPIO_HIGH(M24LR04E_I2C_SCL_GPIO_PORT,M24LR04E_I2C_SDA_PIN);	
		
		
	M24LR04E_DeInit();
	I2C_Cmd(M24LR04E_I2C, DISABLE);
	
	
	return SUCCESS;
}
开发者ID:david1mdavis,项目名称:sam3s-demo-source,代码行数:31,代码来源:main.c


示例18: TIM2_Config

static void TIM2_Config(void)
{
  /* Enable TIM2 CLK */
  CLK_PeripheralClockConfig(CLK_Peripheral_TIM2, ENABLE);
  
  /* Capture only every 8 events!!! */
  /* Enable capture of TIM2 */
  TIM2_ICInit(TIM2_Channel_1, TIM2_ICPolarity_Falling, TIM2_ICSelection_DirectTI, TIM2_ICPSC_Div8, 0);
  
  /* Enable timer1 */
  TIM2_Cmd(ENABLE);
  
  /* Config Channel 1 pin*/
  GPIO_Init(GPIOB, GPIO_Pin_0, GPIO_Mode_In_PU_No_IT);

  /* Clear CC1 Flag*/
  TIM2_ClearFlag(TIM2_FLAG_CC1);
  
  /* wait a Capture on CC1 */
  while((TIM2->SR1 & TIM2_FLAG_CC1) != TIM2_FLAG_CC1);
  
  /* Get CCR1 value*/
  ICValue1 = TIM2_GetCapture1();
  /* Clear CC1 Flag*/
  TIM2_ClearFlag(TIM2_FLAG_CC1);
  
  /* wait a capture on cc1 */
  while((TIM2->SR1 & TIM2_FLAG_CC1) != TIM2_FLAG_CC1);
  /* Get CCR1 value*/
  ICValue2 = TIM2_GetCapture1();
  TIM2_ClearFlag(TIM2_FLAG_CC1); 
}
开发者ID:rijn,项目名称:HardwareWorks,代码行数:32,代码来源:main.c


示例19: ADC_Icc_Init

/**
  * @brief ADC_Icc(ADC_24 of ADC_0~27) initialization
	* @caller main and ADC_Icc_Test
  * @param None
  * @retval None
  */ 
void ADC_Icc_Init(void)
{

/* Enable ADC clock */
  CLK_PeripheralClockConfig(CLK_Peripheral_ADC1, ENABLE);

/* de-initialize ADC */
  ADC_DeInit(ADC1);
	
/*  ADC configured as follow:
  - NbrOfChannel = 1 - ADC_Channel_24
  - Mode = Single ConversionMode(ContinuousConvMode disabled)
  - Resolution = 12Bit
  - Prescaler = /1
  - sampling time 159 */
	
/* Enable ADC1 */
  ADC_Cmd(ADC1, ENABLE);
  ADC_Init(ADC1, ADC_ConversionMode_Single,ADC_Resolution_12Bit, ADC_Prescaler_1);

  ADC_SamplingTimeConfig(ADC1, ADC_Group_FastChannels, ADC_SamplingTime_9Cycles);
  ADC_ChannelCmd(ADC1, ADC_Channel_24, ENABLE);

/* disable SchmittTrigger for ADC_Channel_24, to save power */
  ADC_SchmittTriggerConfig(ADC1, ADC_Channel_24, DISABLE);

/* a short time of delay is required after enable ADC */
  delay_10us(3);
	
}
开发者ID:Montanari9,项目名称:TreinamentoSTM8L,代码行数:36,代码来源:icc_measure.c


示例20: main

/**
  * @brief  Main program.
  * @param  None
  * @retval None
  */
void main(void)
{
    /* I2C  clock Enable*/
    CLK_PeripheralClockConfig(CLK_Peripheral_I2C, ENABLE);

    /* system_clock / 1 */
    CLK_MasterPrescalerConfig(CLK_MasterPrescaler_HSIDiv1);

    /* Initialize LEDs mounted on the EVAL board */
    STM_EVAL_LEDInit(LED2);
    STM_EVAL_LEDInit(LED3);

    I2C_DeInit();
    /* Initialize I2C peripheral */

#ifdef I2C_slave_7Bits_Address
    I2C_Init(100000, SLAVE_ADDRESS, I2C_DutyCycle_2, I2C_Ack_Enable,
             I2C_AcknowledgedAddress_7bit);
#else
    I2C_Init(100000, SLAVE_ADDRESS, I2C_DutyCycle_2, I2C_Ack_Enable,
             I2C_AcknowledgedAddress_10bit);
#endif

    /* Enable Error Interrupt*/
    I2C_ITConfig((I2C_IT_TypeDef)(I2C_IT_ERR | I2C_IT_EVT | I2C_IT_BUF), ENABLE);

    /* Enable general interrupts */
    enableInterrupts();

    /*Main Loop */
    while (1)
    {
        /* infinite loop */
    }
}
开发者ID:rijn,项目名称:HardwareWorks,代码行数:40,代码来源:main.c



注:本文中的CLK_PeripheralClockConfig函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ CLK_SetHCLK函数代码示例发布时间:2022-05-30
下一篇:
C++ CLK_EnableXtalRC函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap