@@ -147,8 +147,6 @@ void Bridge_Init(void);
|
||||
void Bridge_Off(void);
|
||||
void Bridge_Service_1ms(void);
|
||||
void Bridge_Deadtime_Expired(void);
|
||||
uint8_t Bridge_PauseForFlash(void);
|
||||
void Bridge_ResumeAfterFlash(uint8_t paused);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -246,28 +246,6 @@ void Bridge_Off(void)
|
||||
output_mode = BRIDGE_MODE_OFF;
|
||||
}
|
||||
|
||||
uint8_t Bridge_PauseForFlash(void)
|
||||
{
|
||||
/*
|
||||
* Single-color output is hardware PWM and remains stable while flash
|
||||
* masks interrupts. Dual-color output is Timer3-driven, so force both
|
||||
* bridge inputs low before flash can stretch an active direction pulse.
|
||||
*/
|
||||
if (!bridge_ready || output_mode != BRIDGE_MODE_DUAL) {
|
||||
return 0U;
|
||||
}
|
||||
|
||||
Bridge_Off();
|
||||
return 1U;
|
||||
}
|
||||
|
||||
void Bridge_ResumeAfterFlash(uint8_t paused)
|
||||
{
|
||||
if (paused) {
|
||||
Bridge_Service_1ms();
|
||||
}
|
||||
}
|
||||
|
||||
__RAM_CODE void Bridge_Deadtime_Expired(void)
|
||||
{
|
||||
uint32_t w_step;
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
#include "ota_flash_interface.h"
|
||||
#include "xc_drv_fmc_spi.h"
|
||||
#include "arch.h"
|
||||
#include "dbg.h"
|
||||
// extern uint8_t ble_flash_operation_can_check(void);
|
||||
#include "ota_protocol.h"
|
||||
#include "fmc_spi.h"
|
||||
#include "pwm.h"
|
||||
op_flash_t op_flash = {
|
||||
OP_IDEL,
|
||||
};
|
||||
@@ -99,23 +97,10 @@ uint8_t app_data[FLASH_PAGE_SIZE] = {0};
|
||||
//uint16_t app_op_flash_start = 10000;
|
||||
void app_op_flash(void)
|
||||
{
|
||||
uint8_t bridge_paused;
|
||||
|
||||
if(op_flash.op_state == OP_IDEL&&app_op_flash_flag ==0)
|
||||
{
|
||||
/*
|
||||
* Commit user data as one transaction. Timer3 cannot advance
|
||||
* dual-color PWM while flash masks interrupts, so hold the
|
||||
* H-bridge at 00 and resume from a fresh complete frame.
|
||||
* Hardware PWM single-color output does not need pausing.
|
||||
*/
|
||||
GLOBAL_INT_DISABLE();
|
||||
bridge_paused = Bridge_PauseForFlash();
|
||||
FMC_SPI_Flash_Erase_Page(0x1E000);
|
||||
FMC_SPI_Flash_WritePage(0x1E000, app_data, FLASH_PAGE_SIZE);
|
||||
GLOBAL_INT_RESTORE();
|
||||
app_op_flash_flag = 2;
|
||||
Bridge_ResumeAfterFlash(bridge_paused);
|
||||
ble_flash_later_page_erase(0x1E000);
|
||||
}
|
||||
else if(op_flash.op_state == OP_IDEL &&app_op_flash_flag ==1)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user