X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=target%2Fee%2Fee.c;h=7cc47120394a68ec54112826231fa5f58f588559;hb=c35de083ca3d4f362063b056a0fd74ffe629d168;hp=d269d2aa54028f132ac0ce2a7904553665ca3d85;hpb=91b3a6ae74184692f45702587c4d678b2799ad8c;p=fw%2Faltos diff --git a/target/ee/ee.c b/target/ee/ee.c index d269d2aa..7cc47120 100644 --- a/target/ee/ee.c +++ b/target/ee/ee.c @@ -26,6 +26,10 @@ sfr at 0x80 P0; sfr at 0x90 P1; sfr at 0xA0 P2; sfr at 0xC6 CLKCON; +sfr at 0xbe SLEEP; + +# define SLEEP_USB_EN (1 << 7) +# define SLEEP_XOSC_STB (1 << 6) sfr at 0xF1 PERCFG; #define PERCFG_T1CFG_ALT_1 (0 << 6) @@ -273,6 +277,8 @@ usart_in_out(uint8_t byte) U0DBUF = byte; while ((U0CSR & UxCSR_TX_BYTE) == 0) ; + U0CSR &= ~UxCSR_TX_BYTE; + return U0DBUF; } void @@ -375,7 +381,10 @@ main () uint8_t buf[LENGTH]; int i; + P1DIR |= 2; CLKCON = 0; + while (!(SLEEP & SLEEP_XOSC_STB)) + ; spi_init();