RUI3 (RAK Unified Interface 3) - RAK4631
ruiTop.h File Reference

Go to the source code of this file.

Macros

#define PI   3.1415926535897932384626433832795
 
#define HALF_PI   1.5707963267948966192313216916398
 
#define TWO_PI   6.283185307179586476925286766559
 
#define DEG_TO_RAD   0.017453292519943295769236907684886
 
#define RAD_TO_DEG   57.295779513082320876798154814105
 
#define EULER   2.718281828459045235360287471352
 
#define HIGH   0x1
 
#define LOW   0x0
 
#define CHANGE   2
 
#define FALLING   3
 
#define RISING   4
 
#define INPUT   0x0
 
#define OUTPUT   0x1
 
#define INPUT_PULLUP   0x2
 
#define INPUT_PULLDOWN   0x3
 
#define LED_BUILTIN   GREEN_LED
 
#define bitRead(value, bit)   (((value) >> (bit)) & 0x01)
 
#define bitSet(value, bit)   ((value) |= (1UL << (bit)))
 
#define bitClear(value, bit)   ((value) &= ~(1UL << (bit)))
 
#define bitWrite(value, bit, bitvalue)   ((bitvalue) ? bitSet(value, bit) : bitClear(value, bit))
 
#define bit(b)   (1UL << (b))
 
#define lowByte(w)   ((uint8_t) ((w) & 0xff))
 
#define highByte(w)   ((uint8_t) ((w) >> 8))
 
#define constrain(amt, low, high)   ((amt)<(low)?(low):((amt)>(high)?(high):(amt)))
 
#define sq(x)   ((x)*(x))
 
#define round(x)   ((x)>=0?(long)((x)+0.5):(long)((x)-0.5))
 
#define radians(deg)   ((deg)*DEG_TO_RAD)
 
#define degrees(rad)   ((rad)*RAD_TO_DEG)
 
#define abs(x)   ((x)>0?(x):-(x))
 

Typedefs

typedef enum _eAnalogReference eAnalogReference
 
typedef bool boolean
 
typedef uint8_t byte
 
typedef unsigned short word
 

Enumerations

enum  RAK_ADC_RESOLUTION {
  RAK_ADC_RESOLUTION_8BIT = UDRV_ADC_RESOLUTION_8BIT,
  RAK_ADC_RESOLUTION_10BIT = UDRV_ADC_RESOLUTION_10BIT,
  RAK_ADC_RESOLUTION_12BIT = UDRV_ADC_RESOLUTION_12BIT,
  RAK_ADC_RESOLUTION_14BIT = UDRV_ADC_RESOLUTION_14BIT
}
 
enum  RAK_ADC_MODE {
  RAK_ADC_MODE_DEFAULT = UDRV_ADC_MODE_DEFAULT,
  RAK_ADC_MODE_3_0 = UDRV_ADC_MODE_3_0,
  RAK_ADC_MODE_2_4 = UDRV_ADC_MODE_2_4,
  RAK_ADC_MODE_1_8 = UDRV_ADC_MODE_1_8,
  RAK_ADC_MODE_1_2 = UDRV_ADC_MODE_1_2
}
 
enum  RAK_PWM_RESOLUTION {
  RAK_PWM_RESOLUTION_8BIT = UDRV_PWM_RESOLUTION_8BIT,
  RAK_PWM_RESOLUTION_10BIT = UDRV_PWM_RESOLUTION_10BIT,
  RAK_PWM_RESOLUTION_12BIT = UDRV_PWM_RESOLUTION_12BIT,
  RAK_PWM_RESOLUTION_14BIT = UDRV_PWM_RESOLUTION_14BIT
}
 
enum  _eAnalogReference {
  AR_DEFAULT = UDRV_ADC_MODE_DEFAULT,
  AR_INTERNAL = UDRV_ADC_MODE_3_3,
  AR_INTERNAL_3_0 = UDRV_ADC_MODE_3_0,
  AR_INTERNAL_2_4 = UDRV_ADC_MODE_2_4,
  AR_INTERNAL_1_8 = UDRV_ADC_MODE_1_8,
  AR_INTERNAL_1_2 = UDRV_ADC_MODE_1_2
}
 
