สัสชิน
Dependencies: BEAR_Protocol_Edited_V22 BufferedSerial Debug MaxSonar PID Process QEI UI iSerial mbed
Fork of clean_V2 by
inc/rptypes.h@8:fc70c78a443b, 2016-06-08 (annotated)
- Committer:
- icyzkungz
- Date:
- Wed Jun 08 17:19:21 2016 +0000
- Revision:
- 8:fc70c78a443b
- Parent:
- 2:f873deba2305
??????
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
palmdotax | 2:f873deba2305 | 1 | /* |
palmdotax | 2:f873deba2305 | 2 | * Copyright (c) 2014, RoboPeak |
palmdotax | 2:f873deba2305 | 3 | * All rights reserved. |
palmdotax | 2:f873deba2305 | 4 | * |
palmdotax | 2:f873deba2305 | 5 | * Redistribution and use in source and binary forms, with or without modification, |
palmdotax | 2:f873deba2305 | 6 | * are permitted provided that the following conditions are met: |
palmdotax | 2:f873deba2305 | 7 | * |
palmdotax | 2:f873deba2305 | 8 | * 1. Redistributions of source code must retain the above copyright notice, |
palmdotax | 2:f873deba2305 | 9 | * this list of conditions and the following disclaimer. |
palmdotax | 2:f873deba2305 | 10 | * |
palmdotax | 2:f873deba2305 | 11 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
palmdotax | 2:f873deba2305 | 12 | * this list of conditions and the following disclaimer in the documentation |
palmdotax | 2:f873deba2305 | 13 | * and/or other materials provided with the distribution. |
palmdotax | 2:f873deba2305 | 14 | * |
palmdotax | 2:f873deba2305 | 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY |
palmdotax | 2:f873deba2305 | 16 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
palmdotax | 2:f873deba2305 | 17 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT |
palmdotax | 2:f873deba2305 | 18 | * SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
palmdotax | 2:f873deba2305 | 19 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT |
palmdotax | 2:f873deba2305 | 20 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
palmdotax | 2:f873deba2305 | 21 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR |
palmdotax | 2:f873deba2305 | 22 | * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, |
palmdotax | 2:f873deba2305 | 23 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
palmdotax | 2:f873deba2305 | 24 | * |
palmdotax | 2:f873deba2305 | 25 | */ |
palmdotax | 2:f873deba2305 | 26 | /* |
palmdotax | 2:f873deba2305 | 27 | * RoboPeak LIDAR System |
palmdotax | 2:f873deba2305 | 28 | * Common Types definition |
palmdotax | 2:f873deba2305 | 29 | * |
palmdotax | 2:f873deba2305 | 30 | * Copyright 2009 - 2014 RoboPeak Team |
palmdotax | 2:f873deba2305 | 31 | * http://www.robopeak.com |
palmdotax | 2:f873deba2305 | 32 | * |
palmdotax | 2:f873deba2305 | 33 | */ |
palmdotax | 2:f873deba2305 | 34 | |
palmdotax | 2:f873deba2305 | 35 | #pragma once |
palmdotax | 2:f873deba2305 | 36 | |
palmdotax | 2:f873deba2305 | 37 | |
palmdotax | 2:f873deba2305 | 38 | #ifdef _WIN32 |
palmdotax | 2:f873deba2305 | 39 | |
palmdotax | 2:f873deba2305 | 40 | //fake stdint.h for VC only |
palmdotax | 2:f873deba2305 | 41 | |
palmdotax | 2:f873deba2305 | 42 | typedef signed char int8_t; |
palmdotax | 2:f873deba2305 | 43 | typedef unsigned char uint8_t; |
palmdotax | 2:f873deba2305 | 44 | |
palmdotax | 2:f873deba2305 | 45 | typedef __int16 int16_t; |
palmdotax | 2:f873deba2305 | 46 | typedef unsigned __int16 uint16_t; |
palmdotax | 2:f873deba2305 | 47 | |
palmdotax | 2:f873deba2305 | 48 | typedef __int32 int32_t; |
palmdotax | 2:f873deba2305 | 49 | typedef unsigned __int32 uint32_t; |
palmdotax | 2:f873deba2305 | 50 | |
palmdotax | 2:f873deba2305 | 51 | typedef __int64 int64_t; |
palmdotax | 2:f873deba2305 | 52 | typedef unsigned __int64 uint64_t; |
palmdotax | 2:f873deba2305 | 53 | |
palmdotax | 2:f873deba2305 | 54 | #else |
palmdotax | 2:f873deba2305 | 55 | |
palmdotax | 2:f873deba2305 | 56 | #include <stdint.h> |
palmdotax | 2:f873deba2305 | 57 | |
palmdotax | 2:f873deba2305 | 58 | #endif |
palmdotax | 2:f873deba2305 | 59 | |
palmdotax | 2:f873deba2305 | 60 | |
palmdotax | 2:f873deba2305 | 61 | //based on stdint.h |
palmdotax | 2:f873deba2305 | 62 | typedef int8_t _s8; |
palmdotax | 2:f873deba2305 | 63 | typedef uint8_t _u8; |
palmdotax | 2:f873deba2305 | 64 | |
palmdotax | 2:f873deba2305 | 65 | typedef int16_t _s16; |
palmdotax | 2:f873deba2305 | 66 | typedef uint16_t _u16; |
palmdotax | 2:f873deba2305 | 67 | |
palmdotax | 2:f873deba2305 | 68 | typedef int32_t _s32; |
palmdotax | 2:f873deba2305 | 69 | typedef uint32_t _u32; |
palmdotax | 2:f873deba2305 | 70 | |
palmdotax | 2:f873deba2305 | 71 | typedef int64_t _s64; |
palmdotax | 2:f873deba2305 | 72 | typedef uint64_t _u64; |
palmdotax | 2:f873deba2305 | 73 | |
palmdotax | 2:f873deba2305 | 74 | #define __small_endian |
palmdotax | 2:f873deba2305 | 75 | |
palmdotax | 2:f873deba2305 | 76 | #ifndef __GNUC__ |
palmdotax | 2:f873deba2305 | 77 | #define __attribute__(x) |
palmdotax | 2:f873deba2305 | 78 | #endif |
palmdotax | 2:f873deba2305 | 79 | |
palmdotax | 2:f873deba2305 | 80 | |
palmdotax | 2:f873deba2305 | 81 | // The _word_size_t uses actual data bus width of the current CPU |
palmdotax | 2:f873deba2305 | 82 | #ifdef _AVR_ |
palmdotax | 2:f873deba2305 | 83 | typedef _u8 _word_size_t; |
palmdotax | 2:f873deba2305 | 84 | #define THREAD_PROC |
palmdotax | 2:f873deba2305 | 85 | #elif defined (WIN64) |
palmdotax | 2:f873deba2305 | 86 | typedef _u64 _word_size_t; |
palmdotax | 2:f873deba2305 | 87 | #define THREAD_PROC __stdcall |
palmdotax | 2:f873deba2305 | 88 | #elif defined (WIN32) |
palmdotax | 2:f873deba2305 | 89 | typedef _u32 _word_size_t; |
palmdotax | 2:f873deba2305 | 90 | #define THREAD_PROC __stdcall |
palmdotax | 2:f873deba2305 | 91 | #elif defined (__GNUC__) |
palmdotax | 2:f873deba2305 | 92 | typedef unsigned long _word_size_t; |
palmdotax | 2:f873deba2305 | 93 | #define THREAD_PROC |
palmdotax | 2:f873deba2305 | 94 | #elif defined (__ICCARM__) |
palmdotax | 2:f873deba2305 | 95 | typedef _u32 _word_size_t; |
palmdotax | 2:f873deba2305 | 96 | #define THREAD_PROC |
palmdotax | 2:f873deba2305 | 97 | #endif |
palmdotax | 2:f873deba2305 | 98 | |
palmdotax | 2:f873deba2305 | 99 | |
palmdotax | 2:f873deba2305 | 100 | typedef uint32_t u_result; |
palmdotax | 2:f873deba2305 | 101 | |
palmdotax | 2:f873deba2305 | 102 | #define RESULT_OK 0 |
palmdotax | 2:f873deba2305 | 103 | #define RESULT_FAIL_BIT 0x80000000 |
palmdotax | 2:f873deba2305 | 104 | #define RESULT_ALREADY_DONE 0x20 |
palmdotax | 2:f873deba2305 | 105 | #define RESULT_INVALID_DATA (0x8000 | RESULT_FAIL_BIT) |
palmdotax | 2:f873deba2305 | 106 | #define RESULT_OPERATION_FAIL (0x8001 | RESULT_FAIL_BIT) |
palmdotax | 2:f873deba2305 | 107 | #define RESULT_OPERATION_TIMEOUT (0x8002 | RESULT_FAIL_BIT) |
palmdotax | 2:f873deba2305 | 108 | #define RESULT_OPERATION_STOP (0x8003 | RESULT_FAIL_BIT) |
palmdotax | 2:f873deba2305 | 109 | #define RESULT_OPERATION_NOT_SUPPORT (0x8004 | RESULT_FAIL_BIT) |
palmdotax | 2:f873deba2305 | 110 | #define RESULT_FORMAT_NOT_SUPPORT (0x8005 | RESULT_FAIL_BIT) |
palmdotax | 2:f873deba2305 | 111 | #define RESULT_INSUFFICIENT_MEMORY (0x8006 | RESULT_FAIL_BIT) |
palmdotax | 2:f873deba2305 | 112 | |
palmdotax | 2:f873deba2305 | 113 | #define IS_OK(x) ( ((x) & RESULT_FAIL_BIT) == 0 ) |
palmdotax | 2:f873deba2305 | 114 | #define IS_FAIL(x) ( ((x) & RESULT_FAIL_BIT) ) |
palmdotax | 2:f873deba2305 | 115 | |
palmdotax | 2:f873deba2305 | 116 | typedef _word_size_t (THREAD_PROC * thread_proc_t ) ( void * ); |