mcp2515_params.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2016 OTA keys S.A.
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v2.1. See the file LICENSE in the top level
6  * directory for more details.
7  */
8 
20 #ifndef MCP2515_PARAMS_H
21 #define MCP2515_PARAMS_H
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 #include "can/device.h"
28 #include "candev_mcp2515.h"
29 
30 #include "board.h"
31 
36 #ifndef MCP2515_PARAM_SPI
37 #define MCP2515_PARAM_SPI SPI_DEV(0)
38 #endif
39 
40 #ifndef MCP2515_PARAM_SPI_MODE
41 #define MCP2515_PARAM_SPI_MODE SPI_MODE_0
42 #endif
43 
44 #ifndef MCP2515_PARAM_SPI_CLK
45 #define MCP2515_PARAM_SPI_CLK SPI_CLK_10MHZ
46 #endif
47 
48 #ifndef MCP2515_PARAM_CS
49 #define MCP2515_PARAM_CS GPIO_PIN(1, 9)
50 #endif
51 
52 #ifndef MCP2515_PARAM_RST
53 #define MCP2515_PARAM_RST GPIO_UNDEF
54 #endif
55 
56 #ifndef MCP2515_PARAM_INT
57 #define MCP2515_PARAM_INT GPIO_PIN(1, 8)
58 #endif
59 
60 #ifndef MCP2515_PARAM_CLK
61 #define MCP2515_PARAM_CLK (8000000ul)
63 #endif
64 
65 #define MCP2515_DEFAULT_CONFIG \
66 { \
67  .spi = MCP2515_PARAM_SPI, \
68  .spi_mode = MCP2515_PARAM_SPI_MODE, \
69  .spi_clk =MCP2515_PARAM_SPI_CLK, \
70  .cs_pin = MCP2515_PARAM_CS, \
71  .rst_pin = MCP2515_PARAM_RST, \
72  .int_pin = MCP2515_PARAM_INT, \
73  .clk = MCP2515_PARAM_CLK, \
74 }
81  MCP2515_DEFAULT_CONFIG
82 };
83 
88  {
89  .name = "can_mcp2515_0",
90  },
91 };
92 
93 #ifdef __cplusplus
94 }
95 #endif
96 
97 #endif /* MCP2515_PARAMS_H */
Definition of the implementation of the CAN controller driver.
static const candev_params_t candev_mcp2515_params[]
set candev parameters
MCP2515 configuration descriptor.
Parameters to initialize a candev.
Definition: device.h:55
const char * name
candev name to set
Definition: device.h:56
Definitions of CAN device interface.