Digilog Console Firmware
Loading...
Searching...
No Matches
led_driver.h File Reference

Skylar's driver for the LED displays on the console, including knobs and buttons. CONFIGURATION in top of .c file. More...

#include <stdint.h>
#include <stdbool.h>

Go to the source code of this file.

Macros

#define knob_inc(channel, knob)   knob_step((channel), (knob), +1)
 
#define knob_dec(channel, knob)   knob_step((channel), (knob), -1)
 

Enumerations

enum  knob_disp_t { DISP_BAR = 0 , DISP_POINT = 1 }
 
enum  knob_scale_t { SCALE_LEFT = 0 , SCALE_CENTER = 1 }
 
enum  anim_t {
  ANIM_NONE = 0 , ANIM_LOAD , ANIM_SWEEP , ANIM_BREATHE_KEEP ,
  ANIM_BREATHE_ALL
}
 

Functions

void led_init (void)
 
void led_update (void)
 
void led_refresh (void)
 
void led_clear (void)
 
void led_brightness (uint8_t brightness)
 Set brightness of all LEDs through OE pin PWM duty cycle (0 to 255)
 
uint8_t led_get_brightness (void)
 
void knob_led (uint8_t channel, uint8_t knob, int8_t value)
 Change a knob display's value, specify which knob by coords (chnl and knob number)
 
void knob_step (uint8_t channel, uint8_t knob, int8_t delta)
 Changes a knob display by delta LEDs from its current value, clamped to its scale.
 
void knob_disp (uint8_t channel, uint8_t knob, knob_disp_t mode)
 Sets whether a knob draws as a filled bar or a single point.
 
void knob_scale (uint8_t channel, uint8_t knob, knob_scale_t mode)
 Sets a knob to the left (0..32) or centre (-15..16) scale, converting its stored value so the ring does not jump.
 
int8_t knob_get (uint8_t channel, uint8_t knob)
 Returns a knob's current value, in the units of its own scale.
 
knob_disp_t knob_get_disp (uint8_t channel, uint8_t knob)
 Returns a knob's current display mode (bar or point).
 
knob_scale_t knob_get_scale (uint8_t channel, uint8_t knob)
 Returns a knob's current scale mode (left or center).
 
void knob_raw (uint8_t channel, uint8_t knob, uint32_t bits)
 Lights an arbitrary ring pattern, bit31 = LED 0 (left), bypassing the knob's stored value and modes.
 
void button_led (uint8_t channel, uint8_t button, bool on)
 Set a specific button display LED to on or off by coordinate.
 
bool button_get (uint8_t channel, uint8_t button)
 Returns if specified button LED is on or off.
 
void button_mask (uint8_t channel, uint16_t mask)
 Sets 16 button LED states (entire channel) at once in the frame buffer.
 
void anim_stop (void)
 anim_stop : Redraws every knob from its stored value, restores the saved brightness and
 
void anim_claim (anim_t a)
 anim_claim : stop what was running and claim display
 
void anim_loading (int8_t knob)
 anim_loading : Knob 0-9 or -1 for all (int8) -> Void Spinning loading wheel, call repeatedly, one call = one advancement. When loading done just stop and call anim_stop.
 
void anim_sweep (uint8_t channel, uint8_t knob)
 anim_sweep : Channel 0-3 (uint8), Knob 0-9 (uint8) -> Void One step of a back-and-forth sweep, for knobs in left to right mode, and knobs in center mode the animation matches the mode.
 
void anim_breathe (uint8_t mode)
 anim_breathe : Brightness breathing animation
 
void led_debug (bool on)
 
void led_print_config (void)
 

Detailed Description

Skylar's driver for the LED displays on the console, including knobs and buttons. CONFIGURATION in top of .c file.

LED DISPLAYS DRIVER - DIGILOG CONSOLE

Low level driver for showing stuff on the LEDs. Includes all basic writing functions and center/from-left writing for knob rings and both (bar/point) display style modes. There are 40, 32 LED knob rings for a bucket controller, and (up to) 64 more bits for 16 button LEDs per channel (Total 1344 LEDs per bucket). Part: 74HCT595.

Author
Skylar Denno (denno.nosp@m..o@n.nosp@m.orthe.nosp@m.aste.nosp@m.rn.ed.nosp@m.u)
Date
2026-08-20
Version
1.0
Attention
Copyright (C) 2026 Skylar Denno

MIT License: Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Enumeration Type Documentation

◆ anim_t

enum anim_t

@brief type to store animation

◆ knob_disp_t


@brief Display mode (cosmetic): 0 = bar / line of lights, 1 = point indicator

◆ knob_scale_t


@brief Knob scale modes: 0 = standard left to right, 1 = Dist. from center (pan knob, gain/atten)

Function Documentation

◆ anim_breathe()

void anim_breathe ( uint8_t  mode)

anim_breathe : Brightness breathing animation


Parameters
modemode 0 = just the LEDs that

are currently on in normal state will do it, mode 1 = every single LED does it

◆ anim_claim()

void anim_claim ( anim_t  a)

anim_claim : stop what was running and claim display


@param a anim_t "animation type" type, changes what it does a bit

◆ anim_loading()

void anim_loading ( int8_t  knob)

