Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed QEI mbed-rtos
Diff: Hbridge.cpp
- Revision:
- 15:035e2ea34aef
- Parent:
- 13:ba71733c11d7
--- a/Hbridge.cpp Tue Mar 12 04:32:22 2013 +0000 +++ b/Hbridge.cpp Tue Oct 20 04:28:59 2020 +0000 @@ -32,12 +32,16 @@ IN.mode = 0; // モードを0にする }else if( IN.mode==1 ){ // モードが1のとき if( IN.fReverse==0 ){ // モータの回転が順方向のとき - pwm_fwdIN = 1; pwm_rvsIN = 0; // fwdINのみオンにする + pwm_fwdIN = 1; + pwm_rvsIN = 0; // fwdINのみオンにする }else{ // モータの回転が逆方向のとき - pwm_fwdIN = 0; pwm_rvsIN = 1; // rvsINのみオンにする + pwm_fwdIN = 0; + pwm_rvsIN = 1; // rvsINのみオンにする } IN.fwdIN_us = IN.duty*1000000/PWM_FREQ; // fwdINをオンする時間幅を計算 ON time of pwm - if( IN.fwdIN_us < TMIN ){ IN.fwdIN_us=TMIN;} // 時間幅が負のときはTMINにする + if( IN.fwdIN_us < TMIN ){ + IN.fwdIN_us=TMIN; + } // 時間幅が負のときはTMINにする pwm.attach_us(&pwm_out, IN.fwdIN_us); // fwdINをオンする時間幅経過後にタイムアウトでこの関数自身をコール setup pwmU to call pwm_out after t [us] IN.rvsIN_us = 1000000/PWM_FREQ -IN.fwdIN_us; // rvsINをオンする時間幅を計算 OFF time of pwm if( IN.rvsIN_us < TMIN ){ IN.rvsIN_us=TMIN;} // 時間幅が負のときはTMINにする