stw24/Core/Src/vehicle.c

30 lines
613 B
C
Raw Normal View History

2023-03-08 20:20:01 +01:00
#include "vehicle.h"
#include "main.h"
2023-03-16 22:46:51 +01:00
#include "ui.h"
#include "FT_CAN_AL.h"
2023-03-08 20:20:01 +01:00
#include "stm32h7xx.h"
#include "stm32h7xx_hal.h"
#include "stm32h7xx_hal_fdcan.h"
#include "stm32h7xx_hal_gpio.h"
#include "tx_api.h"
void vehicle_thread_entry(ULONG hfdcan_addr) {
2023-03-16 22:46:51 +01:00
ftcan_init((void *)hfdcan_addr);
ftcan_add_filter(0x123, 0x7FF);
2023-03-08 20:20:01 +01:00
while (1) {
uint8_t data[] = {0xFF, 0xEE};
2023-03-16 22:46:51 +01:00
ftcan_transmit(0x456, data, 2);
2023-03-08 20:20:01 +01:00
tx_thread_sleep(10);
}
}
2023-03-16 22:46:51 +01:00
void ftcan_msg_received_cb(uint16_t id, size_t datalen, const uint8_t *data) {
if (id == 0x123) {
2023-03-08 20:20:01 +01:00
HAL_GPIO_TogglePin(STATUS2_GPIO_Port, STATUS2_Pin);
}
}