How to write the data dynamically through USB
Hello friends,
I am working on
PIC18F26J50. I am using its USB features for my application using 'MSD internal flash' USB code provided by microchip's MLA. Till now USB interfacing is done and through this code I am able to detect my device as mass storage device on PC showing flash size upto 48KB right now.
Currently, when I am connecting my device to PC, I am able to see a .txt file in which default 'Data' is written. This is because of following content present in files.c of MLA project folder.
#if (DRV_FILEIO_INTERNAL_FLASH_CONFIG_DRIVE_CAPACITY>0) const uint8_t PARTITION_ATTRIBUTES(SLACK0_ADDRESS) slack0[FILEIO_CONFIG_MEDIA_SECTOR_SIZE] FILE_DATA_ADDR_TAG = { 'D','a','t','a' }; #endif Now my question is : How to write the data dynamically instead of writing 'D','A','T','A' as default in the code? I found there are few functions like
1.
uint8_t FILEIO_InternalFlash_SectorWrite(void* config, uint32_t sector_addr, uint8_t* buffer, uint8_t allowWriteToZero) from internal_flash.c
2.
size_t FILEIO_Write (const void * buffer, size_t size, size_t count, FILEIO_OBJECT * handle); from fileio.h
Are those functions useful? If yes, then how to use them? I can not find their function calls in the code.
Thank you!
post edited by ebtech123 - 2015/05/14 22:48:41