Mbed OS Reference
Loading...
Searching...
No Matches
mbed_version.h
1/* mbed Microcontroller Library
2 * Copyright (c) 2018-2019 ARM Limited
3 * SPDX-License-Identifier: Apache-2.0
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18#ifndef MBED_VERSION_H
19#define MBED_VERSION_H
20
21/** \addtogroup platform-public-api */
22/** @{*/
23
24/**
25 * \defgroup platform_version Version macros
26 * @{
27 */
28
29/** MBED_MAJOR_VERSION
30 * Mbed OS major version
31 *
32 * @note 99 is default value for development version (master branch)
33 */
34#define MBED_MAJOR_VERSION 6
35
36/** MBED_MINOR_VERSION
37 * Mbed OS minor version
38 *
39 * @note 99 is default value for development version (master branch)
40 */
41#define MBED_MINOR_VERSION 17
42
43/** MBED_PATCH_VERSION
44 * Mbed OS patch version
45 *
46 * @note 99 is default value for development version (master branch)
47 */
48#define MBED_PATCH_VERSION 0
49
50#define MBED_ENCODE_VERSION(major, minor, patch) ((major)*10000 + (minor)*100 + (patch))
51
52/** MBED_VERSION
53 * Mbed OS 5 version (MMmmpp - M(Major); m(minor); p(patch))
54 *
55 * @note 999999 is default value for development version (master branch)
56 */
57#define MBED_VERSION MBED_ENCODE_VERSION(MBED_MAJOR_VERSION, MBED_MINOR_VERSION, MBED_PATCH_VERSION)
58
59/** MBED_VERSION_CHECK
60 * Macro can be used to check minimum Mbed OS version required for feature/library. If current version
61 * is less than required, it will assert.
62 *
63 * @note: Version of master branch will be 999999 as default, hence no assert/warning is provided for
64 * master branch code
65 */
66#define MBED_VERSION_CHECK(major, minor, patch) do { \
67 static_assert((MBED_VERSION >= MBED_ENCODE_VERSION((major),(minor),(patch))), "Incompatible mbed-os version detected!!"); \
68 } while(0)
69
70#endif
71
72/** @}*/
73/** @}*/