Commit 0e3ddb18 authored by Donald Chen's avatar Donald Chen
Browse files

add passthrough

parent 99157eb3
......@@ -36,39 +36,61 @@
#include "ser_phy_debug_comm.h"
#if defined ( __CC_ARM )
#if defined(__CC_ARM)
typedef struct __attribute__((packed))
{
uint32_t magic_number; /* Magic number to verify the presence of this structure in memory */
uint32_t struct_version : 8; /* Version of this struct format */
uint32_t rfu0 : 24; /* Reserved for future use, shall be 0xFFFFFF */
uint32_t revision_hash; /* Unique revision identifier */
uint32_t version_major : 8; /* Major version number */
uint32_t version_minor : 8; /* Minor version number */
uint32_t version_patch : 8; /* Patch version number */
uint32_t rfu1 : 8; /* Reserved for future use, shall be 0xFF */
uint32_t sd_ble_api_version : 8; /* SoftDevice BLE API version number */
uint32_t transport_type : 8; /* Connectivity transport type, 1 = UART HCI */
uint32_t rfu2 : 16; /* Reserved for future use, shall be 0xFFFF */
uint32_t baud_rate; /* UART transport baud rate */
uint32_t magic_number; /* Magic number to verify the presence of this structure in memory */
uint32_t struct_version : 8; /* Version of this struct format */
uint32_t rfu0 : 24; /* Reserved for future use, shall be 0xFFFFFF */
uint32_t revision_hash; /* Unique revision identifier */
uint32_t version_major : 8; /* Major version number */
uint32_t version_minor : 8; /* Minor version number */
uint32_t version_patch : 8; /* Patch version number */
uint32_t rfu1 : 8; /* Reserved for future use, shall be 0xFF */
uint32_t sd_ble_api_version : 8; /* SoftDevice BLE API version number */
uint32_t transport_type : 8; /* Connectivity transport type, 1 = UART HCI */
uint32_t rfu2 : 16; /* Reserved for future use, shall be 0xFFFF */
uint32_t baud_rate; /* UART transport baud rate */
} version_info_t;
static const version_info_t version_info __attribute__((at(0x20000))) = {
.magic_number = 0x46D8A517,
.struct_version = 2,
.rfu0 = 0xFFFFFF,
.revision_hash = 0,
.version_major = 1,
.version_minor = 2,
.version_patch = 0,
.rfu1 = 0xFF,
.magic_number = 0x46D8A517,
.struct_version = 2,
.rfu0 = 0xFFFFFF,
.revision_hash = 0,
.version_major = 1,
.version_minor = 2,
.version_patch = 0,
.rfu1 = 0xFF,
.sd_ble_api_version = NRF_SD_BLE_API_VERSION,
.transport_type = 1,
.rfu2 = 0xFFFF,
.baud_rate = SER_PHY_UART_BAUDRATE_VAL,
.transport_type = 1,
.rfu2 = 0xFFFF,
.baud_rate = SER_PHY_UART_BAUDRATE_VAL,
};
#endif
void pa_lna_init(void)
{
#define PA_RX_EN_PIN 38 //p1.06
#define PA_TX_EN_PIN 37 //p1.05
#define PA_MODE_PIN 36 //p1.04
#define ANT_SEL_PIN 34 //p1.02
//configure PA-LNA pins as outputs
nrf_gpio_cfg_output(PA_RX_EN_PIN);
nrf_gpio_cfg_output(PA_TX_EN_PIN);
nrf_gpio_cfg_output(PA_MODE_PIN);
nrf_gpio_cfg_output(ANT_SEL_PIN);
//set PA-LNA pins for bypass mode, using the internal antenna
nrf_gpio_pin_clear(PA_RX_EN_PIN);
nrf_gpio_pin_clear(PA_TX_EN_PIN);
nrf_gpio_pin_set(PA_MODE_PIN);
nrf_gpio_pin_set(ANT_SEL_PIN);
}
/**@brief Main function of the connectivity application. */
int main(void)
{
......@@ -77,7 +99,9 @@ int main(void)
APP_ERROR_CHECK(NRF_LOG_INIT(NULL));
NRF_LOG_INFO("BLE connectivity started\r\n");
#if ( defined(SER_PHY_HCI_DEBUG_ENABLE) || defined(SER_PHY_DEBUG_APP_ENABLE))
pa_lna_init();
#if (defined(SER_PHY_HCI_DEBUG_ENABLE) || defined(SER_PHY_DEBUG_APP_ENABLE))
debug_init(NULL);
#endif
......@@ -92,7 +116,6 @@ int main(void)
nrf_clock_lf_cfg_t clock_lf_cfg = NRF_CLOCK_LFCLKSRC;
SOFTDEVICE_HANDLER_INIT(&clock_lf_cfg, NULL);
/* Subscribe for BLE events. */
err_code = softdevice_ble_evt_handler_set(ser_conn_ble_event_handle);
APP_ERROR_CHECK(err_code);
......
......@@ -126,12 +126,11 @@ LIB_FILES += \
# C flags common to all targets
CFLAGS += -D__STACK_SIZE=2048
CFLAGS += -DNRF52
CFLAGS += -DNRF52_PAN_64
CFLAGS += -DSOFTDEVICE_PRESENT
CFLAGS += -DSER_CONNECTIVITY
CFLAGS += -DBOARD_PCA10040
CFLAGS += -DNRF52832
CFLAGS += -DNRF52840_XXAA
CFLAGS += -D__HEAP_SIZE=1024
CFLAGS += -DNRF52_PAN_12
CFLAGS += -DNRF52_PAN_58
......@@ -163,12 +162,11 @@ CXXFLAGS += \
# Assembler flags common to all targets
ASMFLAGS += -x assembler-with-cpp
ASMFLAGS += -D__STACK_SIZE=2048
ASMFLAGS += -DNRF52
ASMFLAGS += -DNRF52_PAN_64
ASMFLAGS += -DSOFTDEVICE_PRESENT
ASMFLAGS += -DSER_CONNECTIVITY
ASMFLAGS += -DBOARD_PCA10040
ASMFLAGS += -DNRF52832
ASMFLAGS += -DNRF52840_XXAA
ASMFLAGS += -D__HEAP_SIZE=1024
ASMFLAGS += -DNRF52_PAN_12
ASMFLAGS += -DNRF52_PAN_58
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment