Skip to content

Commit

Permalink
Merge pull request DotBots#272 from aabadie/gateway_lr
Browse files Browse the repository at this point in the history
projects: add gateway application with long range radio, switch sailbot to use long range
  • Loading branch information
aabadie authored Jan 26, 2024
2 parents 84acaff + 857773b commit 1b84a7f
Show file tree
Hide file tree
Showing 16 changed files with 100 additions and 110 deletions.
16 changes: 9 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ ifeq (nrf5340dk-app,$(BUILD_TARGET))
01bsp_nvmc \
01bsp_qdec \
01bsp_radio_txrx \
01bsp_radio_lr_txrx \
01bsp_radio_txrx_lr \
01bsp_rgbled \
01bsp_rng \
01bsp_rpm \
Expand All @@ -30,6 +30,7 @@ ifeq (nrf5340dk-app,$(BUILD_TARGET))
01drv_pid \
03app_dotbot \
03app_dotbot_gateway \
03app_dotbot_gateway_lr \
03app_log_dump \
03app_nrf5340_app \
03app_sailbot \
Expand All @@ -41,7 +42,7 @@ else ifeq (nrf5340dk-net,$(BUILD_TARGET))
01bsp_motors \
01bsp_nvmc \
01bsp_radio_txrx \
01bsp_radio_lr_txrx \
01bsp_radio_txrx_lr \
01bsp_rgbled \
01bsp_rng \
01bsp_rpm \
Expand All @@ -51,6 +52,7 @@ else ifeq (nrf5340dk-net,$(BUILD_TARGET))
01drv_lis2mdl \
01drv_pid \
03app_dotbot_gateway \
03app_dotbot_gateway_lr \
03app_log_dump \
03app_nrf5340_net \
#
Expand All @@ -62,20 +64,20 @@ TESTBED_APPS ?= $(shell find testbed/ -maxdepth 1 -mindepth 1 -type d | tr -d "/

# remove incompatible apps (nrf5340, sailbot gateway) for dotbot (v1, v2) builds
ifneq (,$(filter dotbot-v1,$(BUILD_TARGET)))
PROJECTS := $(filter-out 01bsp_qdec 01crypto_% 01drv_lis3mdl 01drv_move 03app_dotbot_gateway 03app_sailbot 03app_nrf5340_%,$(PROJECTS))
PROJECTS := $(filter-out 01bsp_qdec 01crypto_% 01drv_lis3mdl 01drv_move 03app_dotbot_gateway 03app_dotbot_gateway_lr 03app_sailbot 03app_nrf5340_%,$(PROJECTS))
ARTIFACT_PROJECTS := 03app_dotbot
TESTBED_APPS := $(filter-out bootloader partition0 partition1,$(TESTBED_APPS))
endif

ifneq (,$(filter dotbot-v2,$(BUILD_TARGET)))
PROJECTS := $(filter-out 01crypto_% 03app_dotbot_gateway 03app_sailbot 03app_nrf5340_net,$(PROJECTS))
PROJECTS := $(filter-out 01crypto_% 03app_dotbot_gateway 03app_dotbot_gateway_lr 03app_sailbot 03app_nrf5340_net,$(PROJECTS))
ARTIFACT_PROJECTS := 03app_dotbot
TESTBED_APPS := $(filter-out bootloader partition0 partition1,$(TESTBED_APPS))
endif

# remove incompatible apps (nrf5340, dotbot, gateway) for sailbot-v1 build
ifeq (sailbot-v1,$(BUILD_TARGET))
PROJECTS := $(filter-out 01bsp_qdec 01crypto_% 01drv_lis3mdl 01drv_move 03app_dotbot_gateway 03app_dotbot 03app_nrf5340_%,$(PROJECTS))
PROJECTS := $(filter-out 01bsp_qdec 01crypto_% 01drv_lis3mdl 01drv_move 03app_dotbot_gateway 03app_dotbot_gateway_lr 03app_dotbot 03app_nrf5340_%,$(PROJECTS))
ARTIFACT_PROJECTS := 03app_sailbot
TESTBED_APPS := $(filter-out bootloader partition0 partition1,$(TESTBED_APPS))
endif
Expand All @@ -87,11 +89,11 @@ endif
# remove incompatible apps (nrf5340) for nrf52833dk/nrf52840dk build
ifneq (,$(filter nrf52833dk nrf52840dk,$(BUILD_TARGET)))
PROJECTS := $(filter-out 01bsp_qdec 01drv_move 03app_nrf5340_%,$(PROJECTS))
ARTIFACT_PROJECTS := 03app_dotbot_gateway
ARTIFACT_PROJECTS := 03app_dotbot_gateway 03app_dotbot_gateway_lr
endif

ifneq (,$(filter nrf5340dk-app,$(BUILD_TARGET)))
ARTIFACT_PROJECTS := 03app_dotbot_gateway
ARTIFACT_PROJECTS := 03app_dotbot_gateway 03app_dotbot_gateway_lr
endif

ifneq (,$(filter nrf5340dk-net,$(BUILD_TARGET)))
Expand Down
1 change: 1 addition & 0 deletions doc/sphinx/applications.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Main applications
_projects/03app_dotbot
_projects/03app_dotbot_gateway
_projects/03app_dotbot_gateway_lr
_projects/03app_sailbot
_projects/03app_log_dump
_projects/03app_nrf5340_app
Expand Down
2 changes: 1 addition & 1 deletion doc/sphinx/examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ _examples/01bsp_lighthouse
_examples/01bsp_motors
_examples/01bsp_nvmc
_examples/01bsp_qdec
_examples/01bsp_radio_lr_txrx
_examples/01bsp_radio_txrx_lr
_examples/01bsp_radio_txrx
_examples/01bsp_rgbled
_examples/01bsp_rng
Expand Down
86 changes: 0 additions & 86 deletions projects/01bsp_radio_lr_txrx/01bsp_radio_lr_txrx.c

This file was deleted.

9 changes: 5 additions & 4 deletions projects/01bsp_radio_txrx/01bsp_radio_txrx.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@
#include "radio.h"
#include "timer_hf.h"

#include "conf.h"

//=========================== defines ===========================================

#define DELAY_MS (100) // Wait 100ms between each send
#define RADIO_FREQ (8) // Set the frequency to 2408 MHz
#define RADIO_MODE (DB_RADIO_BLE_1MBit) // Use BLE 1Mbit/s
#define DELAY_MS (100) // Wait 100ms between each send
#define RADIO_FREQ (8) // Set the frequency to 2408 MHz

//=========================== variables =========================================

Expand Down Expand Up @@ -70,7 +71,7 @@ int main(void) {

//=========================== Configure Radio ===============================

db_radio_init(&radio_callback, RADIO_MODE);
db_radio_init(&radio_callback, DOTBOT_GW_RADIO_MODE);
db_radio_set_frequency(RADIO_FREQ);
db_radio_rx();

Expand Down
3 changes: 3 additions & 0 deletions projects/01bsp_radio_txrx/conf.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#include <nrf.h>

#define DOTBOT_GW_RADIO_MODE DB_RADIO_BLE_LR125Kbit
File renamed without changes.
3 changes: 3 additions & 0 deletions projects/01bsp_radio_txrx_lr/conf.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#include <nrf.h>

#define DOTBOT_GW_RADIO_MODE DB_RADIO_BLE_1MBit
6 changes: 4 additions & 2 deletions projects/03app_dotbot_gateway/03app_dotbot_gateway.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
#include "timer.h"
#include "uart.h"

#include "conf.h"

//=========================== defines ==========================================

#define DB_BUFFER_MAX_BYTES (255U) ///< Max bytes in UART receive buffer
Expand Down Expand Up @@ -154,8 +156,8 @@ int main(void) {
db_protocol_init();

// Configure Radio as transmitter
db_radio_init(&_radio_callback, DB_RADIO_BLE_1MBit); // All RX packets received are forwarded in an HDLC frame over UART
db_radio_set_frequency(8); // Set the radio frequency to 2408 MHz.
db_radio_init(&_radio_callback, DOTBOT_GW_RADIO_MODE); // All RX packets received are forwarded in an HDLC frame over UART
db_radio_set_frequency(8); // Set the radio frequency to 2408 MHz.
// Initialize the gateway context
_gw_vars.buttons = 0x0000;
_gw_vars.radio_queue.current = 0;
Expand Down
3 changes: 3 additions & 0 deletions projects/03app_dotbot_gateway/conf.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#include <nrf.h>

#define DOTBOT_GW_RADIO_MODE DB_RADIO_BLE_1MBit
15 changes: 15 additions & 0 deletions projects/03app_dotbot_gateway_lr/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# DotBot gateway application - long range

This application can be used as a gateway for communication between a computer
and a SailBot.

Plug an nRF52840-DK on your computer and flash this application on it.

You can then use [dotbot-controller tool](https://github.com/DotBots/PyDotBot)
to communicate with the firmware from your computer.

`dotbot-controller` is available on PyPI:

```
$ pip install dotbot-controller
```
3 changes: 3 additions & 0 deletions projects/03app_dotbot_gateway_lr/conf.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#include <nrf.h>

#define DOTBOT_GW_RADIO_MODE DB_RADIO_BLE_LR125Kbit
6 changes: 3 additions & 3 deletions projects/03app_sailbot/03app_sailbot.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,9 @@ int main(void) {
db_protocol_init();

// Configure Radio as a receiver
db_radio_init(&radio_callback, DB_RADIO_BLE_1MBit); // Set the callback function.
db_radio_set_frequency(8); // Set the RX frequency to 2408 MHz.
db_radio_rx(); // Start receiving packets.
db_radio_init(&radio_callback, DB_RADIO_BLE_LR125Kbit); // Set the callback function.
db_radio_set_frequency(8); // Set the RX frequency to 2408 MHz.
db_radio_rx(); // Start receiving packets.

// Init the IMU chips
imu_init(NULL, NULL);
Expand Down
2 changes: 1 addition & 1 deletion projects/03app_sailbot/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ This app contains the main firmware of the SailBot platform based on Kyosho's Fo
## Instructions

1. Load this app on the SailBot board.
1. Program an nRF52840-DK with [gateway firmware](https://github.com/DotBots/DotBot-firmware/tree/main/projects/03app_dotbot_gateway).
1. Program an nRF52840-DK with [logn range gateway firmware](https://github.com/DotBots/DotBot-firmware/tree/main/projects/03app_dotbot_gateway).
1. Start [DotBot controller](https://github.com/DotBots/PyDotBot)on your computer.
8 changes: 5 additions & 3 deletions projects/projects-bsp-drv.emProject
Original file line number Diff line number Diff line change
Expand Up @@ -234,11 +234,11 @@
<file file_name="$(SeggerThumbStartup)" />
</folder>
</project>
<project Name="01bsp_radio_lr_txrx">
<project Name="01bsp_radio_txrx_lr">
<configuration
Name="Common"
project_dependencies="00bsp_dotbot_board(bsp);00bsp_radio(bsp);00bsp_gpio(bsp);00bsp_timer_hf(bsp)"
project_directory="01bsp_radio_lr_txrx"
project_directory="01bsp_radio_txrx_lr"
project_type="Executable" />
<folder Name="Device Files">
<file file_name="$(DeviceCommonHeaderFile)" />
Expand All @@ -263,7 +263,8 @@
</folder>
<folder Name="Source Files">
<configuration Name="Common" filter="c;cpp;cxx;cc;h;s;asm;inc" />
<file file_name="01bsp_radio_lr_txrx.c" />
<file file_name="../01bsp_radio_txrx/01bsp_radio_txrx.c" />
<file file_name="conf.h" />
</folder>
<folder Name="System Files">
<file file_name="$(DeviceCommonVectorsFile)" />
Expand Down Expand Up @@ -303,6 +304,7 @@
<folder Name="Source Files">
<configuration Name="Common" filter="c;cpp;cxx;cc;h;s;asm;inc" />
<file file_name="01bsp_radio_txrx.c" />
<file file_name="conf.h" />
</folder>
<folder Name="System Files">
<file file_name="$(DeviceCommonVectorsFile)" />
Expand Down
47 changes: 44 additions & 3 deletions projects/projects-gateway.emProject
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
project_directory="03app_dotbot_gateway"
project_type="Executable" />
<folder Name="Device Files">
<file file_name="$(DeviceHeaderFile)" />
<file file_name="$(DeviceCommonHeaderFile)" />
<file file_name="$(DeviceHeaderFile)" />
<file file_name="$(DeviceSystemFile)">
<configuration
Name="Common"
Expand All @@ -17,26 +17,67 @@
</file>
</folder>
<folder Name="Script Files">
<file file_name="$(DeviceLinkerScript)">
<configuration Name="Common" file_type="Linker Script" />
</file>
<file file_name="$(DeviceMemoryMap)">
<configuration Name="Common" file_type="Memory Map" />
</file>
<file file_name="../../nRF/Scripts/nRF_Target.js">
<configuration Name="Common" file_type="Reset Script" />
</file>
</folder>
<folder Name="Source Files">
<configuration Name="Common" filter="c;cpp;cxx;cc;h;s;asm;inc" />
<file file_name="03app_dotbot_gateway.c" />
<file file_name="conf.h" />
</folder>
<folder Name="System Files">
<file file_name="$(DeviceCommonVectorsFile)" />
<file file_name="$(DeviceVectorsFile)">
<configuration Name="Common" file_type="Assembly" />
</file>
<file file_name="$(SeggerThumbStartup)" />
</folder>
</project>
<project Name="03app_dotbot_gateway_lr">
<configuration
Name="Common"
project_dependencies="00bsp_radio(bsp);00bsp_dotbot_board(bsp);00bsp_uart(bsp);00bsp_timer(bsp);00bsp_uart(bsp);00drv_dotbot_hdlc(drv);00drv_dotbot_protocol(drv);00bsp_gpio(bsp)"
project_directory="03app_dotbot_gateway_lr"
project_type="Executable" />
<folder Name="Device Files">
<file file_name="$(DeviceCommonHeaderFile)" />
<file file_name="$(DeviceHeaderFile)" />
<file file_name="$(DeviceSystemFile)">
<configuration
Name="Common"
default_code_section=".init"
default_const_section=".init_rodata" />
</file>
</folder>
<folder Name="Script Files">
<file file_name="$(DeviceLinkerScript)">
<configuration Name="Common" file_type="Linker Script" />
</file>
<file file_name="$(DeviceMemoryMap)">
<configuration Name="Common" file_type="Memory Map" />
</file>
<file file_name="../../nRF/Scripts/nRF_Target.js">
<configuration Name="Common" file_type="Reset Script" />
</file>
</folder>
<folder Name="Source Files">
<configuration Name="Common" filter="c;cpp;cxx;cc;h;s;asm;inc" />
<file file_name="03app_dotbot_gateway.c" />
<file file_name="../03app_dotbot_gateway/03app_dotbot_gateway.c" />
<file file_name="conf.h" />
</folder>
<folder Name="System Files">
<file file_name="$(SeggerThumbStartup)" />
<file file_name="$(DeviceCommonVectorsFile)" />
<file file_name="$(DeviceVectorsFile)">
<configuration Name="Common" file_type="Assembly" />
</file>
<file file_name="$(SeggerThumbStartup)" />
</folder>
</project>
</solution>

0 comments on commit 1b84a7f

Please sign in to comment.