discoverpixy
calc.h
1 //
2 // begin license header
3 //
4 // This file is part of Pixy CMUcam5 or "Pixy" for short
5 //
6 // All Pixy source code is provided under the terms of the
7 // GNU General Public License v2 (http://www.gnu.org/licenses/gpl-2.0.html).
8 // Those wishing to use Pixy source code, software and/or
9 // technologies under different licensing terms should contact us at
10 // cmucam@cs.cmu.edu. Such licensing terms are available for
11 // all portions of the Pixy codebase presented here.
12 //
13 // end license header
14 //
15 
16 #ifndef CALC_H
17 #define CALC_H
18 #include <inttypes.h>
19 
20 #ifdef MAX
21 #undef MAX
22 #endif
23 #ifdef MIN
24 #undef MIN
25 #endif
26 #define MAX(a, b) (a>b ? a : b)
27 #define MIN(a, b) (a<b ? a : b)
28 
29 void hsvc(uint8_t r, uint8_t g, uint8_t b, uint8_t *h, uint8_t *s, uint8_t *v, uint8_t *c);
30 uint32_t lighten(uint32_t color, uint8_t factor);
31 uint32_t saturate(uint32_t color);
32 uint32_t rgbPack(uint32_t r, uint32_t g, uint32_t b);
33 void rgbUnpack(uint32_t color, uint32_t *r, uint32_t *g, uint32_t *b);
34 
35 #endif // CALC_H