mirror of
https://git.intern.spaceteamaachen.de/ALPAKA/CAN-Demo.git
synced 2025-08-05 21:59:42 +00:00
Just straight up can card module SW
This commit is contained in:
@@ -38,7 +38,7 @@ namespace demo
|
||||
void CanTask::func()
|
||||
{
|
||||
//STA_DEBUG_HEAP_STATS();
|
||||
//canController.sendFrame(txHeader, payload);
|
||||
canController.sendFrame(txHeader, payload);
|
||||
//STA_DEBUG_HEAP_STATS();
|
||||
|
||||
CAN_RxHeaderTypeDef rxHeader; //CAN Bus Receive Header
|
||||
|
64
App/Src/tasks/thermo.cpp
Normal file
64
App/Src/tasks/thermo.cpp
Normal file
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* can_task.cpp
|
||||
*
|
||||
* Created on: 10 Dec 2023
|
||||
* Author: Carl
|
||||
*/
|
||||
|
||||
#include <tasks/thermo.hpp>
|
||||
#include <sta/debug/debug.hpp>
|
||||
#include <sta/rtos/debug/heap_stats.hpp>
|
||||
#include <gpio.h>
|
||||
#include <spi.h>
|
||||
#include <sta/MAX31855.hpp>
|
||||
#include <sta/devices/stm32/bus/spi.hpp>
|
||||
|
||||
#include <sta/rtos/mutex.hpp>
|
||||
|
||||
#include <cmsis_os2.h>
|
||||
|
||||
namespace demo
|
||||
{
|
||||
ThermoTask::ThermoTask()
|
||||
: TacosThread("Thermo", osPriorityNormal)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void ThermoTask::init()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
sta::STM32GpioPin cs_pin(GPIOE, GPIO_PIN_13);
|
||||
|
||||
sta::RtosMutex mutex("spi2");
|
||||
sta::STM32SPI spi2_ptr(&hspi2, 16000000, &mutex);
|
||||
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);
|
||||
}
|
||||
|
||||
} // namespace demo
|
||||
|
Reference in New Issue
Block a user