Skip to content

Commit a2887a2

Browse files
committed
Move config to MyConfig
1 parent d90238e commit a2887a2

File tree

2 files changed

+44
-8
lines changed

2 files changed

+44
-8
lines changed

MyConfig.h

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,48 @@
272272
* @brief Define this to use the CAN wired transport for sensor network communication.
273273
*/
274274
//#define MY_CAN
275+
#if defined(MY_CAN)
276+
/**
277+
* @def MY_DEBUG_VERBOSE_CAN
278+
* @brief Define this for verbose debug prints related to the %CAN driver.
279+
*/
280+
//#define MY_DEBUG_VERBOSE_CAN
281+
/**
282+
* @def CAN_INT
283+
* @brief Message arrived interrupt pin.
284+
*/
285+
#ifndef CAN_INT
286+
#define CAN_INT (2u)
287+
#endif
288+
/**
289+
* @def CAN_CS
290+
* @brief Chip select pin.
291+
*/
292+
#ifndef CAN_CS
293+
#define CAN_CS (10u)
294+
#endif
295+
/**
296+
* @def CAN_SPEED
297+
* @brief Baud rate. Allowed values can be found in mcp_can_dfs.h
298+
*/
299+
#ifndef CAN_SPEED
300+
#define CAN_SPEED CAN_250KBPS
301+
#endif
302+
/**
303+
* @def CAN_CLOCK
304+
* @brief can clock. Allowed values can be found in mcp_can_dfs.h
305+
*/
306+
#ifndef CAN_CLOCK
307+
#define CAN_CLOCK MCP_8MHZ
308+
#endif
309+
/**
310+
* @def CAN_BUF_SIZE
311+
* @brief assemble buffer size. Since long messages can be sliced and arrive mixed with other messages, assemble buffer is required.
312+
*/
313+
#ifndef CAN_BUF_SIZE
314+
#define CAN_BUF_SIZE (8u)
315+
#endif
316+
#endif
275317

276318
/**
277319
* @def MY_RS485_BAUD_RATE
@@ -2450,8 +2492,8 @@
24502492
#define MY_PJON
24512493
#define MY_DEBUG_VERBOSE_PJON
24522494
// CAN
2453-
//TODO add more.
24542495
#define MY_CAN
2496+
#define MY_DEBUG_VERBOSE_CAN
24552497
// RF24
24562498
#define MY_RADIO_RF24
24572499
#define MY_RADIO_NRF24 //deprecated

hal/transport/CAN/MyTransportCAN.cpp

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,7 @@
1616
#else
1717
#define CAN_DEBUG(x,...) //!< DEBUG null
1818
#endif
19-
#define CAN_INT 2 // TODO make configurable
20-
#define CAN_CS 10
21-
#define CAN_SPEED CAN_250KBPS
22-
#define CAN_CLOCK MCP_8MHZ
23-
MCP_CAN CAN0(CAN_CS); // TODO make configurable
24-
//since long messages can be sliced and arrive mixed with other messages assemble buffer is required
25-
#define CAN_BUF_SIZE 8 //TODO make configurable
19+
MCP_CAN CAN0(CAN_CS);
2620
bool canInitialized=false;
2721

2822
//input buffer for raw data (from library).

0 commit comments

Comments
 (0)