Astra MCU SDK Peripheral Driver Library
Loading...
Searching...
No Matches

Topics

 Enumerated Types
 Enumerated types for the FC driver.
 Data Structures
 Data structures for FC configuration and runtime data paths.
 Functions
 General FC control, routing, log, and ISR APIs.

Detailed Description

The FC (Flight Control) driver provides a complete interface to configure hardware fault inputs, program fault routing to interrupt/trigger/reset outputs, and consume the FC fault log stream.

The driver supports callback-based ISR notification, timing control for interrupt timeout and pulse widths, and runtime programming of association tables used for fault propagation.

Features:

  • Fault input type and logging mask configuration
  • Interrupt output timeout/mask/type configuration
  • Fault association programming for interrupt, trigger, and reset outputs
  • Trigger and reset pulse width configuration
  • Fault log erase, count, indexed read, multi-read, and software-log injection
  • ISR callback registration and dispatch

Configuration Considerations

Typical FC initialization and operation flow:

  1. Call fc_init for the target instance.
  2. Configure fault inputs through fc_config_fault.
  3. Configure interrupt outputs with fc_config_interrupt.
  4. Program fault routing maps via fc_set_fault_association.
  5. Program timing controls with fc_config_timing or helper APIs.
  6. Optionally register callback via fc_register_callback.
  7. Use log APIs to erase/read/inject and process interrupt events in fc_isr.
  8. Call fc_deinit when FC is no longer needed.
Note
Each association output has two 32-bit entries. Bit 0 in entry 0 maps fault ID 0, and bit 0 in entry 1 maps fault ID 32.
Warning
FC callbacks run in fc_isr caller context, usually ISR context. Keep callbacks short and nonblocking.

Usage Examples

Basic Initialization and Fault Configuration

fc_fault_config_t fault_cfg = {
.fault_id = 3,
.type = FC_FAULT_LEVEL,
.mask = false
};
fc_init(FC0);
fc_config_fault(FC0, &fault_cfg);
fc_set_interrupt_timeout(FC0, 100);

Read Retained Fault Logs

fc_log_entry_t logs[8];
uint16_t read_count = 0;
if (fc_read_logs(FC0, logs, 8, &read_count) == FC_OK) {
/* process logs[0..read_count-1] */
}