aboutsummaryrefslogtreecommitdiff
path: root/drivers/chibios/spi_master.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/chibios/spi_master.h')
-rw-r--r--drivers/chibios/spi_master.h80
1 files changed, 0 insertions, 80 deletions
diff --git a/drivers/chibios/spi_master.h b/drivers/chibios/spi_master.h
deleted file mode 100644
index e93580e31..000000000
--- a/drivers/chibios/spi_master.h
+++ /dev/null
@@ -1,80 +0,0 @@
1/* Copyright 2020 Nick Brassel (tzarc)
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 3 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <https://www.gnu.org/licenses/>.
15 */
16
17#pragma once
18
19#include <ch.h>
20#include <hal.h>
21#include <stdbool.h>
22
23#include "gpio.h"
24
25#ifndef SPI_DRIVER
26# define SPI_DRIVER SPID2
27#endif
28
29#ifndef SPI_SCK_PIN
30# define SPI_SCK_PIN B13
31#endif
32
33#ifndef SPI_SCK_PAL_MODE
34# define SPI_SCK_PAL_MODE 5
35#endif
36
37#ifndef SPI_MOSI_PIN
38# define SPI_MOSI_PIN B15
39#endif
40
41#ifndef SPI_MOSI_PAL_MODE
42# define SPI_MOSI_PAL_MODE 5
43#endif
44
45#ifndef SPI_MISO_PIN
46# define SPI_MISO_PIN B14
47#endif
48
49#ifndef SPI_MISO_PAL_MODE
50# define SPI_MISO_PAL_MODE 5
51#endif
52
53typedef int16_t spi_status_t;
54
55#define SPI_STATUS_SUCCESS (0)
56#define SPI_STATUS_ERROR (-1)
57#define SPI_STATUS_TIMEOUT (-2)
58
59#define SPI_TIMEOUT_IMMEDIATE (0)
60#define SPI_TIMEOUT_INFINITE (0xFFFF)
61
62#ifdef __cplusplus
63extern "C" {
64#endif
65void spi_init(void);
66
67bool spi_start(pin_t slavePin, bool lsbFirst, uint8_t mode, uint16_t divisor);
68
69spi_status_t spi_write(uint8_t data);
70
71spi_status_t spi_read(void);
72
73spi_status_t spi_transmit(const uint8_t *data, uint16_t length);
74
75spi_status_t spi_receive(uint8_t *data, uint16_t length);
76
77void spi_stop(void);
78#ifdef __cplusplus
79}
80#endif