Hello everyone,
I'm having a think about my project and the number of GPIO I'm using up for status LEDs currently 4 but I may want to do more. I've coded for WiFi, Run, Error, and User LEDs now I'm also using the onboard led as a I'm alive and running. I also have a static LED for power.
But now the blinking, I want to just set it and something in the background look after things. I came up with assigning a byte to each LED and then each bit has a function.
bit 0 - On/Off
bit 1 - Flash/Steady
bit 2 - Fast/Slow
bit 3 - Pattern/Count
bit 4-7 Blink Code
I figured that if I use a timer or I simply poll over them I can update the LEDs and then not have to worry in the main code when it's time to turn something on or off. Mostly useful for Error code, at a glance you the blink pattern know the WiFi is connection or what Error is going on.
I thought doing it this way if I take the status off the GPIO and move it to a shift register or port expander or what ever the looping code can handle the updates.
As for the timing base I'm thinking there is a absolute_us timer running and I could pick off that. I just don't know is this a good way to approach status LEDs? Has anyone else done this or simpler with status LEDs?
I'm having a think about my project and the number of GPIO I'm using up for status LEDs currently 4 but I may want to do more. I've coded for WiFi, Run, Error, and User LEDs now I'm also using the onboard led as a I'm alive and running. I also have a static LED for power.
But now the blinking, I want to just set it and something in the background look after things. I came up with assigning a byte to each LED and then each bit has a function.
bit 0 - On/Off
bit 1 - Flash/Steady
bit 2 - Fast/Slow
bit 3 - Pattern/Count
bit 4-7 Blink Code
I figured that if I use a timer or I simply poll over them I can update the LEDs and then not have to worry in the main code when it's time to turn something on or off. Mostly useful for Error code, at a glance you the blink pattern know the WiFi is connection or what Error is going on.
I thought doing it this way if I take the status off the GPIO and move it to a shift register or port expander or what ever the looping code can handle the updates.
As for the timing base I'm thinking there is a absolute_us timer running and I could pick off that. I just don't know is this a good way to approach status LEDs? Has anyone else done this or simpler with status LEDs?
Statistics: Posted by DarkElvenAngel — Sat Dec 30, 2023 2:33 am