/**
 * Update EDIT boxes on LCD function
 */
static void lcd_update_values(WM_HWIN hWin_up)
{
	WM_HWIN hItem;
	char tbuff[16];
	static uint32_t ipaddr, hostip;

	if (ipaddr != ipcex_getGblVal(SHGBL_IPADDR)) {
		if (!ipaddr) lcd_create_infobox();
		ipaddr = ipcex_getGblVal(SHGBL_IPADDR);
		/* Set Host IP Address */
		hItem = WM_GetDialogItem(hWin_up, ID_EDIT_0);
		EDIT_SetTextAlign(hItem, GUI_TA_HCENTER);
		EDIT_SetBkColor(hItem, EDIT_CI_DISABLED, GUI_GREEN);
		EDIT_SetTextColor(hItem, EDIT_CI_DISABLED, GUI_GREEN);
		snprintf(tbuff, sizeof(tbuff) - 1, "%d.%d.%d.%d",
			ipaddr & 0xFF, (ipaddr >> 8) & 0xFF,
			(ipaddr >> 16) & 0xFF, (ipaddr >> 24) & 0xFF);
		EDIT_SetText(hItem, tbuff);
	}

	if (ipaddr && hostip != ipcex_getGblVal(SHGBL_HOSTADDR)) {
		hostip = ipcex_getGblVal(SHGBL_HOSTADDR);
		/* Set Remote IP address */
		hItem = WM_GetDialogItem(hWin_up, ID_EDIT_1);
		EDIT_SetTextAlign(hItem, GUI_TA_HCENTER);
		EDIT_SetBkColor(hItem, EDIT_CI_DISABLED, GUI_RED);
		EDIT_SetTextColor(hItem, EDIT_CI_DISABLED, GUI_RED);
		snprintf(tbuff, sizeof(tbuff)-1, "%d.%d.%d.%d",
			hostip & 0xFF, (hostip >> 8) & 0xFF,
			(hostip >> 16) & 0xFF, (hostip >> 24) & 0xFF);
		EDIT_SetText(hItem, tbuff);
	}
Exemple #2
0
/* File open function */
struct fs_file *fs_open(const char *name) {
	FRESULT res;
	int hlen;
	struct file_ds *fds;
	struct fs_file *fs;

	if (!ipcex_getGblVal(SHGBL_USBDISKADDR))
		return NULL;

	if (!Fatfs) {
		/* One time allocation not to be freed! */
		Fatfs = malloc(sizeof(*Fatfs));
		if (Fatfs == NULL) return NULL;
		f_mount(0, Fatfs); /* Never fails */
	}

	/* Allocate file descriptor */
	fds = malloc(sizeof(*fds));
	if (fds == NULL) {
		DEBUGSTR("Malloc Failure, Out of Memory!\r\n");
		return NULL;
	}

	res = f_open(&fds->fi, name, FA_READ);
	if (res) {
		LWIP_DEBUGF(HTTPD_DEBUG, ("DFS: OPEN: File %s does not exist\r\n", name));
		free(fds);
		return NULL;
	}

	fs = &fds->fs;
	fds->fi_valid = 1;
	fs->pextension = (void *) fds;	/* Store this for later use */
	hlen = get_http_headers(name, (char *) fds->scratch);
	fs->data = (const char *) fds->scratch;
	fs->index = hlen;
	fs->len = f_size(&fds->fi) + hlen;
	fs->http_header_included = 1;
	return fs;
}
Exemple #3
0
/* Fat file system information function */
void FATFS_GetBufferInfo(uint8_t **buffer, uint32_t *size)
{
	*buffer = (uint8_t *) ipcex_getGblVal(SHGBL_USBDISKADDR);
	*size = (uint32_t) RAMDISK_SIZE;
}