diff options
author | Josh Rahm <joshuarahm@gmail.com> | 2024-12-03 10:35:55 -0700 |
---|---|---|
committer | Josh Rahm <joshuarahm@gmail.com> | 2024-12-03 10:35:55 -0700 |
commit | f5e15a5a2d55cf0a6fbdbe04e5c49499a6eac642 (patch) | |
tree | d9f570c228268dfa0ecc31ad15579d412b953a6f /include/byte_math.h | |
parent | a15656b399689d0c7b12963a718729bea9b6dfcc (diff) | |
download | ch573-f5e15a5a2d55cf0a6fbdbe04e5c49499a6eac642.tar.gz ch573-f5e15a5a2d55cf0a6fbdbe04e5c49499a6eac642.tar.bz2 ch573-f5e15a5a2d55cf0a6fbdbe04e5c49499a6eac642.zip |
Basic Christmas light implementation!
Diffstat (limited to 'include/byte_math.h')
-rw-r--r-- | include/byte_math.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/include/byte_math.h b/include/byte_math.h new file mode 100644 index 0000000..79f93b8 --- /dev/null +++ b/include/byte_math.h @@ -0,0 +1,15 @@ +#pragma once + +#include <stdint.h> + +/* Library for doing fast math functions using just uint8_t. */ + +extern uint8_t sintable[256]; + +/* Returns ((sin(n) + 1) / 2) * 255 */ +static inline uint8_t byte_sin(uint8_t n) +{ + return sintable[n]; +} + +uint8_t calc_w(uint8_t n); |