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.
Fork of Nucleo_CaitSith_Firmware by
DelayServo.h
00001 #ifndef __DELAYSERVO_H__ 00002 #define __DELAYSERVO_H__ 00003 00004 #include "ExtendedServo.h" 00005 00006 /** 00007 * 遅延サーボクラス 00008 * @author yosuke kirihata 00009 */ 00010 00011 #define DEFAULT_INTERVAL 100000 //100ms 00012 #define DEFAULT_STEP_ANGLE 180 00013 00014 class DelayServo : public ExtendedServo 00015 { 00016 public: 00017 /** 00018 * コンストラクタ 00019 */ 00020 DelayServo(PinName pin); 00021 00022 /** 00023 * コンストラクタ 00024 */ 00025 DelayServo(PinName pin, int limitAngle); 00026 00027 /** 00028 * コンストラクタ 00029 */ 00030 DelayServo(PinName pin, int limitAngle, int interval); 00031 00032 /** 00033 * コンストラクタ 00034 */ 00035 //TODO:引数が多いのでBuilderパターンにする 00036 DelayServo(PinName pin, int limitAngle, int interval, int upperLimit ,int lowerLimit, int offsetAngle, bool isReverse); 00037 00038 /** 00039 * デストラクタ 00040 */ 00041 ~DelayServo(); 00042 00043 /** 00044 * 更新周期再設定 00045 * @param interval 更新周期(us) 00046 */ 00047 void updateInterval(int interval); 00048 00049 /** 00050 * 角度設定 00051 * @param angle 目標角度 00052 */ 00053 void setAngle(int angle); 00054 00055 private: 00056 //Ticker mTick; /** @brief 周期タイマ */ 00057 int mStepAngle; /** @brief 更新上限角度(刻み角度) */ 00058 int mCurrentAngle;/** @brief 現在角度 */ 00059 int mTargetAngle; /** @brief 目標角度 */ 00060 int mInterval; /** @brief 更新間隔 */ 00061 00062 /** 00063 * サーボ移動 00064 * @brief 周期タイマのコールバック関数 00065 */ 00066 public: 00067 void moveServo(); 00068 }; 00069 00070 #endif /* __DELAYSERVO_H__ */
Generated on Sat Jul 16 2022 17:03:40 by
1.7.2
