Skip to content

Commit

Permalink
Rename Vue to Vu 🤦‍♀️
Browse files Browse the repository at this point in the history
  • Loading branch information
LouDnl committed Nov 20, 2024
1 parent e3697ae commit bb56278
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 21 deletions.
4 changes: 2 additions & 2 deletions src/gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,13 @@ void init_gpio()
gpio_set_dir(RW, GPIO_OUT);
}

void init_vue(void)
void init_vu(void)
{
/* PWM led */
gpio_init( BUILTIN_LED );
gpio_set_dir(BUILTIN_LED, GPIO_OUT);
gpio_set_function(BUILTIN_LED, GPIO_FUNC_PWM);
/* Init Vue */
/* Init Vu */
int led_pin_slice = pwm_gpio_to_slice_num( BUILTIN_LED );
pwm_config configLED = pwm_get_default_config();
pwm_config_set_clkdiv( &configLED, 1 );
Expand Down
36 changes: 18 additions & 18 deletions src/usbsid.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ int usb_connected = 0, usbdata = 0, pwm_value = 0, updown = 1;
uint32_t cdcread = 0, cdcwrite = 0, webread = 0, webwrite = 0;
uint sm_clock, offset_clock;
uint8_t *cdc_itf, *wusb_itf;
uint16_t vue;
uint16_t vu;
uint32_t breathe_interval_ms = BREATHE_INTV;
uint32_t start_ms = 0;
char ntype = '0', dtype = '0', cdc = 'C', asid = 'A', midi = 'M', wusb = 'W';
Expand All @@ -66,7 +66,7 @@ extern void verify_clockrate(void);
/* GPIO externals */
extern PIO bus_pio;
extern void init_gpio(void);
extern void init_vue(void);
extern void init_vu(void);
extern void setup_piobus(void);
extern void setup_dmachannels(void);
extern void pause_sid(void);
Expand Down Expand Up @@ -267,7 +267,7 @@ void cdc_write(uint8_t * itf, uint32_t n)
{ /* No need to check if write available with current driver code */
tud_cdc_n_write(*itf, write_buffer, n); /* write n bytes of data to client */
tud_cdc_n_write_flush(*itf);
vue = vue == 0 ? 100 : vue; /* NOTICE: Testfix for core1 setting dtype to 0 */
vu = vu == 0 ? 100 : vu; /* NOTICE: Testfix for core1 setting dtype to 0 */
IODBG("[O] [%c] DAT[0x%02x] \r\n", dtype, write_buffer[0]);
}

Expand All @@ -276,7 +276,7 @@ void webserial_write(uint8_t * itf, uint32_t n)
{ /* No need to check if write available with current driver code */
tud_vendor_write(write_buffer, n);
tud_vendor_flush();
vue = vue == 0 ? 100 : vue; /* NOTICE: Testfix for core1 setting dtype to 0 */
vu = vu == 0 ? 100 : vu; /* NOTICE: Testfix for core1 setting dtype to 0 */
IODBG("[O] [%c] DAT[0x%02x] \r\n", dtype, write_buffer[0]);
}

Expand Down Expand Up @@ -354,7 +354,7 @@ void __not_in_flash_func(handle_buffer_task)(uint8_t * itf, uint32_t * n)
/* LED SORCERERS */

/* It goes up and it goes down */
void led_vuemeter_task(void)
void led_vumeter_task(void)
{
if (to_ms_since_boot(get_absolute_time()) - start_ms < breathe_interval_ms) {
return; /* not enough time */
Expand Down Expand Up @@ -435,18 +435,18 @@ void led_vuemeter_task(void)

/* Color LED debugging ~ uncomment for testing */
// DBG("[%c][PWM]$%04x [R]%02x [G]%02x [B]%02x [O1]$%02x $%02d [O2]$%02x $%02d [O3]$%02x $%02d [O4]$%02x $%02d [O5]$%02x $%02d [O6]$%02x $%02d\r\n",
// dtype, vue, r_, g_, b_, osc1, o1, osc2, o2, osc3, o3, osc4, o4, osc5, o5, osc6, o6);
// dtype, vu, r_, g_, b_, osc1, o1, osc2, o2, osc3, o3, osc4, o4, osc5, o5, osc6, o6);
}
#endif

vue = abs((osc1 + osc2 + osc3) / 3.0f);
vue = map(vue, 0, HZ_MAX, 0, VUE_MAX);
vu = abs((osc1 + osc2 + osc3) / 3.0f);
vu = map(vu, 0, HZ_MAX, 0, VU_MAX);
if (usbsid_config.LED.enabled) {
pwm_set_gpio_level(BUILTIN_LED, vue);
pwm_set_gpio_level(BUILTIN_LED, vu);
}

MDBG("[%c:%d] [VOL]$%02x [PWM]$%04x | [V1] $%02X%02X %02X%02X %02X %02X %02X | [V2] $%02X%02X %02X%02X %02X %02X %02X | [V3] $%02X%02X %02X%02X %02X %02X %02X \n",
dtype, usbdata, sid_memory[0x18], vue,
dtype, usbdata, sid_memory[0x18], vu,
sid_memory[0x00], sid_memory[0x01], sid_memory[0x02], sid_memory[0x03], sid_memory[0x04], sid_memory[0x05], sid_memory[0x06],
sid_memory[0x07], sid_memory[0x08], sid_memory[0x09], sid_memory[0x0A], sid_memory[0x0B], sid_memory[0x0C], sid_memory[0x0D],
sid_memory[0x0E], sid_memory[0x0F], sid_memory[0x10], sid_memory[0x11], sid_memory[0x12], sid_memory[0x13], sid_memory[0x14]);
Expand All @@ -463,7 +463,7 @@ void led_breathe_task(void)
}
start_ms = to_ms_since_boot(get_absolute_time());

if (pwm_value >= VUE_MAX) {
if (pwm_value >= VU_MAX) {
updown = 0;
}
if (pwm_value <= 0) {
Expand All @@ -473,7 +473,7 @@ void led_breathe_task(void)
#endif
}

if (updown == 1 && pwm_value <= VUE_MAX)
if (updown == 1 && pwm_value <= VU_MAX)
pwm_value += BREATHE_STEP;

if (updown == 0 && pwm_value >= 0)
Expand All @@ -483,7 +483,7 @@ void led_breathe_task(void)
}
#if defined(USE_RGB)
if (usbsid_config.RGBLED.enabled && usbsid_config.RGBLED.idle_breathe) {
int rgb_ = map(pwm_value, 0, VUE_MAX, 0, 43);
int rgb_ = map(pwm_value, 0, VU_MAX, 0, 43);
r_ = color_LUT[rgb_][_rgb][0];
g_ = color_LUT[rgb_][_rgb][1];
b_ = color_LUT[rgb_][_rgb][2];
Expand Down Expand Up @@ -534,7 +534,7 @@ void tud_cdc_rx_cb(uint8_t itf)
{ /* No need to check available bytes for reading */
cdc_itf = &itf;
usbdata = 1, dtype = cdc;
vue = vue == 0 ? 100 : vue; /* NOTICE: Testfix for core1 setting dtype to 0 */
vu = vu == 0 ? 100 : vu; /* NOTICE: Testfix for core1 setting dtype to 0 */
cdcread = tud_cdc_n_read(*cdc_itf, &read_buffer, MAX_BUFFER_SIZE); /* Read data from client */
tud_cdc_n_read_flush(*cdc_itf);
handle_buffer_task(cdc_itf, &cdcread);
Expand Down Expand Up @@ -701,21 +701,21 @@ void core1_main(void)
init_rgb();
/* Clear the dirt */
__builtin_memset(sid_memory, 0, sizeof sid_memory);
/* Start the VUE */
init_vue();
/* Start the VU */
init_vu();
/* Release semaphore when core 1 is started */
sem_release(&core1_init);

int n_checks = 0, m_now = 0;
m_now = to_ms_since_boot(get_absolute_time());
while (1) {
usbdata == 1 ? led_vuemeter_task() : led_breathe_task();
usbdata == 1 ? led_vumeter_task() : led_breathe_task();
if (to_ms_since_boot(get_absolute_time()) - m_now < CHECK_INTV) { /* 20 seconds */
/* NOTICE: Testfix for core1 setting dtype to 0 */
/* do nothing */
} else {
m_now = to_ms_since_boot(get_absolute_time());
if (vue == 0 && usbdata == 1) {
if (vu == 0 && usbdata == 1) {
n_checks++;
if (n_checks >= MAX_CHECKS)
{
Expand Down
2 changes: 1 addition & 1 deletion src/usbsid.h
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ enum
MAX_CHECKS = 200, /* 200 checks times 100ms == 20 seconds */
BREATHE_INTV = 1,
BREATHE_STEP = 100,
VUE_MAX = 65534,
VU_MAX = 65534,
HZ_MAX = 40
};

Expand Down

0 comments on commit bb56278

Please sign in to comment.