33#include " Inkplate13Driver.h"
44#include " Inkplate.h"
55
6- SPIClass spi2 (1 );
6+ // SPI used for the MicroSd card
7+ SPIClass spi1 (1 );
8+
9+ // Instance of the SdFat object
710SdFat sd;
811
12+ // SPI settings for communicating with the display, 10MHz
913SPISettings epdSpiSettings (10000000 , MSBFIRST, SPI_MODE0);
1014
1115/* *
@@ -17,7 +21,7 @@ SPISettings epdSpiSettings(10000000, MSBFIRST, SPI_MODE0);
1721 * @param int16_t y0
1822 * default position for y, will be changed depending on rotation
1923 * @param uint16_t color
20- * pixel color, in 3bit mode have values in range 0-7
24+ * pixel color
2125 *
2226 * @note If x0 or y0 are out of inkplate screen borders, function will
2327 * exit.
@@ -89,8 +93,6 @@ int EPDDriver::initDriver(Inkplate *_inkplatePtr)
8993
9094 _inkplate->setRotation (1 );
9195
92- // _inkplate->setRotation(1);
93-
9496 // Allocate memory for internal frame buffer
9597 DMemory4Bit = (uint8_t *)ps_malloc (E_INK_WIDTH * E_INK_HEIGHT / 2 );
9698 if (DMemory4Bit == NULL )
@@ -179,11 +181,22 @@ void EPDDriver::display(bool _leaveOn)
179181 if (!_leaveOn) setPanelState (false );
180182}
181183
182-
184+ /* *
185+ * @brief returns the current panel state, 0 for off, 1 for on
186+ *
187+ */
183188uint8_t EPDDriver::getPanelState ()
184189{
185190 return _panelState;
186191}
192+
193+ /* *
194+ * @brief sets the current panel state
195+ *
196+ * @param uint8_t state
197+ * if set to 1, the panel will be turned on and initialized.
198+ * is et to 0, the panel will be turned off.
199+ */
187200void EPDDriver::setPanelState (uint8_t state)
188201{
189202 // Check if the current display power state is different than the provided.
@@ -238,6 +251,10 @@ void EPDDriver::setPanelState(uint8_t state)
238251 }
239252}
240253
254+ /* *
255+ * @brief initializes the communication pins as well as SPI communication with the Inkplate 13 panel
256+ *
257+ */
241258void EPDDriver::setIO ()
242259{
243260 // Config the GPIOs.
@@ -347,8 +364,8 @@ int16_t EPDDriver::sdCardInit()
347364 internalIO.pinMode (SD_PMOS_PIN, OUTPUT);
348365 internalIO.digitalWrite (SD_PMOS_PIN, LOW);
349366 delay (200 );
350- spi2 .begin (12 , 13 , 11 , 10 );
351- setSdCardOk (sd.begin (SdSpiConfig (10 , SHARED_SPI, SD_SCK_MHZ (25 ), &spi2 )));
367+ spi1 .begin (12 , 13 , 11 , 10 );
368+ setSdCardOk (sd.begin (SdSpiConfig (10 , SHARED_SPI, SD_SCK_MHZ (25 ), &spi1 )));
352369 return getSdCardOk ();
353370}
354371
@@ -384,7 +401,7 @@ SdFat& EPDDriver::getSdFat()
384401 */
385402SPIClass *EPDDriver::getSPIptr ()
386403{
387- return &spi2 ;
404+ return &spi1 ;
388405}
389406
390407/* *
0 commit comments