1
0
mirror of https://github.com/elua/elua.git synced 2025-01-08 20:56:17 +08:00
elua/inc/elua_adc.h
Bogdan Marinescu f253c9003f - fixed a small AVR32 syntax error
- added newlines to the end of some files to avoid GCC errors
2009-02-17 18:57:05 +00:00

37 lines
1.0 KiB
C

#ifndef __ELUA_ADC_H__
#define __ELUA_ADC_H__
#include "type.h"
typedef struct
{
// Status Bit Flags
volatile u8 op_pending: 1, // Is there a pending conversion?
nonblocking: 1, // Are we in blocking or non-blocking mode? (0 - blocking, 1 - nonblocking)
burst: 1, // Acquiring in burst mode
smooth_ready: 1; // Has smoothing filter warmed up (i.e. smoothlen samples collected)
unsigned id, timer_id;
u8 logsmoothlen;
volatile u16 smoothidx;
volatile u32 smoothsum;
u16 *smoothbuf;
volatile u16 reqsamples;
} elua_adc_state;
void adc_smooth_data( unsigned id );
elua_adc_state *adc_get_ch_state( unsigned id );
u16 adc_get_processed_sample( unsigned id );
void adc_init_state( unsigned id );
int adc_update_smoothing( unsigned id, u8 loglen );
void adc_flush_smoothing( unsigned id );
u16 adc_samples_requested( unsigned id );
u16 adc_samples_available( unsigned id );
void adc_wait_pending( unsigned id );
#endif