updated decode sample on CC26XX for AC
This commit is contained in:
Binary file not shown.
@@ -777,7 +777,7 @@ void HalLcdDisplayPercentBar( char *title, uint8 value )
|
|||||||
buf[1+x] = '+';
|
buf[1+x] = '+';
|
||||||
|
|
||||||
err = (uint32)value;
|
err = (uint32)value;
|
||||||
_ltoa( err, (uint8*)&buf[13], 10 );
|
_ltoa( err, &buf[13], 10 );
|
||||||
|
|
||||||
HalLcdWriteString( (char*)buf, 1 );
|
HalLcdWriteString( (char*)buf, 1 );
|
||||||
|
|
||||||
|
|||||||
@@ -162,14 +162,14 @@ void WriteBytes(uint8 *data, uint16_t len)
|
|||||||
void WriteValue(char *content, uint32 value, uint8 format)
|
void WriteValue(char *content, uint32 value, uint8 format)
|
||||||
{
|
{
|
||||||
uint8 tmpLen;
|
uint8 tmpLen;
|
||||||
uint8 buf[UART_BUFFER_SIZE];
|
char buf[UART_BUFFER_SIZE];
|
||||||
uint32 err;
|
uint32 err;
|
||||||
|
|
||||||
tmpLen = (uint8)strlen((char*)content);
|
tmpLen = (uint8)strlen((char*)content);
|
||||||
memcpy(buf, content, tmpLen);
|
memcpy(buf, content, tmpLen);
|
||||||
err = (uint32)(value);
|
err = (uint32)(value);
|
||||||
_ltoa(err, &buf[tmpLen], format);
|
_ltoa(err, (uint8*)&buf[tmpLen], format);
|
||||||
WriteBytes(buf, strlen(buf));
|
WriteBytes((uint8*)buf, strlen(buf));
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -483,7 +483,7 @@ extern UINT16 ir_ac_lib_control(remote_ac_status_t ac_status, UINT16 *user_data,
|
|||||||
*
|
*
|
||||||
* return: IR_DECODE_SUCCEEDED / IR_DECODE_FAILED
|
* return: IR_DECODE_SUCCEEDED / IR_DECODE_FAILED
|
||||||
*/
|
*/
|
||||||
extern void ir_ac_lib_close();
|
extern INT8 ir_ac_lib_close();
|
||||||
///////////////////////////////////////////////// AC End /////////////////////////////////////////////////
|
///////////////////////////////////////////////// AC End /////////////////////////////////////////////////
|
||||||
|
|
||||||
///////////////////////////////////////////////// TV Begin /////////////////////////////////////////////////
|
///////////////////////////////////////////////// TV Begin /////////////////////////////////////////////////
|
||||||
|
|||||||
@@ -225,7 +225,7 @@ UINT16 ir_ac_lib_control(remote_ac_status_t ac_status, UINT16 *user_data, UINT8
|
|||||||
return time_length;
|
return time_length;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ir_ac_lib_close()
|
INT8 ir_ac_lib_close()
|
||||||
{
|
{
|
||||||
// free context
|
// free context
|
||||||
if (NULL != tags)
|
if (NULL != tags)
|
||||||
@@ -235,7 +235,7 @@ void ir_ac_lib_close()
|
|||||||
}
|
}
|
||||||
free_ac_context();
|
free_ac_context();
|
||||||
|
|
||||||
return;
|
return IR_DECODE_SUCCEEDED;
|
||||||
}
|
}
|
||||||
|
|
||||||
// utils
|
// utils
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ static void IRext_processState()
|
|||||||
}
|
}
|
||||||
else if (IR_STATE_READY == dccb.ir_state)
|
else if (IR_STATE_READY == dccb.ir_state)
|
||||||
{
|
{
|
||||||
if (dccb.ir_type == IR_TYPE_TV)
|
if (IR_TYPE_TV == dccb.ir_type)
|
||||||
{
|
{
|
||||||
if (IR_DECODE_SUCCEEDED == ir_tv_lib_open(dccb.source_code, dccb.source_code_length))
|
if (IR_DECODE_SUCCEEDED == ir_tv_lib_open(dccb.source_code, dccb.source_code_length))
|
||||||
{
|
{
|
||||||
@@ -171,13 +171,30 @@ static void IRext_processState()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LCD_WRITE_STRING("OPEN ERROR", LCD_PAGE7);
|
LCD_WRITE_STRING("OPEN TV ERROR", LCD_PAGE7);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (IR_TYPE_AC == dccb.ir_type)
|
||||||
|
{
|
||||||
|
if (IR_DECODE_SUCCEEDED == ir_ac_lib_open(dccb.source_code, dccb.source_code_length))
|
||||||
|
{
|
||||||
|
LCD_WRITE_STRING("IR OPENED", LCD_PAGE7);
|
||||||
|
HalLedSet(HAL_LED_1, HAL_LED_MODE_ON);
|
||||||
|
dccb.ir_state = IR_STATE_OPENED;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LCD_WRITE_STRING("OPEN AC ERROR", LCD_PAGE7);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LCD_WRITE_STRING("TYPE ERROR", LCD_PAGE7);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (IR_STATE_OPENED == dccb.ir_state)
|
else if (IR_STATE_OPENED == dccb.ir_state)
|
||||||
{
|
{
|
||||||
if (dccb.ir_type == IR_TYPE_TV)
|
if (IR_TYPE_TV == dccb.ir_type)
|
||||||
{
|
{
|
||||||
if (IR_DECODE_SUCCEEDED == ir_tv_lib_parse(0))
|
if (IR_DECODE_SUCCEEDED == ir_tv_lib_parse(0))
|
||||||
{
|
{
|
||||||
@@ -187,13 +204,31 @@ static void IRext_processState()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LCD_WRITE_STRING("PARSE ERROR", LCD_PAGE7);
|
LCD_WRITE_STRING("PARSE TV ERROR", LCD_PAGE7);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (IR_TYPE_AC == dccb.ir_type)
|
||||||
|
{
|
||||||
|
if (IR_DECODE_SUCCEEDED == ir_ac_lib_parse())
|
||||||
|
{
|
||||||
|
LCD_WRITE_STRING("IR PARSED", LCD_PAGE7);
|
||||||
|
HalLedSet(HAL_LED_2, HAL_LED_MODE_ON);
|
||||||
|
dccb.ir_state = IR_STATE_PARSED;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LCD_WRITE_STRING("PARSE AC ERROR", LCD_PAGE7);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LCD_WRITE_STRING("TYPE ERROR", LCD_PAGE7);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (IR_STATE_PARSED == dccb.ir_state)
|
else if (IR_STATE_PARSED == dccb.ir_state)
|
||||||
{
|
{
|
||||||
if (IR_DECODE_SUCCEEDED == ir_tv_lib_close())
|
if ((dccb.ir_type == IR_TYPE_TV && IR_DECODE_SUCCEEDED == ir_tv_lib_close()) ||
|
||||||
|
(dccb.ir_type == IR_TYPE_AC && IR_DECODE_SUCCEEDED == ir_ac_lib_close()))
|
||||||
{
|
{
|
||||||
LCD_WRITE_STRING("IR READY", LCD_PAGE7);
|
LCD_WRITE_STRING("IR READY", LCD_PAGE7);
|
||||||
HalLedSet(HAL_LED_1 | HAL_LED_2, HAL_LED_MODE_OFF);
|
HalLedSet(HAL_LED_1 | HAL_LED_2, HAL_LED_MODE_OFF);
|
||||||
|
|||||||
@@ -483,7 +483,7 @@ extern UINT16 ir_ac_lib_control(remote_ac_status_t ac_status, UINT16 *user_data,
|
|||||||
*
|
*
|
||||||
* return: IR_DECODE_SUCCEEDED / IR_DECODE_FAILED
|
* return: IR_DECODE_SUCCEEDED / IR_DECODE_FAILED
|
||||||
*/
|
*/
|
||||||
extern void ir_ac_lib_close();
|
extern INT8 ir_ac_lib_close();
|
||||||
///////////////////////////////////////////////// AC End /////////////////////////////////////////////////
|
///////////////////////////////////////////////// AC End /////////////////////////////////////////////////
|
||||||
|
|
||||||
///////////////////////////////////////////////// TV Begin /////////////////////////////////////////////////
|
///////////////////////////////////////////////// TV Begin /////////////////////////////////////////////////
|
||||||
|
|||||||
@@ -225,7 +225,7 @@ UINT16 ir_ac_lib_control(remote_ac_status_t ac_status, UINT16 *user_data, UINT8
|
|||||||
return time_length;
|
return time_length;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ir_ac_lib_close()
|
INT8 ir_ac_lib_close()
|
||||||
{
|
{
|
||||||
// free context
|
// free context
|
||||||
if (NULL != tags)
|
if (NULL != tags)
|
||||||
@@ -235,7 +235,7 @@ void ir_ac_lib_close()
|
|||||||
}
|
}
|
||||||
free_ac_context();
|
free_ac_context();
|
||||||
|
|
||||||
return;
|
return IR_DECODE_SUCCEEDED;
|
||||||
}
|
}
|
||||||
|
|
||||||
// utils
|
// utils
|
||||||
|
|||||||
Reference in New Issue
Block a user