2024-05-01 21:43:05 +08:00
|
|
|
#ifndef __LTC1867_H__
|
|
|
|
|
#define __LTC1867_H__
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
extern "C" {
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#include "stm32f4xx.h"
|
|
|
|
|
|
|
|
|
|
#define LEDIR_FREQ (8)
|
2024-06-29 15:22:55 +08:00
|
|
|
#define SAMPLES_PER_PERIOD (1024)
|
2024-05-01 21:43:05 +08:00
|
|
|
#define TIMER_SRC_FREQ (84 * 1000 * 1000)
|
2024-06-29 15:22:55 +08:00
|
|
|
#define TIMER_PERIOD_SAMPLE (TIMER_SRC_FREQ / LEDIR_FREQ / SAMPLES_PER_PERIOD - 1)
|
2024-05-01 21:43:05 +08:00
|
|
|
#define TIMER_PERIOD_DELAY (TIMER_SRC_FREQ / 1000 / 1000 * 35 / 10 - 1) /* 3.5us */
|
2024-06-29 15:22:55 +08:00
|
|
|
|
|
|
|
|
#define LTC1867_CH_CNT (2)
|
2024-05-01 21:43:05 +08:00
|
|
|
|
|
|
|
|
#define PORT_LEDIR (GPIOB)
|
|
|
|
|
#define PIN_LEDIR (GPIO_Pin_0)
|
|
|
|
|
#define PORT_LTC1867 (GPIOA)
|
|
|
|
|
#define PIN_CONV (GPIO_Pin_4)
|
|
|
|
|
#define PORT_SPI (GPIOA)
|
|
|
|
|
#define PIN_SPI_CS (GPIO_Pin_4)
|
|
|
|
|
#define PIN_SPI_SCK (GPIO_Pin_5)
|
|
|
|
|
#define PIN_SPI_SDO (GPIO_Pin_6)
|
|
|
|
|
#define PIN_SPI_SDI (GPIO_Pin_7)
|
|
|
|
|
|
|
|
|
|
void ltc1867_init(void);
|
2024-06-29 15:22:55 +08:00
|
|
|
void ltc1867_ledir_on(void);
|
|
|
|
|
void ltc1867_ledir_off(void);
|
|
|
|
|
void ltc1867_ledir_toggle(void);
|
2024-05-01 21:43:05 +08:00
|
|
|
void ltc1867_delay(void);
|
|
|
|
|
void ltc1867_conv(void);
|
|
|
|
|
void ltc1867_spi_select(void);
|
|
|
|
|
uint16_t ltc1867_transfer(uint16_t data_send);
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#endif /* __LTC1867_H__ */
|