From 9caddf6c5c0dce43a531c3dc8cf2831195ea0876 Mon Sep 17 00:00:00 2001 From: Josh Rahm Date: Sun, 29 Nov 2020 21:02:37 -0700 Subject: The lights really work this time. I also found out that the noise in the lighhts was coming from the USB debug interface. For whatever reason it doesn't appear that the spi pins are not well isolated from the debugger noise so unplugging and running off one power source works pretty well. --- src/drv/ws2812B/ws2812b.c | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) (limited to 'src/drv/ws2812B/ws2812b.c') diff --git a/src/drv/ws2812B/ws2812b.c b/src/drv/ws2812B/ws2812b.c index 2a1ccfb..0fc519a 100644 --- a/src/drv/ws2812B/ws2812b.c +++ b/src/drv/ws2812B/ws2812b.c @@ -6,24 +6,25 @@ #include "kern/panic.h" uint8_t sintable[256] = { - 128, 148, 156, 162, 168, 172, 177, 181, 184, 187, 191, 194, 196, 199, 202, - 204, 207, 209, 211, 213, 215, 217, 219, 221, 223, 224, 226, 228, 229, 231, - 232, 233, 235, 236, 237, 239, 240, 241, 242, 243, 244, 245, 246, 246, 247, - 248, 249, 249, 250, 251, 251, 252, 252, 253, 253, 253, 254, 254, 254, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 254, 254, 254, 253, 253, - 253, 252, 252, 251, 251, 250, 249, 249, 248, 247, 246, 246, 245, 244, 243, - 242, 241, 240, 239, 237, 236, 235, 233, 232, 231, 229, 228, 226, 224, 223, - 221, 219, 217, 215, 213, 211, 209, 207, 204, 202, 199, 196, 194, 191, 187, - 184, 181, 177, 172, 168, 162, 156, 148, 128, 108, 100, 94, 88, 84, 79, - 75, 72, 69, 65, 62, 60, 57, 54, 52, 49, 47, 45, 43, 41, 39, - 37, 35, 33, 32, 30, 28, 27, 25, 24, 23, 21, 20, 19, 17, 16, - 15, 14, 13, 12, 11, 10, 10, 9, 8, 7, 7, 6, 5, 5, 4, - 4, 3, 3, 3, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 6, 7, - 7, 8, 9, 10, 10, 11, 12, 13, 14, 15, 16, 17, 19, 20, 21, - 23, 24, 25, 27, 28, 30, 32, 33, 35, 37, 39, 41, 43, 45, 47, - 49, 52, 54, 57, 60, 62, 65, 69, 72, 75, 79, 84, 88, 94, 100, - 108}; + 128, 131, 134, 137, 140, 143, 146, 149, 152, 155, 158, 162, 165, 167, 170, + 173, 176, 179, 182, 185, 188, 190, 193, 196, 198, 201, 203, 206, 208, 211, + 213, 215, 218, 220, 222, 224, 226, 228, 230, 232, 234, 235, 237, 238, 240, + 241, 243, 244, 245, 246, 248, 249, 250, 250, 251, 252, 253, 253, 254, 254, + 254, 255, 255, 255, 255, 255, 255, 255, 254, 254, 254, 253, 253, 252, 251, + 250, 250, 249, 248, 246, 245, 244, 243, 241, 240, 238, 237, 235, 234, 232, + 230, 228, 226, 224, 222, 220, 218, 215, 213, 211, 208, 206, 203, 201, 198, + 196, 193, 190, 188, 185, 182, 179, 176, 173, 170, 167, 165, 162, 158, 155, + 152, 149, 146, 143, 140, 137, 134, 131, 128, 124, 121, 118, 115, 112, 109, + 106, 103, 100, 97, 93, 90, 88, 85, 82, 79, 76, 73, 70, 67, 65, + 62, 59, 57, 54, 52, 49, 47, 44, 42, 40, 37, 35, 33, 31, 29, + 27, 25, 23, 21, 20, 18, 17, 15, 14, 12, 11, 10, 9, 7, 6, + 5, 5, 4, 3, 2, 2, 1, 1, 1, 0, 0, 0, 0, 0, 0, + 0, 1, 1, 1, 2, 2, 3, 4, 5, 5, 6, 7, 9, 10, 11, + 12, 14, 15, 17, 18, 20, 21, 23, 25, 27, 29, 31, 33, 35, 37, + 40, 42, 44, 47, 49, 52, 54, 57, 59, 62, 65, 67, 70, 73, 76, + 79, 82, 85, 88, 90, 93, 97, 100, 103, 106, 109, 112, 115, 118, 121, + 124, +}; uint8_t byte_sin(uint8_t n) { -- cgit