#ifndef __LTC2640_H__
#define __LTC2640_H__

#ifdef __cplusplus
 extern "C" {
#endif

#include "stm32f4xx.h"

#define LTC2640_PIN_CLR (GPIO_Pin_7)
#define LTC2640_PIN_CS  (GPIO_Pin_15)
#define LTC2640_PIN_SCK (GPIO_Pin_3)
#define LTC2640_PIN_SDI (GPIO_Pin_5)

#define LTC2640_OUTPUT_LEN (3)

#define VOLTAGE_200MV  (328)
#define VOLTAGE_300MV  (492)
#define VOLTAGE_400MV  (655)
#define VOLTAGE_500MV  (819)
#define VOLTAGE_1000MV (1638)
#define VOLTAGE_1200MV (1966)
#define VOLTAGE_1500MV (2458)
#define VOLTAGE_1800MV (2949)
#define VOLTAGE_2000MV (3277)
#define VOLTAGE_2400MV (3932)
#define VOLTAGE_2500MV (4095)

extern uint32_t system_tick_cnt;

void ltc2640_init(void);
void ltc2640_send_data(uint16_t data);
void ltc2640_loop(void);

#ifdef __cplusplus
}
#endif

#endif /* __LTC2640_H__ */
