Init
This commit is contained in:
parent
24f073a925
commit
70a78a02ae
|
|
@ -0,0 +1,23 @@
|
|||
//
|
||||
// Created by cfif on 03.06.2024.
|
||||
//
|
||||
#include "SensorSPI.h"
|
||||
|
||||
bool setSpiSensor(tSensorSPI *env, uint16_t reg) {
|
||||
|
||||
GpioPinSet(&env->conns->COON_A_B9_B10.En1, false);
|
||||
GpioPinSet(&env->conns->COON_A_B9_B10.En1, true);
|
||||
|
||||
GpioPinSet(&env->conns->COON_A_B9_B10.Con.A, false);
|
||||
GpioPinSet(&env->conns->COON_A_B9_B10.Con.B, false);
|
||||
GpioPinSet(&env->conns->COON_A_B9_B10.Con.C, false);
|
||||
|
||||
bool result = SpiPortTransmit(&env->spiPorts->Spi1_IO, ®, 1000);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void SensorSpi_Init(tSensorSPI *env, tSpiPorts *spiPorts, tConns *conns) {
|
||||
env->spiPorts = spiPorts;
|
||||
env->conns = conns;
|
||||
}
|
||||
|
|
@ -6,6 +6,7 @@
|
|||
#define SMART_COMPONENTS_SENSOR_H
|
||||
|
||||
#include "GpioPin.h"
|
||||
#include "SpiPorts.h"
|
||||
|
||||
typedef struct {
|
||||
tGpioPin A;
|
||||
|
|
@ -19,4 +20,15 @@ typedef struct {
|
|||
tGpioPin En2;
|
||||
} tConn;
|
||||
|
||||
typedef struct {
|
||||
tConn COON_A_B9_B10;
|
||||
} tConns;
|
||||
|
||||
typedef struct {
|
||||
tConns *conns;
|
||||
tSpiPorts *spiPorts;
|
||||
} tSensorSPI;
|
||||
|
||||
void SensorSpi_Init(tSensorSPI *env, tSpiPorts *spiPorts, tConns *conns);
|
||||
|
||||
#endif //SMART_COMPONENTS_SENSOR_H
|
||||
Loading…
Reference in New Issue