wayne roberts / libscpi

Dependents:   scpi_sx127x scpi_sx127x_firstTest MLX90418_I2C_master

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers config.h Source File

config.h

Go to the documentation of this file.
00001 /*-
00002  * Copyright (c) 2012-2013 Jan Breuer,
00003  *
00004  * All Rights Reserved
00005  *
00006  * Redistribution and use in source and binary forms, with or without
00007  * modification, are permitted provided that the following conditions are
00008  * met:
00009  * 1. Redistributions of source code must retain the above copyright notice,
00010  *    this list of conditions and the following disclaimer.
00011  * 2. Redistributions in binary form must reproduce the above copyright
00012  *    notice, this list of conditions and the following disclaimer in the
00013  *    documentation and/or other materials provided with the distribution.
00014  *
00015  * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
00016  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
00017  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00018  * DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
00019  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
00020  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
00021  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
00022  * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
00023  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
00024  * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
00025  * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00026  */
00027 
00028 /**
00029  * @file   config.h
00030  * @date   Wed Mar 20 12:21:26 UTC 2013
00031  *
00032  * @brief  SCPI Configuration
00033  *
00034  *
00035  */
00036 
00037 #ifndef __SCPI_CONFIG_H_
00038 #define __SCPI_CONFIG_H_
00039 
00040 #ifdef  __cplusplus
00041 extern "C" {
00042 #endif
00043 
00044 #ifdef SCPI_USER_CONFIG
00045 #include "scpi_user_config.h"
00046 #endif
00047 
00048 /* set the termination character(s)   */
00049 #define LINE_ENDING_CR          "\r"    /*   use a <CR> carriage return as termination charcter */
00050 #define LINE_ENDING_LF          "\n"    /*   use a <LF> line feed as termination charcter */
00051 #define LINE_ENDING_CRLF        "\r\n"  /*   use <CR><LF> carriage return + line feed as termination charcters */
00052 
00053 #ifndef SCPI_LINE_ENDING
00054 #define SCPI_LINE_ENDING        LINE_ENDING_CRLF
00055 #endif
00056 
00057 /* Enable full error list
00058  * 0 = Minimal set of errors
00059  * 1 = Full set of errors
00060  *
00061  * For small systems, full set of errors will occupy large ammount of data
00062  */
00063 #ifndef USE_FULL_ERROR_LIST
00064 #define USE_FULL_ERROR_LIST 0
00065 #endif
00066 
00067 /**
00068  * Enable also LIST_OF_USER_ERRORS to be included
00069  * 0 = Use only library defined errors
00070  * 1 = Use also LIST_OF_USER_ERRORS
00071  */
00072 #ifndef USE_USER_ERROR_LIST
00073 #define USE_USER_ERROR_LIST 0
00074 #endif
00075 
00076 /* Compiler specific */
00077 /* RealView/Keil ARM Compiler, e.g. Cortex-M CPUs */
00078 #if defined(__CC_ARM)
00079 #define HAVE_STRNLEN            0
00080 #define HAVE_STRNCASECMP        1
00081 #define HAVE_STRNICMP           0
00082 #endif
00083 
00084 /* National Instruments (R) CVI x86/x64 PC platform */
00085 #if defined(_CVI_)
00086 #define HAVE_STRNLEN            0
00087 #define HAVE_STRNCASECMP        0
00088 #define HAVE_STRNICMP           1
00089 #define HAVE_STDBOOL            0
00090 #endif
00091 
00092 /* 8bit PIC - PIC16, etc */
00093 #if defined(_MPC_)
00094 #define HAVE_STRNLEN            0
00095 #define HAVE_STRNCASECMP        0
00096 #define HAVE_STRNICMP           1
00097 #endif
00098 
00099 /* PIC24 */
00100 #if defined(__C30__)
00101 #define HAVE_STRNLEN            0
00102 #define HAVE_STRNCASECMP        0
00103 #define HAVE_STRNICMP           0
00104 #endif
00105 
00106 /* PIC32mx */
00107 #if defined(__C32__)
00108 #define HAVE_STRNLEN            0
00109 #define HAVE_STRNCASECMP        1
00110 #define HAVE_STRNICMP           0
00111 #endif
00112 
00113 /* AVR libc */
00114 #if defined(__AVR__)
00115 #include <stdlib.h>
00116 #define HAVE_DTOSTRE            1
00117 #endif
00118 
00119 /* ======== test strnlen ======== */
00120 #ifndef HAVE_STRNLEN
00121 #define HAVE_STRNLEN            1
00122 #endif
00123 /* ======== test strncasecmp ======== */
00124 #ifndef HAVE_STRNCASECMP
00125 #define HAVE_STRNCASECMP        1
00126 #endif
00127 /* ======== test strnicmp ======== */
00128 #ifndef HAVE_STRNICMP
00129 #define HAVE_STRNICMP           0
00130 #endif
00131 
00132 #ifndef HAVE_STDBOOL
00133 #define HAVE_STDBOOL            1
00134 #endif
00135 
00136 /* define local macros depending on existance of strnlen */
00137 #if HAVE_STRNLEN
00138 #define SCPIDEFINE_strnlen(s, l)    strnlen((s), (l))
00139 #else
00140 #define SCPIDEFINE_strnlen(s, l)    BSD_strnlen((s), (l))
00141 #endif
00142 
00143 /* define local macros depending on existance of strncasecmp and strnicmp */
00144 #if HAVE_STRNCASECMP
00145 #define SCPIDEFINE_strncasecmp(s1, s2, l) strncasecmp((s1), (s2), (l))
00146 #elif HAVE_STRNICMP
00147 #define SCPIDEFINE_strncasecmp(s1, s2, l) strnicmp((s1), (s2), (l))
00148 #else
00149 #define SCPIDEFINE_strncasecmp(s1, s2, l) OUR_strncasecmp((s1), (s2), (l))
00150 #endif
00151 
00152 #if HAVE_DTOSTRE
00153 #define SCPIDEFINE_doubleToStr(v, s, l) strlen(dtostre((v), (s), 6, DTOSTR_PLUS_SIGN | DTOSTR_ALWAYS_SIGN | DTOSTR_UPPERCASE))
00154 #else
00155 #define SCPIDEFINE_doubleToStr(v, s, l) snprintf((s), (l), "%lg", (v))
00156 #endif
00157 
00158 
00159 #ifdef  __cplusplus
00160 }
00161 #endif
00162 
00163 #endif