// This function initializes the system clock to use the internal oscillator
// at 16 MHz.
//
//-----------------------------------------------------------------------------
void Oscillator_Init (void)
{
OSCICN = 0x05; // // 系统时钟初始化为片内的 24.5MHz / 8
}
//
// P0.0 - SCK (SPI0), Push-Pull, Digital
// P0.1 - MISO (SPI0), Open-Drain, Digital
// P0.2 - MOSI (SPI0), Push-Pull, Digital
// P0.3 - NSS (SPI0), Open-Drain, Digital
//
// P0.7 - SLAVE_SEL, Push-Pull, Digital
void PORT_Init (void)
{
P0MDOUT = 0x0f; // Make SCK, MOSI, and SLAVE_SEL
// push-pull
// P1MDOUT = 0x40; // Make the LED push-pull
XBR0 = 0x02; // Enable the SPI on the XBAR
XBR2 = 0x40; // Enable the XBAR and weak pull-ups
P2MDOUT = 0xf0; // P2口设为推挽方式
P3MDOUT = 0x00;
}