Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion RemoteIDModule/RemoteIDModule.ino
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,18 @@ void setup()
#endif

#if defined(PIN_CAN_TERM)
#if !defined(CAN_TERM_EN)
#define CAN_TERM_EN HIGH
#endif

// optional CAN termination control
pinMode(PIN_CAN_TERM, OUTPUT);
digitalWrite(PIN_CAN_TERM, HIGH);

if (g.can_term == 1) {
digitalWrite(PIN_CAN_TERM, CAN_TERM_EN);
} else {
digitalWrite(PIN_CAN_TERM, !CAN_TERM_EN);
}
#endif

#if defined(BUZZER_PIN)
Expand Down
3 changes: 3 additions & 0 deletions RemoteIDModule/board_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,9 @@

#define WS2812_LED_PIN GPIO_NUM_48

#define PIN_CAN_TERM GPIO_NUM_37
#define CAN_TERM_EN LOW

#else
#error "unsupported board"
#endif
3 changes: 3 additions & 0 deletions RemoteIDModule/parameters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ static nvs_handle handle;
const Parameters::Param Parameters::params[] = {
{ "LOCK_LEVEL", Parameters::ParamType::INT8, (const void*)&g.lock_level, 0, -1, 2 },
{ "CAN_NODE", Parameters::ParamType::UINT8, (const void*)&g.can_node, 0, 0, 127 },
#if defined(PIN_CAN_TERM)
{ "CAN_TERMINATE", Parameters::ParamType::UINT8, (const void*)&g.can_term, 0, 0, 1 },
#endif
{ "UAS_TYPE", Parameters::ParamType::UINT8, (const void*)&g.ua_type, 0, 0, 15 },
{ "UAS_ID_TYPE", Parameters::ParamType::UINT8, (const void*)&g.id_type, 0, 0, 4 },
{ "UAS_ID", Parameters::ParamType::CHAR20, (const void*)&g.uas_id[0], 0, 0, 0 },
Expand Down
4 changes: 4 additions & 0 deletions RemoteIDModule/parameters.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#pragma once

#include <stdint.h>
#include "board_config.h"

#define MAX_PUBLIC_KEYS 5
#define PUBLIC_KEY_LEN 32
Expand All @@ -12,6 +13,9 @@

class Parameters {
public:
#if defined(PIN_CAN_TERM)
uint8_t can_term = !CAN_TERM_EN;
#endif
int8_t lock_level;
uint8_t can_node;
uint8_t bcast_powerup;
Expand Down
Loading