Mar. 14. 2018
Dependencies: GraphicsFramework GR-PEACH_video LCD_shield_config AsciiFont R_BSP USBHost_custom
STBTrValidValue.c
00001 /*---------------------------------------------------------------------------*/ 00002 /* Copyright(C) 2017 OMRON Corporation */ 00003 /* */ 00004 /* Licensed under the Apache License, Version 2.0 (the "License"); */ 00005 /* you may not use this file except in compliance with the License. */ 00006 /* You may obtain a copy of the License at */ 00007 /* */ 00008 /* http://www.apache.org/licenses/LICENSE-2.0 */ 00009 /* */ 00010 /* Unless required by applicable law or agreed to in writing, software */ 00011 /* distributed under the License is distributed on an "AS IS" BASIS, */ 00012 /* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */ 00013 /* See the License for the specific language governing permissions and */ 00014 /* limitations under the License. */ 00015 /*---------------------------------------------------------------------------*/ 00016 00017 #include "STBTrValidValue.h" 00018 00019 /*Value range check*/ 00020 #define IS_OUT_RANGE( val , min , max )( ( (val) < (min) ) || ( (max) < (val) ) ) 00021 00022 /*------------------------------------------------------------------------------------------------------------------*/ 00023 /* STB_TrIsValidValue */ 00024 /*------------------------------------------------------------------------------------------------------------------*/ 00025 STB_INT32 STB_TrIsValidValue(const STB_TR_DET *input, STBExecFlg *execFlg) 00026 { 00027 STB_INT32 i ; 00028 00029 00030 00031 if( execFlg->bodyTr == STB_TRUE ) 00032 { 00033 if( IS_OUT_RANGE( input->bdNum , STB_BODY_CNT_MIN , STB_BODY_CNT_MAX ) ){ return STB_FALSE;} 00034 for( i = 0 ; i < input->bdNum ; i++) 00035 { 00036 if( IS_OUT_RANGE( input->bdDet[i].posX , STB_BODY_XY_MIN , STB_BODY_XY_MAX ) ){ return STB_FALSE;} 00037 if( IS_OUT_RANGE( input->bdDet[i].posY , STB_BODY_XY_MIN , STB_BODY_XY_MAX ) ){ return STB_FALSE;} 00038 if( IS_OUT_RANGE( input->bdDet[i].size , STB_BODY_SIZE_MIN , STB_BODY_SIZE_MAX ) ){ return STB_FALSE;} 00039 if( IS_OUT_RANGE( input->bdDet[i].conf , STB_BODY_CONF_MIN , STB_BODY_CONF_MAX ) ){ return STB_FALSE;} 00040 } 00041 00042 } 00043 00044 if( execFlg->faceTr == STB_TRUE ) 00045 { 00046 if( IS_OUT_RANGE( input->fcNum , STB_FACE_CNT_MIN , STB_FACE_CNT_MAX ) ){ return STB_FALSE;} 00047 for( i = 0 ; i < input->fcNum ; i++) 00048 { 00049 if( IS_OUT_RANGE( input->fcDet[i].posX , STB_FACE_XY_MIN , STB_FACE_XY_MAX ) ){ return STB_FALSE;} 00050 if( IS_OUT_RANGE( input->fcDet[i].posY , STB_FACE_XY_MIN , STB_FACE_XY_MAX ) ){ return STB_FALSE;} 00051 if( IS_OUT_RANGE( input->fcDet[i].size , STB_FACE_SIZE_MIN , STB_FACE_SIZE_MAX ) ){ return STB_FALSE;} 00052 if( IS_OUT_RANGE( input->fcDet[i].conf , STB_FACE_CONF_MIN , STB_FACE_CONF_MAX ) ){ return STB_FALSE;} 00053 } 00054 } 00055 00056 00057 00058 return STB_TRUE; 00059 }
Generated on Tue Jul 12 2022 16:00:45 by 1.7.2