first submission
This commit is contained in:
@@ -0,0 +1,70 @@
|
||||
/********************************** (C) COPYRIGHT *******************************
|
||||
* File Name : main.c
|
||||
* Author : WCH
|
||||
* Version : V1.0.0
|
||||
* Date : 2022/08/08
|
||||
* Description : Main program body.
|
||||
*********************************************************************************
|
||||
* Copyright (c) 2021 Nanjing Qinheng Microelectronics Co., Ltd.
|
||||
* Attention: This software (modified or not) and binary are used for
|
||||
* microcontroller manufactured by Nanjing Qinheng Microelectronics.
|
||||
*******************************************************************************/
|
||||
|
||||
#include <SPI_FLASH.h>
|
||||
#include <SW_UDISK.h>
|
||||
#include "debug.h"
|
||||
#include "usb_lib.h"
|
||||
#include "Internal_Flash.h"
|
||||
|
||||
/* @Note
|
||||
* UDisk Example:
|
||||
* This program provides examples of UDisk.Supports external SPI Flash and internal
|
||||
* Flash, selected by STORAGE_MEDIUM at SW_UDISK.h.
|
||||
* */
|
||||
|
||||
/*********************************************************************
|
||||
* @fn main
|
||||
*
|
||||
* @brief Main program.
|
||||
*
|
||||
* @return none
|
||||
*/
|
||||
int main(void)
|
||||
{
|
||||
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);
|
||||
Delay_Init();
|
||||
USART_Printf_Init(115200);
|
||||
printf("SystemClk:%d\r\n",SystemCoreClock);
|
||||
#if (STORAGE_MEDIUM == MEDIUM_SPI_FLASH)
|
||||
printf("USBD UDisk Demo\nStorage Medium: SPI FLASH \r\n");
|
||||
/* SPI flash init */
|
||||
FLASH_Port_Init( );
|
||||
/* FLASH ID check */
|
||||
FLASH_IC_Check( );
|
||||
#elif (STORAGE_MEDIUM == MEDIUM_INTERAL_FLASH)
|
||||
printf("USBD UDisk Demo\r\nStorage Medium: INTERNAL FLASH \r\n");
|
||||
Flash_Sector_Count = IFLASH_UDISK_SIZE / DEF_UDISK_SECTOR_SIZE;
|
||||
Flash_Sector_Size = DEF_UDISK_SECTOR_SIZE;
|
||||
#endif
|
||||
|
||||
/* Enable Udisk */
|
||||
Udisk_Capability = Flash_Sector_Count;
|
||||
Udisk_Status |= DEF_UDISK_EN_FLAG;
|
||||
|
||||
/* USBD init */
|
||||
Set_USBConfig();
|
||||
USB_Init();
|
||||
USB_Interrupts_Config();
|
||||
|
||||
while(1)
|
||||
{
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user