/* * can_task.cpp * * Created on: 10 Dec 2023 * Author: Carl */ #include #include #include #include #include #include #include #include #include namespace demo { ThermoTask::ThermoTask() : TacosThread("Thermo", osPriorityNormal) { } 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() { //STA_DEBUG_HEAP_STATS(); //canController.sendFrame(txHeader, payload); //STA_DEBUG_HEAP_STATS(); //fuck off other pins HAL_GPIO_WritePin(GPIOE,GPIO_PIN_12, 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_14, GPIO_PIN_SET); 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); } } // namespace demo