aboutsummaryrefslogtreecommitdiffstats
path: root/Projects
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2010-03-09 05:15:08 +0000
committerDean Camera <dean@fourwalledcubicle.com>2010-03-09 05:15:08 +0000
commitce260ae786326b9f1e476fa3e580ecf9176889c2 (patch)
tree9d61be0f91806aa41ba268a53439624ef85baa83 /Projects
parenta61c7f671d7dc0f775f730d07ae764d03bdf3aba (diff)
downloadlufa-ce260ae786326b9f1e476fa3e580ecf9176889c2.tar.gz
lufa-ce260ae786326b9f1e476fa3e580ecf9176889c2.tar.bz2
lufa-ce260ae786326b9f1e476fa3e580ecf9176889c2.zip
Webserver project now uses the board LEDs to indicate the current IP configuration state.
Don't double-read data from the attached disk in the incomplete StandaloneProgrammer project when in host mode.
Diffstat (limited to 'Projects')
-rw-r--r--Projects/Incomplete/StandaloneProgrammer/Lib/PetiteFATFs/diskio.c2
-rw-r--r--Projects/Webserver/Lib/DHCPClientApp.c5
-rw-r--r--Projects/Webserver/Lib/HTTPServerApp.c2
-rw-r--r--Projects/Webserver/Lib/uIPManagement.c5
-rw-r--r--Projects/Webserver/Lib/uIPManagement.h2
-rw-r--r--Projects/Webserver/Webserver.h16
6 files changed, 22 insertions, 10 deletions
diff --git a/Projects/Incomplete/StandaloneProgrammer/Lib/PetiteFATFs/diskio.c b/Projects/Incomplete/StandaloneProgrammer/Lib/PetiteFATFs/diskio.c
index bcf1674f9..c0393dd84 100644
--- a/Projects/Incomplete/StandaloneProgrammer/Lib/PetiteFATFs/diskio.c
+++ b/Projects/Incomplete/StandaloneProgrammer/Lib/PetiteFATFs/diskio.c
@@ -41,8 +41,6 @@ DRESULT disk_readp (
ErrorCode = RES_NOTRDY;
else if (MS_Host_ReadDeviceBlocks(&DiskHost_MS_Interface, 0, sector, 1, 512, BlockTemp))
ErrorCode = RES_ERROR;
-
- MS_Host_ReadDeviceBlocks(&DiskHost_MS_Interface, 0, sector, 1, 512, BlockTemp);
#endif
}
else
diff --git a/Projects/Webserver/Lib/DHCPClientApp.c b/Projects/Webserver/Lib/DHCPClientApp.c
index cf512734e..01cbb7e26 100644
--- a/Projects/Webserver/Lib/DHCPClientApp.c
+++ b/Projects/Webserver/Lib/DHCPClientApp.c
@@ -156,7 +156,10 @@ void DHCPClientApp_Callback(void)
uip_setnetmask((uip_ipaddr_t*)&AppState->DHCPClient.DHCPOffer_Data.Netmask);
uip_setdraddr((uip_ipaddr_t*)&AppState->DHCPClient.DHCPOffer_Data.GatewayIP);
- AppState->DHCPClient.CurrentState = DHCP_STATE_AddressLeased;
+ /* Indicate to the user that we now have a valid IP configuration */
+ HaveIPConfiguration = true;
+
+ AppState->DHCPClient.CurrentState = DHCP_STATE_AddressLeased;
}
break;
diff --git a/Projects/Webserver/Lib/HTTPServerApp.c b/Projects/Webserver/Lib/HTTPServerApp.c
index 4e00952f3..1a1d2c4bf 100644
--- a/Projects/Webserver/Lib/HTTPServerApp.c
+++ b/Projects/Webserver/Lib/HTTPServerApp.c
@@ -77,7 +77,7 @@ const MIME_Type_t MIMETypes[] =
{.Extension = "pdf", .MIMEType = "application/pdf"},
};
-/** FAT Fs structure to hold the internal state of the FAT driver for the dataflash contents. */
+/** FATFs structure to hold the internal state of the FAT driver for the dataflash contents. */
FATFS DiskFATState;
diff --git a/Projects/Webserver/Lib/uIPManagement.c b/Projects/Webserver/Lib/uIPManagement.c
index bd7804e6e..3a9db3462 100644
--- a/Projects/Webserver/Lib/uIPManagement.c
+++ b/Projects/Webserver/Lib/uIPManagement.c
@@ -46,6 +46,7 @@ struct timer ARPTimer;
/** MAC address of the RNDIS device, when enumerated */
struct uip_eth_addr MACAddress;
+bool HaveIPConfiguration;
/** Configures the uIP stack ready for network traffic. */
void uIPManagement_Init(void)
@@ -62,8 +63,10 @@ void uIPManagement_Init(void)
/* DHCP/Server IP Settings Initialization */
#if defined(ENABLE_DHCP_CLIENT)
+ HaveIPConfiguration = false;
DHCPClientApp_Init();
#else
+ HaveIPConfiguration = true;
uip_ipaddr_t IPAddress, Netmask, GatewayIPAddress;
uip_ipaddr(&IPAddress, DEVICE_IP_ADDRESS[0], DEVICE_IP_ADDRESS[1], DEVICE_IP_ADDRESS[2], DEVICE_IP_ADDRESS[3]);
uip_ipaddr(&Netmask, DEVICE_NETMASK[0], DEVICE_NETMASK[1], DEVICE_NETMASK[2], DEVICE_NETMASK[3]);
@@ -169,7 +172,7 @@ static void uIPManagement_ProcessIncomingPacket(void)
}
}
- LEDs_SetAllLEDs(LEDMASK_USB_READY);
+ LEDs_SetAllLEDs(LEDMASK_USB_READY | ((HaveIPConfiguration) ? LEDMASK_UIP_READY : LEDMASK_UIP_READY_NOCONFIG));
}
/** Manages the currently open network connections, including TCP and (if enabled) UDP. */
diff --git a/Projects/Webserver/Lib/uIPManagement.h b/Projects/Webserver/Lib/uIPManagement.h
index 90b47ede9..ed02374f5 100644
--- a/Projects/Webserver/Lib/uIPManagement.h
+++ b/Projects/Webserver/Lib/uIPManagement.h
@@ -63,6 +63,8 @@
/* External Variables: */
extern struct uip_eth_addr MACAddress;
+ extern bool HaveIPConfiguration;
+
/* Function Prototypes: */
void uIPManagement_Init(void);
void uIPManagement_ManageNetwork(void);
diff --git a/Projects/Webserver/Webserver.h b/Projects/Webserver/Webserver.h
index a9621e32f..f1351d891 100644
--- a/Projects/Webserver/Webserver.h
+++ b/Projects/Webserver/Webserver.h
@@ -53,19 +53,25 @@
/* Macros: */
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
- #define LEDMASK_USB_NOTREADY LEDS_LED1
+ #define LEDMASK_USB_NOTREADY LEDS_LED1
/** LED mask for the library LED driver, to indicate that the USB interface is enumerating. */
- #define LEDMASK_USB_ENUMERATING (LEDS_LED2 | LEDS_LED3)
+ #define LEDMASK_USB_ENUMERATING (LEDS_LED1 | LEDS_LED2)
/** LED mask for the library LED driver, to indicate that the USB interface is ready. */
- #define LEDMASK_USB_READY (LEDS_LED2 | LEDS_LED4)
+ #define LEDMASK_USB_READY LEDS_LED2
/** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */
- #define LEDMASK_USB_ERROR (LEDS_LED1 | LEDS_LED3)
+ #define LEDMASK_USB_ERROR (LEDS_LED1 | LEDS_LED3)
/** LED mask for the library LED driver, to indicate that the USB interface is busy. */
- #define LEDMASK_USB_BUSY LEDS_LED2
+ #define LEDMASK_USB_BUSY (LEDS_LED1 | LEDS_LED3 | LEDS_LED4)
+
+ /** LED mask for the uIP stack idling with no IP configuration */
+ #define LEDMASK_UIP_READY_NOCONFIG LEDS_LED3
+
+ /** LED mask for the uIP stack idling with a valid IP configuration */
+ #define LEDMASK_UIP_READY_CONFIG LEDS_LED4
/* Function Prototypes: */
void SetupHardware(void);