Further work, but DO NOT USE HDMI else does not Working
This commit is contained in:
parent
bb613f90ab
commit
1a1f4999ff
2 changed files with 53 additions and 17 deletions
|
@ -634,6 +634,7 @@ void SimpleTestBurstFsk(uint64_t Freq)
|
|||
void SimpleTestAtv(uint64_t Freq)
|
||||
{
|
||||
|
||||
//int SR = 1000000;
|
||||
int SR = 1000000;
|
||||
int FifoSize = 625 * 52;
|
||||
unsigned char samples[FifoSize];
|
||||
|
@ -641,27 +642,61 @@ void SimpleTestAtv(uint64_t Freq)
|
|||
|
||||
atv atvtest(Freq, SR, 14, 625);
|
||||
atvtest.start();
|
||||
enum {patern_grey,patern_square,patern_move,patern_point};
|
||||
int Mode=patern_move;
|
||||
bool random_patern=true;
|
||||
for(int frame=0;running;frame++)
|
||||
{
|
||||
int x,y;
|
||||
y=rand()%625;
|
||||
x=rand()%52;
|
||||
if((frame%50==0)&&(random_patern))
|
||||
Mode=rand()%(patern_point+1);
|
||||
for(int i=0;i<625;i++)
|
||||
{
|
||||
for (int j = 0; j < 52; j++)
|
||||
{
|
||||
if(i%2==0)
|
||||
samples[i/2*52+j]=((i+j*frame)%255);
|
||||
else
|
||||
samples[i/2*52+j+52*312]=((i+j*frame)%255);
|
||||
/*if(i%16<8)
|
||||
samples[i*52+j]=(j%8<4)?0:255;
|
||||
else
|
||||
samples[i*52+j]=(j%8<4)?255:0;*/
|
||||
switch(Mode)
|
||||
{
|
||||
case patern_grey:
|
||||
{
|
||||
samples[i*52+j]=255*(j/52.0);
|
||||
}
|
||||
break;
|
||||
case patern_square:
|
||||
{
|
||||
if(i%64<(frame%64))
|
||||
samples[i*52+j]=(j%16<8)?255*(j/52.0):255*(1-(j/52.0));
|
||||
else
|
||||
samples[i*52+j]=(j%16<8)?255:0;
|
||||
}
|
||||
break;
|
||||
case patern_move:
|
||||
{
|
||||
samples[i*52+j]=((i+j*frame)%255);
|
||||
}
|
||||
break;
|
||||
case patern_point:
|
||||
{
|
||||
if((i==y)&&(j==x))
|
||||
samples[i*52+j]=255;
|
||||
else
|
||||
samples[i*52+j]=0;
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//atvtest.SetTvSamples(samples,FifoSize/4);
|
||||
atvtest.SetFrame(samples,625);
|
||||
|
||||
atvtest.SetFrame(samples,625);
|
||||
usleep(40000);
|
||||
}
|
||||
}
|
||||
|
|
17
src/atv.cpp
17
src/atv.cpp
|
@ -25,7 +25,7 @@ This program is free software: you can redistribute it and/or modify
|
|||
#include <stdlib.h>
|
||||
|
||||
//#define CB_ATV (6 * 4 + 5 * 4 + 5 * 4 + (304 + 305) * (4 + 52 * 2))
|
||||
#define CB_ATV 68000
|
||||
#define CB_ATV 70000
|
||||
|
||||
atv::atv(uint64_t TuneFrequency, uint32_t SR, int Channel, uint32_t Lines) : dma(Channel, CB_ATV, Lines * 52 + 3)
|
||||
// Need 2 more bytes for 0 and 1
|
||||
|
@ -38,7 +38,7 @@ atv::atv(uint64_t TuneFrequency, uint32_t SR, int Channel, uint32_t Lines) : dma
|
|||
clkgpio::SetCenterFrequency(TuneFrequency, SampleRate);
|
||||
clkgpio::SetFrequency(0);
|
||||
clkgpio::enableclk(4); // GPIO 4 CLK by default
|
||||
syncwithpwm = false;
|
||||
syncwithpwm = true;
|
||||
|
||||
if (syncwithpwm)
|
||||
{
|
||||
|
@ -91,7 +91,7 @@ void atv::SetDmaAlgo()
|
|||
for (int frame = 0; frame < 2; frame++)
|
||||
{
|
||||
//Preegalisation //6*4*2FrameCB
|
||||
for (int i = 0; i < 6 /*-frame*/; i++)
|
||||
for (int i = 0; i < 5 + frame; i++)
|
||||
{
|
||||
//2us 0,30us 1
|
||||
//@0
|
||||
|
@ -247,7 +247,7 @@ void atv::SetDmaAlgo()
|
|||
cbp++;
|
||||
}
|
||||
//(304+305)*(4+52*2+2)CB
|
||||
for (int line = 0; line < /*305*/ 304 + frame; line++)
|
||||
for (int line = 0; line < 305/* 317 + frame*/; line++)
|
||||
{
|
||||
|
||||
//@0
|
||||
|
@ -370,12 +370,13 @@ void atv::SetFrame(unsigned char *Luminance, size_t Lines)
|
|||
{
|
||||
for (size_t x = 0; x < 52; x++)
|
||||
{
|
||||
int AmplitudePAD = (Luminance[i * 52 + x]/255.0) * 6 + 1; //1 to 7
|
||||
int AmplitudePAD = (Luminance[i * 52 + x]/255.0) * 6.0 + 1; //1 to 7
|
||||
// usermem[i* 52 + x] = (0x5A << 24) + (AmplitudePAD & 0x7) + (1 << 4) + (0 << 3); // Amplitude PAD
|
||||
if (i % 2 == 0) // First field
|
||||
usermem[i * 52 + x] = (0x5A << 24) + (AmplitudePAD & 0x7) + (1 << 4) + (0 << 3); // Amplitude PAD
|
||||
usermem[i* 52 /2 + x] = (0x5A << 24) + (AmplitudePAD & 0x7) + (1 << 4) + (0 << 3); // Amplitude PAD
|
||||
else
|
||||
usermem[i * 52 + x] = (0x5A << 24) + (AmplitudePAD & 0x7) + (1 << 4) + (0 << 3); // Amplitude PAD
|
||||
|
||||
usermem[(i-1)* 52/2 + x+52*312] = (0x5A << 24) + (AmplitudePAD & 0x7) + (1 << 4) + (0 << 3); // Amplitude PAD
|
||||
|
||||
}
|
||||
/*for (size_t x = 0; x < 52; x++)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue