when I press an external interrupt button, I want to switch to static IP, press again want to switch to DHCP, how can I get this? because in CubeMX it just defines once for LWIP_DHCP macro and how can I use this for static IP or vice versa ?
I would suggest to post this question to the lwip user group.
@recep I found this similar issue, please check if it helps - RE: [lwip-users] How to securely switch between DHCP and static IP assig
But as @RAc suggested it is best to post it on lwip forum.
FreeRTOS+TCP offers this flexibility “at runtime” as follows: the DHCP driver can call a user-defined function xApplicationDHCPHook()
, in which the application may decide to return either of:
eDHCPContinue, /**< Continue the DHCP process */
eDHCPUseDefaults, /**< Stop DHCP and use the static defaults. */
eDHCPStopNoChanges, /**< Stop DHCP and continue with current settings. */
The application hook is only called if ipconfigUSE_DHCP_HOOK
is defined as 1.
2 Likes
thanks for your reply
thanks a lot for replying