##// END OF EJS Templates
SD card Library started, SDCARD init and detection OK
SD card Library started, SDCARD init and detection OK

File last commit:

r11:798f00e676fa default
r11:798f00e676fa default
Show More
main.c
107 lines | 2.9 KiB | text/x-c | CLexer
/*------------------------------------------------------------------------------
-- This file is a part of the libuc, microcontroler library
-- Copyright (C) 2011, Alexis Jeandet
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program; if not, write to the Free Software
-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-------------------------------------------------------------------------------
-- Author : Alexis Jeandet
-- Mail : alexis.jeandet@gmail.com
-------------------------------------------------------------------------------*/
#include "LPC17xx.h"
#include "bsp.h"
#include "core.h"
#include "uart.h"
#include "libucstrings.h"
#define __delay(t) for(volatile int i=0;i<t;i++);
#define ledspos1 LED1_OFF;LED2_ON;LED3_OFF;LED4_ON;LED5_OFF;LED6_ON;LED7_OFF;LED8_ON
#define ledspos2 LED1_ON;LED2_OFF;LED3_ON;LED4_OFF;LED5_ON;LED6_OFF;LED7_ON;LED8_OFF
#define tableSize 256
void eepromTest();
int main (void)
{
bsp_init();
uartsetbaudrate(UART0,38400);
eepromTest();
libucprintf("CPU Freq =%dMHz\n\r",currentCpuFreq/1000000);
libucprintf("IIC Freq =%dKHz\n\r",i2cgetdatarate(IIC0)/1000);
while(1)
{
ledspos1;
__delay(1024*1024);
ledspos2;
__delay(1024*1024);
}
return 0;
}
void eepromTest()
{
unsigned char val1,val2;
unsigned char table1[256];
unsigned char table2[256];
int i=0;
for(i=0;i<tableSize;i++)table1[i]=i;
libucprintf("Writing 0x56 @ 0x10...");
eeprom24lc0xbytewrite(eeprom0,0x10,0x56);
libucprintf("\tdone\n\r");
libucprintf("Writing 0xF1 @ 0x39...");
eeprom24lc0xbytewrite(eeprom0,0x39,0xF1);
libucprintf("\tdone\n\r");
libucprintf("Reading @ 0x10 ...");
val1=eeprom24lc0xbyteread(eeprom0,0x10);
libucprintf("\tdone result = 0x%X\n\r",val1);
libucprintf("Reading @ 0x39 ...");
val2=eeprom24lc0xbyteread(eeprom0,0x39);
libucprintf("\tdone result = 0x%X\n\r",val2);
libucprintf("Writing folowing table @ 0x00");
libucprintchartable(table1,tableSize,"0x%X"," ");
libucprintf("...");
eeprom24lc0xwriten(eeprom0,0,table1, tableSize);
libucprintf("\tdone\n\r");
libucprintf("Reading table @ 0x00 ...");
eeprom24lc0xreadn(eeprom0,0,table2, tableSize);
libucprintf("\tdone\n\r");
libucprintf("result = ");
libucprintchartable(table2,tableSize,"0x%X"," ");
libucprintf("\n\r");
}