Skip to content

Commit

Permalink
update registers and add a few examples (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
PonomarevDA authored Nov 1, 2023
1 parent 7afdb51 commit ed06399
Show file tree
Hide file tree
Showing 11 changed files with 34 additions and 46 deletions.
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ else()
)
set(applicationSourceCode
Src/cyphal_application/application.cpp
Src/cyphal_application/params.cpp
build/src/params.cpp
build/src/string_params.cpp
)
set(applicationHeaders
Src/cyphal_application
Expand Down
2 changes: 1 addition & 1 deletion Libs/Cyphal
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ BUILD_OBJ_DIR:=build/obj

cyphal: clean autogenerate_git_related_headers
mkdir -p ${BUILD_OBJ_DIR}
./scripts/prebuild_cyphal.sh
cd ${BUILD_OBJ_DIR} && cmake ../.. && make

dronecan: clean autogenerate_git_related_headers
Expand Down
1 change: 0 additions & 1 deletion Src/cyphal_application/application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#include "main.h"
#include "string_params.hpp"
#include "params.hpp"
#include "storage.h"

void application_entry_point() {
paramsInit(static_cast<uint8_t>(IntParamsIndexes::INTEGER_PARAMS_AMOUNT), NUM_OF_STR_PARAMS);
Expand Down
18 changes: 0 additions & 18 deletions Src/cyphal_application/params.cpp

This file was deleted.

16 changes: 0 additions & 16 deletions Src/cyphal_application/params.hpp

This file was deleted.

17 changes: 17 additions & 0 deletions Src/cyphal_application/params.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
example.integer:
type: Integer
enum: PARAM_EXAMPLE_INTEGER
flags: mutable
default: 42
min: 0
max: 255

example.string:
type: String
enum: PARAM_EXAMPLE_STRING
flags: mutable
default: "default_string_value"

uavcan.pub.example :
data_type: reg.udral.service.actuator.common.Feedback.0.1
enum_base: PWM_1_FB
6 changes: 0 additions & 6 deletions Src/cyphal_application/string_params.hpp

This file was deleted.

4 changes: 2 additions & 2 deletions Src/dronecan_application/params.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
#include "storage.h"

IntegerDesc_t integer_desc_pool[] = {
{(uint8_t*)"id", 0, 127, 50},
{"id", 0, 127, 50},
};
IntegerParamValue_t integer_values_pool[sizeof(integer_desc_pool) / sizeof(IntegerDesc_t)];

StringDesc_t __attribute__((weak)) string_desc_pool[NUM_OF_STR_PARAMS] = {
{(uint8_t*)"name", "", false},
{"name", "", false},
};
StringParamValue_t string_values_pool[sizeof(string_desc_pool) / sizeof(StringDesc_t)];
10 changes: 10 additions & 0 deletions scripts/prebuild_cyphal.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
REPOSITORY_PATH="$(dirname "$SCRIPT_DIR")"
BUILD_DIR=${REPOSITORY_PATH}/build/src/

${REPOSITORY_PATH}/Libs/libparams/scripts/params_generate_array_from_yaml.py \
${BUILD_DIR} \
c++ \
params \
${REPOSITORY_PATH}/Libs/Cyphal/Cyphal/params.yaml ${REPOSITORY_PATH}/Src/cyphal_application/params.yaml

0 comments on commit ed06399

Please sign in to comment.