Skip to content

Commit

Permalink
DotBots#292 LH_LOC: add sample project to segger
Browse files Browse the repository at this point in the history
  • Loading branch information
SaidAlvarado committed Apr 29, 2024
1 parent 1e47adf commit ce8c361
Show file tree
Hide file tree
Showing 4 changed files with 99 additions and 0 deletions.
9 changes: 9 additions & 0 deletions drv/drv.emProject
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,15 @@
<file file_name="lis3mdl.c" />
<file file_name="../lis3mdl.h" />
</project>
<project Name="00drv_lh_location">
<configuration
Name="Common"
project_dependencies="00bsp_lh2(bsp)"
project_directory="lh_location"
project_type="Library" />
<file file_name="lh_location.c" />
<file file_name="../lh_location.h" />
</project>
<project Name="00drv_log_flash">
<configuration
Name="Common"
Expand Down
51 changes: 51 additions & 0 deletions projects/01drv_lh_location/01drv_lh_location.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/**
* @file
* @ingroup samples_drv
* @author Said Alvarado-Marin <[email protected]>
* @brief This is a short example of how to calculate the position of the DotBot using the 1LH_2D algorithm.
*
*
* @date 2024
*
* @copyright Inria, 2024
*
*/
#include <nrf.h>
#include <stdio.h>
#include <stdlib.h>
#include "board.h"
#include "board_config.h"
#include "lh2.h"
#include "lh_location.h"

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

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

static db_lh2_t _lh2;

//=========================== main =============================================

/**
* @brief The program starts executing here.
*/
int main(void) {
// Initialize the board core features (voltage regulator)
db_board_init();

// Initialize the LH2
db_lh2_init(&_lh2, &db_lh2_d, &db_lh2_e);
db_lh2_start();

while (1) {
// wait until something happens e.g. an SPI interrupt
__WFE();

// the location function has to be running all the time
db_lh2_process_location(&_lh2);
}

// one last instruction, doesn't do anything, it's just to have a place to put a breakpoint.
__NOP();
}
Empty file.
39 changes: 39 additions & 0 deletions projects/projects-bsp-drv.emProject
Original file line number Diff line number Diff line change
Expand Up @@ -783,6 +783,45 @@
<file file_name="$(SeggerThumbStartup)" />
</folder>
</project>
<project Name="01drv_lh_location">
<configuration
Name="Common"
project_dependencies="00drv_lh_location(drv);00bsp_dotbot_board(bsp);00bsp_timer_hf(bsp)"
project_directory="01drv_lh_location"
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="01drv_lh_location.c" />
</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="01drv_lis2mdl">
<configuration
Name="Common"
Expand Down

0 comments on commit ce8c361

Please sign in to comment.