int main(void) { //m0 core
int i;
const int time=500000;//10000=fast 500000=slow //<<<<--- I just change this value to change the blinky frequency
#if defined (M0_SLAVE_PAUSE_AT_MAIN)
// Pause execution until debugger attaches and modifies variable
while (pause_at_main == 0) {}
#endif
SystemCoreClockUpdate();
Board_UART_Init(0);//needed, or it will not compile ..??..
// LED setup
//pin SODIMM-GPIO76=P9_0=GPIO4[12] pin 57 del J5
Chip_SCU_PinMuxSet(4, 12, SCU_MODE_FUNC0 | SCU_MODE_INACT); //SCU_MODE_INACT disable pull up/down // la SCU_MODE_FUNC0/1/2/.. la trovi sull'U.M. (User Manual)
Chip_GPIO_SetPinDIROutput(LPC_GPIO_PORT, 4, 12);
Chip_GPIO_SetPinOutHigh(LPC_GPIO_PORT,4, 12); //led high
Chip_GPIO_SetPinOutLow(LPC_GPIO_PORT, 4, 12);//led low
while(1) {
for(i=0;i<time;i++);
Chip_GPIO_SetPinOutHigh(LPC_GPIO_PORT, 4, 12); //led high
for(i=0;i<time;i++);
Chip_GPIO_SetPinOutLow(LPC_GPIO_PORT, 4, 12);//led low
}
return 0 ;
}
/////////////////////////////////////////////////////////////////////////////////////////////////////
/// This code runs on PC to convert *.bin file into ascii *.h file
///////////////////////////////////////////////////////////////////////////////////////////////////
#include <stdio.h>
int main(int argc, char *argv[])
{
FILE *fpi, *fpo;
unsigned char v;
if (argc < 3)
{
printf("USAGE: BINconvert <sourcefile.bin> <destfile.h>\n");
return 0;
}
fpi = fopen(argv[1], "rb");
if (fpi == 0)
{
printf("Cannot open file %s\n", argv[1]);
return -1;
}
fpo = fopen(argv[2], "w");
if (fpo == 0)
{
printf("Cannot create file %s\n", argv[2]);
return -1;
}
fread(&v, 1, 1, fpi);
while (!feof(fpi))
{
fprintf(fpo, "%d,\n", (int)v);
fread(&v, 1, 1, fpi);
}
fclose(fpo);
fclose(fpi);
return 0;
}
|