Skip to content

Commit

Permalink
Better flash locking
Browse files Browse the repository at this point in the history
  • Loading branch information
Teeed committed May 18, 2020
1 parent f530c57 commit e3b6340
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions Core/Src/bootloader.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,14 @@ void canpybara_bootloader_erase(uint32_t addr)
return;
}

HAL_FLASH_Unlock();
FLASH_EraseInitTypeDef erase_init_struct;
erase_init_struct.TypeErase = FLASH_TYPEERASE_PAGES;
erase_init_struct.PageAddress = addr;
erase_init_struct.NbPages = 1;

uint32_t page_error;
HAL_FLASH_Unlock();
HAL_FLASHEx_Erase(&erase_init_struct, &page_error);

HAL_FLASH_Lock();

static CanTxMsgTypeDef can_tx;
Expand Down

0 comments on commit e3b6340

Please sign in to comment.