mirror of https://github.com/ARMmbed/mbed-os.git
				
				
				
			Add mbed OS version macros
Allow compile-time tests on the version of mbed-os to cope with e.g. API changes across versions. To distinguish between mbed OS 2 and mbed OS 5, we use the MBED_CONF_RTOS_PRESENT macro. Note: mbed OS 2 versioning is 2.0.MBED_LIBRARY_VERSIONpull/3207/head
							parent
							
								
									03b8ae1811
								
							
						
					
					
						commit
						546da87cd8
					
				
							
								
								
									
										17
									
								
								mbed.h
								
								
								
								
							
							
						
						
									
										17
									
								
								mbed.h
								
								
								
								
							| 
						 | 
				
			
			@ -18,6 +18,23 @@
 | 
			
		|||
 | 
			
		||||
#define MBED_LIBRARY_VERSION 123
 | 
			
		||||
 | 
			
		||||
#if MBED_CONF_RTOS_PRESENT
 | 
			
		||||
// RTOS present, this is valid only for mbed OS 5
 | 
			
		||||
#define MBED_MAJOR_VERSION 5
 | 
			
		||||
#define MBED_MINOR_VERSION 2
 | 
			
		||||
#define MBED_PATCH_VERSION 1
 | 
			
		||||
 | 
			
		||||
#else
 | 
			
		||||
// mbed 2
 | 
			
		||||
#define MBED_MAJOR_VERSION 2
 | 
			
		||||
#define MBED_MINOR_VERSION 0
 | 
			
		||||
#define MBED_PATCH_VERSION MBED_LIBRARY_VERSION
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#define MBED_ENCODE_VERSION(major, minor, patch) ((major)*10000 + (minor)*100 + (patch))
 | 
			
		||||
 | 
			
		||||
#define MBED_VERSION MBED_ENCODE_VERSION(MBED_MAJOR_VERSION, MBED_MINOR_VERSION, MBED_PATCH_VERSION)
 | 
			
		||||
 | 
			
		||||
#if MBED_CONF_RTOS_PRESENT
 | 
			
		||||
#include "rtos/rtos.h"
 | 
			
		||||
#endif
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue