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

replaced file download with streaming for sd card pipeline. #752 #915

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ CONFIG_BT_AUTO_PHY_UPDATE=y
# CONFIG_DEBUG=y
# CONFIG_DEBUG_OPTIMIZATIONS=y
# CONFIG_LOG=y
# CONFIG_LOG_PRINTK=y
# # CONFIG_LOG_PRINTK=y
# CONFIG_LOG_MODE_IMMEDIATE=y
# CONFIG_SERIAL=y
# CONFIG_UART_CONSOLE=y
Expand Down Expand Up @@ -144,19 +144,19 @@ CONFIG_HEAP_MEM_POOL_SIZE=4096
# CONFIG_NRFX_TWIM1=n

# Disable LSM6DSL sensor (accelerometer and gyroscope)
CONFIG_LSM6DSL=n
CONFIG_LSM6DSL=y
CONFIG_LSM6DSL_ENABLE_TEMP=n
CONFIG_LSM6DSL_TRIGGER_GLOBAL_THREAD=y
CONFIG_SENSOR=y
# Speaker
# Speaker
CONFIG_I2S=y
CONFIG_I2S_NRFX=y
CONFIG_SPI_NRFX=y

#THE ACCELEROMETER
CONFIG_ACCELEROMETER=n
CONFIG_ACCELEROMETER=y
#ENABLE THE BUTTON!
CONFIG_ENABLE_BUTTON=n
CONFIG_ENABLE_BUTTON=y
#ENABLE THE SPEAKER
CONFIG_ENABLE_SPEAKER=n

Expand Down
21 changes: 7 additions & 14 deletions Friend/firmware/firmware_v1.0/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,19 +100,6 @@ void set_led_state()
set_led_blue(false);
}

// void test_sd_card(void) {
// char test_data[] = "Hello, SD card!";
// int ret = create_file("test.txt");
// if (ret) {
// LOG_ERR("Failed to create test file: %d", ret);
// }
// ret = write_file((uint8_t *)test_data, strlen(test_data), false, true);
// if (ret) {
// LOG_ERR("Failed to write test data: %d", ret);
// }
// LOG_INF("Successfully wrote test data to SD card");
// }

// Main loop
int main(void)
{
Expand All @@ -126,6 +113,12 @@ int main(void)
}
// Run the boot LED sequence
boot_led_sequence();
err = mount_sd_card();
k_msleep(500);
if (err) {
LOG_ERR("Failed to mount SD card: %d", err);
return err;
}
// Indicate transport initialization
set_led_green(true);
err = transport_start();
Expand All @@ -141,7 +134,7 @@ int main(void)
}
set_led_green(false);

err = mount_sd_card();

LOG_INF("result of mount:%d",err);

k_msleep(500);
Expand Down
5 changes: 3 additions & 2 deletions Friend/firmware/firmware_v1.0/src/sdcard.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ static const char *disk_mount_pt = "/SD:/";
uint32_t get_file_size(uint8_t num){
char *ptr = generate_new_audio_header(num);
snprintf(current_full_path, sizeof(current_full_path), "%s%s", disk_mount_pt, ptr);
k_free(ptr);
// k_free(ptr);
struct fs_dirent entry;
fs_stat(&current_full_path,&entry);
return (uint32_t)entry.size;
Expand Down Expand Up @@ -68,7 +68,7 @@ int move_write_pointer(uint8_t num) {
return 0;
}

uint32_t file_num_array[40];
uint32_t file_num_array[40] = {0};

int mount_sd_card(void)
{
Expand Down Expand Up @@ -96,6 +96,7 @@ int mount_sd_card(void)
return -1;
}
}

mount_point.mnt_point = "/SD:";
int res = fs_mount(&mount_point);

Expand Down
Loading
Loading