sra-romi

Dependencies:   BufferedSerial Matrix

Committer:
joaopsousa99
Date:
Tue May 11 18:10:22 2021 +0000
Revision:
4:1defb279922a
Parent:
0:2b691d200d6f
as.djvblaskdvj

Who changed what in which revision?

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