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