WMath.h
Go to the documentation of this file.
1 /* $Id: WMath.h 1156 2011-06-07 04:01:16Z bhagman $
2 ||
3 || @author Hernando Barragan <b@wiring.org.co>
4 || @url http://wiring.org.co/
5 || @contribution Brett Hagman <bhagman@wiring.org.co>
6 || @contribution Alexander Brevig <abrevig@wiring.org.co>
7 ||
8 || @description
9 || | Math methods.
10 || |
11 || | Wiring Common API
12 || #
13 ||
14 || @license Please see cores/Common/License.txt.
15 ||
16 */
17 
18 #pragma once
19 
20 #include <cstdint>
21 
22 long random(long howbig);
23 
24 long random(long howsmall, long howbig);
25 
26 long map(long x, long in_min, long in_max, long out_min, long out_max);
27 
28 void randomSeed(uint16_t);
29 
30 static inline uint16_t makeWord(uint8_t highByte, uint8_t lowByte)
31 {
32  return (highByte << 8) | lowByte;
33 }
34 
35 static inline uint16_t makeWord(uint16_t w)
36 {
37  return w;
38 }
#define lowByte(x)
Definition: WConstants.h:105
#define highByte(x)
Definition: WConstants.h:106
long random(long howbig)
long map(long x, long in_min, long in_max, long out_min, long out_max)
static uint16_t makeWord(uint8_t highByte, uint8_t lowByte)
Definition: WMath.h:30
void randomSeed(uint16_t)