Functions
Functions
SYSTEM » Device Firmware Update

## Functions
void | dfu_init (dfu_func_t *p_app_dfu_func, dfu_buffer_t *dfu_buffer, dfu_pro_callback_t *p_dfu_callback)
| Function for initializing the DFU Used and Program State Callback. More...
void | dfu_cmd_parse_state_reset (void)
| Function for reset the DFU cmd parse state. More...
void | dfu_ble_set_mtu_size (uint16_t mtu_size)
| Function for setting the BLE MTU size. More...
void | dfu_ble_send_data_cmpl_process (void)
| This function should be called when BLE stack sends data completely. More...
void | dfu_ble_receive_data_process (uint8_t *p_data, uint16_t length)
| This function should be called when BLE receives data. More...
void | dfu_uart_receive_data_process (uint8_t *p_data, uint16_t length)
| This function should be called when UART receives data. More...
void | dfu_set_disable_cmd (uint16_t disable_cmd_bit_map)
| Function for set DFU disable cmd. More...
void | dfu_set_cmd_handler (uint8_t index, uint16_t cmd, dfu_receive_cmd_handler_t cmd_handler)
| Function for set DFU cmd handler. More...
void | dfu_spi_flash_func_config (dfu_spi_flash_func_t *spi_flash_func)
| Function for initializing the DFU SPI Flash Callback. More...

## Detailed Description

## Function Documentation

## ◆ dfu_ble_receive_data_process()

void dfu_ble_receive_data_process | ( | uint8_t * | p_data,
|  | uint16_t | length
| ) |  |

This function should be called when BLE receives data.

Note
  This function should be used when the user wants to create his or her own DFU bootloader.

Parameters

  [in] | p_data | The received data from BLE.
  [in] | length | The length of data.

## ◆ dfu_ble_send_data_cmpl_process()

void dfu_ble_send_data_cmpl_process | ( | void |  | ) |

This function should be called when BLE stack sends data completely.

Note
  This function should be used when the user wants to create his or her own DFU bootloader.

Return values

  void |

## ◆ dfu_ble_set_mtu_size()

void dfu_ble_set_mtu_size | ( | uint16_t | mtu_size | ) |

Function for setting the BLE MTU size.

Note
  If the user wants to create his or her own DFU bootloader, the DFU MTU size should be set by using this function (when the MTU size is updated, this function should be called).

Parameters

  [in] | mtu_size | The BLE MTU size.

## ◆ dfu_cmd_parse_state_reset()

void dfu_cmd_parse_state_reset | ( | void |  | ) |

Function for reset the DFU cmd parse state.

Note
  When APP wants to add DFU timeout feature, shoulde reset DFU cmd parse state when timeout.

## ◆ dfu_init()

void dfu_init | ( | dfu_func_t * | p_app_dfu_func,
|  | dfu_buffer_t * | dfu_buffer,
|  | dfu_pro_callback_t * | p_dfu_callback
| ) |  |

Function for initializing the DFU Used and Program State Callback.

Note
  When APP wants to add DFU features, the flash_read and flash_write functions should be registered. To creat own DFU bootloaders, all functions in dfu_func_t should be registered. In order to show DFU program states by own DFU bootloaders, all functions in dfu_pro_callback_t should be registered.

Parameters

  [in] | p_app_dfu_func | DFU used functions.
  [in] | dfu_buffer | DFU data receiving buffer.
  [in] | p_dfu_callback | DFU program state callback functions.

## ◆ dfu_set_cmd_handler()

void dfu_set_cmd_handler | ( | uint8_t | index,
|  | uint16_t | cmd,
|  | dfu_receive_cmd_handler_t | cmd_handler
| ) |  |

Function for set DFU cmd handler.

Note
  In Apps, if the user wants to jump to ROM DFU run,but want to be able to control the operation permissions of DFU, this function can be called.

Parameters

  [in] | index | The index of DFU cmd.
  [in] | cmd | The code of DFU cmd.
  [in] | cmd_handler | The handler of DFU cmd.

## ◆ dfu_set_disable_cmd()

void dfu_set_disable_cmd | ( | uint16_t | disable_cmd_bit_map | ) |

Function for set DFU disable cmd.

Note
  In Apps, if the user wants to jump to ROM DFU run,but want to be able to control the operation permissions of DFU, this function can be called.

Parameters

  [in] | disable_cmd_bit_map | The bitmask of DFU disable cmd.

## ◆ dfu_spi_flash_func_config()

void dfu_spi_flash_func_config | ( | dfu_spi_flash_func_t * | spi_flash_func | ) |

Function for initializing the DFU SPI Flash Callback.

Note
  When APP wants to add DFU operationally external flash feature, the dfu_spi_flash_func_t should be registered.

Parameters

  [in] | spi_flash_func | DFU operationally external flash used functions.

## ◆ dfu_uart_receive_data_process()

void dfu_uart_receive_data_process | ( | uint8_t * | p_data,
|  | uint16_t | length
| ) |  |

This function should be called when UART receives data.

Note
  This function should be used when the user wants to create his or her own DFU bootloader.

Parameters

  [in] | p_data | The received data from UART
  [in] | length | The length of data