Twizy-Cfg/TwizyCfg/utils.h

58 lines
1.3 KiB
C
Raw Normal View History

2017-06-13 22:35:06 +00:00
/**
* ==========================================================================
* Twizy/SEVCON configuration shell
* ==========================================================================
*
* Utilities
*
* Based on the OVMS:
* https://github.com/openvehicles/Open-Vehicle-Monitoring-System
*
* License:
* This is free software.
* This is a modified copy of the OVMS general utils, so the OVMS license applies:
* https://github.com/openvehicles/Open-Vehicle-Monitoring-System/blob/master/LICENSE
*
*/
#ifndef _utils_h
#define _utils_h
// Type shortcuts:
typedef unsigned char UINT8;
2023-03-05 07:43:30 +00:00
typedef unsigned short UINT;
typedef unsigned short WORD;
2017-06-13 22:35:06 +00:00
typedef unsigned long UINT32;
typedef signed char INT8;
typedef byte BYTE;
typedef bool BOOL;
#define TRUE true
#define FALSE false
2017-06-13 22:35:06 +00:00
// Useful macros:
#define SQR(n) ((n)*(n))
#define ABS(n) (((n) < 0) ? -(n) : (n))
#define MIN(n,m) ((n) < (m) ? (n) : (m))
#define MAX(n,m) ((n) > (m) ? (n) : (m))
#define LIMIT_MIN(n,lim) ((n) < (lim) ? (lim) : (n))
#define LIMIT_MAX(n,lim) ((n) > (lim) ? (lim) : (n))
#define delay5(n) delay(5*(n))
#define delay100(n) delay(100*(n))
#define CHECKPOINT(n) ;
// PROGMEM string helpers:
#define FLASHSTRING const __FlashStringHelper
#define FS(x) (__FlashStringHelper*)(x)
2017-06-13 22:35:06 +00:00
#endif // _utils_h