v2

Dependencies:   BEAR_Protocol_Edited BufferedSerial Debug MaxSonar PID Process QEI UI iSerial mbed

Fork of clean_V1 by Betago

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers rptypes.h Source File

rptypes.h

00001 /*
00002  * Copyright (c) 2014, RoboPeak
00003  * All rights reserved.
00004  *
00005  * Redistribution and use in source and binary forms, with or without modification, 
00006  * are permitted provided that the following conditions are met:
00007  *
00008  * 1. Redistributions of source code must retain the above copyright notice, 
00009  *    this list of conditions and the following disclaimer.
00010  *
00011  * 2. Redistributions in binary form must reproduce the above copyright notice, 
00012  *    this list of conditions and the following disclaimer in the documentation 
00013  *    and/or other materials provided with the distribution.
00014  *
00015  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 
00016  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 
00017  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 
00018  * SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
00019  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 
00020  * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
00021  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 
00022  * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 
00023  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00024  *
00025  */
00026 /*
00027  *  RoboPeak LIDAR System
00028  *  Common Types definition
00029  *
00030  *  Copyright 2009 - 2014 RoboPeak Team
00031  *  http://www.robopeak.com
00032  * 
00033  */
00034 
00035 #pragma once
00036 
00037 
00038 #ifdef _WIN32
00039 
00040 //fake stdint.h for VC only
00041 
00042 typedef signed   char     int8_t;
00043 typedef unsigned char     uint8_t;
00044 
00045 typedef __int16           int16_t;
00046 typedef unsigned __int16  uint16_t;
00047 
00048 typedef __int32           int32_t;
00049 typedef unsigned __int32  uint32_t;
00050 
00051 typedef __int64           int64_t;
00052 typedef unsigned __int64  uint64_t;
00053 
00054 #else
00055 
00056 #include <stdint.h>
00057 
00058 #endif
00059 
00060 
00061 //based on stdint.h
00062 typedef int8_t         _s8;
00063 typedef uint8_t        _u8;
00064 
00065 typedef int16_t        _s16;
00066 typedef uint16_t       _u16;
00067 
00068 typedef int32_t        _s32;
00069 typedef uint32_t       _u32;
00070 
00071 typedef int64_t        _s64;
00072 typedef uint64_t       _u64;
00073 
00074 #define __small_endian
00075 
00076 #ifndef __GNUC__
00077 #define __attribute__(x)
00078 #endif
00079 
00080 
00081 // The _word_size_t uses actual data bus width of the current CPU
00082 #ifdef _AVR_
00083 typedef _u8            _word_size_t;
00084 #define THREAD_PROC    
00085 #elif defined (WIN64)
00086 typedef _u64           _word_size_t;
00087 #define THREAD_PROC    __stdcall
00088 #elif defined (WIN32)
00089 typedef _u32           _word_size_t;
00090 #define THREAD_PROC    __stdcall
00091 #elif defined (__GNUC__)
00092 typedef unsigned long  _word_size_t;
00093 #define THREAD_PROC   
00094 #elif defined (__ICCARM__)
00095 typedef _u32            _word_size_t;
00096 #define THREAD_PROC  
00097 #endif
00098 
00099 
00100 typedef uint32_t u_result;
00101 
00102 #define RESULT_OK              0
00103 #define RESULT_FAIL_BIT        0x80000000
00104 #define RESULT_ALREADY_DONE    0x20
00105 #define RESULT_INVALID_DATA    (0x8000 | RESULT_FAIL_BIT)
00106 #define RESULT_OPERATION_FAIL  (0x8001 | RESULT_FAIL_BIT)
00107 #define RESULT_OPERATION_TIMEOUT  (0x8002 | RESULT_FAIL_BIT)
00108 #define RESULT_OPERATION_STOP    (0x8003 | RESULT_FAIL_BIT)
00109 #define RESULT_OPERATION_NOT_SUPPORT    (0x8004 | RESULT_FAIL_BIT)
00110 #define RESULT_FORMAT_NOT_SUPPORT    (0x8005 | RESULT_FAIL_BIT)
00111 #define RESULT_INSUFFICIENT_MEMORY   (0x8006 | RESULT_FAIL_BIT)
00112 
00113 #define IS_OK(x)    ( ((x) & RESULT_FAIL_BIT) == 0 )
00114 #define IS_FAIL(x)  ( ((x) & RESULT_FAIL_BIT) )
00115 
00116 typedef _word_size_t (THREAD_PROC * thread_proc_t ) ( void * );