nrfx power
This commit is contained in:
parent
2847b319f2
commit
c1c43b3c83
11
src/Makefile
11
src/Makefile
@ -113,6 +113,10 @@ endif
|
||||
C_SOURCE_FILES += $(SRC_PATH)/main.c
|
||||
C_SOURCE_FILES += $(SRC_PATH)/dfu_ble_svc.c
|
||||
|
||||
# nrfx
|
||||
|
||||
C_SOURCE_FILES += $(NRFX_PATH)/drivers/src/nrfx_power.c
|
||||
|
||||
# SDK 11 files
|
||||
C_SOURCE_FILES += $(SDK11_PATH)/libraries/bootloader_dfu/bootloader.c
|
||||
C_SOURCE_FILES += $(SDK11_PATH)/libraries/bootloader_dfu/bootloader_settings.c
|
||||
@ -189,15 +193,16 @@ endif
|
||||
#******************************************************************************
|
||||
|
||||
# src
|
||||
IPATH += $(SRC_PATH)/
|
||||
IPATH += $(SRC_PATH)
|
||||
IPATH += $(SRC_PATH)/cmsis/include
|
||||
IPATH += $(SRC_PATH)/usb
|
||||
IPATH += $(TUSB_PATH)/
|
||||
IPATH += $(TUSB_PATH)
|
||||
|
||||
# nrfx
|
||||
IPATH += $(NRFX_PATH)
|
||||
IPATH += $(NRFX_PATH)/mdk
|
||||
IPATH += $(NRFX_PATH)/hal
|
||||
IPATH += $(NRFX_PATH)/drivers/include
|
||||
|
||||
IPATH += $(SDK11_PATH)/libraries/bootloader_dfu/hci_transport
|
||||
IPATH += $(SDK11_PATH)/libraries/bootloader_dfu
|
||||
@ -221,8 +226,6 @@ IPATH += $(SDK_PATH)/libraries/hci
|
||||
IPATH += $(SDK_PATH)/drivers_nrf/delay
|
||||
#IPATH += $(SDK_PATH)/drivers_nrf/uart
|
||||
#IPATH += $(SDK_PATH)/drivers_nrf/power
|
||||
#IPATH += $(SDK_PATH)/drivers_nrf/usbd
|
||||
#IPATH += $(SDK_PATH)/device
|
||||
|
||||
# Softdevice
|
||||
IPATH += $(SD_PATH)/headers
|
||||
|
10
src/main.c
10
src/main.c
@ -31,6 +31,8 @@
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
#include <stddef.h>
|
||||
#include "nrfx.h"
|
||||
#include "nrfx_power.h"
|
||||
|
||||
#include "nordic_common.h"
|
||||
#include "sdk_common.h"
|
||||
@ -38,6 +40,7 @@
|
||||
#include "bootloader.h"
|
||||
#include "bootloader_util.h"
|
||||
|
||||
|
||||
#include "nrf.h"
|
||||
#include "nrf_soc.h"
|
||||
#include "nrf_nvic.h"
|
||||
@ -69,13 +72,6 @@ void usb_teardown(void);
|
||||
* We must call it within SD's SOC event handler, or set it as power event handler if SD is not enabled. */
|
||||
extern void tusb_hal_nrf_power_event(uint32_t event);
|
||||
|
||||
// TODO fully move to nrfx
|
||||
enum {
|
||||
NRFX_POWER_USB_EVT_DETECTED, /**< USB power detected on the connector (plugged in). */
|
||||
NRFX_POWER_USB_EVT_REMOVED, /**< USB power removed from the connector. */
|
||||
NRFX_POWER_USB_EVT_READY /**< USB power regulator ready. */
|
||||
};
|
||||
|
||||
#else
|
||||
|
||||
#define usb_init()
|
||||
|
@ -34,6 +34,9 @@
|
||||
*/
|
||||
/**************************************************************************/
|
||||
|
||||
#include "nrfx.h"
|
||||
#include "nrfx_power.h"
|
||||
|
||||
#ifdef SOFTDEVICE_PRESENT
|
||||
#include "nrf_sdm.h"
|
||||
#include "nrf_soc.h"
|
||||
@ -42,13 +45,6 @@
|
||||
#include "nrf_usbd.h"
|
||||
#include "tusb.h"
|
||||
|
||||
// TODO fully move to nrfx
|
||||
enum {
|
||||
NRFX_POWER_USB_EVT_DETECTED, /**< USB power detected on the connector (plugged in). */
|
||||
NRFX_POWER_USB_EVT_REMOVED, /**< USB power removed from the connector. */
|
||||
NRFX_POWER_USB_EVT_READY /**< USB power regulator ready. */
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// MACRO TYPEDEF CONSTANT ENUM DECLARATION
|
||||
//--------------------------------------------------------------------+
|
||||
@ -78,7 +74,6 @@ void usb_init(void)
|
||||
}else
|
||||
#endif
|
||||
{
|
||||
#if 0 // TODO enable
|
||||
// Power module init
|
||||
const nrfx_power_config_t pwr_cfg = { 0 };
|
||||
nrfx_power_init(&pwr_cfg);
|
||||
@ -90,7 +85,6 @@ void usb_init(void)
|
||||
nrfx_power_usbevt_enable();
|
||||
|
||||
usb_reg = NRF_POWER->USBREGSTATUS;
|
||||
#endif
|
||||
}
|
||||
|
||||
if ( usb_reg & POWER_USBREGSTATUS_VBUSDETECT_Msk ) {
|
||||
|
Loading…
Reference in New Issue
Block a user