#ifndef __CAP1296_H
#define __CAP1296_H


#include "stm32f0xx.h"
#include "stm32f0xx_rcc.h"
#include "stm32f0xx_gpio.h"
#include "stm32f0xx_i2c.h"


#define CAP1296_I2C I2C2

//DS3232 I2C Address
#define CAP1296_ADDR 0x50




/*8-Bit Registers*/
#define CAP_SAGCYC 0x000 //R/W
#define CAP_GEN_STAT 0x02
#define CAP_SIS	0x03
#define CAP_NFS	0x04
#define CAP_SI1DC 0x10
#define CAP_SI2DC 0x11
#define CAP_SI3DC 0x12
#define CAP_SI4Dc 0x13
#define CAP_SI5DC 0x14
#define CAP_SI6DC 0x15
#define CAP_SENS_CTRL 0x1F
#define CAP_CONFIG 0x20
#define CAP_IN_EN 0x21
#define CAP_IN_CONFIG 0x22
#define CAP_IN_CONFIG2 0x23
#define CAP_AS_CONFIG 0x24
#define CAP_CAS 0x26
#define CAP_INT_EN 0x27
#define CAP_REP_EN 0x28
#define CAP_SG_EN 0x29
#define CAP_MT_CONFIG 0x2A
#define CAP_MTP_CONFIG 0x2B
#define CAP_MTP 0x2D
#define CAP_BCOL 0x2E
#define CAP_RECAL_CONFIG 0x2F
#define CAP_IN1THR 0x30
#define CAP_IN2THR 0x31
#define CAP_IN3THR 0x32
#define CAP_IN4THR 0x33
#define CAP_IN5THR 0x34
#define CAP_IN6THR 0x35
#define CAP_IN_N_THR 0x38

//STBY CTRL REGS
#define CAP_STBY_CH 0x40
#define CAP_STBY_CONFIG 0x41
#define CAP_STBY_SENS 0x42
#define CAP_STBY_THR 0x43

#define CAP_CONFIG2 0x44
/*
#define CAP_
#define CAP_
#define CAP_
#define CAP_
#define CAP_*/


typedef struct
{
	uint8_t CAP1296_Pin;
	uint8_t CAP1296_Enable;
	uint8_t CAP1296_Repeat;
	uint8_t CAP1296_Guard;
}CAP1296_InputSetStruct;


void CAP1296_write_reg_8 (uint8_t reg, uint8_t val);
uint8_t CAP1296_read_reg_8 (uint8_t reg);
uint32_t CAP1296_read_keys(void);
void CAP1296_init(void);

#endif /*__CAP1296_H */














