keep origin API too

This commit is contained in:
huangxiaoming
2016-09-30 13:45:29 +08:00
parent 31096445f9
commit 820e1cef65
2 changed files with 29 additions and 30 deletions

View File

@@ -30,7 +30,7 @@ void NexTimer::detachTimer(void)
NexTouch::detachPop();
}
bool NexTimer::Get_cycle_tim(uint32_t *number)
bool NexTimer::getCycle(uint32_t *number)
{
String cmd = String("get ");
cmd += getObjName();
@@ -39,7 +39,7 @@ bool NexTimer::Get_cycle_tim(uint32_t *number)
return recvRetNumber(number);
}
bool NexTimer::Set_cycle_tim(uint32_t number)
bool NexTimer::setCycle(uint32_t number)
{
char buf[10] = {0};
String cmd;
@@ -83,7 +83,7 @@ bool NexTimer::disable(void)
return recvRetCommandFinished();
}
bool NexTimer::getCycle(uint32_t *number)
uint32_t NexTimer::Get_cycle_tim(uint32_t *number)
{
String cmd = String("get ");
cmd += getObjName();
@@ -92,21 +92,24 @@ bool NexTimer::getCycle(uint32_t *number)
return recvRetNumber(number);
}
bool NexTimer::setCycle(uint32_t number)
bool NexTimer::Set_cycle_tim(uint32_t number)
{
char buf[10] = {0};
String cmd;
if (number < 50)
if (number < 8)
{
number = 50;
number = 8;
}
utoa(number, buf, 10);
cmd += getObjName();
cmd += ".tim=";
cmd += buf;
sendCommand(cmd.c_str());
cmd = "";
cmd += "ref ";
cmd += getObjName();
sendCommand(cmd.c_str());
return recvRetCommandFinished();
}

View File

@@ -66,7 +66,7 @@ public: /* methods */
* @retval true - success.
* @retval false - failed.
*/
bool Get_cycle_tim(uint32_t *number);
bool getCycle(uint32_t *number);
/**
* Set the value of timer cycle val.
@@ -78,7 +78,7 @@ public: /* methods */
*
* @warning the cycle value must be greater than 50.
*/
bool Set_cycle_tim(uint32_t number);
bool setCycle(uint32_t number);
/**
* contorl timer enable.
@@ -95,28 +95,24 @@ public: /* methods */
* @retval false - failed.
*/
bool disable(void);
/*
* Get tim attribute of component
*
* @param number - buffer storing data retur
* @return the length of the data
*/
/**
* Get the value of timer cycle val.
*
* @param number - an output parameter to save the value of timer cycle.
*
* @retval true - success.
* @retval false - failed.
*/
bool getCycle(uint32_t *number);
uint32_t Get_cycle_tim(uint32_t *number);
/**
* Set the value of timer cycle val.
*
* @param number - the value of timer cycle.
*
* @retval true - success.
* @retval false - failed.
*
* @warning the cycle value must be greater than 50.
*/
bool setCycle(uint32_t number);
/*
* Set tim attribute of component
*
* @param number - To set up the data
* @return true if success, false for failure
*/
bool Set_cycle_tim(uint32_t number);
};
/**