3#ifdef USE_NRF52_REG0_VOUT
4#include <zephyr/init.h>
5#include <hal/nrf_power.h>
6#include <zephyr/sys/printk.h>
24 a =
static_cast<StatusFlags>(
static_cast<uint8_t
>(a) |
static_cast<uint8_t
>(b));
29 return (
static_cast<uint8_t
>(a) &
static_cast<uint8_t
>(b)) != 0;
32static bool regout0_ok() {
33 return (NRF_UICR->REGOUT0 & UICR_REGOUT0_VOUT_Msk) == (USE_NRF52_REG0_VOUT << UICR_REGOUT0_VOUT_Pos);
43 (NRF_UICR->REGOUT0 & ~((
uint32_t) UICR_REGOUT0_VOUT_Msk)) | (USE_NRF52_REG0_VOUT << UICR_REGOUT0_VOUT_Pos);
51#ifndef USE_BOOTLOADER_MCUBOOT
56static bool bootloader_ok() {
61 if (!bootloader_ok()) {
73#define BOOTLOADER_VERSION_REGISTER NRF_TIMER2->CC[0]
77#ifndef USE_BOOTLOADER_MCUBOOT
78 if (BOOTLOADER_VERSION_REGISTER <= 0x902) {
80 printk(
"cannot control regout0 for %#x\n", BOOTLOADER_VERSION_REGISTER);
87#ifndef USE_BOOTLOADER_MCUBOOT
88 status |= fix_bootloader();
93static int board_esphome_init() {
96#ifdef USE_NRF52_UICR_ERASE
99 if (ret != NRFX_SUCCESS) {
101 printk(
"nrfx_nvmc_uicr_erase failed %d\n", ret);
119static int board_esphome_init() {
return esphome::nrf52::board_esphome_init(); }
121SYS_INIT(board_esphome_init, PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
BedjetMode mode
BedJet operating mode.
constexpr StatusFlags & operator|=(StatusFlags &a, StatusFlags b)
constexpr bool operator&(StatusFlags a, StatusFlags b)
constexpr uint32_t BOOTLOADER_MBR_PARAMS_PAGE_ADDRESS
constexpr uint32_t BOOTLOADER_REGION_START
void nvmc_config(uint32_t mode)
nrfx_err_t nrfx_nvmc_uicr_erase()
SYS_INIT(board_esphome_init, PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT)