Skip to content

Commit ac27993

Browse files
Added makeWord macro and functions to fix #316
1 parent 7d1119e commit ac27993

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

STM32F1/cores/maple/wirish_math.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,12 @@ long random(long howsmall, long howbig) {
4747
return random(diff) + howsmall;
4848
}
4949

50+
extern uint16_t makeWord( uint16_t w )
51+
{
52+
return w ;
53+
}
54+
55+
extern uint16_t makeWord( uint8_t h, uint8_t l )
56+
{
57+
return (h << 8) | l ;
58+
}

STM32F1/cores/maple/wirish_math.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#define _WIRISH_WIRISH_MATH_H_
3434

3535
#include <math.h>
36+
#include <stdint.h>
3637

3738
/**
3839
* @brief Initialize the pseudo-random number generator.
@@ -161,4 +162,9 @@ double sqrt(double x);
161162
*/
162163
double pow(double x, double y);
163164

165+
extern uint16_t makeWord( uint16_t w ) ;
166+
extern uint16_t makeWord( uint8_t h, uint8_t l ) ;
167+
168+
#define word(...) makeWord(__VA_ARGS__)
169+
164170
#endif

0 commit comments

Comments
 (0)