updated decode sample on CC26XX for AC

This commit is contained in:
2017-03-14 12:55:56 +08:00
parent ec6016a494
commit 7fd04960b6
8 changed files with 50 additions and 15 deletions

View File

@@ -777,7 +777,7 @@ void HalLcdDisplayPercentBar( char *title, uint8 value )
buf[1+x] = '+';
err = (uint32)value;
_ltoa( err, (uint8*)&buf[13], 10 );
_ltoa( err, &buf[13], 10 );
HalLcdWriteString( (char*)buf, 1 );

View File

@@ -162,14 +162,14 @@ void WriteBytes(uint8 *data, uint16_t len)
void WriteValue(char *content, uint32 value, uint8 format)
{
uint8 tmpLen;
uint8 buf[UART_BUFFER_SIZE];
char buf[UART_BUFFER_SIZE];
uint32 err;
tmpLen = (uint8)strlen((char*)content);
memcpy(buf, content, tmpLen);
err = (uint32)(value);
_ltoa(err, &buf[tmpLen], format);
WriteBytes(buf, strlen(buf));
_ltoa(err, (uint8*)&buf[tmpLen], format);
WriteBytes((uint8*)buf, strlen(buf));
}
#endif

View File

@@ -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
*/
extern void ir_ac_lib_close();
extern INT8 ir_ac_lib_close();
///////////////////////////////////////////////// AC End /////////////////////////////////////////////////
///////////////////////////////////////////////// TV Begin /////////////////////////////////////////////////

View File

@@ -225,7 +225,7 @@ UINT16 ir_ac_lib_control(remote_ac_status_t ac_status, UINT16 *user_data, UINT8
return time_length;
}
void ir_ac_lib_close()
INT8 ir_ac_lib_close()
{
// free context
if (NULL != tags)
@@ -235,7 +235,7 @@ void ir_ac_lib_close()
}
free_ac_context();
return;
return IR_DECODE_SUCCEEDED;
}
// utils

View File

@@ -161,7 +161,7 @@ static void IRext_processState()
}
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))
{
@@ -171,13 +171,30 @@ static void IRext_processState()
}
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)
{
if (dccb.ir_type == IR_TYPE_TV)
if (IR_TYPE_TV == dccb.ir_type)
{
if (IR_DECODE_SUCCEEDED == ir_tv_lib_parse(0))
{
@@ -187,13 +204,31 @@ static void IRext_processState()
}
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)
{
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);
HalLedSet(HAL_LED_1 | HAL_LED_2, HAL_LED_MODE_OFF);

View File

@@ -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
*/
extern void ir_ac_lib_close();
extern INT8 ir_ac_lib_close();
///////////////////////////////////////////////// AC End /////////////////////////////////////////////////
///////////////////////////////////////////////// TV Begin /////////////////////////////////////////////////

View File

@@ -225,7 +225,7 @@ UINT16 ir_ac_lib_control(remote_ac_status_t ac_status, UINT16 *user_data, UINT8
return time_length;
}
void ir_ac_lib_close()
INT8 ir_ac_lib_close()
{
// free context
if (NULL != tags)
@@ -235,7 +235,7 @@ void ir_ac_lib_close()
}
free_ac_context();
return;
return IR_DECODE_SUCCEEDED;
}
// utils