enum  BitOrder {
  LSBFIRST = 0,
  MSBFIRST = 1
}
 

Functions

template<class T , class L >
auto min (const T &a, const L &b) -> decltype((b< a) ? b :a)
 
template<class T , class L >
auto max (const T &a, const L &b) -> decltype((b< a) ? b :a)
 
long map (long, long, long, long, long)
 
long random (long max)
 
long random (long min, long max)
 
void randomSeed (unsigned long seed)
 
void pinMode (uint8_t pin, uint8_t mode)
 
void digitalWrite (uint8_t pin, uint8_t value)
 
int digitalRead (uint8_t pin)
 
int analogRead (uint8_t pin)
 
void analogReference (eAnalogReference mode)
 
void analogOversampling (uint32_t ulOversampling)
 
void analogWrite (uint8_t pin, int value)
 
void analogReadResolution (uint8_t bits)
 
void analogWriteResolution (uint8_t bits)
 
void tone (uint8_t pin, uint32_t frequency, uint64_t duration=0)
 
void noTone (uint8_t pin)
 
void shiftOut (uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder, uint8_t val)
 
uint32_t shiftIn (uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder)
 
unsigned long pulseIn (uint8_t pin, uint8_t state, unsigned long timeout=1000000L)
 
unsigned long pulseInLong (uint8_t pin, uint8_t state, unsigned long timeout=1000000L)
 
void interrupts (void)
 
void noInterrupts (void)
 
void attachInterrupt (uint32_t pin, void(*userFunc)(void), int mode)
 
void detachInterrupt (uint32_t pin)
 
void yield (void)
 

Macro Definition Documentation

◆ PI

#define PI   3.1415926535897932384626433832795

◆ HALF_PI

#define HALF_PI   1.5707963267948966192313216916398

◆ TWO_PI

#define TWO_PI   6.283185307179586476925286766559

◆ DEG_TO_RAD

#define DEG_TO_RAD   0.017453292519943295769236907684886

◆ RAD_TO_DEG

#define RAD_TO_DEG   57.295779513082320876798154814105

◆ EULER

#define EULER   2.718281828459045235360287471352

◆ HIGH

#define HIGH   0x1

◆ LOW

#define LOW   0x0

◆ CHANGE

#define CHANGE   2

◆ FALLING

#define FALLING   3

◆ RISING

#define RISING   4

◆ INPUT

#define INPUT   0x0

◆ OUTPUT

#define OUTPUT   0x1

◆ INPUT_PULLUP

#define INPUT_PULLUP   0x2

◆ INPUT_PULLDOWN

#define INPUT_PULLDOWN   0x3

◆ LED_BUILTIN

#define LED_BUILTIN   GREEN_LED

◆ constrain

#define constrain (   amt,
  low,
  high 
)    ((amt)<(low)?(low):((amt)>(high)?(high):(amt)))

◆ sq

#define sq (   x)    ((x)*(x))

◆ round

#define round (   x)    ((x)>=0?(long)((x)+0.5):(long)((x)-0.5))

◆ radians

#define radians (   deg)    ((deg)*DEG_TO_RAD)

◆ degrees

#define degrees (   rad)    ((rad)*RAD_TO_DEG)

◆ abs

#define abs (   x)    ((x)>0?(x):-(x))

Typedef Documentation

◆ boolean

typedef bool boolean

◆ byte

typedef uint8_t byte

◆ word

typedef unsigned short word

Enumeration Type Documentation

◆ BitOrder

enum BitOrder
Enumerator
LSBFIRST 
MSBFIRST 

Function Documentation

◆ min()

auto min ( const T &  a,
const L &  b 
) -> decltype((b < a) ? b : a)

◆ max()

auto max ( const T &  a,
const L &  b 
) -> decltype((b < a) ? b : a)

◆ map()

long map ( long  ,
long  ,
long  ,
long  ,
long   
)

◆ random()

long random ( long  max)