LCD-ESP32-Driver 1.0
Project includes component for controlling LCD displays. Currently supports only one LCD controller - SSD1283A but it may change in the future.
Loading...
Searching...
No Matches
spi.h
Go to the documentation of this file.
1/*
2 * MIT License
3 *
4 * Copyright (c) 2022 Damian Úlusarczyk
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
7 * and associated documentation files (the "Software"), to deal in the Software without restriction,
8 * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
10 * subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice shall be included in all copies or substantial
13 * portions of the Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
16 * TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
18 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19 *
20 */
27#ifndef SPI_H
28#define SPI_H
29
30#include "spi_error_codes.h"
31
32#include "driver/spi_master.h"
33
51spi_error_t spi_init(const int miso, const int mosi, const int sclk, const int wp, const int hd, const int cs, const int maxTransferSize,
52 const int queueSize, const int clockSpeedHz, const spi_host_device_t host, const spi_dma_chan_t dma, spi_device_handle_t * const spi);
53
60spi_error_t spi_free(spi_host_device_t host);
61
70spi_error_t spi_send_cmd(spi_device_handle_t spi, const int dcGpio, const uint8_t cmd);
71
81spi_error_t spi_send_single_bytes(spi_device_handle_t spi, const int dcGpio, const uint8_t *data, const size_t dataSize);
82
91spi_error_t spi_send_two_bytes(spi_device_handle_t spi, const int dcGpio, uint16_t data);
92
93#endif /* SPI_H */
spi_error_t spi_send_cmd(spi_device_handle_t spi, const int dcGpio, const uint8_t cmd)
Sends command address to the specific device available on the SPI bus.
Definition: spi.c:106
spi_error_t spi_send_two_bytes(spi_device_handle_t spi, const int dcGpio, uint16_t data)
Sends exactly two bytes of data to the specific device available on the SPI bus.
Definition: spi.c:134
spi_error_t spi_free(spi_host_device_t host)
Frees SPI bus for specific host.
Definition: spi.c:96
spi_error_t spi_send_single_bytes(spi_device_handle_t spi, const int dcGpio, const uint8_t *data, const size_t dataSize)
Sends data bytes to the specific device available on the SPI bus.
Definition: spi.c:120
spi_error_t spi_init(const int miso, const int mosi, const int sclk, const int wp, const int hd, const int cs, const int maxTransferSize, const int queueSize, const int clockSpeedHz, const spi_host_device_t host, const spi_dma_chan_t dma, spi_device_handle_t *const spi)
Initializes SPI bus and registers the single device on it.
Definition: spi.c:56
Contains error codes as an enumeration.
spi_error_t
Describes the status of performed operation on the SPI bus.
Definition: spi_error_codes.h:38