Merge pull request #3292 from jflyper/bfdev-configurable-transponder
Configurable transponder
This commit is contained in:
commit
446184b4cf
|
@ -152,16 +152,8 @@ void transponderIrHardwareInit(ioTag_t ioTag, transponder_t *transponder)
|
|||
DMA_ITConfig(dmaRef, DMA_IT_TC, ENABLE);
|
||||
}
|
||||
|
||||
bool transponderIrInit(const transponderProvider_e provider)
|
||||
bool transponderIrInit(const ioTag_t ioTag, const transponderProvider_e provider)
|
||||
{
|
||||
ioTag_t ioTag = IO_TAG_NONE;
|
||||
for (int i = 0; i < USABLE_TIMER_CHANNEL_COUNT; i++) {
|
||||
if (timerHardware[i].usageFlags & TIM_USE_TRANSPONDER) {
|
||||
ioTag = timerHardware[i].tag;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!ioTag) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -113,7 +113,7 @@ struct transponderVTable {
|
|||
void (*updateTransponderDMABuffer)(transponder_t *transponder, const uint8_t* transponderData);
|
||||
};
|
||||
|
||||
bool transponderIrInit(const transponderProvider_e provider);
|
||||
bool transponderIrInit(const ioTag_t ioTag, const transponderProvider_e provider);
|
||||
void transponderIrDisable(void);
|
||||
|
||||
void transponderIrHardwareInit(ioTag_t ioTag, transponder_t *transponder);
|
||||
|
|
Binary file not shown.
|
@ -71,6 +71,7 @@ extern uint8_t __config_end;
|
|||
#include "drivers/sonar_hcsr04.h"
|
||||
#include "drivers/stack_check.h"
|
||||
#include "drivers/system.h"
|
||||
#include "drivers/transponder_ir.h"
|
||||
#include "drivers/time.h"
|
||||
#include "drivers/timer.h"
|
||||
#include "drivers/vcd.h"
|
||||
|
@ -104,6 +105,7 @@ extern uint8_t __config_end;
|
|||
#include "io/ledstrip.h"
|
||||
#include "io/osd.h"
|
||||
#include "io/serial.h"
|
||||
#include "io/transponder_ir.h"
|
||||
#include "io/vtx_rtc6705.h"
|
||||
#include "io/vtx_control.h"
|
||||
|
||||
|
@ -2849,6 +2851,9 @@ const cliResourceValue_t resourceTable[] = {
|
|||
{ OWNER_RX_BIND, PG_RX_CONFIG, offsetof(rxConfig_t, spektrum_bind_pin_override_ioTag), 0 },
|
||||
{ OWNER_RX_BIND_PLUG, PG_RX_CONFIG, offsetof(rxConfig_t, spektrum_bind_plug_ioTag), 0 },
|
||||
#endif
|
||||
#ifdef TRANSPONDER
|
||||
{ OWNER_TRANSPONDER, PG_TRANSPONDER_CONFIG, offsetof(transponderConfig_t, ioTag), 0 },
|
||||
#endif
|
||||
};
|
||||
|
||||
static ioTag_t *getIoTag(const cliResourceValue_t value, uint8_t index)
|
||||
|
|
|
@ -26,9 +26,11 @@
|
|||
#ifdef TRANSPONDER
|
||||
#include "build/build_config.h"
|
||||
|
||||
#include "config/config_reset.h"
|
||||
#include "config/parameter_group.h"
|
||||
#include "config/parameter_group_ids.h"
|
||||
|
||||
#include "drivers/timer.h"
|
||||
#include "drivers/transponder_ir.h"
|
||||
#include "drivers/system.h"
|
||||
#include "drivers/usb_io.h"
|
||||
|
@ -37,13 +39,24 @@
|
|||
|
||||
#include "io/transponder_ir.h"
|
||||
|
||||
PG_REGISTER_WITH_RESET_TEMPLATE(transponderConfig_t, transponderConfig, PG_TRANSPONDER_CONFIG, 0);
|
||||
PG_REGISTER_WITH_RESET_FN(transponderConfig_t, transponderConfig, PG_TRANSPONDER_CONFIG, 0);
|
||||
|
||||
PG_RESET_TEMPLATE(transponderConfig_t, transponderConfig,
|
||||
void pgResetFn_transponderConfig(transponderConfig_t *transponderConfig)
|
||||
{
|
||||
RESET_CONFIG_2(transponderConfig_t, transponderConfig,
|
||||
.provider = TRANSPONDER_ILAP,
|
||||
.reserved = 0,
|
||||
.data = { 0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0x0, 0x0, 0x0 }, // Note, this is NOT a valid transponder code, it's just for testing production hardware
|
||||
);
|
||||
.ioTag = IO_TAG_NONE
|
||||
);
|
||||
|
||||
for (int i = 0; i < USABLE_TIMER_CHANNEL_COUNT; i++) {
|
||||
if (timerHardware[i].usageFlags & TIM_USE_TRANSPONDER) {
|
||||
transponderConfig->ioTag = timerHardware[i].tag;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static bool transponderInitialised = false;
|
||||
static bool transponderRepeat = false;
|
||||
|
@ -95,7 +108,7 @@ void transponderUpdate(timeUs_t currentTimeUs)
|
|||
|
||||
void transponderInit(void)
|
||||
{
|
||||
transponderInitialised = transponderIrInit(transponderConfig()->provider);
|
||||
transponderInitialised = transponderIrInit(transponderConfig()->ioTag, transponderConfig()->provider);
|
||||
if (!transponderInitialised) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ typedef struct transponderConfig_s {
|
|||
transponderProvider_e provider;
|
||||
uint8_t reserved;
|
||||
uint8_t data[9];
|
||||
ioTag_t ioTag;
|
||||
} transponderConfig_t;
|
||||
|
||||
typedef struct transponderRequirement_s {
|
||||
|
|
Loading…
Reference in New Issue