Library to read/write Sensirion SF04 based gas/liquid flow sensors.

Dependents:   TestBenchSerenity-proto_F429ZI TestBenchFlow HSPFLOW1 TestBenchFlow1 ... more

Committer:
dmwahl
Date:
Thu Sep 16 20:46:51 2021 +0000
Revision:
7:0c1bbd80bec3
Parent:
6:585dc94d5161
Added static_cast<char>(____) to line 188 of sensirion_sf04.cpp

Who changed what in which revision?

UserRevisionLine numberNew contents of line
dmwahl 6:585dc94d5161 1 #ifndef SENSIRION_SF04_TYPEDEFS_H
dmwahl 6:585dc94d5161 2 #define SENSIRION_SF04_TYPEDEFS_H
dmwahl 0:9e74b14299fd 3 //==============================================================================
dmwahl 0:9e74b14299fd 4 // S E N S I R I O N AG, Laubisruetistr. 50, CH-8712 Staefa, Switzerland
dmwahl 0:9e74b14299fd 5 //==============================================================================
dmwahl 0:9e74b14299fd 6 // Project : SF04 Sample Code (V1.0)
dmwahl 0:9e74b14299fd 7 // File : typedefs.h
dmwahl 0:9e74b14299fd 8 // Author : MST
dmwahl 0:9e74b14299fd 9 // Controller: NEC V850/SG3 (uPD70F3740)
dmwahl 0:9e74b14299fd 10 // Compiler : IAR compiler for V850 (3.50A)
dmwahl 0:9e74b14299fd 11 // Brief : Definitions of typedefs for good readability and portability
dmwahl 0:9e74b14299fd 12 //==============================================================================
dmwahl 0:9e74b14299fd 13 //---------- Defines -----------------------------------------------------------
dmwahl 0:9e74b14299fd 14 //Processor endian system
dmwahl 0:9e74b14299fd 15 //#define BIG ENDIAN //e.g. Motorola (not tested at this time)
dmwahl 0:9e74b14299fd 16 #define LITTLE_ENDIAN //e.g. PIC, 8051, NEC V850
dmwahl 0:9e74b14299fd 17 //==============================================================================
dmwahl 0:9e74b14299fd 18 // basic types: making the size of types clear
dmwahl 0:9e74b14299fd 19 //==============================================================================
dmwahl 0:9e74b14299fd 20 typedef unsigned char u8t; ///< range: 0 .. 255
dmwahl 0:9e74b14299fd 21 typedef signed char i8t; ///< range: -128 .. +127
dmwahl 0:9e74b14299fd 22
dmwahl 0:9e74b14299fd 23 typedef unsigned short u16t; ///< range: 0 .. 65535
dmwahl 0:9e74b14299fd 24 typedef signed short i16t; ///< range: -32768 .. +32767
dmwahl 0:9e74b14299fd 25
dmwahl 0:9e74b14299fd 26 typedef unsigned long u32t; ///< range: 0 .. 4'294'967'295
dmwahl 0:9e74b14299fd 27 typedef signed long i32t; ///< range: -2'147'483'648 .. +2'147'483'647
dmwahl 0:9e74b14299fd 28
dmwahl 0:9e74b14299fd 29 typedef float ft; ///< range: +-1.18E-38 .. +-3.39E+38
dmwahl 0:9e74b14299fd 30 typedef double dt; ///< range: .. +-1.79E+308
dmwahl 0:9e74b14299fd 31
dmwahl 0:9e74b14299fd 32 typedef bool bt; ///< values: 0, 1 (real bool used)
dmwahl 0:9e74b14299fd 33
dmwahl 0:9e74b14299fd 34 typedef union {
dmwahl 0:9e74b14299fd 35 u16t u16; // element specifier for accessing the whole u16
dmwahl 0:9e74b14299fd 36 i16t i16; // element specifier for accessing the whole i16
dmwahl 0:9e74b14299fd 37 struct {
dmwahl 0:9e74b14299fd 38 #ifdef LITTLE_ENDIAN // Byte-order is little endian
dmwahl 0:9e74b14299fd 39 u8t u8L; // element specifier for accessing the low u8
dmwahl 0:9e74b14299fd 40 u8t u8H; // element specifier for accessing the high u8
dmwahl 0:9e74b14299fd 41 #else // Byte-order is big endian
dmwahl 0:9e74b14299fd 42 u8t u8H; // element specifier for accessing the low u8
dmwahl 0:9e74b14299fd 43 u8t u8L; // element specifier for accessing the high u8
dmwahl 0:9e74b14299fd 44 #endif
dmwahl 0:9e74b14299fd 45 } s16; // element spec. for acc. struct with low or high u8
dmwahl 0:9e74b14299fd 46 } nt16;
dmwahl 0:9e74b14299fd 47
dmwahl 0:9e74b14299fd 48 typedef union {
dmwahl 0:9e74b14299fd 49 u32t u32; // element specifier for accessing the whole u32
dmwahl 0:9e74b14299fd 50 i32t i32; // element specifier for accessing the whole i32
dmwahl 0:9e74b14299fd 51 struct {
dmwahl 0:9e74b14299fd 52 #ifdef LITTLE_ENDIAN // Byte-order is little endian
dmwahl 0:9e74b14299fd 53 u16t u16L; // element specifier for accessing the low u16
dmwahl 0:9e74b14299fd 54 u16t u16H; // element specifier for accessing the high u16
dmwahl 0:9e74b14299fd 55 #else // Byte-order is big endian
dmwahl 0:9e74b14299fd 56 u16t u16H; // element specifier for accessing the low u16
dmwahl 0:9e74b14299fd 57 u16t u16L; // element specifier for accessing the high u16
dmwahl 0:9e74b14299fd 58 #endif
dmwahl 0:9e74b14299fd 59 } s32; // element spec. for acc. struct with low or high u16
dmwahl 0:9e74b14299fd 60 } nt32;
dmwahl 0:9e74b14299fd 61 #endif