LCDGFX LCD display driver  1.1.5
This library is developed to control SSD1306/SSD1325/SSD1327/SSD1331/SSD1351/IL9163/PCD8554 RGB i2c/spi LED displays
arduino_spi.h
1 /*
2  MIT License
3 
4  Copyright (c) 2018-2022, Alexey Dynda
5 
6  Permission is hereby granted, free of charge, to any person obtaining a copy
7  of this software and associated documentation files (the "Software"), to deal
8  in the Software without restriction, including without limitation the rights
9  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10  copies of the Software, and to permit persons to whom the Software is
11  furnished to do so, subject to the following conditions:
12 
13  The above copyright notice and this permission notice shall be included in all
14  copies or substantial portions of the Software.
15 
16  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22  SOFTWARE.
23 */
24 
25 /*
26  * @file hal/arduino/arduino_spi.h LCDGFX ARDUINO Interface communication functions
27  */
28 
29 #pragma once
30 
31 #if defined(CONFIG_ARDUINO_SPI_AVAILABLE) && defined(CONFIG_ARDUINO_SPI_ENABLE)
32 
33 #include <SPI.h>
34 
39 {
40 public:
49  explicit ArduinoSpi(int8_t csPin = -1, int8_t dcPin = -1, int8_t clkPin = -1, int8_t mosiPin = -1, uint32_t freq = 0,
50  SPIClass *spi = &SPI);
51  ~ArduinoSpi();
52 
56  void begin();
57 
61  void end();
62 
66  void start();
67 
71  void stop();
72 
77  void send(uint8_t data);
78 
88  void sendBuffer(const uint8_t *buffer, uint16_t size);
89 
90 private:
91  int8_t m_cs;
92  int8_t m_dc;
93  int8_t m_clk;
94  int8_t m_mosi;
95  uint32_t m_frequency;
96  SPIClass *m_spi;
97 };
98 
99 #endif
100 
101 #if defined(CONFIG_ARDUINO_SPI2_AVAILABLE) && defined(CONFIG_ARDUINO_SPI_ENABLE)
102 
105 class ArduinoSpi2
106 {
107 public:
116  explicit ArduinoSpi2(int8_t csPin = -1, int8_t dcPin = -1, int8_t clkPin = -1, int8_t mosiPin = -1, uint32_t freq = 8000000);
117  ~ArduinoSpi2();
118 
122  void begin();
123 
127  void end();
128 
132  void start();
133 
137  void stop();
138 
143  void send(uint8_t data);
144 
154  void sendBuffer(const uint8_t *buffer, uint16_t size);
155 
156 private:
157  int8_t m_cs;
158  int8_t m_dc;
159  int8_t m_clk;
160  int8_t m_mosi;
161  uint32_t m_frequency;
162 };
163 
164 #endif
void send(uint8_t data)
void sendBuffer(const uint8_t *buffer, uint16_t size)
Sends bytes to SSD1306 device.
void stop()
ArduinoSpi(int8_t csPin=-1, int8_t dcPin=-1, int8_t clkPin=-1, int8_t mosiPin=-1, uint32_t freq=0, SPIClass *spi=&SPI)
void begin()
void end()
void start()