John Tarasidis
/
VGA
I2S speed test wip
Diff: main.cpp
- Revision:
- 2:8008da2bb047
- Parent:
- 1:3c1ad60f5cf3
- Child:
- 3:c9f3ff8e49c0
--- a/main.cpp Sat Apr 25 18:55:54 2020 +0000 +++ b/main.cpp Sat Apr 25 23:21:07 2020 +0000 @@ -1,6 +1,6 @@ #include "mbed.h" //#include "SDFileSystem" -#include "FastIO.h" +//#include "FastIO.h" //#include "MODDMA.h" void pllfeed() { @@ -32,30 +32,40 @@ LPC_SC->PLL0CON=0x00000003; pllfeed(); } - -DigitalOut led1(LED1); -DigitalOut led2(LED2); - -//MODDMA dma; - -void TC0_callback(void) { - led1 = 1; -} - -Serial test(p13, p14); - -FastOut<p21> pixel; -void pixelout(void) { - pixel = 1; - wait(0.1); - pixel=0; - wait(0.1); -} - int main() { setpll(); pllfeed(); - pixelout(); + LPC_SC -> PCONP = 0; + //power on pwm + LPC_SC -> PCONP |= (1<<6); + //set pwm periph clock + LPC_SC -> PCLKSEL0 |= (1<<12); + //pin select (PWM1.2 on P2.1 -> DIP25) + //LPC_PINCON -> PINMODE_OD2 |= (1<<1); + LPC_PINCON -> PINSEL4 |= (1<<2); + //disable internal pull down and pull up resistors + LPC_PINCON -> PINMODE4 |= (1<<3); + //set prescale to make 25Mhz timer count (TC) + LPC_PWM1 -> PR = 3; + //set trig for PWM TC to reset after each line + LPC_PWM1 -> MR0 = 800; + //enable TC reset on MR0 match (end of line) + LPC_PWM1 -> MCR = 1<<1; + //set trig for HSYNC to go low after 656 pixels + LPC_PWM1 -> MR2 = 656; + //set trig for HSYNC to go high after 752 pixels + LPC_PWM1 -> MR1 |= 752; + //enable double edged control on MR2/MR1 trigs + LPC_PWM1 -> PCR = 1<<2; + //enable output + LPC_PWM1 -> PCR |= 1<<10; + //enable TC + LPC_PWM1 -> TCR |= 1; + //enable PWM + LPC_PWM1 -> TCR |= 8; + + + //char s[] = "I2S CCLK/4 Verification Test"; //turn on i2s periph @@ -95,9 +105,7 @@ //dma.Setup(config); //dma.Enable(config); while(1) { - //printf("%d ;", LPC_I2S -> I2SSTATE); - //wait(0.5); - pixelout(); + } }