Skip to content

Commit 1f79e9a

Browse files
committed
Modify the I2S config naming scheme
1 parent 66d3593 commit 1f79e9a

5 files changed

Lines changed: 21 additions & 22 deletions

File tree

src/boards/Inkplate5V2/Inkplate5V2Driver.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@
3030

3131
#include "../../system/defines.h"
3232

33-
#include "../../system/esp32/Esp.h"
33+
#include "../../system/UtilI2S/UtilI2S.h"
3434

3535

3636
class Inkplate;
3737

3838

39-
class EPDDriver : public Esp
39+
class EPDDriver : public UtilI2S
4040
{
4141
public:
4242
void writePixelInternal(int16_t x, int16_t y, uint16_t color);

src/boards/Inkplate6/Inkplate6Driver.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@
3030

3131
#include "../../system/defines.h"
3232

33-
#include "../../system/esp32/Esp.h"
33+
#include "../../system/UtilI2S/UtilI2S.h"
3434

3535

3636
class Inkplate;
3737

3838

39-
class EPDDriver : public Esp
39+
class EPDDriver : public UtilI2S
4040
{
4141
public:
4242
void writePixelInternal(int16_t x, int16_t y, uint16_t color);

src/boards/Inkplate6FLICK/Inkplate6FLICKDriver.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@
3030

3131
#include "../../system/defines.h"
3232

33-
#include "../../system/esp32/Esp.h"
33+
#include "../../system/UtilI2S/UtilI2S.h"
3434

3535

3636
class Inkplate;
3737

3838

39-
class EPDDriver : public Esp
39+
class EPDDriver : public UtilI2S
4040
{
4141
public:
4242
void writePixelInternal(int16_t x, int16_t y, uint16_t color);
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
**************************************************
3-
* @file Esp.cpp
4-
* @brief File for ESP, currently empty
3+
* @file UtilI2S.cpp
4+
* @brief File for utilizing the I2S peripheral to send data to the panel.
55
*
66
* https://github.com/e-radionicacom/Inkplate-Arduino-library
77
* For support, please reach over forums: forum.e-radionica.com/en
@@ -16,7 +16,7 @@
1616
* @authors Soldered
1717
***************************************************/
1818

19-
#include "Esp.h"
19+
#include "UtilI2S.h"
2020
#include "../../boardSelect.h"
2121
#ifdef USES_I2S
2222
/**
@@ -25,9 +25,9 @@
2525
* @param i2s_dev_t *_i2sDev
2626
* Pointer of the selected I2S driver
2727
*
28-
* @note Function must be declared static to fit into Instruction RAM of the ESP32.
28+
* @note Function must be declared IRAM_ATTR to fit into Instruction RAM of the ESP32.
2929
*/
30-
void IRAM_ATTR I2SInit(i2s_dev_t *_i2sDev, uint8_t _clockDivider)
30+
void IRAM_ATTR UtilI2S::I2SInit(i2s_dev_t *_i2sDev, uint8_t _clockDivider)
3131
{
3232
// Enable I2S peripheral and reset it.
3333
periph_module_enable(PERIPH_I2S1_MODULE);
@@ -104,10 +104,10 @@ void IRAM_ATTR I2SInit(i2s_dev_t *_i2sDev, uint8_t _clockDivider)
104104
* lldesc_s *_dmaDecs
105105
* Pointer to the DMA descriptor.
106106
*
107-
* @note Function must be declared static to fit into Instruction RAM of the ESP32. Also, DMA descriptor must be
107+
* @note Function must be declared IRAM_ATTR to fit into Instruction RAM of the ESP32. Also, DMA descriptor must be
108108
* already configured!
109109
*/
110-
void IRAM_ATTR sendDataI2S(i2s_dev_t *_i2sDev, volatile lldesc_s *_dmaDecs)
110+
void IRAM_ATTR UtilI2S::sendDataI2S(i2s_dev_t *_i2sDev, volatile lldesc_s *_dmaDecs)
111111
{
112112
// Stop any on-going transmission (just in case).
113113
_i2sDev->out_link.stop = 1;
@@ -153,7 +153,7 @@ void IRAM_ATTR sendDataI2S(i2s_dev_t *_i2sDev, volatile lldesc_s *_dmaDecs)
153153
_i2sDev->out_link.start = 0;
154154
}
155155

156-
void IRAM_ATTR setI2S1pin(uint32_t _pin, uint32_t _function, uint32_t _inv)
156+
void IRAM_ATTR UtilI2S::setI2S1pin(uint32_t _pin, uint32_t _function, uint32_t _inv)
157157
{
158158
// Check if valid pin is selected
159159
if (_pin > 39)
Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
* @authors Soldered
1717
***************************************************/
1818

19-
#ifndef __ESP_H__
20-
#define __ESP_H__
19+
#ifndef __UTILI2S_H__
20+
#define __UTILI2S_H__
2121

2222
#include "Arduino.h"
2323
#include "driver/periph_ctrl.h"
@@ -29,16 +29,15 @@
2929
#include "soc/rtc.h"
3030
#include "soc/soc.h"
3131

32-
void IRAM_ATTR I2SInit(volatile i2s_dev_t *_i2sDev, uint8_t _clockDivider = 5);
33-
void IRAM_ATTR sendDataI2S(volatile i2s_dev_t *_i2sDev, volatile lldesc_s *_dmaDecs);
34-
void IRAM_ATTR setI2S1pin(uint32_t _pin, uint32_t _function, uint32_t _inv);
35-
3632
/**
37-
* @brief Esp class
33+
* @brief I2S class used to send data to the panel.
3834
*/
39-
class Esp
35+
class UtilI2S
4036
{
4137
public:
38+
void IRAM_ATTR I2SInit(volatile i2s_dev_t *_i2sDev, uint8_t _clockDivider = 5);
39+
void IRAM_ATTR sendDataI2S(volatile i2s_dev_t *_i2sDev, volatile lldesc_s *_dmaDecs);
40+
void IRAM_ATTR setI2S1pin(uint32_t _pin, uint32_t _function, uint32_t _inv);
4241
protected:
4342
volatile uint8_t *_dmaLineBuffer;
4443
volatile lldesc_s *_dmaI2SDesc;

0 commit comments

Comments
 (0)