1 /** 2 * \file 3 * 4 * \brief Increment macro. 5 * 6 * Copyright (C) 2014 Atmel Corporation. All rights reserved. 7 * 8 * \asf_license_start 9 * 10 * \page License 11 * 12 * Redistribution and use in source and binary forms, with or without 13 * modification, are permitted provided that the following conditions are met: 14 * 15 * 1. Redistributions of source code must retain the above copyright notice, 16 * this list of conditions and the following disclaimer. 17 * 18 * 2. Redistributions in binary form must reproduce the above copyright notice, 19 * this list of conditions and the following disclaimer in the documentation 20 * and/or other materials provided with the distribution. 21 * 22 * 3. The name of Atmel may not be used to endorse or promote products derived 23 * from this software without specific prior written permission. 24 * 25 * 4. This software may only be redistributed and used in connection with an 26 * Atmel microcontroller product. 27 * 28 * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED 29 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 30 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE 31 * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR 32 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 33 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 34 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 35 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 36 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 37 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 38 * POSSIBILITY OF SUCH DAMAGE. 39 * 40 * \asf_license_stop 41 * 42 */ 43 44 #ifndef _UTILS_INCREMENT_MACRO_H 45 #define _UTILS_INCREMENT_MACRO_H 46 47 #ifdef __cplusplus 48 extern "C" { 49 #endif 50 51 /** 52 * \brief Compile time increment, result value is entire integer literal 53 * 54 * \param[in] val - value to be incremented (254 max) 55 */ 56 #define INC_VALUE(val) SP_INC_##val 57 58 // Preprocessor increment implementation 59 #define SP_INC_0 1 60 #define SP_INC_1 2 61 #define SP_INC_2 3 62 #define SP_INC_3 4 63 #define SP_INC_4 5 64 #define SP_INC_5 6 65 #define SP_INC_6 7 66 #define SP_INC_7 8 67 #define SP_INC_8 9 68 #define SP_INC_9 10 69 #define SP_INC_10 11 70 #define SP_INC_11 12 71 #define SP_INC_12 13 72 #define SP_INC_13 14 73 #define SP_INC_14 15 74 #define SP_INC_15 16 75 #define SP_INC_16 17 76 #define SP_INC_17 18 77 #define SP_INC_18 19 78 #define SP_INC_19 20 79 #define SP_INC_20 21 80 #define SP_INC_21 22 81 #define SP_INC_22 23 82 #define SP_INC_23 24 83 #define SP_INC_24 25 84 #define SP_INC_25 26 85 #define SP_INC_26 27 86 #define SP_INC_27 28 87 #define SP_INC_28 29 88 #define SP_INC_29 30 89 #define SP_INC_30 31 90 #define SP_INC_31 32 91 #define SP_INC_32 33 92 #define SP_INC_33 34 93 #define SP_INC_34 35 94 #define SP_INC_35 36 95 #define SP_INC_36 37 96 #define SP_INC_37 38 97 #define SP_INC_38 39 98 #define SP_INC_39 40 99 #define SP_INC_40 41 100 #define SP_INC_41 42 101 #define SP_INC_42 43 102 #define SP_INC_43 44 103 #define SP_INC_44 45 104 #define SP_INC_45 46 105 #define SP_INC_46 47 106 #define SP_INC_47 48 107 #define SP_INC_48 49 108 #define SP_INC_49 50 109 #define SP_INC_50 51 110 #define SP_INC_51 52 111 #define SP_INC_52 53 112 #define SP_INC_53 54 113 #define SP_INC_54 55 114 #define SP_INC_55 56 115 #define SP_INC_56 57 116 #define SP_INC_57 58 117 #define SP_INC_58 59 118 #define SP_INC_59 60 119 #define SP_INC_60 61 120 #define SP_INC_61 62 121 #define SP_INC_62 63 122 #define SP_INC_63 64 123 #define SP_INC_64 65 124 #define SP_INC_65 66 125 #define SP_INC_66 67 126 #define SP_INC_67 68 127 #define SP_INC_68 69 128 #define SP_INC_69 70 129 #define SP_INC_70 71 130 #define SP_INC_71 72 131 #define SP_INC_72 73 132 #define SP_INC_73 74 133 #define SP_INC_74 75 134 #define SP_INC_75 76 135 #define SP_INC_76 77 136 #define SP_INC_77 78 137 #define SP_INC_78 79 138 #define SP_INC_79 80 139 #define SP_INC_80 81 140 #define SP_INC_81 82 141 #define SP_INC_82 83 142 #define SP_INC_83 84 143 #define SP_INC_84 85 144 #define SP_INC_85 86 145 #define SP_INC_86 87 146 #define SP_INC_87 88 147 #define SP_INC_88 89 148 #define SP_INC_89 90 149 #define SP_INC_90 91 150 #define SP_INC_91 92 151 #define SP_INC_92 93 152 #define SP_INC_93 94 153 #define SP_INC_94 95 154 #define SP_INC_95 96 155 #define SP_INC_96 97 156 #define SP_INC_97 98 157 #define SP_INC_98 99 158 #define SP_INC_99 100 159 #define SP_INC_100 101 160 #define SP_INC_101 102 161 #define SP_INC_102 103 162 #define SP_INC_103 104 163 #define SP_INC_104 105 164 #define SP_INC_105 106 165 #define SP_INC_106 107 166 #define SP_INC_107 108 167 #define SP_INC_108 109 168 #define SP_INC_109 110 169 #define SP_INC_110 111 170 #define SP_INC_111 112 171 #define SP_INC_112 113 172 #define SP_INC_113 114 173 #define SP_INC_114 115 174 #define SP_INC_115 116 175 #define SP_INC_116 117 176 #define SP_INC_117 118 177 #define SP_INC_118 119 178 #define SP_INC_119 120 179 #define SP_INC_120 121 180 #define SP_INC_121 122 181 #define SP_INC_122 123 182 #define SP_INC_123 124 183 #define SP_INC_124 125 184 #define SP_INC_125 126 185 #define SP_INC_126 127 186 #define SP_INC_127 128 187 #define SP_INC_128 129 188 #define SP_INC_129 130 189 #define SP_INC_130 131 190 #define SP_INC_131 132 191 #define SP_INC_132 133 192 #define SP_INC_133 134 193 #define SP_INC_134 135 194 #define SP_INC_135 136 195 #define SP_INC_136 137 196 #define SP_INC_137 138 197 #define SP_INC_138 139 198 #define SP_INC_139 140 199 #define SP_INC_140 141 200 #define SP_INC_141 142 201 #define SP_INC_142 143 202 #define SP_INC_143 144 203 #define SP_INC_144 145 204 #define SP_INC_145 146 205 #define SP_INC_146 147 206 #define SP_INC_147 148 207 #define SP_INC_148 149 208 #define SP_INC_149 150 209 #define SP_INC_150 151 210 #define SP_INC_151 152 211 #define SP_INC_152 153 212 #define SP_INC_153 154 213 #define SP_INC_154 155 214 #define SP_INC_155 156 215 #define SP_INC_156 157 216 #define SP_INC_157 158 217 #define SP_INC_158 159 218 #define SP_INC_159 160 219 #define SP_INC_160 161 220 #define SP_INC_161 162 221 #define SP_INC_162 163 222 #define SP_INC_163 164 223 #define SP_INC_164 165 224 #define SP_INC_165 166 225 #define SP_INC_166 167 226 #define SP_INC_167 168 227 #define SP_INC_168 169 228 #define SP_INC_169 170 229 #define SP_INC_170 171 230 #define SP_INC_171 172 231 #define SP_INC_172 173 232 #define SP_INC_173 174 233 #define SP_INC_174 175 234 #define SP_INC_175 176 235 #define SP_INC_176 177 236 #define SP_INC_177 178 237 #define SP_INC_178 179 238 #define SP_INC_179 180 239 #define SP_INC_180 181 240 #define SP_INC_181 182 241 #define SP_INC_182 183 242 #define SP_INC_183 184 243 #define SP_INC_184 185 244 #define SP_INC_185 186 245 #define SP_INC_186 187 246 #define SP_INC_187 188 247 #define SP_INC_188 189 248 #define SP_INC_189 190 249 #define SP_INC_190 191 250 #define SP_INC_191 192 251 #define SP_INC_192 193 252 #define SP_INC_193 194 253 #define SP_INC_194 195 254 #define SP_INC_195 196 255 #define SP_INC_196 197 256 #define SP_INC_197 198 257 #define SP_INC_198 199 258 #define SP_INC_199 200 259 #define SP_INC_200 201 260 #define SP_INC_201 202 261 #define SP_INC_202 203 262 #define SP_INC_203 204 263 #define SP_INC_204 205 264 #define SP_INC_205 206 265 #define SP_INC_206 207 266 #define SP_INC_207 208 267 #define SP_INC_208 209 268 #define SP_INC_209 210 269 #define SP_INC_210 211 270 #define SP_INC_211 212 271 #define SP_INC_212 213 272 #define SP_INC_213 214 273 #define SP_INC_214 215 274 #define SP_INC_215 216 275 #define SP_INC_216 217 276 #define SP_INC_217 218 277 #define SP_INC_218 219 278 #define SP_INC_219 220 279 #define SP_INC_220 221 280 #define SP_INC_221 222 281 #define SP_INC_222 223 282 #define SP_INC_223 224 283 #define SP_INC_224 225 284 #define SP_INC_225 226 285 #define SP_INC_226 227 286 #define SP_INC_227 228 287 #define SP_INC_228 229 288 #define SP_INC_229 230 289 #define SP_INC_230 231 290 #define SP_INC_231 232 291 #define SP_INC_232 233 292 #define SP_INC_233 234 293 #define SP_INC_234 235 294 #define SP_INC_235 236 295 #define SP_INC_236 237 296 #define SP_INC_237 238 297 #define SP_INC_238 239 298 #define SP_INC_239 240 299 #define SP_INC_240 241 300 #define SP_INC_241 242 301 #define SP_INC_242 243 302 #define SP_INC_243 244 303 #define SP_INC_244 245 304 #define SP_INC_245 246 305 #define SP_INC_246 247 306 #define SP_INC_247 248 307 #define SP_INC_248 249 308 #define SP_INC_249 250 309 #define SP_INC_250 251 310 #define SP_INC_251 252 311 #define SP_INC_252 253 312 #define SP_INC_253 254 313 #define SP_INC_254 255 314 315 #ifdef __cplusplus 316 } 317 #endif 318 #endif /* _UTILS_INCREMENT_MACRO_H */ 319