Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent blanking of all outputs when manual programming #27

Merged
merged 2 commits into from
May 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 17 additions & 5 deletions prawnblaster/prawnblaster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ PIO pio_to_use;
static mutex_t status_mutex;
static mutex_t wait_mutex;

// SIO GPIO init status
int gpio_inited = 0;

// STATUS flag
int status;
#define STOPPED 0
Expand Down Expand Up @@ -667,12 +670,17 @@ void core1_entry()

void configure_gpio()
{
configure_missing_pins();
// initialise output pin. Needs to be done after state machine has run
for (int i = 0; i < num_pseudoclocks_in_use; i++)
if (!gpio_inited)
{
gpio_init(OUT_PINS[i]);
gpio_set_dir(OUT_PINS[i], GPIO_OUT);
configure_missing_pins();
// initialise output pin. Needs to be done after state machine has run
for (int i = 0; i < num_pseudoclocks_in_use; i++)
{
gpio_init(OUT_PINS[i]);
gpio_set_dir(OUT_PINS[i], GPIO_OUT);
}
// update inited state
gpio_inited = 1;
}
}

Expand Down Expand Up @@ -1032,6 +1040,8 @@ void loop()
multicore_fifo_push_blocking(1);
// update status
set_status(TRANSITION_TO_RUNNING);
// update gpio inited status
gpio_inited = 0;
fast_serial_printf("ok\r\n");
}
else if ((strncmp(readstring, "start", 5) == 0))
Expand All @@ -1046,6 +1056,8 @@ void loop()
multicore_fifo_push_blocking(0);
// update status
set_status(TRANSITION_TO_RUNNING);
// update gpio inited status
gpio_inited = 0;
fast_serial_printf("ok\r\n");
}
// TODO: update this to support pseudoclock selection
Expand Down
Loading