我知道大约有一百万个这样的帖子,但我不知道如何解决这个问题。是不是因为上面定义了 elua_adc_ch_state 然后再次使用?错误的行被标记。
typedef struct
{
// Status Bit Flags
volatile u8 op_pending: 1, // Is there a pending conversion?
blocking: 1, // Are we in blocking or non-blocking mode? (0 - blocking, 1 - nonblocking)
freerunning: 1, // If true, we don't stop when we've acquired the requested number of samples
smooth_ready: 1, // Has smoothing filter warmed up (i.e. smoothlen samples collected)
value_fresh: 1; // Whether the value pointed to by value_ptr is fresh
unsigned id;
u8 logsmoothlen;
volatile u16 smoothidx;
volatile u32 smoothsum;
u16 *smoothbuf;
volatile u16 reqsamples;
volatile u16 *value_ptr;
} elua_adc_ch_state;
typedef struct
{
elua_adc_ch_state *ch_state[ NUM_ADC ]; *** <----
volatile u16 sample_buf[ NUM_ADC ]; *** <----
volatile u8 clocked: 1,
force_reseq: 1,
skip_cycle: 1,
running: 1; // Whether or not sequence is running
volatile u32 ch_active; // bits represent whether channel should be converted on this device
volatile u32 last_ch_active; // keep copy of old configuration
unsigned timer_id, seq_id; // Timer bound to device, sequencer device id
volatile u8 seq_ctr, seq_len;
} elua_adc_dev_state;
定义并包含所有 u16、u8、NUM_ADC 分配。我只是不确定为什么当第一个结构很好时第二个结构会失败......也没有循环头依赖项。
谢谢