64 lines
1.1 KiB
C
64 lines
1.1 KiB
C
//
|
|
// Created by cfif on 03.06.2024.
|
|
//
|
|
|
|
#ifndef SMART_COMPONENTS_SENSOR_H
|
|
#define SMART_COMPONENTS_SENSOR_H
|
|
|
|
#include "GpioPin.h"
|
|
#include "SpiPorts.h"
|
|
|
|
typedef struct {
|
|
tGpioPin A;
|
|
tGpioPin B;
|
|
tGpioPin C;
|
|
} tConABC;
|
|
|
|
typedef struct {
|
|
tConABC Con;
|
|
tGpioPin En1;
|
|
tGpioPin En2;
|
|
} tConn;
|
|
|
|
typedef struct {
|
|
tConn COON_A_B9_B10;
|
|
tConn COON_B;
|
|
} tConns;
|
|
|
|
typedef struct {
|
|
tConns *conns;
|
|
tSpiPorts *spiPorts;
|
|
} tSensorSPI;
|
|
|
|
typedef enum {
|
|
SENSOR_TYPE_A,
|
|
SENSOR_TYPE_B,
|
|
SENSOR_TYPE_C,
|
|
SENSOR_TYPE_D,
|
|
} tSensorType;
|
|
|
|
typedef enum {
|
|
SENSOR_ADR_1 = 0,
|
|
SENSOR_ADR_2 = 1,
|
|
SENSOR_ADR_3 = 2,
|
|
SENSOR_ADR_4 = 3,
|
|
SENSOR_ADR_5 = 4,
|
|
SENSOR_ADR_6 = 5,
|
|
SENSOR_ADR_7 = 6,
|
|
SENSOR_ADR_8 = 7,
|
|
SENSOR_ADR_9 = 8,
|
|
SENSOR_ADR_10 = 9,
|
|
SENSOR_ADR_11 = 10,
|
|
SENSOR_ADR_12 = 11,
|
|
SENSOR_ADR_13 = 12,
|
|
SENSOR_ADR_14 = 13,
|
|
SENSOR_ADR_15 = 14,
|
|
SENSOR_ADR_16 = 15
|
|
} tSensorAdr;
|
|
|
|
void SensorSpi_Init(tSensorSPI *env, tSpiPorts *spiPorts, tConns *conns);
|
|
|
|
bool setSpiSensor(tSensorSPI *env, tSensorType sensorType, tSensorAdr sensorAdr, uint16_t data);
|
|
|
|
#endif //SMART_COMPONENTS_SENSOR_H
|