int main(void) { unsigned char input[16]="0123456789abcdef"; unsigned char output[16]; unsigned char K[32]; int C_UART0=0; unsigned int keysize=128 ; aes_context ctx; SystemInit(); UART0_Init(); UART2_Init(); memset(K, 1, 32 ); //aes_setkey_enc(&ctx, K , 128 ); while (1) { input[C_UART0++]=UART0_GetChar (); if (C_UART0==16) { //aes_crypt_ecb(&ctx,1,input,output ); UART0_SendString (input); UART0_SendString (output); C_UART0=0;} } }
char wificonnect() { //InitMcu(); UART2_Init(115200); Delay_ms(1000); InitWiFi(); SearchSSID(); ConnectToAp(); return(1); }
void BSP_Init(void) { SYSCLK_Init(); SysTick_Init(); LED_Config(); Out_GPIO_Init(); In_GPIO_Init(); UART1_Init(UART1_BAUD); UART2_Init(UART2_BAUD); }
void MCU_Init() { InitGPIO(); delay_ms(5000); UART2_Init(115200); Delay_ms(100); ble2_hal_init(); data_len = 0; data_ready = 0; U2IP0_bit = 0; U2IP1_bit = 1; U2IP2_bit = 1; U2RXIE_bit = 1; EnableInterrupts(); }
/* FUNCTIONS ******************************************************************************/ void system_init() { GPIO_Digital_Input( &GPIO_PORT_24_31, _GPIO_PINMASK_4 ); /* Button pin */ GPIO_Digital_Output( &GPIO_PORT_08_15, _GPIO_PINMASK_1 ); /* STB pin */ Delay_ms( 200 ); /* DBG UART */ UART1_Init( 115200 ); Delay_ms( 200 ); /* MODULE UART */ UART2_Init( 115200 ); Delay_ms( 200 ); UART1_Write_Text( "System Initialized\r\n" ); }
int main(void) { // Set the internal high-speed oscillator to 1 to run at 16/1=16MHz. CLK_HSIPrescalerConfig(CLK_PRESCALER_HSIDIV1); // Reset ("de-initialise") GPIO port D. GPIO_DeInit(GPIOD); // Initialise pin 0 of port D by setting it as: // - an output pin, // - using a push-pull driver, // - at a low logic level (0V), and // - 10MHz. GPIO_Init(GPIOD, GPIO_PIN_0, GPIO_MODE_OUT_PP_LOW_FAST); UART2_DeInit(); /* UART2 configuration ------------------------------------------------------*/ /* UART2 configured as follow: - BaudRate = 9600 baud - Word Length = 8 Bits - One Stop Bit - Even parity - Receive and transmit enabled - UART2 Clock disabled */ /* Configure the UART2 */ UART2_Init((u32)9600, UART2_WORDLENGTH_8D, UART2_STOPBITS_1, UART2_PARITY_NO, UART2_SYNCMODE_CLOCK_DISABLE, UART2_MODE_TXRX_ENABLE); LCDInit(); DrawScreen(); UpdateLCD(); UART2_ITConfig(UART2_IT_RXNE, ENABLE); enableInterrupts(); // Infinite loop. for(;;) { DrawDemo(); Delay(80); } }
void uartInit(void) { UART2_DeInit(); /* 将寄存器的值复位 */ /* * 将UART2配置为: * 波特率 = 115200 * 数据位 = 8 * 1位停止位 * 无校验位 * 使能接收和发送 */ UART2_Init((u32)115200, UART2_WORDLENGTH_8D, UART2_STOPBITS_1, \ UART2_PARITY_NO, UART2_SYNCMODE_CLOCK_DISABLE, UART2_MODE_TXRX_ENABLE); UART2_ITConfig(UART2_IT_RXNE, ENABLE); //开启接收中断 UART2_Cmd(ENABLE); }
void MOD_UART_Config(uint32_t baud) { /* UART1 and UART3 configured as follow: - BaudRate = 230400 baud - Word Length = 8 Bits - One Stop Bit - No parity - Receive and transmit enabled */ UART2_DeInit(); UART2_Init(baud, UART2_WORDLENGTH_8D, UART2_STOPBITS_1, UART2_PARITY_NO, UART2_SYNCMODE_CLOCK_DISABLE, UART2_MODE_TXRX_ENABLE); UART2_ClearITPendingBit(UART2_IT_RXNE); //UART2_ITConfig(UART2_IT_RXNE_OR, ENABLE); //UART2_ITConfig(UART2_IT_TXE, ENABLE); UART2_Cmd(ENABLE); //UART2_ClearITPendingBit(UART2_IT_IDLE); //UART2_ITConfig(UART2_IT_IDLE, ENABLE); }
void Init() { //-------Oscillator Configuration OSCCON=0b01100000; OSCTUNE.PLLEN=1; //-------AD Configuration ANCON0=0; ANCON1=0; //-------Port Configuration porta=1; portb=0; portc=0; portd=0; porte=0; trisa=0b10111110; trisb=0b11000000; trisc=0b10100001; trisd=0b10110000; trise=0b1110; //------TMR0 T0CON=0b10000001; //prescaler 4 TMR0H=0x63; TMR0L=0xBF; INTCON.b7=1; INTCON.T0IE=1; //------LCD Init LCD_Init(); delay_ms(100); LCDBL=1; //-------UART UART1_Init(9600); UART2_Init(9600); //-------Signaling System SignalingSystem_Init(&SigSys); }
//Modbus Initialization void Modbus_Init(void) { //Clock divider equals 1.Clock 16MHz CLK_HSIPrescalerConfig(CLK_PRESCALER_HSIDIV1); //Clear bits TIM2_DeInit(); GPIO_DeInit(GPIOA); UART2_DeInit(); //Peripetial Initialization TIM2_TimeBaseInit(TIM2_PRESCALER_2048, 78); GPIO_Init(GPIOA, GPIO_PIN_3, GPIO_MODE_OUT_PP_LOW_FAST); UART2_Init(BAUDRATE, UART2_WORDLENGTH_8D, UART2_STOPBITS_2,UART2_PARITY_NO,UART2_SYNCMODE_CLOCK_DISABLE,UART2_MODE_TXRX_ENABLE ); //Enable Periphs TIM2_Cmd(ENABLE); UART2_Cmd(ENABLE); //Interrupt configuration TIM2_ITConfig(TIM2_IT_UPDATE, ENABLE); UART2_ITConfig(UART2_IT_RXNE_OR, ENABLE); #ifndef __DELAY_EN #define __MODBUS_EN enableInterrupts(); #endif }
void Hardware_Init(void) { RCC_Configuration(); SysTick_Configuration(); NVIC_Configuration(); GPIO_Configuration(); //TIM1_Configuration(); TIM2_Configuration(); TIM3_Configuration(); TIM4_Configuration(); UART2_Init(); Unselect_SPI_Device(); //不选中任何一个SPI设备 SPI1_FLASH_Init(); }
void InitDevice(void) { IntDisableAll(); WDT_INIT(); Digitals_Init(); ItcInit(); NVM_FlashInit(); CRM_Init(); TMR_Init(); ASM_Init(); UART1_Init(); UART2_Init(); SPI_Init(); MACA_Init(); /// DMAP_ResetStack(0); // WirelessHART Stack Initialisation NVM_ReadRecords(); // persistent data reading APP_Init(); DLL_Init(); // reset the modem inside TL_Init(); NET_Init(); HART_DLL_Init(HART_ROLE_DECIDED); #if ( SHT1X_MODE != 0 ) SHT1x_INIT(); #endif #if ( (BOARD_TYPE == BOARD_TYPE_HART_DEV_KIT) ) #if (!defined (IS_VN220)) ADC_Extern_Init(); #endif #endif IntEnableAll(); }
void Peripherals_Init(void) { #ifdef NVIC_AUTOINIT NVIC_Init(); #endif /* NVIC_AUTOINIT */ #ifdef SIM_AUTOINIT SIM_Init(); #endif /* SIM_AUTOINIT */ #ifdef MCM_AUTOINIT MCM_Init(); #endif /* MCM_AUTOINIT */ #ifdef PMC_AUTOINIT PMC_Init(); #endif /* PMC_AUTOINIT */ #ifdef PORTA_AUTOINIT PORTA_Init(); #endif /* PORTA_AUTOINIT */ #ifdef PORTB_AUTOINIT PORTB_Init(); #endif /* PORTB_AUTOINIT */ #ifdef PORTC_AUTOINIT PORTC_Init(); #endif /* PORTC_AUTOINIT */ #ifdef PORTD_AUTOINIT PORTD_Init(); #endif /* PORTD_AUTOINIT */ #ifdef PORTE_AUTOINIT PORTE_Init(); #endif /* PORTE_AUTOINIT */ #ifdef ADC0_AUTOINIT ADC0_Init(); #endif /* ADC0_AUTOINIT */ #ifdef ADC1_AUTOINIT ADC1_Init(); #endif /* ADC1_AUTOINIT */ #ifdef AIPS0_AUTOINIT AIPS0_Init(); #endif /* AIPS0_AUTOINIT */ #ifdef AIPS1_AUTOINIT AIPS1_Init(); #endif /* AIPS1_AUTOINIT */ #ifdef AXBS_AUTOINIT AXBS_Init(); #endif /* AXBS_AUTOINIT */ #ifdef CAN0_AUTOINIT CAN0_Init(); #endif /* CAN0_AUTOINIT */ #ifdef CMP0_AUTOINIT CMP0_Init(); #endif /* CMP0_AUTOINIT */ #ifdef CMP1_AUTOINIT CMP1_Init(); #endif /* CMP1_AUTOINIT */ #ifdef CMP2_AUTOINIT CMP2_Init(); #endif /* CMP2_AUTOINIT */ #ifdef CMT_AUTOINIT CMT_Init(); #endif /* CMT_AUTOINIT */ #ifdef CRC_AUTOINIT CRC_Init(); #endif /* CRC_AUTOINIT */ #ifdef DAC0_AUTOINIT DAC0_Init(); #endif /* DAC0_AUTOINIT */ #ifdef DMAMUX_AUTOINIT DMAMUX_Init(); #endif /* DMAMUX_AUTOINIT */ #ifdef DMA_AUTOINIT DMA_Init(); #endif /* DMA_AUTOINIT */ #ifdef ENET_AUTOINIT ENET_Init(); #endif /* ENET_AUTOINIT */ #ifdef EWM_AUTOINIT EWM_Init(); #endif /* EWM_AUTOINIT */ #ifdef FB_AUTOINIT FB_Init(); #endif /* FB_AUTOINIT */ #ifdef FMC_AUTOINIT FMC_Init(); #endif /* FMC_AUTOINIT */ #ifdef FTFE_AUTOINIT FTFE_Init(); #endif /* FTFE_AUTOINIT */ #ifdef FTM0_AUTOINIT FTM0_Init(); #endif /* FTM0_AUTOINIT */ #ifdef FTM1_AUTOINIT FTM1_Init(); #endif /* FTM1_AUTOINIT */ #ifdef FTM2_AUTOINIT FTM2_Init(); #endif /* FTM2_AUTOINIT */ #ifdef FTM3_AUTOINIT FTM3_Init(); #endif /* FTM3_AUTOINIT */ #ifdef I2C0_AUTOINIT I2C0_Init(); #endif /* I2C0_AUTOINIT */ #ifdef I2C1_AUTOINIT I2C1_Init(); #endif /* I2C1_AUTOINIT */ #ifdef I2C2_AUTOINIT I2C2_Init(); #endif /* I2C2_AUTOINIT */ #ifdef I2S0_AUTOINIT I2S0_Init(); #endif /* I2S0_AUTOINIT */ #ifdef LLWU_AUTOINIT LLWU_Init(); #endif /* LLWU_AUTOINIT */ #ifdef LPTMR0_AUTOINIT LPTMR0_Init(); #endif /* LPTMR0_AUTOINIT */ #ifdef MPU_AUTOINIT MPU_Init(); #endif /* MPU_AUTOINIT */ #ifdef PDB0_AUTOINIT PDB0_Init(); #endif /* PDB0_AUTOINIT */ #ifdef PIT_AUTOINIT PIT_Init(); #endif /* PIT_AUTOINIT */ #ifdef PTA_AUTOINIT PTA_Init(); #endif /* PTA_AUTOINIT */ #ifdef PTB_AUTOINIT PTB_Init(); #endif /* PTB_AUTOINIT */ #ifdef PTC_AUTOINIT PTC_Init(); #endif /* PTC_AUTOINIT */ #ifdef PTD_AUTOINIT PTD_Init(); #endif /* PTD_AUTOINIT */ #ifdef PTE_AUTOINIT PTE_Init(); #endif /* PTE_AUTOINIT */ #ifdef RCM_AUTOINIT RCM_Init(); #endif /* RCM_AUTOINIT */ #ifdef RNG_AUTOINIT RNG_Init(); #endif /* RNG_AUTOINIT */ #ifdef RTC_AUTOINIT RTC_Init(); #endif /* RTC_AUTOINIT */ #ifdef SDHC_AUTOINIT SDHC_Init(); #endif /* SDHC_AUTOINIT */ #ifdef SMC_AUTOINIT SMC_Init(); #endif /* SMC_AUTOINIT */ #ifdef SPI0_AUTOINIT SPI0_Init(); #endif /* SPI0_AUTOINIT */ #ifdef SPI1_AUTOINIT SPI1_Init(); #endif /* SPI1_AUTOINIT */ #ifdef SPI2_AUTOINIT SPI2_Init(); #endif /* SPI2_AUTOINIT */ #ifdef SystemControl_AUTOINIT SystemControl_Init(); #endif /* SystemControl_AUTOINIT */ #ifdef SysTick_AUTOINIT SysTick_Init(); #endif /* SysTick_AUTOINIT */ #ifdef UART0_AUTOINIT UART0_Init(); #endif /* UART0_AUTOINIT */ #ifdef UART1_AUTOINIT UART1_Init(); #endif /* UART1_AUTOINIT */ #ifdef UART2_AUTOINIT UART2_Init(); #endif /* UART2_AUTOINIT */ #ifdef UART3_AUTOINIT UART3_Init(); #endif /* UART3_AUTOINIT */ #ifdef UART4_AUTOINIT UART4_Init(); #endif /* UART4_AUTOINIT */ #ifdef UART5_AUTOINIT UART5_Init(); #endif /* UART5_AUTOINIT */ #ifdef USB0_AUTOINIT USB0_Init(); #endif /* USB0_AUTOINIT */ #ifdef USBDCD_AUTOINIT USBDCD_Init(); #endif /* USBDCD_AUTOINIT */ #ifdef VREF_AUTOINIT VREF_Init(); #endif /* VREF_AUTOINIT */ #ifdef WDOG_AUTOINIT WDOG_Init(); #endif /* WDOG_AUTOINIT */ }
/********************************* main entry point *********************************/ int main ( void ) { // Init the basic hardware InitCnsts(); InitHardware(); // Start the main 1Khz timer and PWM timer InitTimer1(); InitTimer2(); InitPWM(); // Initialize A2D, InitA2D(); UART1_Init(XBEE_SPEED); // for communication and control signals UART2_Init(LOGGING_RC_SPEED); // for spektrum RC satellite receiver // Wait for a bit before doing rate gyro bias calibration // TODO: test this length of wait uint16_t i=0;for(i=0;i<60000;i++){Nop();} // turn on the leds until the bias calibration is complete led_on(LED_RED); led_on(LED_GREEN); // Initialize the AHRS AHRS_init(); // Initialize the Controller variables Controller_Init(); // MAIN CONTROL LOOP: Loop forever while (1) { // Gyro propagation if(loop.GyroProp){ loop.GyroProp = 0; // Call gyro propagation AHRS_GyroProp(); } // Attitude control if(loop.AttCtl){ loop.AttCtl = 0; // Call attitude control Controller_Update(); } // Accelerometer correction if( loop.ReadAccMag ){ loop.ReadAccMag = 0; AHRS_AccMagCorrect( ); } // Send data over modem - runs at ~20Hz if(loop.SendSerial){ loop.SendSerial = 0; // Send debug packet UART1_SendAHRSpacket(); } // Process Spektrum RC data if(loop.ProcessSpektrum){ loop.ProcessSpektrum = 0; UART2_ProcessSpektrumData(); } // Read data from UART RX buffers - 500 Hz if(loop.ReadSerial){ loop.ReadSerial = 0; // Read serial data //UART2_FlushRX_Spektrum(); } // Toggle Red LED at 1Hz if(loop.ToggleLED){ loop.ToggleLED = 0; // Toggle LED led_toggle(LED_RED); } } // End while(1) }
/////////////////////////////////////////////////////////////////////////////////// // Name: MAIN Function /////////////////////////////////////////////////////////////////////////////////// void main(void) { IntDisableAll(); WDT_INIT(); Digitals_Init(); ItcInit(); NVM_FlashInit(); CRM_Init(); TMR_Init(); ASM_Init(); UART1_Init(); UART2_Init(); SPI_Init(); PROVISION_Init(); MACA_Init(); DAQ_Init(); DMAP_ResetStack(0); IntEnableAll(); //-------------------------------------------------------------------- // Main Loop //-------------------------------------------------------------------- for (;;) { NLDE_Task(); // as fast as possible, keep this task first on loop DMAP_Task(); // ASLDE_ASLTask(); // UART_LINK_Task(); // UART2_CommControl(); DAQ_RxHandler(); if( g_uc250msFlag ) // 250ms Tasks { g_uc250msFlag = 0; // Handle DAQ after all other stack related tasks. DAQ_TxHandler(); UAP_MainTask(); ARMO_Task(); if( !g_stTAI.m_uc250msStep ) // first 250ms slot from each second -> 1sec Tasks { ASLDE_PerformOneSecondOperations(); DMAP_DMO_CheckNewDevInfoTTL(); DMAP_CheckSecondCounter(); ARMO_OneSecondTask(); SLME_KeyUpdateTask(); DMO_PerformOneSecondTasks(); MACA_WachDog(); } } FEED_WDT(); } }
int main(void) { char c; signed char length; unsigned char msgtype; unsigned char msgbuffer[MSGLEN + 1]; unsigned char i; ANSELA = 0x0; // Set to Digital Function ANSELB = 0x0; ANSELC = 0x0; ANSELD = 0x0; ANSELE = 0x0; UART_DATA uart_data1; UART_DATA uart_data2; TIMER_DATA TIMER1; timer_init(&TIMER1); UART1_Init(&uart_data1); UART2_Init(&uart_data2); TRISAbits.TRISA0 = 0; // Set PIN A as output TRISAbits.TRISA1 = 0; TRISAbits.TRISA2 = 0; // Set PIN A as output TRISAbits.TRISA3 = 0; TRISAbits.TRISA4 = 0; // Set PIN A as output TRISAbits.TRISA5 = 0; TRISAbits.TRISA6 = 0; // Set PIN A as output TRISAbits.TRISA7 = 0; LATAbits.LATA1 = 0; //Set PIN for Stepper motor low // initialize message queues before enabling any interrupts init_queues(); // Peripheral interrupts can have their priority set to high or low // enable high-priority interrupts and low-priority interrupts enable_interrupts(); laser_init(); /* Junk to force an I2C interrupt in the simulator (if you wanted to) PIR1bits.SSPIF = 1; _asm goto 0x08 _endasm; */ // printf() is available, but is not advisable. It goes to the UART pin // on the PIC and then you must hook something up to that to view it. // It is also slow and is blocking, so it will perturb your code's operation // Here is how it looks: printf("Hello\r\n"); // loop forever // This loop is responsible for "handing off" messages to the subroutines // that should get them. Although the subroutines are not threads, but // they can be equated with the tasks in your task diagram if you // structure them properly. while (1) { // Call a routine that blocks until either on the incoming // messages queues has a message (this may put the processor into // an idle mode) block_on_To_msgqueues(); // At this point, one or both of the queues has a message. It // makes sense to check the high-priority messages first -- in fact, // you may only want to check the low-priority messages when there // is not a high priority message. That is a design decision and // I haven't done it here. length = ToMainHigh_recvmsg(MSGLEN, &msgtype, (void *) msgbuffer); if (length < 0) { // no message, check the error code to see if it is concern if (length != MSGQUEUE_EMPTY) { // This case be handled by your code. } } else { switch (msgtype) { case MSGT_LASER_READ: { ReadLaser_Message(msgbuffer, length); break; }; case MSGT_WIFLY_RECIEVE: { ReadWIFLY_Message(msgbuffer,length); break; }; default: { // Your code should handle this error break; }; }; } // Check the low priority queue length = ToMainLow_recvmsg(MSGLEN, &msgtype, (void *) msgbuffer); if (length < 0) { // no message, check the error code to see if it is concern if (length != MSGQUEUE_EMPTY) { // Your code should handle this situation } } else { switch (msgtype) { case MSGT_TIMER0: { Timer_message_handle(); break; }; default: { // Your code should handle this error break; }; }; } } }
int main(void){ uint8_t sample[10] = "sneeches!"; uint8_t *familytype; uint8_t *identification; uint8_t *read_bytes; const uint8_t str_size = strlen(sample); uint8_t mod_value = str_size % 4; uint8_t buf[8] = {0}; uint8_t addrs, index, byte1, byte2, byte3, byte4; uint8_t rfid_address = 3; uint8_t flash_start_addr = 0x0b; int count; /* INITs & SET UP CALCULATIONS */ if(!(UART1_Init())){ UART1_Print("\nUART 1 Initialized\n"); UART1_Print(itoa(str_size, buf, 10)); UART1_Print(" "); UART1_Print(itoa(mod_value, buf, 10)); UART1_Print(" "); UART1_Print(itoa(str_size/4, buf, 10)); UART1_Print(" "); } if(!(UART2_Init())){ UART1_Print("\nUART 2 Initialized\n"); } if(!(Flash_Init())){ UART1_Print("\nFlash Memory Inititalized"); UART1_Print("Flash memory ID: "); UART1_Print(itoa(Flashmem_ID(), buf, 16)); UART1_Print("\r\n"); }else{ UART1_Print("\nProblem initializing flash..."); } if(str_size % 4 != 0){ addrs = ((str_size/4) + 1); UART1_Print("Addrs:"); UART1_Print(itoa(addrs, buf, 10)); UART1_Print("\n"); } else{ addrs = str_size/4; UART1_Print("Addrs:"); UART1_Print(itoa(addrs, buf, 10)); UART1_Print("\n"); } rfid_address = 9; while(1){ UART1_Print("\r\n#### START ####"); /* GET FAMILY TYPE */ UART1_Print("\r\nRFID Tag Family Is Type:"); familytype = Read_Family_RFID(); //for(index = 0; index < strlen(familytype); index++){ for(index = 0; index < 3; index++){ UART1_Print(itoa(*(familytype+index), buf, 16)); } UART1_Flush(); /* GET SERIAL NUMBER */ UART1_Print("\r\nRFID Tag Serial #:"); identification = Read_Serial_RFID(); for(index = 0; index < strlen(identification); index++){ UART1_Print(itoa(*(identification+index), buf, 16)); } UART1_Flush(); /* WRITE STRING */ Write_RFID(rfid_address, sample[0], sample[1], sample[2], sample[3]); _delay_ms(5); /* READ ADDRESS */ UART1_Print("\r\nReading RFID address "); UART1_Print(itoa(rfid_address, buf, 10)); UART1_Print("..."); read_bytes = Read_RFID(rfid_address); for(index = 0; index < strlen(read_bytes); index++){ UART1_Print(itoa(*(read_bytes+index), buf, 16)); } read_bytes = Read_RFID(rfid_address); //for(index = 0; index < strlen(read_bytes); index++){ // UART1_Print(itoa(*(read_bytes+index), buf, 16)); //} UART1_Flush(); /* STORING IDENTIFICATION */ UART1_Print("\r\nWriting to flash... "); UART1_Flush(); _delay_ms(1); //Flash_Test_Write(); Flash_Byte_Write(&identification[0], flash_start_addr); UART1_Flush(); UART1_Print("\r\nReading flash...: "); UART1_Flush(); _delay_ms(1); Flash_Read_Bytes(10, flash_start_addr,0x00,0x00); _delay_ms(1); UART1_Print("\r\n#### DONE ####\r\n"); /* CLEAN UP */ Reset_Tag(); _delay_ms(5); UART1_Flush(); free(read_bytes); free(familytype); free(identification); } return 0; }
int main(void) { UART2_Init(); // Initialize USART2 (for printf) TIMER_Init(SYSTICK_FREQ); // Initialize timer int8_t timerID = TIMER_AddSoftTimer(1000,softTimerCallback); TIMER_StartSoftTimer(timerID); LED_TypeDef led; led.nr = LED0; led.gpio = GPIOD; led.pin = 12; led.clk = RCC_AHB1Periph_GPIOD; LED_Add(&led); // Add an LED printf("Starting program\r\n"); // Print a string to UART2 // SD_Init(); // // uint8_t buf[1024]; // // SD_ReadSectors(buf, 0, 1); // // TIMER_Delay(1000); // hexdump(buf, 512); // // printf("After hexdump\r\n"); FAT_Init(SD_Init, SD_ReadSectors, SD_WriteSectors); // FATFS FatFs; // FIL file; // FRESULT result; // // char buf[256]; // // printf("Mounting volume\r\n"); // result = f_mount(&FatFs, "", 1); // Mount SD card // // if (result) { // printf("Error mounting volume!\r\n"); // while(1); // } // // printf("Opening file: \"hello.txt\"\r\n"); // result = f_open(&file, "hello.txt", FA_READ); // // if (result) { // printf("Error opening file!\r\n"); // while(1); // } // // f_gets((char*)buf, 256, &file); // // printf("The file contains the following text:\r\n\"%s\"\r\n", buf); // // f_close(&file); // Close file // f_mount(NULL, "", 1); // Unmount SD Card while (1){ TIMER_SoftTimersUpdate(); } }