rusefi-1/firmware/hw_layer/HIP9011.h

60 lines
1.1 KiB
C
Raw Normal View History

2014-08-29 07:52:33 -07:00
/**
* @file HIP9011.h
* @brief HIP9011/TPIC8101 driver
*
* @date Nov 27, 2013
2015-01-12 15:04:10 -08:00
* @author Andrey Belomutskiy, (c) 2012-2015
2014-08-29 07:52:33 -07:00
*/
#ifndef HIP9011_H_
#define HIP9011_H_
2015-01-14 20:03:40 -08:00
typedef enum {
2015-01-15 17:04:01 -08:00
/**
* the step after this one is always IS_INTEGRATING
*/
2015-01-14 20:03:40 -08:00
READY_TO_INTEGRATE,
2015-01-15 17:04:01 -08:00
/**
* the step after this one is always WAITING_FOR_ADC_TO_SKIP
*/
2015-01-14 20:03:40 -08:00
IS_INTEGRATING,
2015-01-15 17:04:01 -08:00
/**
* the step after this one is always WAITING_FOR_RESULT_ADC
*/
2015-01-14 20:03:40 -08:00
WAITING_FOR_ADC_TO_SKIP,
2015-01-15 17:04:01 -08:00
/**
* the step after this one is always IS_SENDING_SPI_COMMAND or READY_TO_INTEGRATE
*/
2015-01-14 20:03:40 -08:00
WAITING_FOR_RESULT_ADC,
2015-01-15 17:04:01 -08:00
/**
* the step after this one is always READY_TO_INTEGRATE
*/
IS_SENDING_SPI_COMMAND,
2015-01-14 20:03:40 -08:00
} hip_state_e;
2015-01-04 18:03:36 -08:00
// 0b01000000
#define SET_PRESCALER_CMD 0x40
// 0b11100000
#define SET_CHANNEL_CMD 0xE0
2015-01-04 21:03:44 -08:00
// 0b11000000
#define SET_INTEGRATOR_CMD 0xC0
2015-01-04 18:03:36 -08:00
// 0b00000000
#define SET_BAND_PASS_CMD 0x0
// 0b10000000
#define SET_GAIN_CMD 0x80
// 0b01110001
2015-01-04 21:03:44 -08:00
//#define SET_ADVANCED_MODE 0x71
#define HIP_THREAD_PERIOD 100
2015-01-04 18:03:36 -08:00
2015-01-14 16:03:39 -08:00
void initHip9011(Logging *sharedLogger);
2014-12-15 17:03:49 -08:00
void setHip9011FrankensoPinout(void);
2015-01-14 19:04:08 -08:00
void hipAdcCallback(adcsample_t value);
2014-08-29 07:52:33 -07:00
#endif /* HIP9011_H_ */