Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions CompositeVideo/CompositeGraphics.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#pragma once
#include "Font.h"
#include "TriangleTree.h"
#include <algorithm>

class CompositeGraphics
{
Expand Down Expand Up @@ -64,7 +65,7 @@ class CompositeGraphics
cursorY = y;
}

void print(char *str)
void print(const char *str)
{
if(!font) return;
while(*str)
Expand Down Expand Up @@ -125,7 +126,7 @@ class CompositeGraphics
inline void dotAdd(int x, int y, char color)
{
if((unsigned int)x < xres && (unsigned int)y < yres)
backbuffer[y][x] = min(54, color + backbuffer[y][x]);
backbuffer[y][x] = std::min(54, color + backbuffer[y][x]);
}

inline char get(int x, int y)
Expand Down
3 changes: 2 additions & 1 deletion CompositeVideo/CompositeOutput.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#pragma once
#include "driver/i2s.h"
#include "soc/i2s_reg.h"

typedef struct
{
Expand Down Expand Up @@ -162,7 +163,7 @@ class CompositeOutput
.sample_rate = 1000000, //not really used
.bits_per_sample = (i2s_bits_per_sample_t)I2S_BITS_PER_SAMPLE_16BIT,
.channel_format = I2S_CHANNEL_FMT_ONLY_RIGHT,
.communication_format = I2S_COMM_FORMAT_I2S_MSB,
.communication_format = I2S_COMM_FORMAT_STAND_I2S,
.intr_alloc_flags = ESP_INTR_FLAG_LEVEL1,
.dma_buf_count = 2,
.dma_buf_len = samplesLine //a buffer per line
Expand Down
3 changes: 3 additions & 0 deletions CompositeVideo/CompositeVideo.ino
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
//code by bitluni (send me a high five if you like the code)
#ifdef ARDUINO
#include <Arduino.h>
#endif
#include "esp_pm.h"

//#define SKULL
Expand Down
3 changes: 2 additions & 1 deletion CompositeVideo/Mesh.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#pragma once
#include "Matrix.h"
#include <algorithm>

template<class Graphics>
class Mesh
Expand Down Expand Up @@ -64,7 +65,7 @@ class Mesh

const float L[3] = { 0, 0, -1 };

const float NdotL = max(0.0f, nx * L[0] + ny * L[1] + nz * L[2]);
const float NdotL = std::max(0.0f, nx * L[0] + ny * L[1] + nz * L[2]);
c = (char) (color * NdotL + 0.5);
}
else
Expand Down
5 changes: 3 additions & 2 deletions CompositeVideoSimple/CompositeGraphics.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#pragma once
#include "Font.h"
#include "TriangleTree.h"
#include <algorithm>

class CompositeGraphics
{
Expand Down Expand Up @@ -64,7 +65,7 @@ class CompositeGraphics
cursorY = y;
}

void print(char *str)
void print(const char *str)
{
if(!font) return;
while(*str)
Expand Down Expand Up @@ -125,7 +126,7 @@ class CompositeGraphics
inline void dotAdd(int x, int y, char color)
{
if((unsigned int)x < xres && (unsigned int)y < yres)
backbuffer[y][x] = min(54, color + backbuffer[y][x]);
backbuffer[y][x] = std::min(54, color + backbuffer[y][x]);
}

inline char get(int x, int y)
Expand Down
3 changes: 2 additions & 1 deletion CompositeVideoSimple/CompositeOutput.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#pragma once
#include "driver/i2s.h"
#include "soc/i2s_reg.h"

typedef struct
{
Expand Down Expand Up @@ -162,7 +163,7 @@ class CompositeOutput
.sample_rate = 1000000, //not really used
.bits_per_sample = (i2s_bits_per_sample_t)I2S_BITS_PER_SAMPLE_16BIT,
.channel_format = I2S_CHANNEL_FMT_ONLY_RIGHT,
.communication_format = I2S_COMM_FORMAT_I2S_MSB,
.communication_format = I2S_COMM_FORMAT_STAND_I2S,
.intr_alloc_flags = ESP_INTR_FLAG_LEVEL1,
.dma_buf_count = 2,
.dma_buf_len = samplesLine //a buffer per line
Expand Down
66 changes: 65 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,68 @@ http://bitluni.net/esp32-composite-video
CC0. Do whatever you like with the code but I will be thankfull
if you attribute me. Keep the spirit alive :-)

- bitluni
- bitluni

---

# Upgrade to ESP-IDF v5.4:

## Arduino Platform:
- Upgrade to Arduino 3.2.0 based on ESP-IDF v5.4
- Board Manager -> esp32 by Espressif Systems version 3.2.0
- GitHub: https://github.com/espressif/arduino-esp32/releases

## Platformio:
- VSCode with Platformio for Espressif 32 Dev Module Version 6.10.0 based on ESP-IDF v5.4.
- Board -> Espressif 32 Dev Module
- Platform -> Espressif 32 Version 6.10.0
- GitHub: https://github.com/platformio/platform-espressif32/releases

## Example CompositeVideoSimple
### Changes on files:
- ``CompositeGraphics.h``:
- After line 3 add:
``#include <algorithm>``

- 68 ``void print(char *str)`` -> ``void print(const char *str)`` [char -> const char].

- 129 ``backbuffer[y][x] = min(54, color + backbuffer[y][x]);`` -> ``backbuffer[y][x] = std::min(54, color + backbuffer[y][x]);`` [min() -> std:min()].

- ``CompositeOutput.h``:
- After Line 2 add:
``#include "soc/i2s_reg.h"``

- 166 ``.communication_format = I2S_COMM_FORMAT_I2S_MSB`` -> ``.communication_format = I2S_COMM_FORMAT_STAND_I2S`` [I2S_COMM_FORMAT_I2S_MSB -> I2S_COMM_FORMAT_STAND_I2S]

## Example CompositeVideo.
### Changes on files:
- ``CompositeVideo.ino`` This is for PlatformIO compability.
- After line 1 add:

```
#ifdef ARDUINO
#include <Arduino.h>
#endif
````

- ``Mesh.h``
- After line 2 add:
``#include <algorithm>``

- 68 ``const float NdotL = max(0.0f, nx * L[0] + ny * L[1] + nz * L[2]);`` -> ``const float NdotL = std::max(0.0f, nx * L[0] + ny * L[1] + nz * L[2]);`` [max() -> std::max()]

- ``CompositeGraphics.h``:
- After line 3 add:
``#include <algorithm>``

- 68 ``void print(char *str)`` -> ``void print(const char *str)`` [char -> const char].

- 129 ``backbuffer[y][x] = min(54, color + backbuffer[y][x]);`` -> ``backbuffer[y][x] = std::min(54, color + backbuffer[y][x]);`` [min() -> std:min()].

- ``CompositeOutput.h``:
- After Line 2 add:
``#include "soc/i2s_reg.h"``

- 166 ``.communication_format = I2S_COMM_FORMAT_I2S_MSB`` -> ``.communication_format = I2S_COMM_FORMAT_STAND_I2S`` [I2S_COMM_FORMAT_I2S_MSB -> I2S_COMM_FORMAT_STAND_I2S]

---