ESPHome
2026.5.0-dev
Loading...
Searching...
No Matches
esphome
components
nrf52
dfu.cpp
Go to the documentation of this file.
1
#include "
dfu.h
"
2
3
#ifdef USE_NRF52_DFU
4
5
#include "
esphome/core/log.h
"
6
#include "
esphome/components/zephyr/cdc_acm.h
"
7
8
namespace
esphome
{
9
namespace
nrf52 {
10
11
static
const
char
*
const
TAG =
"dfu"
;
12
13
static
const
uint32_t
DFU_DBL_RESET_MAGIC = 0x5A1AD5;
// SALADS
14
15
void
DeviceFirmwareUpdate::setup
() {
16
this->
reset_pin_
->
setup
();
17
#if defined(CONFIG_CDC_ACM_DTE_RATE_CALLBACK_SUPPORT)
18
zephyr::global_cdc_acm
->
add_on_rate_callback
([
this
](
const
device *,
uint32_t
rate) {
19
if
(rate == 1200) {
20
volatile
uint32_t
*dbl_reset_mem = (
volatile
uint32_t
*) 0x20007F7C;
21
(*dbl_reset_mem) = DFU_DBL_RESET_MAGIC;
22
this->
reset_pin_
->
digital_write
(
true
);
23
}
24
});
25
#endif
26
}
27
28
void
DeviceFirmwareUpdate::dump_config
() {
29
ESP_LOGCONFIG(TAG,
"DFU:"
);
30
LOG_PIN(
" RESET Pin: "
, this->
reset_pin_
);
31
}
32
33
}
// namespace nrf52
34
}
// namespace esphome
35
36
#endif
cdc_acm.h
esphome::GPIOPin::setup
virtual void setup()=0
esphome::GPIOPin::digital_write
virtual void digital_write(bool value)=0
esphome::nrf52::DeviceFirmwareUpdate::dump_config
void dump_config() override
Definition
dfu.cpp:28
esphome::nrf52::DeviceFirmwareUpdate::reset_pin_
GPIOPin * reset_pin_
Definition
dfu.h:17
esphome::nrf52::DeviceFirmwareUpdate::setup
void setup() override
Definition
dfu.cpp:15
esphome::zephyr::CdcAcm::add_on_rate_callback
void add_on_rate_callback(F &&callback)
Definition
cdc_acm.h:14
dfu.h
log.h
esphome::zephyr::global_cdc_acm
CdcAcm * global_cdc_acm
Definition
cdc_acm.cpp:26
esphome
Providing packet encoding functions for exchanging data with a remote host.
Definition
a01nyub.cpp:7
uint32_t
static void uint32_t
Definition
crash_handler.cpp:141
Generated by
1.12.0