| 전자부품 데이터시트 검색엔진 |
|
AN4099 데이터시트(PDF) 33 Page - STMicroelectronics |
|
|
|||||||||||||||||||||||||||||
AN4099 데이터시트(HTML) 33 Page - STMicroelectronics |
|
33 / 39 page ![]() AN4099 Interface layer Doc ID 023110 Rev 2 33/39 4.2 How to customize the IR drivers 4.2.1 IR receiver drivers To include an infrared decoder driver based on the PWM input solution in a user application, you must: 1. Add the header file of the appropriate IR protocol to your project. Example: rc5_decode.h. 2. Add the file.c corresponding to the IR protocol to your project. Example: rc5_decode.c. 3. Call the function of protocol initiation in the main() Example: RC5_Init(); 4. Add the TIMx interrupt functions to stm32f0xx_it.c or stm32f3xx_it.c. Example: void TIM2_IRQHandler (void) { static uint32_t ICValue1; static uint32_t ICValue2; /* IC1 Interrupt*/ if((TIM_GetFlagStatus(IR_TIM, TIM_FLAG_CC1) != RESET)) { TIM_ClearFlag(IR_TIM, TIM_FLAG_CC1); /* Get the Input Capture value */ ICValue2 = TIM_GetCapture1(IR_TIM); /* RC5 */ RC5_DataSampling(ICValue2 - ICValue1, 0); } /* IC2 Interrupt */ else if((TIM_GetFlagStatus(IR_TIM, TIM_FLAG_CC2) != RESET)) { TIM_ClearFlag(IR_TIM, TIM_FLAG_CC2); /* Get the Input Capture value */ ICValue1 = TIM_GetCapture2(IR_TIM); RC5_DataSampling(ICValue1 , 1); } /* Checks whether the IR_TIM flag is set or not.*/ else if ((TIM_GetFlagStatus(IR_TIM, TIM_FLAG_Update) != RESET)) { /* Clears the IR_TIM's pending flags*/ TIM_ClearFlag(IR_TIM, TIM_FLAG_Update); RC5_ResetPacket(); } } |
|
링크 URL |
| ALLDATASHEET 가 귀하에 도움이 되셨나요? [ DONATE ] |
Alldatasheet는? | 광고문의 | 운영자에게 연락하기 | 개인정보취급방침 | 링크 투 데이터시트 | 링크교환 | 제조사별 검색 All Rights Reserved©Alldatasheet.com |
| Russian : Alldatasheetru.com | Korean : Alldatasheet.co.kr | Spanish : Alldatasheet.es | French : Alldatasheet.fr | Italian : Alldatasheetit.com Portuguese : Alldatasheetpt.com | Polish : Alldatasheet.pl | Vietnamese : Alldatasheet.vn Indian : Alldatasheet.in | Mexican : Alldatasheet.com.mx | British : Alldatasheet.co.uk | New Zealand : Alldatasheet.co.nz |
|
Family Site : ic2ic.com |
icmetro.com |