Skip to content

Commit c344e6f

Browse files
author
viteo
committed
add custom html pages (compiled with makefsdata into fsdata_custom.c)
1 parent 38bb96f commit c344e6f

File tree

9 files changed

+389
-14
lines changed

9 files changed

+389
-14
lines changed

Diff for: .cproject

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@
8282
<sourceEntries>
8383
<entry excluding="device|lib/cmsis|lib/spl|lib|Startup" flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name=""/>
8484
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="Startup"/>
85-
<entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="device"/>
85+
<entry excluding="fsdata_custom.c" flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="device"/>
8686
<entry excluding="lwip/src/apps/http/fsdata.c|lwip/src/apps/http/makefsdata|lwip/doc|lwip/test" flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="lib"/>
8787
</sourceEntries>
8888
</configuration>

Diff for: device/fsdata_custom.c

+314
Large diffs are not rendered by default.

Diff for: lib/lwip_port/httpd_cgi_ssi.c renamed to device/httpd_cgi_ssi.c

+5-5
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const char IsChecked[] = "checked";
1414

1515
const char *SSI_TAGS[] =
1616
{
17-
"led", // 0
17+
"IsLED", // 0
1818
};
1919

2020
uint16_t SSI_Handler(int iIndex, char *pcInsert, int iInsertLen)
@@ -24,7 +24,7 @@ uint16_t SSI_Handler(int iIndex, char *pcInsert, int iInsertLen)
2424
//iIndex of element in SSI_TAGS array
2525
{
2626
case 0: // is LED on
27-
if(GPIO_ReadInputDataBit(GPIOC, PIN_LED))
27+
if(!GPIO_ReadInputDataBit(GPIOC, PIN_LED))
2828
strcpy(pcInsert, IsChecked);
2929
break;
3030
default:
@@ -47,7 +47,7 @@ const char* CGI_LEDS_Handler(int iIndex, int iNumParams, char *pcParam[], char *
4747
if (iIndex == 0)
4848
{
4949
/* All leds off */
50-
GPIO_ResetBits(GPIOC, PIN_LED);
50+
GPIO_SetBits(GPIOC, PIN_LED);
5151

5252
/* Check cgi parameter : example GET /leds.cgi?led=1&led=2 */
5353
for (i = 0; i < iNumParams; i++)
@@ -57,12 +57,12 @@ const char* CGI_LEDS_Handler(int iIndex, int iNumParams, char *pcParam[], char *
5757
{
5858
/* switch led1 ON if 1 */
5959
if (strcmp(pcValue[i], "1") == 0)
60-
GPIO_SetBits(GPIOC, PIN_LED);
60+
GPIO_ResetBits(GPIOC, PIN_LED);
6161
}
6262
}
6363
}
6464
/* uri to send after cgi call*/
65-
return "/status.shtml";
65+
return "/index.shtml";
6666
}
6767

6868
/* CGI call table */
File renamed without changes.

Diff for: fs/404.html

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<html>
2+
<head>
3+
<title>404</title>
4+
</head>
5+
<body>
6+
<H1>404 - PAGE NOT FOUND</H1>
7+
</body>
8+
</html>

Diff for: fs/img/BluePill.svg

+27
Loading

Diff for: fs/index.shtml

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<html>
2+
<head>
3+
<title>RNDIS Bluepull with lwIP</title>
4+
</head>
5+
<body>
6+
<table style="margin-left: auto; margin-right: auto;">
7+
<tr>
8+
<td>
9+
<form method="get" action="/leds.cgi">
10+
<table>
11+
<tr>
12+
<th>LED PC13</th>
13+
<td>
14+
<input type="checkbox" id="ld1" name="led" value="1" <!--#IsLED--> />
15+
</td>
16+
</tr>
17+
</table>
18+
<input value="OK" type="submit"/>
19+
</form>
20+
</td>
21+
<td><img src="./img/BluePill.svg"></td>
22+
</tr>
23+
</table>
24+
</body>

Diff for: lib/lwip_port/lwipopts.h

+3-1
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,9 @@ a lot of data that needs to be copied, this should be set high. */
175175
#define LWIP_HTTPD_CGI 1
176176
#define LWIP_HTTPD_SSI 1
177177
#define LWIP_HTTPD_SSI_INCLUDE_TAG 0
178-
//#define HTTPD_USE_CUSTOM_FSDATA 1
178+
#define HTTPD_USE_CUSTOM_FSDATA 1
179+
// additional define for makefsdata app to properly include svg files:
180+
#define HTTPD_ADDITIONAL_CONTENT_TYPES {"svg", HTTP_CONTENT_TYPE("image/svg+xml")}
179181

180182
/*
181183
----------------------------------------

Diff for: main.c

+7-7
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@ int main()
3333
if (rndis_data_pending())
3434
LwIP_Pkt_Handle();
3535

36-
static uint32_t LocalTime = 0;
37-
LocalTime += 10;
38-
if(LocalTime % 500 == 0)
39-
{
40-
GPIO_ToggleBits(GPIOC, PIN_LED);
41-
}
42-
DWT_Delay_ms(10);
36+
// static uint32_t LocalTime = 0;
37+
// LocalTime += 10;
38+
// if(LocalTime % 500 == 0)
39+
// {
40+
// GPIO_ToggleBits(GPIOC, PIN_LED);
41+
// }
42+
// DWT_Delay_ms(10);
4343
}
4444
}

0 commit comments

Comments
 (0)