add CAN test placeholder
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
#include "CAN_Test.h"
|
||||
#include "drvCAN.h"
|
||||
#include "cmsis_os2.h"
|
||||
#include "main.h"
|
||||
|
||||
static const osThreadAttr_t task_attrs = {
|
||||
.stack_size = 256
|
||||
};
|
||||
|
||||
static void CAN_Test_Task(void *arg)
|
||||
{
|
||||
(void) arg;
|
||||
|
||||
for ( ; ; )
|
||||
{
|
||||
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_12, GPIO_PIN_SET);
|
||||
osDelay(100);
|
||||
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_12, GPIO_PIN_RESET);
|
||||
osDelay(100);
|
||||
}
|
||||
}
|
||||
|
||||
void CAN_Test_Init(void)
|
||||
{
|
||||
(void) drvCAN_Init();
|
||||
|
||||
osThreadNew(CAN_Test_Task, (void *) 0, &task_attrs);
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
#ifndef __TEST_CAN
|
||||
#define __TEST_CAN
|
||||
|
||||
void CAN_Test_Init(void);
|
||||
|
||||
#endif /* __TEST_CAN */
|
||||
@@ -0,0 +1,29 @@
|
||||
set(KPI_Rover_CAN_Test_Inc
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
)
|
||||
|
||||
set(KPI_Rover_CAN_Test_Src
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hwCAN.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drvCAN.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/CAN_Test.c
|
||||
)
|
||||
|
||||
add_library(KPI_Rover_CAN_Test STATIC)
|
||||
|
||||
target_include_directories(KPI_Rover_CAN_Test PRIVATE
|
||||
${KPI_Rover_CAN_Test_Inc}
|
||||
)
|
||||
|
||||
target_sources(KPI_Rover_CAN_Test PRIVATE
|
||||
${KPI_Rover_CAN_Test_Src}
|
||||
)
|
||||
|
||||
target_link_libraries(KPI_Rover_CAN_Test PRIVATE
|
||||
HAL_H
|
||||
FREERTOS_H
|
||||
)
|
||||
|
||||
add_library(KPI_Rover_CAN_Test_H INTERFACE)
|
||||
target_include_directories(KPI_Rover_CAN_Test_H INTERFACE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
)
|
||||
@@ -0,0 +1,10 @@
|
||||
#include "main.h"
|
||||
#include "drvCAN.h"
|
||||
#include "hwCAN.h"
|
||||
|
||||
bool drvCAN_Init(void)
|
||||
{
|
||||
hwCAN_Init();
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
#ifndef __DRV_CAN
|
||||
#define __DRV_CAN
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
bool drvCAN_Init(void);
|
||||
|
||||
#endif /* __DRV_CAN */
|
||||
@@ -0,0 +1,19 @@
|
||||
#include "main.h"
|
||||
#include "hwCAN.h"
|
||||
|
||||
void hwCAN_Init(void)
|
||||
{
|
||||
__HAL_RCC_GPIOA_CLK_ENABLE();
|
||||
|
||||
GPIO_InitTypeDef GPIO_InitStruct = {0};
|
||||
|
||||
GPIO_InitStruct.Pin = GPIO_PIN_12;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
|
||||
|
||||
GPIO_InitStruct.Pin = GPIO_PIN_11;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
#ifndef __HW_CAN
|
||||
#define __HW_CAN
|
||||
|
||||
#include "main.h"
|
||||
|
||||
void hwCAN_Init(void);
|
||||
|
||||
#endif /* __HW_CAN */
|
||||
@@ -14,6 +14,7 @@ set(KPIROVER_COMPONENTS
|
||||
#Storage
|
||||
ADC
|
||||
Communication
|
||||
CAN_Test
|
||||
DIP
|
||||
Database
|
||||
Encoders
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "KPIRover.h"
|
||||
|
||||
#include "CAN_Test.h"
|
||||
#include "ExternalI2C_Test.h"
|
||||
#include "PCA9685_Test.h"
|
||||
#include "ProtocolHandler.h"
|
||||
@@ -87,6 +88,7 @@ void KPIRover_Init(void) {
|
||||
Servos_Test_Init();
|
||||
Ultrasonic_Test_Init();
|
||||
ExternalI2C_Test_Init();
|
||||
CAN_Test_Init();
|
||||
ulLEDMode_Start();
|
||||
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user