Skip to content

Commit

Permalink
update ci
Browse files Browse the repository at this point in the history
  • Loading branch information
vacabun committed Dec 15, 2023
1 parent 5559a2e commit 634f281
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 7 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,41 +41,77 @@ jobs:
- name: Build tag(dw1000)
run: |
cd app
if grep -q 'CONFIG_DW3000=y' prj.conf; then
sed -i 's/CONFIG_DW3000=y/CONFIG_DW3000=n/g' prj.conf
fi
if grep -q 'CONFIG_DW1000=n' prj.conf; then
sed -i 's/CONFIG_DW1000=n/CONFIG_DW1000=y/g' prj.conf
fi
make clean
make dw1000
make tag
cd ..
- name: Build anchor(dw1000)
run: |
cd app
if grep -q 'CONFIG_DW3000=y' prj.conf; then
sed -i 's/CONFIG_DW3000=y/CONFIG_DW3000=n/g' prj.conf
fi
if grep -q 'CONFIG_DW1000=n' prj.conf; then
sed -i 's/CONFIG_DW1000=n/CONFIG_DW1000=y/g' prj.conf
fi
make clean
make dw1000
make anchor
cd ..
- name: Build node(dw1000)
run: |
cd app
if grep -q 'CONFIG_DW3000=y' prj.conf; then
sed -i 's/CONFIG_DW3000=y/CONFIG_DW3000=n/g' prj.conf
fi
if grep -q 'CONFIG_DW1000=n' prj.conf; then
sed -i 's/CONFIG_DW1000=n/CONFIG_DW1000=y/g' prj.conf
fi
make clean
make dw1000
make node
cd ..
- name: Build tag(dw3000)
run: |
cd app
if grep -q 'CONFIG_DW3000=n' prj.conf; then
sed -i 's/CONFIG_DW3000=n/CONFIG_DW3000=y/g' prj.conf
fi
if grep -q 'CONFIG_DW1000=y' prj.conf; then
sed -i 's/CONFIG_DW1000=y/CONFIG_DW1000=n/g' prj.conf
fi
make clean
make dw3000
make tag
cd ..
- name: Build anchor(dw3000)
run: |
cd app
if grep -q 'CONFIG_DW3000=n' prj.conf; then
sed -i 's/CONFIG_DW3000=n/CONFIG_DW3000=y/g' prj.conf
fi
if grep -q 'CONFIG_DW1000=y' prj.conf; then
sed -i 's/CONFIG_DW1000=y/CONFIG_DW1000=n/g' prj.conf
fi
make clean
make dw3000
make anchor
cd ..
- name: Build node(dw3000)
run: |
cd app
if grep -q 'CONFIG_DW3000=n' prj.conf; then
sed -i 's/CONFIG_DW3000=n/CONFIG_DW3000=y/g' prj.conf
fi
if grep -q 'CONFIG_DW1000=y' prj.conf; then
sed -i 's/CONFIG_DW1000=y/CONFIG_DW1000=n/g' prj.conf
fi
make clean
make dw3000
make node
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ set(BOARD_FLASH_RUNNER openocd)
set(DTC_OVERLAY_FILE ${CMAKE_CURRENT_SOURCE_DIR}/boards/stm32f401_mini.overlay)

# add the dw3000-decadriver directory as a zephyr module by hand, not needed when using west
# list(APPEND ZEPHYR_EXTRA_MODULES ${CMAKE_CURRENT_SOURCE_DIR}/zephyr-dw3000-driver/)
list(APPEND ZEPHYR_EXTRA_MODULES ${CMAKE_CURRENT_SOURCE_DIR}/zephyr-dw3000-driver/)
list(APPEND ZEPHYR_EXTRA_MODULES ${CMAKE_CURRENT_SOURCE_DIR}/zephyr-dw1000-driver/)

find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
Expand Down
4 changes: 2 additions & 2 deletions prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@ CONFIG_SHELL=y
CONFIG_LOG=y
CONFIG_CBPRINTF_FP_SUPPORT=y

# CONFIG_DW3000=n
CONFIG_DW1000=y
CONFIG_DW3000=n
CONFIG_DW1000=n
14 changes: 10 additions & 4 deletions src/device/device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@ Device::Device()
dw_hw_init();
dw_hw_reset();
dw_hw_init_interrupt();
#if CONFIG_DW1000
dw1000_hw_interrupt_enable();
dw1000_spi_speed_fast();

#endif
#if CONFIG_DW3000
if (dwt_probe((struct dwt_probe_s *)&dw3000_probe_interf) == DWT_ERROR)
{
Expand All @@ -36,14 +37,18 @@ Device::Device()
while (!dwt_checkidlerc())
;
#endif
#if CONFIG_DW1000
dw1000_spi_speed_slow();
#endif
if (dwt_initialise(DW_INIT_CONFIG_PARAMETER) == DWT_ERROR)
{
LOG_DBG("DEV INIT FAILED");
}

LOG_INF("Device ID: 0x%lx", dwt_readdevid());
#if CONFIG_DW1000
dw1000_spi_speed_fast();
#endif
k_sleep(K_MSEC(100));
#if CONFIG_DW3000
dwt_configuretxrf(&txconfig_options);
Expand Down Expand Up @@ -163,13 +168,13 @@ Device::Device()
k_sleep(K_MSEC(100));

device_address = DEVICE_ADDR;
device_address16 = device_address & 0xFFFF;
pan_id = PAN_ID;

LOG_INF("pan_id: %04X", pan_id);
LOG_INF("device_address: %016llX", device_address);

#if CONFIG_DW1000
device_address16 = device_address & 0xFFFF;
LOG_INF("device_address16: %04X", device_address16);
dwt_setlnapamode(DWT_LNA_ENABLE | DWT_PA_ENABLE);
dwt_setpanid(pan_id);
Expand Down Expand Up @@ -267,6 +272,7 @@ uint64_t Device::tx_msg(uint8_t *msg, uint16_t len, uint64_t dest_addr, uint8_t

return 0;
#endif
#if CONFIG_DW1000
uint64_t tx_ts = 0;
uint16_t dest_addr_16 = dest_addr & 0xFFFF;

Expand Down Expand Up @@ -302,6 +308,7 @@ uint64_t Device::tx_msg(uint8_t *msg, uint16_t len, uint64_t dest_addr, uint8_t
k_mutex_unlock(&transceiver_mutex);
dwt_rxenable(DWT_START_RX_IMMEDIATE);
return tx_ts;
#endif
}

void Device::set_msg_dly_ts(uint8_t *msg, uint16_t len, uint64_t ts)
Expand All @@ -322,7 +329,6 @@ void Device::set_msg_dly_ts(uint8_t *msg, uint16_t len, uint64_t ts)
void Device::tx_done_cb(const dwt_cb_data_t *cb_data)
{
// LOG_DBG("TX done");
dwt_write32bitreg(SYS_STATUS_ID, SYS_STATUS_TXFRS);
}

void Device::rx_ok_cb(const dwt_cb_data_t *cb_data)
Expand Down Expand Up @@ -401,7 +407,7 @@ void Device::rx_ok_cb(const dwt_cb_data_t *cb_data)
#if CONFIG_DW1000

uint64_t rx_ts = get_rx_timestamp_u64();

dwt_readrxdata(device_ptr->rx_buffer, cb_data->datalength, 0);

DWT_MSG_TYPR *rx_msg = (DWT_MSG_TYPR *)device_ptr->rx_buffer;
Expand Down

0 comments on commit 634f281

Please sign in to comment.