Change the LED to a SD activity light
Some checks failed
Build pico-mac / bins (push) Has been cancelled
Some checks failed
Build pico-mac / bins (push) Has been cancelled
This commit is contained in:
parent
41a8e0e9b6
commit
b1c20d06ea
1 changed files with 4 additions and 8 deletions
12
src/main.c
12
src/main.c
|
|
@ -104,15 +104,11 @@ static void io_init()
|
|||
|
||||
static void poll_led_etc()
|
||||
{
|
||||
static int led_on = 0;
|
||||
static absolute_time_t last = 0;
|
||||
absolute_time_t now = get_absolute_time();
|
||||
|
||||
if (absolute_time_diff_us(last, now) > 500*1000) {
|
||||
last = now;
|
||||
|
||||
//led_on ^= 1;
|
||||
//gpio_put(GPIO_LED_PIN, led_on);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -205,10 +201,12 @@ static void poll_umac()
|
|||
#if USE_SD
|
||||
static int disc_do_read(void *ctx, uint8_t *data, unsigned int offset, unsigned int len)
|
||||
{
|
||||
gpio_put(GPIO_LED_PIN, 1);
|
||||
FIL *fp = (FIL *)ctx;
|
||||
f_lseek(fp, offset);
|
||||
unsigned int did_read = 0;
|
||||
FRESULT fr = f_read(fp, data, len, &did_read);
|
||||
gpio_put(GPIO_LED_PIN, 0);
|
||||
if (fr != FR_OK || len != did_read) {
|
||||
printf("disc: f_read returned %d, read %u (of %u)\n", fr, did_read, len);
|
||||
return -1;
|
||||
|
|
@ -218,10 +216,12 @@ static int disc_do_read(void *ctx, uint8_t *data, unsigned int offset, unsi
|
|||
|
||||
static int disc_do_write(void *ctx, uint8_t *data, unsigned int offset, unsigned int len)
|
||||
{
|
||||
gpio_put(GPIO_LED_PIN, 1);
|
||||
FIL *fp = (FIL *)ctx;
|
||||
f_lseek(fp, offset);
|
||||
unsigned int did_write = 0;
|
||||
FRESULT fr = f_write(fp, data, len, &did_write);
|
||||
gpio_put(GPIO_LED_PIN, 0);
|
||||
if (fr != FR_OK || len != did_write) {
|
||||
printf("disc: f_write returned %d, read %u (of %u)\n", fr, did_write, len);
|
||||
return -1;
|
||||
|
|
@ -676,9 +676,6 @@ static int volscale;
|
|||
int16_t audio[SAMPLES_PER_BUFFER];
|
||||
|
||||
void umac_audio_trap() {
|
||||
static int led_on;
|
||||
led_on ^= 1;
|
||||
gpio_put(GPIO_LED_PIN, 1);
|
||||
int32_t offset = 128;
|
||||
uint16_t *audiodata = (uint16_t*)audio_base;
|
||||
int scale = volscale;
|
||||
|
|
@ -732,7 +729,6 @@ setup_i2s_dac();
|
|||
static bool audio_poll() {
|
||||
audio_buffer_t *buffer = take_audio_buffer(producer_pool, false);
|
||||
if (!buffer) return false;
|
||||
gpio_put(GPIO_LED_PIN, 0);
|
||||
memcpy(buffer->buffer->bytes, audio, sizeof(audio));
|
||||
buffer->sample_count = SAMPLES_PER_BUFFER;
|
||||
give_audio_buffer(producer_pool, buffer);
|
||||
|
|
|
|||
Loading…
Reference in a new issue