optimized code for embedded usage

This commit is contained in:
strawmanbobi
2020-07-26 20:49:42 +08:00
parent ea33c2ac1f
commit fb8e8e05a2
13 changed files with 32 additions and 9 deletions

View File

@@ -12,7 +12,9 @@ Revision log:
#ifndef _IR_APPLY_H_
#define _IR_APPLY_H_
#if defined (BOARD_PC)
#pragma ide diagnostic ignored "OCUnusedMacroInspection"
#endif
#ifdef __cplusplus
extern "C"

View File

@@ -11,7 +11,9 @@ Revision log:
#ifndef _IR_DECODER_IR_AC_CONTROL_H
#define _IR_DECODER_IR_AC_CONTROL_H
#if defined (BOARD_PC)
#pragma ide diagnostic ignored "OCUnusedGlobalDeclarationInspection"
#endif
#ifdef __cplusplus
extern "C"

View File

@@ -12,8 +12,10 @@ Revision log:
#ifndef _IR_DECODE_H_
#define _IR_DECODE_H_
#if defined (BOARD_PC)
#pragma ide diagnostic ignored "OCUnusedGlobalDeclarationInspection"
#pragma ide diagnostic ignored "OCUnusedMacroInspection"
#endif
#ifdef __cplusplus
extern "C"

View File

@@ -12,8 +12,10 @@ Revision log:
#ifndef _IR_DEFS_H
#define _IR_DEFS_H
#if defined (BOARD_PC)
#pragma ide diagnostic ignored "OCUnusedGlobalDeclarationInspection"
#pragma ide diagnostic ignored "OCUnusedMacroInspection"
#endif
#ifdef __cplusplus
extern "C"

View File

@@ -12,8 +12,10 @@ Revision log:
#ifndef _IR_TV_CONTROL_H_
#define _IR_TV_CONTROL_H_
#if defined (BOARD_PC)
#pragma ide diagnostic ignored "OCUnusedMacroInspection"
#pragma ide diagnostic ignored "OCUnusedGlobalDeclarationInspection"
#endif
#ifdef __cplusplus
extern "C"

View File

@@ -12,7 +12,9 @@ Revision log:
#ifndef _IR_UTILS_H_
#define _IR_UTILS_H_
#if defined (BOARD_PC)
#pragma ide diagnostic ignored "OCUnusedGlobalDeclarationInspection"
#endif
#ifdef __cplusplus
extern "C"

View File

@@ -8,8 +8,10 @@ Description: This file provides methods for AC IR applying functionalities
Revision log:
* 2016-10-12: created by strawmanbobi
**************************************************************************************/
#if defined (BOARD_PC)
#pragma ide diagnostic ignored "bugprone-branch-clone"
#pragma ide diagnostic ignored "hicpp-signed-bitwise"
#endif
#include "include/ir_utils.h"
#include "include/ir_ac_apply.h"

View File

@@ -9,8 +9,10 @@ Revision log:
* 2016-10-01: created by strawmanbobi
**************************************************************************************/
#if defined (BOARD_PC)
#pragma ide diagnostic ignored "hicpp-signed-bitwise"
#pragma ide diagnostic ignored "readability-redundant-declaration"
#endif
#include "include/ir_ac_build_frame.h"
#include "include/ir_decode.h"

View File

@@ -550,10 +550,11 @@ INT8 free_ac_context()
return IR_DECODE_SUCCEEDED;
}
#pragma clang diagnostic push
#if defined (BOARD_PC)
#pragma ide diagnostic ignored "hicpp-signed-bitwise"
#endif
BOOL is_solo_function(UINT8 function_code)
{
return (((context->solo_function_mark >> (function_code - 1)) & 0x01) == 0x01) ? TRUE : FALSE;
}
#pragma clang diagnostic pop
}

View File

@@ -9,7 +9,9 @@ Revision log:
* 2016-10-05: created by strawmanbobi
**************************************************************************************/
#if defined (BOARD_PC)
#pragma ide diagnostic ignored "readability-redundant-declaration"
#endif
#include <stdio.h>
#include <stdlib.h>

View File

@@ -31,8 +31,10 @@ struct tag_head tags[TAG_COUNT_FOR_PROTOCOL];
#endif
static UINT8 byte_array[PROTOCOL_SIZE] = { 0 };
#if !defined NO_FS
static size_t binary_length = 0;
static UINT8 *binary_content = NULL;
#endif
static t_remote_category remote_category = REMOTE_CATEGORY_NONE;
static UINT8 ir_binary_type = IR_TYPE_STATUS;
@@ -178,7 +180,7 @@ INT8 ir_binary_open(const UINT8 category, const UINT8 sub_category, UINT8* binar
ir_printf("wrong remote category\n");
return IR_DECODE_FAILED;
}
remote_category = category;
remote_category = (t_remote_category) category;
if (sub_category < SUB_CATEGORY_QUATERNARY ||
sub_category >= SUB_CATEGORY_NEXT)
@@ -738,7 +740,7 @@ UINT16 ir_decode_combo(const UINT8 category, const UINT8 sub_category,
return IR_DECODE_FAILED;
}
remote_category = category;
remote_category = (t_remote_category) category;
if (key_code < 0 || key_code >= KEY_CODE_MAX[remote_category])
{

View File

@@ -1,9 +1,9 @@
/**************************************************************************************
Filename: ir_main.c
Filename: ir_decode_test.c
Revised: Date: 2016-11-05
Revision: Revision: 1.0
Description: This file provides main entry for irda decoder
Description: This file provides main entry for irda decoder test
Revision log:
* 2016-11-05: created by strawmanbobi
@@ -74,13 +74,13 @@ static INT8 decode_as_ac(char *file_name)
UINT8 supported_swing = 0x00;
UINT8 supported_wind_direction = 0x00;
BOOL need_control;
BOOL need_control = TRUE;
// init air conditioner status
ac_status.ac_display = 0;
ac_status.ac_sleep = 0;
ac_status.ac_timer = 0;
ac_status.ac_power = AC_POWER_OFF;
ac_status.ac_power = AC_POWER_ON;
ac_status.ac_mode = AC_MODE_COOL;
ac_status.ac_temp = AC_TEMP_20;
ac_status.ac_wind_dir = AC_SWING_ON;

View File

@@ -9,7 +9,9 @@ Revision log:
* 2016-10-21: created by strawmanbobi
**************************************************************************************/
#if defined (BOARD_PC)
#pragma ide diagnostic ignored "hicpp-signed-bitwise"
#endif
#include <string.h>