anim_loading : Knob 0-9 or -1 for all (int8) -> Void Spinning loading wheel, call repeatedly, one call = one advancement. When loading done just stop and call anim_stop.


@param knob knob number 0-9 (all channels that knob will do loading), use -1 to do every knob

◆ anim_stop()

void anim_stop ( void  )

anim_stop : Redraws every knob from its stored value, restores the saved brightness and


resets all animation phases

◆ anim_sweep()

void anim_sweep ( uint8_t  channel,
uint8_t  knob 
)

anim_sweep : Channel 0-3 (uint8), Knob 0-9 (uint8) -> Void One step of a back-and-forth sweep, for knobs in left to right mode, and knobs in center mode the animation matches the mode.


Parameters
channelchannel 0-3

@param knob knob 0-9

◆ button_get()

bool button_get ( uint8_t  channel,
uint8_t  button 
)

Returns if specified button LED is on or off.


Parameters
channelchannel number 0-3
buttonchannel's button number 0-15

@return boolean value of that button's LED display on/off

◆ button_led()

void button_led ( uint8_t  channel,
uint8_t  button,
bool  on 
)

Set a specific button display LED to on or off by coordinate.


Parameters
channelchannel number 0-3
buttonchannel's button number 0-15

@param on set that button LED on or off? true = on

◆ button_mask()

void button_mask ( uint8_t  channel,
uint16_t  mask 
)

Sets 16 button LED states (entire channel) at once in the frame buffer.


Parameters
channelchannel number 0-3

@param mask 16-bits representing that channel's 16 button displays, 1 = on

◆ knob_disp()

void knob_disp ( uint8_t  channel,
uint8_t  knob,
knob_disp_t  mode 
)

Sets whether a knob draws as a filled bar or a single point.


Parameters
channelchannel number 0-3
knobknob inside that channel number 0-9

@param mode display mode (0 = bar, 1 = point, see knob_disp_t)

◆ knob_get()

int8_t knob_get ( uint8_t  channel,
uint8_t  knob 
)

Returns a knob's current value, in the units of its own scale.


Parameters
channelchannel number 0-3
knobknob inside that channel number 0-9

@return returns the value of the knob display (-15 to 16 or 0 to 32 depending on scale mode)

◆ knob_get_disp()

knob_disp_t knob_get_disp ( uint8_t  channel,
uint8_t  knob 
)

Returns a knob's current display mode (bar or point).


Parameters
channelchannel number 0-3
knobknob inside that channel number 0-9

@return returns a knob display mode 0 or 1 (see knob_disp_t)

◆ knob_get_scale()

knob_scale_t knob_get_scale ( uint8_t  channel,
uint8_t  knob 
)

Returns a knob's current scale mode (left or center).


Parameters
channelchannel number 0-3
knobknob inside that channel number 0-9

@return returns a knob scale mode 0 or 1 (see knob_scale_t)

◆ knob_led()

void knob_led ( uint8_t  channel,
uint8_t  knob,
int8_t  value 
)

Change a knob display's value, specify which knob by coords (chnl and knob number)


Parameters
channelchannel number 0-3
knobknob inside that channel number 0-9

@param value int between 0-32 for left/standard mode and -15 to 16 for center/pan mode (0 = center)

◆ knob_raw()

void knob_raw ( uint8_t  channel,
uint8_t  knob,
uint32_t  bits 
)

Lights an arbitrary ring pattern, bit31 = LED 0 (left), bypassing the knob's stored value and modes.


Parameters
channelchannel number 0-3
knobknob inside that channel number 0-9

@param bits 32 bits corresponding to LEDs left to right, 1 = on

◆ knob_scale()

void knob_scale ( uint8_t  channel,
uint8_t  knob,
knob_scale_t  mode 
)

Sets a knob to the left (0..32) or centre (-15..16) scale, converting its stored value so the ring does not jump.


Parameters
channelchannel number 0-3
knobknob inside that channel number 0-9

@param mode scale mode (0 = from left, 1 = center/pan, see knob_scale_t)

◆ knob_step()

void knob_step ( uint8_t  channel,
uint8_t  knob,
int8_t  delta 
)

Changes a knob display by delta LEDs from its current value, clamped to its scale.


Parameters
channelchannel number 0-3
knobknob inside that channel number 0-9

@param delta int change by this value

◆ led_brightness()

void led_brightness ( uint8_t  brightness)

Set brightness of all LEDs through OE pin PWM duty cycle (0 to 255)


@param brightness Brightness 0 - 255 integer.

◆ led_clear()

void led_clear ( void  )

@brief Clear all LED states (in the data, not with OE pin), turning them all off

◆ led_debug()

void led_debug ( bool  on)

@brief [DEBUG MODE] Toggles debug mode with input boolean

◆ led_get_brightness()

uint8_t led_get_brightness ( void  )

@brief Gives the current brightness setting 0 - 255

◆ led_init()

void led_init ( void  )

@brief GPIO, OE PWM setup, turn off all LEDs

◆ led_print_config()

void led_print_config ( void  )

@brief [DEBUG MODE] Prints the configuration params to console

◆ led_refresh()

void led_refresh ( void  )

@brief Push frame to hardware UNCONDITIONALLY

◆ led_update()

void led_update ( void  )

@brief Push frame to hardware IF changed