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 
21 #ifndef MCP2515_PARAMS_H
22 #define MCP2515_PARAMS_H
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
28 #include "can/device.h"
29 #include "candev_mcp2515.h"
30 
31 #include "board.h"
32 
37 #ifndef MCP2515_PARAM_SPI
38 #define MCP2515_PARAM_SPI SPI_DEV(0)
39 #endif
40 
41 #ifndef MCP2515_PARAM_SPI_MODE
42 #define MCP2515_PARAM_SPI_MODE SPI_MODE_0
43 #endif
44 
45 #ifndef MCP2515_PARAM_SPI_CLK
46 #define MCP2515_PARAM_SPI_CLK SPI_CLK_10MHZ
47 #endif
48 
49 #ifndef MCP2515_PARAM_CS
50 #define MCP2515_PARAM_CS GPIO_PIN(1, 9)
51 #endif
52 
53 #ifndef MCP2515_PARAM_RST
54 #define MCP2515_PARAM_RST GPIO_PIN(0, 0)
55 #endif
56 
57 #ifndef MCP2515_PARAM_INT
58 #define MCP2515_PARAM_INT GPIO_PIN(1, 8)
59 #endif
60 
61 #ifndef MCP2515_PARAM_CLK
62 #define MCP2515_PARAM_CLK (8000000ul)
64 #endif
65 
66 #define MCP2515_DEFAULT_CONFIG \
67 { \
68  .spi = MCP2515_PARAM_SPI, \
69  .spi_mode = MCP2515_PARAM_SPI_MODE, \
70  .spi_clk =MCP2515_PARAM_SPI_CLK, \
71  .cs_pin = MCP2515_PARAM_CS, \
72  .rst_pin = MCP2515_PARAM_RST, \
73  .int_pin = MCP2515_PARAM_INT, \
74  .clk = MCP2515_PARAM_CLK, \
75 }
76 
82  MCP2515_DEFAULT_CONFIG
83 };
84 
89  {
90  .name = "can_mcp2515_0",
91  },
92 };
93 
94 #ifdef __cplusplus
95 }
96 #endif
97 
98 #endif /* MCP2515_PARAMS_H */
device.h
Definitions of CAN device interface.
candev_mcp2515_params
static const candev_params_t candev_mcp2515_params[]
set candev parameters
Definition: mcp2515_params.h:88
candev_params::name
const char * name
candev name to set
Definition: device.h:56
candev_mcp2515.h
Definition of the implementation of the CAN controller driver.
candev_mcp2515_conf
MCP2515 configuration descriptor.
Definition: candev_mcp2515.h:92
candev_params
Parameters to initialize a candev.
Definition: device.h:55