Skip to content

Commit

Permalink
add:little_flash 添加锁
Browse files Browse the repository at this point in the history
  • Loading branch information
Dozingfiretruck committed May 16, 2024
1 parent 5dd7ee8 commit 66ce2cd
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions components/little_flash/port/little_flash_port.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,25 @@ static void little_flash_free(void* ptr){
}
#endif

static void little_flash_lock(little_flash_t *lf){
luat_mutex_lock(lf->user_data);
}

static void little_flash_unlock(little_flash_t *lf){
luat_mutex_unlock(lf->user_data);
}

lf_err_t little_flash_port_init(little_flash_t *lf){
lf->spi.transfer = little_flash_spi_transfer;
lf->wait_10us = little_flash_wait_10us;
#ifdef LF_USE_HEAP
lf->malloc = little_flash_malloc;
lf->free = little_flash_free;
#endif
/* create a mutex for locking */
lf->user_data = luat_mutex_create();
lf->lock = little_flash_lock;
lf->unlock = little_flash_unlock;
return LF_ERR_OK;
}

Expand Down

0 comments on commit 66ce2cd

Please sign in to comment.