void spyglassTest(void) { // initializing Spyglass interface and I2C bus rprintf("Initializing Spyglass communication..."); spyglassInit(); spyglassLcdInit(); rprintf("Done!\r\n"); rprintf("Printing 'Hello World!' message to spyglass LCD.\r\n"); rprintfInit(spyglassLcdWriteChar); spyglassLcdGotoXY(0,0); rprintfProgStrM("Hello World!"); rprintfInit(uartSendByte); timerPause(1000); // initialize systick timer rprintf("Initializing Periodic Timer\r\n"); timer2SetPrescaler(TIMERRTC_CLK_DIV1024); // attach the 'systickHandler' so that it gets called every time Timer2 overflows timerAttach(TIMER2OVERFLOW_INT, systickHandler); rprintf("Starting local command prompt. Type '?' to get help.\r\n"); rprintf("cmd>"); while(1) { serviceLocal(); } }
int main(void) { struct netEthAddr myEthAddress; timerInit(); uartInit(); uartSetBaudRate(9600); rprintfInit(uartSendByte); timerPause(100); rprintf("\r\nNetwork Stack Example\r\n"); // initialize systick timer rprintf("Initializing Periodic Timer\r\n"); timer2SetPrescaler(TIMER_CLK_DIV1024); timerAttach(TIMER2OVERFLOW_INT, systickHandler); // init network stack rprintf("Initializing Network Stack\r\n"); netstackInit(IPADDRESS, NETMASK, GATEWAY); nicGetMacAddress(&myEthAddress.addr[0]); rprintfProgStrM("Eth Addr is: "); netPrintEthAddr(&myEthAddress); rprintfCRLF(); rprintfProgStrM("IP Addr is: "); netPrintIPAddr(ipGetConfig()->ip); rprintfCRLF(); rprintf("Network Stack is up!\r\n"); rprintf("Starting packet receive loop\r\n"); while (1) { // service local stuff serviceLocal(); // service the network netstackService(); } return 0; }