Skip to content

Commit 9c67a4a

Browse files
committed
Got build working
1 parent 4647665 commit 9c67a4a

File tree

2 files changed

+5
-55
lines changed

2 files changed

+5
-55
lines changed

CanHacker.cpp

Lines changed: 2 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -16,56 +16,6 @@ const char hex_asc_upper[] = "0123456789ABCDEF";
1616
#define hex_asc_upper_lo(x) hex_asc_upper[((x) & 0x0F)]
1717
#define hex_asc_upper_hi(x) hex_asc_upper[((x) & 0xF0) >> 4]
1818

19-
#ifdef STM_DRIVER
20-
/**
21-
* @brief System Clock Configuration (Generated from Cube MX. Project stored in can_multi_tool_board.ioc)
22-
* @retval None
23-
*
24-
* External clock is 8MHz. Core runs at 96MHz. CAN peripheral at 48MHz.
25-
*/
26-
extern "C" void SystemClock_Config(void)
27-
{
28-
RCC_OscInitTypeDef RCC_OscInitStruct = {};
29-
RCC_ClkInitTypeDef RCC_ClkInitStruct = {};
30-
31-
/** Configure the main internal regulator output voltage
32-
*/
33-
__HAL_RCC_PWR_CLK_ENABLE();
34-
__HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);
35-
36-
/** Initializes the RCC Oscillators according to the specified parameters
37-
* in the RCC_OscInitTypeDef structure.
38-
*/
39-
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
40-
RCC_OscInitStruct.HSEState = RCC_HSE_ON;
41-
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
42-
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
43-
RCC_OscInitStruct.PLL.PLLM = 4;
44-
RCC_OscInitStruct.PLL.PLLN = 96;
45-
RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2;
46-
RCC_OscInitStruct.PLL.PLLQ = 4;
47-
RCC_OscInitStruct.PLL.PLLR = 2;
48-
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
49-
{
50-
Error_Handler();
51-
}
52-
53-
/** Initializes the CPU, AHB and APB buses clocks
54-
*/
55-
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK
56-
|RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2;
57-
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
58-
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
59-
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV2;
60-
RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;
61-
62-
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_3) != HAL_OK)
63-
{
64-
Error_Handler();
65-
}
66-
}
67-
#endif
68-
6919
static inline void put_hex_byte(char *buf, __u8 byte)
7020
{
7121
buf[0] = hex_asc_upper_hi(byte);
@@ -103,7 +53,7 @@ CanHacker::CanHacker(Stream *stream, Stream *debugStream, uint8_t cs, const uint
10353
#endif /* STM_DRIVER */
10454

10555

106-
can_instance->begin();
56+
can_instance->begin();
10757

10858
}
10959

@@ -124,7 +74,7 @@ void CanHacker::setClock(BASE_CAN::CAN_CLOCK clock){
12474
}
12575

12676
CanHacker::ERROR CanHacker::connectCan() {
127-
can_instance->connectCan();
77+
can_instance->connectCan();
12878

12979
ERROR error = (ERROR)can_instance->getError();
13080

can_driver_config.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
#ifndef CAN_DRIVER_CONFIG_H
22
#define CAN_DRIVER_CONFIG_H
33

4-
// Comment out the driver that is not being used
4+
// Comment out the driver that is not being used
55

66
#if !defined(MCP_DRIVER) || !defined(STM_DRIVER)
7-
#define MCP_DRIVER 1
8-
//#define STM_DRIVER 1
7+
//#define MCP_DRIVER 1
8+
#define STM_DRIVER 1
99
#endif // MCP_DRIVER) || STM_DRIVER
1010

1111
#endif /* CAN_DRIVER_CONFIG_H */

0 commit comments

Comments
 (0)