ファームウェア関数一覧
TIM_OC1Init †
ヘッダ宣言 †
関数プロトタイプ †
void TIM_OC1Init(TIM_TypeDef* TIMx, TIM_OCInitTypeDef* TIM_OCInitStruct)
動作 †
引数 †
- TIMx
TIM1,2,3,4,5,8を指定
- uint16_t TIM_OCInitStruct
- uint16_t TIM_OCMode
TIM_OCMode_Timing | TIM Output Compare Timing mode. |
TIM_OCMode_Active | TIM Output Compare Active mode. |
TIM_OCMode_Inactive | TIM Output Compare Inactive mode. |
TIM_OCMode_Toggle | TIM Output Compare Toggle mode. |
TIM_OCMode_PWM1 | TIM Pulse Width Modulation mode1. |
TIM_OCMode_PWM2 | TIM Pulse Width Modulation mode2. |
- uint16_t TIM_OutputState
TIM_OutputState_Disable | Disables the TIM Output Compare state. |
TIM_OutputState_Enable | Enables the TIM Output Compare state. |
- uint16_t TIM_OutputNState
TIM_OutputNState_Disable | Disables the TIM Output N Compare state. |
TIM_OutputNState_Enable | Enables the TIM Output N Compare state. |
- uint16_t TIM_Pulse
0x0000 ~ 0xFFFF
- uint16_t TIM_OCPolarity
TIM_OCPolarity_High | Sets the TIM Output Compare polarity to high. |
TIM_OCPolarity_Low | Sets the TIM Output Compare polarity to low. |
- uint16_t TIM_OCNPolarity
TIM_OCNPolarity_High | Sets the Output Compare N Polarity to high. |
TIM_OCNPolarity_Low | Sets the Output Compare N Polarity to low. |
- uint16_t TIM_OCIdleState
TIM_OCIdleState_Set | TIM Output OC Idle state set when MOE = 0 |
TIM_OCIdleState_Reset | TIM Output OC Idle state reset when MOE = 0 |
- uint16_t TIM_OCNIdleState
TIM_OCNIdleState_Set | TIM Output OCN Idle state set when MOE = 0 |
TIM_OCNIdleState_Reset | TIM Output OCN Idle state reset when MOE = 0 |
戻り値 †
場所 †
呼び出し関数 †
サンプル †
/* Configures the TIM1 Channel1 in PWM Mode */
TIM_OCInitTypeDef TIM_OCInitStructure;
TIM_OCInitStructure.TIM_OCMode = TIM_OCMode_PWM1;
TIM_OCInitStructure.TIM_OutputState = TIM_OutputState_Enable;
TIM_OCInitStructure.TIM_OutputNState = TIM_OutputNState_Enable;
TIM_OCInitStructure.TIM_Pulse = 0x7FF;
TIM_OCInitStructure.TIM_OCPolarity = TIM_OCPolarity_Low;
TIM_OCInitStructure.TIM_OCNPolarity = TIM_OCNPolarity_Low;
TIM_OCInitStructure.TIM_OCIdleState = TIM_OCIdleState_Set;
TIM_OCInitStructure.TIM_OCNIdleState = TIM_OCIdleState_Reset;
TIM_OC1Init(TIM1, &TIM_OCInitStructure);
/* Configures the TIM3 Channel1 in Toggle Mode */
TIM_OCInitTypeDef TIM_OCInitStructure;
TIM_OCInitStructure.TIM_OCMode = TIM_OCMode_Toggle;
TIM_OCInitStructure.TIM_OutputState = TIM_OutputState_Enable;
TIM_OCInitStructure.TIM_Pulse = 0x7FF;
TIM_OCInitStructure.TIM_OCPolarity = TIM_OCPolarity_Low;
TIM_OC1Init(TIM3, &TIM_OCInitStructure);
参照 †