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