steering-wheel/Core/Src/vehicle.c

30 lines
613 B
C

#include "vehicle.h"
#include "main.h"
#include "ui.h"
#include "FT_CAN_AL.h"
#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) {
ftcan_init((void *)hfdcan_addr);
ftcan_add_filter(0x123, 0x7FF);
while (1) {
uint8_t data[] = {0xFF, 0xEE};
ftcan_transmit(0x456, data, 2);
tx_thread_sleep(10);
}
}
void ftcan_msg_received_cb(uint16_t id, size_t datalen, const uint8_t *data) {
if (id == 0x123) {
HAL_GPIO_TogglePin(STATUS2_GPIO_Port, STATUS2_Pin);
}
}