mirror of
https://github.com/infiniteCable2/panda.git
synced 2026-02-19 01:33:52 +08:00
* H7 drivers * Include H7 into the code * fix flash write for H7 * get serial from flasher.h from F4 and H7 * flash.sh and recover.sh for gen3 * add set_data_speed for BRS CAN FD * build all fws * gen3 to panda lib * gen3 name in scons project * disable fd can and brs * gen3 to CI tests * jenkins fix for new tests and build_all * fix pedal test * pedal in panda tests again... * cleanup llfdcan.h * cleanup clock.h * Add LDORDY bit check instead of delay * missing define in stm32h735xx.h lib * board_id helper * enable debug detection again * clean gpio inits * fix board_id helper, make cleaner * comment MCUs in stm lib for faster misra * target MCU * misra-5.5 * improve headers and misra speed * cleanup CI tests * change naming from gen3 to h7 * readable if statement * cleanup llusb.h * only cycle one transceifer in bus-off * move unused funcs to common header * bus_off_err reset * misra 10.4 fdcan * extern to can_data_speed variable * limit can_data_speed array size to 3 * reinit fd can on data speed change * Improve test with ELM327 and extaddr check * bugfix for fdcan * panda python config naming * abstracted init request in llfdcan * misra fdcan * Improve llusb.h for H7
29 lines
673 B
C
29 lines
673 B
C
bool flash_is_locked(void) {
|
|
return (FLASH->CR & FLASH_CR_LOCK);
|
|
}
|
|
|
|
void flash_unlock(void) {
|
|
FLASH->KEYR = 0x45670123;
|
|
FLASH->KEYR = 0xCDEF89AB;
|
|
}
|
|
|
|
bool flash_erase_sector(uint8_t sector, bool unlocked) {
|
|
// don't erase the bootloader(sector 0)
|
|
if (sector != 0 && sector < 12 && unlocked) {
|
|
FLASH->CR = (sector << 3) | FLASH_CR_SER;
|
|
FLASH->CR |= FLASH_CR_STRT;
|
|
while (FLASH->SR & FLASH_SR_BSY);
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
void flash_write_word(void *prog_ptr, uint32_t data) {
|
|
uint32_t *pp = prog_ptr;
|
|
FLASH->CR = FLASH_CR_PSIZE_1 | FLASH_CR_PG;
|
|
*pp = data;
|
|
while (FLASH->SR & FLASH_SR_BSY);
|
|
}
|
|
|
|
void flush_write_buffer(void) { }
|