Files
SingleColumn_Trolley/Project/source/Module/CS1237/CS1237_RIGHTLOW.h
T

79 lines
1.8 KiB
C
Raw Normal View History

2026-06-01 18:15:20 +08:00
#include "bsp.h"
#ifndef _CS1237_RIGHTLOW_H_
#define _CS1237_RIGHTLOW_H_
#define READ_CONFIG_CMD 0x56
#define WRITE_CONFIG_CMD 0x65
#define CONFIG_RST 0x0C
#define REFO_OFF 0x40
#define REFO_ON 0x00
#define SPEED_SEL_10Hz 0x00
#define SPEED_SEL_40Hz 0x10
#define SPEED_SEL_640Hz 0x20
#define SPEED_SEL6_1280Hz 0x30
#define PGA_SEL_1 0x00
#define PGA_SEL_2 0x04
#define PGA_SEL_64 0x08
#define PGA_SEL_128 0x0C
#define CH_SEL_A 0x00
//#define CH_SEL_B 0x01
#define CH_SEL_TEMP 0x02
#define CH_SEL_JUMP 0x03
/*Definition of conversion time corresponding to repeatability setting*/
/*
10Hz //建立时间300ms
40Hz //建立时间75ms
640Hz //建立时间6.25ms
1280Hz //建立时间3.125ms
*/
#define tCon_10Hz 300 /* ms. */
#define tCon_40Hz 75 /* ms. */
#define tCon_640Hz 7 /* ms. */
#define tCon_1280Hz 4 /* ms. */
#define PORT_A 1 //采集通道A
//#define PORT_B 1 //采集通道B
#define PORT_TEMP 0 //采集温度
#define PORT_JUMP 0 //内短采集
#define PACK_NUM 1 //一次采集的数据包数量
#define FILTER_NUM 0 //滤波数
typedef enum{
RLCS1237_STATUS_IDLE,
RLCS1237_STATUS_START,
RLCS1237_STATUS_DELAY,
RLCS1237_STATUS_READ,
RLCS1237_STATUS_WAIT_READ,
RLCS1237_STATUS_CH_SEL,
RLCS1237_STATUS_STOP,
}RightLowCS1237Status_m;
typedef struct{
RightLowCS1237Status_m Status;
uint32_t CS1237Delay1mSCnt;
int32_t AinA_AD;//AINAad数据
//int32_t AinB_AD;//AINBad数据
int32_t Temp_AD;//温度ad数据
int32_t Jump_AD;//内短ad数据
}
RIGHTLOW_CS1237Var_t;
void RIGHTLOW_CS1237_Init(void);
void RIGHTLOW_CS1237_IrqCallBack(void);
void RIGHTLOW_CS1237DataLoopCollect(void);
void RIGHTLOW_CS12371mSRoutine(void);
void RIGHTLOW_CS1237Start(void);
void RIGHTLOW_CS1237Stop(void);
#endif