npr::rf::PhyTdmExecutor class final

PHY execution backend: SI4463 RX/TX + precise slot alarm execution.

Core idea:

  • Runtime/MAC decide what to send and when; this class executes it against real hardware timing constraints.
  • Slotted TX burst is treated as one radio TX session: first frame uses full preamble, follow-up frames can use shorter preamble.
  • RX capture combines IRQ-edge hints with worker-context FIFO processing.
  • This layer stays policy-free: no TDMA allocation decisions live here.

Public functions

void apply_master_ta_feedback(int16_t timing_advance_us, uint64_t now_us)
Applies master timing-advance feedback to slot timing controller.
void apply_slot_alarm_plan(PhySlotAlarmAction action, uint64_t alarm_time_us, uint64_t slot_target_us)
Applies MAC/runtime alarm action to internal slot executor.
auto consume_slot_tx_opportunity(uint64_t now_us, PhySlotTxOpportunity* out) -> bool
Consumes due slot event (if any) as TX opportunity for runtime.
auto estimate_frame_tx_duration_us(SlotTxFrameKind kind, bool first_in_slot) const -> uint32_t
Estimates frame TX duration for selected frame kind.
auto estimate_frame_tx_duration_us_for_size(size_t frame_size, bool first_in_slot) const -> uint32_t
Estimates frame TX duration from concrete encoded frame size.
void finalize_slotted_tx_burst()
Finalizes any active slotted TX burst and restores RX state.
auto init(const RadioProfile& profile, NprDiagnostics& diagnostics, NprFrameCodec& codec, bool role_is_master, bool radio_rx_only, uint8_t network_id, uint8_t tx_power_raw, float center_frequency_mhz, float freq_shift_mhz, const Si4463Hal& radio_hal) -> bool
Initializes PHY backend and binds profile/diagnostics/codec/HAL dependencies.
auto pop_received_packet(PhyRxPacket* out) -> bool
Pops one captured RX packet from internal queue.
auto radio_ready() const -> bool
true when radio is initialized and healthy for RX/TX.
auto slot_alarm_armed() const -> bool
true when slot alarm is currently armed.
auto sync_tx_stale_limit_us() const -> uint64_t
Maximum sync age where slotted TX is still allowed.
auto transmit_slotted_frame(const uint8_t* frame, size_t frame_size, uint64_t now_us) -> bool
Sends one slotted frame (slot-edge timing accounted).
auto transmit_unslotted_frame(const uint8_t* frame, size_t frame_size, uint64_t now_us) -> bool
Sends one unslotted frame (connect/wake path).
auto tx_prep_advance_us() const -> uint64_t
Effective advance needed before slot start to prepare/send TX.
void worker_iteration()
Executes one backend step (init, RX capture, periodic diagnostics, waits).

Function documentation

uint32_t npr::rf::PhyTdmExecutor::estimate_frame_tx_duration_us(SlotTxFrameKind kind, bool first_in_slot) const

Estimates frame TX duration for selected frame kind.

first_in_slot=true includes first-frame preamble overhead.

uint32_t npr::rf::PhyTdmExecutor::estimate_frame_tx_duration_us_for_size(size_t frame_size, bool first_in_slot) const

Estimates frame TX duration from concrete encoded frame size.

first_in_slot=true includes first-frame preamble overhead.

void npr::rf::PhyTdmExecutor::finalize_slotted_tx_burst()

Finalizes any active slotted TX burst and restores RX state.

Must be called exactly once after slot burst handling is finished.

bool npr::rf::PhyTdmExecutor::init(const RadioProfile& profile, NprDiagnostics& diagnostics, NprFrameCodec& codec, bool role_is_master, bool radio_rx_only, uint8_t network_id, uint8_t tx_power_raw, float center_frequency_mhz, float freq_shift_mhz, const Si4463Hal& radio_hal)

Initializes PHY backend and binds profile/diagnostics/codec/HAL dependencies.

Role is propagated down to radio driver so RX/TX frequency split can be mapped correctly from center_frequency_mhz + freq_shift_mhz.