Creates DAC interface

Fork of DevInterfaces by wimbeaumont Project

Committer:
wbeaumont
Date:
Fri Jan 08 11:56:44 2016 +0000
Revision:
1:5672673314f9
Parent:
0:da1fb7dd363f
Child:
2:58f1d5a3f850
virtual  I2C interface and some other classes for I2C devices

Who changed what in which revision?

UserRevisionLine numberNew contents of line
wbeaumont 0:da1fb7dd363f 1 #include "getVersion.h"
wbeaumont 0:da1fb7dd363f 2
wbeaumont 1:5672673314f9 3 #define GETVERSION_SRC_VER "0.11"
wbeaumont 1:5672673314f9 4 #ifdef MBED
wbeaumont 0:da1fb7dd363f 5 #include "mbed.h"
wbeaumont 1:5672673314f9 6 #else
wbeaumont 1:5672673314f9 7 #include <stdlib.h>
wbeaumont 1:5672673314f9 8 #endif
wbeaumont 0:da1fb7dd363f 9
wbeaumont 0:da1fb7dd363f 10 #define NULL 0
wbeaumont 0:da1fb7dd363f 11
wbeaumont 0:da1fb7dd363f 12 void getVersion::get_dec_version( unsigned short hexversion , unsigned char & version, unsigned char& subversion) {
wbeaumont 0:da1fb7dd363f 13 subversion =(unsigned short)( hexversion & 0xFF);
wbeaumont 0:da1fb7dd363f 14 hexversion=hexversion >> 8;
wbeaumont 0:da1fb7dd363f 15 version =(unsigned char)( hexversion & 0xFF);
wbeaumont 0:da1fb7dd363f 16 }
wbeaumont 0:da1fb7dd363f 17
wbeaumont 0:da1fb7dd363f 18
wbeaumont 0:da1fb7dd363f 19
wbeaumont 0:da1fb7dd363f 20 unsigned short getVersion::get_hex_version_nr(const char * vers){
wbeaumont 0:da1fb7dd363f 21 float verf = strtof(vers,NULL);
wbeaumont 0:da1fb7dd363f 22 unsigned short version=(unsigned short) verf;
wbeaumont 0:da1fb7dd363f 23 verf=verf-version;
wbeaumont 0:da1fb7dd363f 24 version = version<<8;
wbeaumont 0:da1fb7dd363f 25 verf=verf*100;
wbeaumont 0:da1fb7dd363f 26 unsigned char sub=(unsigned char)verf;
wbeaumont 0:da1fb7dd363f 27 version=version| sub;
wbeaumont 0:da1fb7dd363f 28 return version;
wbeaumont 0:da1fb7dd363f 29 }
wbeaumont 0:da1fb7dd363f 30
wbeaumont 0:da1fb7dd363f 31
wbeaumont 0:da1fb7dd363f 32
wbeaumont 0:da1fb7dd363f 33
wbeaumont 0:da1fb7dd363f 34
wbeaumont 0:da1fb7dd363f 35
wbeaumont 0:da1fb7dd363f 36 unsigned short getVersion::getHdrVersion(){
wbeaumont 0:da1fb7dd363f 37 if( hver == NULL) return get_hex_version_nr(GETVERSION_HDR_VER);
wbeaumont 0:da1fb7dd363f 38 else return get_hex_version_nr(hver);
wbeaumont 0:da1fb7dd363f 39 }
wbeaumont 0:da1fb7dd363f 40
wbeaumont 0:da1fb7dd363f 41 unsigned short getVersion::getSrcVersion(){
wbeaumont 0:da1fb7dd363f 42 if( sver == NULL) return get_hex_version_nr(GETVERSION_SRC_VER);
wbeaumont 0:da1fb7dd363f 43 else return get_hex_version_nr(sver);
wbeaumont 0:da1fb7dd363f 44 }
wbeaumont 0:da1fb7dd363f 45
wbeaumont 0:da1fb7dd363f 46
wbeaumont 0:da1fb7dd363f 47 unsigned short getVersion::getCompileTime(){
wbeaumont 0:da1fb7dd363f 48 if ( ctime == NULL ) return 0;
wbeaumont 0:da1fb7dd363f 49 else return 0;
wbeaumont 0:da1fb7dd363f 50 }
wbeaumont 0:da1fb7dd363f 51
wbeaumont 0:da1fb7dd363f 52
wbeaumont 0:da1fb7dd363f 53 unsigned short getVersion::getCompileDate(){
wbeaumont 0:da1fb7dd363f 54 if ( cdate == NULL ) return 0;
wbeaumont 0:da1fb7dd363f 55 else return 0;
wbeaumont 0:da1fb7dd363f 56 }
wbeaumont 0:da1fb7dd363f 57
wbeaumont 0:da1fb7dd363f 58 unsigned short getVersion::getCompileYear(){
wbeaumont 0:da1fb7dd363f 59
wbeaumont 0:da1fb7dd363f 60 if ( cdate == NULL ) return 0;
wbeaumont 0:da1fb7dd363f 61 else return 0;
wbeaumont 0:da1fb7dd363f 62 }