diff --git a/src/example/decode_example/CC26xx/IAR.zip b/src/example/decode_example/CC26xx/IAR.zip index cb55ce6..4de38b8 100644 Binary files a/src/example/decode_example/CC26xx/IAR.zip and b/src/example/decode_example/CC26xx/IAR.zip differ diff --git a/src/example/decode_example/CC26xx/Source/Application/Board/board_lcd.c b/src/example/decode_example/CC26xx/Source/Application/Board/board_lcd.c index 4c3d096..3932fd7 100644 --- a/src/example/decode_example/CC26xx/Source/Application/Board/board_lcd.c +++ b/src/example/decode_example/CC26xx/Source/Application/Board/board_lcd.c @@ -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 ); diff --git a/src/example/decode_example/CC26xx/Source/Application/Board/board_uart.c b/src/example/decode_example/CC26xx/Source/Application/Board/board_uart.c index 3d992df..8364820 100644 --- a/src/example/decode_example/CC26xx/Source/Application/Board/board_uart.c +++ b/src/example/decode_example/CC26xx/Source/Application/Board/board_uart.c @@ -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 diff --git a/src/example/decode_example/CC26xx/Source/Application/Irext/include/ir_decode.h b/src/example/decode_example/CC26xx/Source/Application/Irext/include/ir_decode.h index b464060..994350a 100644 --- a/src/example/decode_example/CC26xx/Source/Application/Irext/include/ir_decode.h +++ b/src/example/decode_example/CC26xx/Source/Application/Irext/include/ir_decode.h @@ -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 ///////////////////////////////////////////////// diff --git a/src/example/decode_example/CC26xx/Source/Application/Irext/src/ir_decode.c b/src/example/decode_example/CC26xx/Source/Application/Irext/src/ir_decode.c index b4d1f15..56fc558 100644 --- a/src/example/decode_example/CC26xx/Source/Application/Irext/src/ir_decode.c +++ b/src/example/decode_example/CC26xx/Source/Application/Irext/src/ir_decode.c @@ -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 diff --git a/src/example/decode_example/CC26xx/Source/Application/simpleBLEPeripheral.c b/src/example/decode_example/CC26xx/Source/Application/simpleBLEPeripheral.c index 71946fe..6a69d05 100644 --- a/src/example/decode_example/CC26xx/Source/Application/simpleBLEPeripheral.c +++ b/src/example/decode_example/CC26xx/Source/Application/simpleBLEPeripheral.c @@ -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); diff --git a/src/ir_decoder/include/ir_decode.h b/src/ir_decoder/include/ir_decode.h index b464060..994350a 100644 --- a/src/ir_decoder/include/ir_decode.h +++ b/src/ir_decoder/include/ir_decode.h @@ -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 ///////////////////////////////////////////////// diff --git a/src/ir_decoder/src/ir_decode.c b/src/ir_decoder/src/ir_decode.c index e267f0c..29a5eff 100644 --- a/src/ir_decoder/src/ir_decode.c +++ b/src/ir_decoder/src/ir_decode.c @@ -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