Added ADC and I/O read.

This commit is contained in:
BIITER 2011-04-08 19:43:52 +02:00
parent b9d7328f20
commit 2b9ef9759b
8 changed files with 391 additions and 24 deletions

View file

@ -22,6 +22,7 @@
#include "rom_drivers.h"
#include "config.h"
#include "ssp.h"
#include "adc.h"
#include "edubrm.h"
#define EN_TIMER32_1 (1<<10)
@ -42,23 +43,12 @@ int main (void)
SystemInit();
//#endif
LPC_IOCON->PIO1_6 &= ~0x07;
LPC_IOCON->PIO1_6 |= 0x02; // Selects function CT32B0_MAT0
SSPInit();
LPC_SYSCON->SYSAHBCLKCTRL |= 1<<9; // Enables clock for 32-bit counter/timer 0.
ADCInit(ADC_CLK);
LPC_TMR32B0->MR3 = 4294967; // period
LPC_TMR32B0->MR0 = 4294967/2; // duty
LPC_TMR32B0->MCR = 1<<10; // | 1<<9; // Reset on MR3: the TC will be reset if MR3 matches it.
LPC_TMR32B0->EMR = 3<<4; // Toggle the corresponding External Match bit/output.
LPC_TMR32B0->PWMC = 1<<0 | 1<<3; // enable pwn
NVIC_EnableIRQ(TIMER_32_0_IRQn);
LPC_TMR32B0->TCR = 1;
// enable read on pin PIO3_3
LPC_GPIO3->DIR &= ~(1<<3);
HidDevInfo.idVendor = USB_VENDOR_ID;
HidDevInfo.idProduct = USB_PROD_ID;
@ -87,7 +77,7 @@ int main (void)
for (n = 0; n < 75; n++) {}
SSPInit();
PWMRun();
while (1)
__WFI();
@ -104,7 +94,7 @@ void USB_IRQHandler()
void SSP_IRQHandler(void)
{
// while(1)
// {
// }
while(1)
{
}
}