GY-63_MS5611/libraries/integer24/integer24.h

88 lines
1.7 KiB
C
Raw Normal View History

2023-06-22 12:50:03 -04:00
#pragma once
//
// FILE: integer24.h
// AUTHOR: Rob Tillaart
2023-11-07 08:29:20 -05:00
// VERSION: 0.1.2
2023-06-22 12:50:03 -04:00
// DATE: 2023-06-22
// PURPOSE: Arduino library for the uint24_t and int24_t
// URL: https://github.com/RobTillaart/integer24
//
// uses a simple typedef
2023-06-27 12:28:02 -04:00
// only tested on AVR for now
2023-06-22 12:50:03 -04:00
2023-11-07 08:29:20 -05:00
#define INTEGER24_LIB_VERSION (F("0.1.2"))
2023-06-22 12:50:03 -04:00
#include "Arduino.h"
#if defined(ARDUINO_ARCH_AVR) || defined(ARDUINO_ARCH_MEGAAVR)
// supports a true 3 byte data type
typedef __uint24 uint24_t;
typedef __int24 int24_t;
#else
2023-06-27 12:28:02 -04:00
2023-06-22 12:50:03 -04:00
// use 32 bits (4 byte) for now
typedef uint32_t uint24_t;
typedef int32_t int24_t;
#endif
2023-11-07 08:29:20 -05:00
/*
// interface of the class, int24_t idem.
// copied from float16()
class uint24_t : public Printable
{
public:
// Constructors
uint24_t(void) { _value = 0; };
uint24_t(double f);
uint24_t(const uint24_t &f) { _value = f._value; };
// equalities
bool operator == (const uint24_t& f);
bool operator != (const uint24_t& f);
bool operator > (const uint24_t& f);
bool operator >= (const uint24_t& f);
bool operator < (const uint24_t& f);
bool operator <= (const uint24_t& f);
// negation
uint24_t operator - ();
// basic math
uint24_t operator + (const uint24_t& f);
uint24_t operator - (const uint24_t& f);
uint24_t operator * (const uint24_t& f);
uint24_t operator / (const uint24_t& f);
uint24_t& operator += (const uint24_t& f);
uint24_t& operator -= (const uint24_t& f);
uint24_t& operator *= (const uint24_t& f);
uint24_t& operator /= (const uint24_t& f);
// Printable
size_t printTo(Print& p) const;
private:
#if defined(ARDUINO_ARCH_AVR) || defined(ARDUINO_ARCH_MEGAAVR)
uint24_t _value;
#else
uint32_t _value;
#endif
}
*/
2023-06-27 12:28:02 -04:00
2023-06-22 12:50:03 -04:00
// -- END OF FILE --