JWoodrell 285 Posted December 21, 2016 Share Posted December 21, 2016 personally I use the SPI method exclusively for the smart LEDs (WS2812B, and sk6812 recently) one trick for getting the timing to cooperate is to set the SPI divider to get you close then you can change the rate of the MCLK registers to fine tune the timing. it only has to be changed while the SPI is transmitting so you can change the clock back to normal "speed" after your done with the transmission. dubnet, Rickta59 and Fmilburn 3 Quote Link to post Share on other sites
Rickta59 589 Posted December 22, 2016 Share Posted December 22, 2016 So I liked your idea JWoodrell, I made a little class to let me tweak on the fly without much effort: class tweak_clk { int plus_; public: tweak_clk(int plus) : plus_(plus) { DCOCTL += plus_; } ~tweak_clk(void) { DCOCTL -= plus_; } }; ... to use it .. void foo(void) { ... code running at normal speed { tweak_clk turbo_20(0x20); // constructor called here ... run some more code at faster speed } .. // destructor called when we left that code block .. all code here is normal speed again Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.