mirror of
https://git.intern.spaceteamaachen.de/ALPAKA/CAN-Demo.git
synced 2025-06-10 19:15:59 +00:00
Proper thermo driver init
This commit is contained in:
parent
a23e573e64
commit
ca953ee8c4
@ -25,6 +25,12 @@ namespace demo
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
sta::STM32GpioPin cs_pin = sta::STM32GpioPin(GPIOE, GPIO_PIN_13);
|
||||||
|
sta::RtosMutex* mutex;
|
||||||
|
sta::STM32SPI* spi2;
|
||||||
|
sta::STM32SPIDevice* device_;
|
||||||
|
|
||||||
|
sta::MAX31855 tc*;
|
||||||
|
|
||||||
};
|
};
|
||||||
} // namespace demo
|
} // namespace demo
|
||||||
|
@ -27,8 +27,11 @@ namespace demo
|
|||||||
|
|
||||||
void ThermoTask::init()
|
void ThermoTask::init()
|
||||||
{
|
{
|
||||||
|
mutex = new sta::RtosMutex("spi2");
|
||||||
|
spi2 = new sta::STM32SPI(&hspi2, 16000000, &mutex);
|
||||||
|
device_ = new sta::STM32SPIDevice(spi2, &cs_pin);
|
||||||
|
|
||||||
|
tc = new sta::MAX31855(&device_); //create driver object
|
||||||
}
|
}
|
||||||
|
|
||||||
void ThermoTask::func()
|
void ThermoTask::func()
|
||||||
@ -38,24 +41,15 @@ namespace demo
|
|||||||
//STA_DEBUG_HEAP_STATS();
|
//STA_DEBUG_HEAP_STATS();
|
||||||
|
|
||||||
//fuck off other pins
|
//fuck off other pins
|
||||||
|
|
||||||
HAL_GPIO_WritePin(GPIOE,GPIO_PIN_12, GPIO_PIN_SET);
|
HAL_GPIO_WritePin(GPIOE,GPIO_PIN_12, GPIO_PIN_SET);
|
||||||
HAL_GPIO_WritePin(GPIOB,GPIO_PIN_10, GPIO_PIN_SET);
|
HAL_GPIO_WritePin(GPIOB,GPIO_PIN_10, GPIO_PIN_SET);
|
||||||
HAL_GPIO_WritePin(GPIOE,GPIO_PIN_15, GPIO_PIN_SET);
|
HAL_GPIO_WritePin(GPIOE,GPIO_PIN_15, GPIO_PIN_SET);
|
||||||
HAL_GPIO_WritePin(GPIOE,GPIO_PIN_14, GPIO_PIN_SET);
|
HAL_GPIO_WritePin(GPIOE,GPIO_PIN_14, GPIO_PIN_SET);
|
||||||
|
|
||||||
sta::STM32GpioPin cs_pin(GPIOE, GPIO_PIN_13);
|
tc->update(); // update internal values
|
||||||
|
float temperature = tc->getTemp(); //read out temperature in degrees Celsius
|
||||||
sta::RtosMutex mutex("spi2");
|
float referenceTemperature = tc->getReferenceTemp(); // read out reference temperature in degrees Celsius
|
||||||
sta::STM32SPI spi2_ptr(&hspi2, 16000000, &mutex);
|
uint8_t status = tc->getStatus(); //read out status of the update
|
||||||
sta::STM32SPIDevice device_(&spi2_ptr, &cs_pin);
|
|
||||||
|
|
||||||
sta::MAX31855 tc = sta::MAX31855(&device_); //create driver object
|
|
||||||
|
|
||||||
tc.update(); // update internal values
|
|
||||||
float temperature = tc.getTemp(); //read out temperature in degrees Celsius
|
|
||||||
float referenceTemperature = tc.getReferenceTemp(); // read out reference temperature in degrees Celsius
|
|
||||||
uint8_t status = tc.getStatus(); //read out status of the update
|
|
||||||
|
|
||||||
HAL_Delay(1000);
|
HAL_Delay(1000);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user