Subversion Repositories Code-Repo

Rev

Blame | Last modification | View Log | RSS feed

#ifndef CPS_H
#define CPS_H

// Size of rolling average buffer
#define CPS_AVG_COUNT 16

// Number of capacitance button inputs
#define CPS_NUM_CHANNELS 2

// Value of capacitance change to register button press
#define CPS_PCT_ON 40
#define CPS_PCT_OFF 40

typedef struct {
    uint8_t channel;
    uint8_t channels[CPS_NUM_CHANNELS];
    uint8_t btn_pressed[CPS_NUM_CHANNELS];
    uint16_t btn_last_value[CPS_NUM_CHANNELS];
    uint16_t btn_avg_value[CPS_NUM_CHANNELS];
    uint8_t btn_pct_value[CPS_NUM_CHANNELS];
} CPS_DATA;

void CPS_Init(CPS_DATA *data);
void CPS_Timer_0_Interrupt_Handler(void);
void CPS_Reset(void);

void CPS_Enable(void);
void CPS_Disable(void);

#endif