Added simple commands to switch RF out
This commit is contained in:
parent
160ed6fc8c
commit
0fe1ed1c56
|
|
@ -89,6 +89,9 @@
|
|||
#include "FreeRTOS_IP.h"
|
||||
#include "FreeRTOS_Sockets.h"
|
||||
|
||||
#include "rf_switch_driver.h"
|
||||
extern struct rf_switch_config rfSwitchConfig;
|
||||
|
||||
/* Remove the whole file if FreeRTOSIPConfig.h is set to exclude TCP. */
|
||||
#if( ipconfigUSE_TCP == 1 )
|
||||
|
||||
|
|
@ -201,17 +204,14 @@ const BaseType_t xBacklog = 20;
|
|||
/* Wait for a client to connect. */
|
||||
xConnectedSocket = FreeRTOS_accept( xListeningSocket, &xClient, &xSize );
|
||||
configASSERT( xConnectedSocket != FREERTOS_INVALID_SOCKET );
|
||||
FreeRTOS_debug_printf(("Heap size TCP 0 = %d\n", xPortGetFreeHeapSize()));
|
||||
//FreeRTOS_debug_printf(("Heap size TCP 0 = %d\n", xPortGetFreeHeapSize()));
|
||||
|
||||
/* Delete previous suspended EchoServer task if it was created. */
|
||||
if (prvServerConnectionInstance_Handle && eSuspended == eTaskGetState( prvServerConnectionInstance_Handle) )
|
||||
{
|
||||
/* Pause for a short while to ensure the network is not too
|
||||
* congested. */
|
||||
vTaskDelay( 150 );
|
||||
{
|
||||
vTaskDelete( prvServerConnectionInstance_Handle );
|
||||
}
|
||||
FreeRTOS_debug_printf(("Heap size TCP 1 = %d\n", xPortGetFreeHeapSize()));
|
||||
//FreeRTOS_debug_printf(("Heap size TCP 1 = %d\n", xPortGetFreeHeapSize()));
|
||||
|
||||
/* Spawn a task to handle the connection. */
|
||||
xTaskCreate( prvServerConnectionInstance, "EchoServer", usUsedStackSize, ( void * ) xConnectedSocket, tskIDLE_PRIORITY + 1, &prvServerConnectionInstance_Handle );
|
||||
|
|
@ -252,6 +252,27 @@ uint8_t *pucRxBuffer;
|
|||
/* If data was received, echo it back. */
|
||||
if( lBytes >= 0 )
|
||||
{
|
||||
RF_OUT_ENUM state = -1;
|
||||
if (!strcmp("RF01", (char*)pucRxBuffer))
|
||||
state = xSwitchRFOut(&rfSwitchConfig, RF_OUT_01);
|
||||
else if (!strcmp("RF02", (char*)pucRxBuffer))
|
||||
state = xSwitchRFOut(&rfSwitchConfig, RF_OUT_02);
|
||||
else if (!strcmp("RF03", (char*)pucRxBuffer))
|
||||
state = xSwitchRFOut(&rfSwitchConfig, RF_OUT_03);
|
||||
else if (!strcmp("RF04", (char*)pucRxBuffer))
|
||||
state = xSwitchRFOut(&rfSwitchConfig, RF_OUT_04);
|
||||
else if (!strcmp("RF05", (char*)pucRxBuffer))
|
||||
state = xSwitchRFOut(&rfSwitchConfig, RF_OUT_05);
|
||||
else if (!strcmp("RF06", (char*)pucRxBuffer))
|
||||
state = xSwitchRFOut(&rfSwitchConfig, RF_OUT_06);
|
||||
else if (!strcmp("RF07", (char*)pucRxBuffer))
|
||||
state = xSwitchRFOut(&rfSwitchConfig, RF_OUT_07);
|
||||
else if (!strcmp("RF08", (char*)pucRxBuffer))
|
||||
state = xSwitchRFOut(&rfSwitchConfig, RF_OUT_08);
|
||||
if (RF_OUT_01 <= state && state <= RF_OUT_08)
|
||||
FreeRTOS_debug_printf(("Switched to %s\n", (char*)pucRxBuffer));
|
||||
else
|
||||
FreeRTOS_debug_printf(("Wrong command\n"));
|
||||
lSent = 0;
|
||||
lTotalSent = 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -191,6 +191,7 @@ Socket_t xListeningSocket;
|
|||
/* Error check. */
|
||||
configASSERT( lBytes == ( BaseType_t ) strlen( ( const char * ) cReceivedString ) );
|
||||
FreeRTOS_debug_printf( ("Received on port %d a string: %s\r\n", FreeRTOS_htons( xBindAddress.sin_port ), cReceivedString) );
|
||||
lBytes = FreeRTOS_sendto( xListeningSocket, ( void * ) cReceivedString, strlen( ( const char * ) cReceivedString ), 0, &xClient, sizeof( xClient ) );
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
|
@ -328,6 +329,7 @@ Socket_t xListeningSocket;
|
|||
|
||||
for( ;; )
|
||||
{
|
||||
FreeRTOS_debug_printf(("Heap size UDP 0 = %d\n", xPortGetFreeHeapSize()));
|
||||
/* Receive data on the socket. ulFlags has the zero copy bit set
|
||||
(FREERTOS_ZERO_COPY) indicating to the stack that a reference to the
|
||||
received data should be passed out to this task using the second
|
||||
|
|
@ -336,20 +338,24 @@ Socket_t xListeningSocket;
|
|||
the task *must* return the buffer to the stack when it is no longer
|
||||
needed. By default the block time is portMAX_DELAY. */
|
||||
lBytes = FreeRTOS_recvfrom( xListeningSocket, ( void * ) &pucUDPPayloadBuffer, 0, FREERTOS_ZERO_COPY, &xClient, &xClientLength );
|
||||
|
||||
|
||||
/* Print the received characters. */
|
||||
if( lBytes > 0 )
|
||||
{
|
||||
{
|
||||
/* It is expected to receive one more byte than the string length as
|
||||
the NULL terminator is also transmitted. */
|
||||
configASSERT( lBytes == ( ( BaseType_t ) strlen( ( const char * ) pucUDPPayloadBuffer ) ) );
|
||||
}
|
||||
FreeRTOS_debug_printf( ("Received on port %d with ZERO_COPY a string: %s\r\n", FreeRTOS_htons( xBindAddress.sin_port ), pucUDPPayloadBuffer) );
|
||||
FreeRTOS_debug_printf( ("Received on port %d with ZERO_COPY a string: %s\r\n", FreeRTOS_htons( xBindAddress.sin_port ), pucUDPPayloadBuffer) );
|
||||
FreeRTOS_sendto( xListeningSocket, ( void * ) pucUDPPayloadBuffer, lBytes, 0, &xClient, sizeof( xClient ) );
|
||||
}
|
||||
|
||||
if( lBytes >= 0 )
|
||||
{
|
||||
/* The buffer *must* be freed once it is no longer needed. */
|
||||
FreeRTOS_ReleaseUDPPayloadBuffer( pucUDPPayloadBuffer );
|
||||
}
|
||||
|
||||
FreeRTOS_debug_printf(("Heap size UDP 1 = %d\n", xPortGetFreeHeapSize()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -44,6 +44,10 @@
|
|||
#define ipconfigUSE_DHCP_HOOK 1
|
||||
#define ipconfigUSE_DNS_CACHE 1
|
||||
#define ipconfigMAC_INTERRUPT_PRIORITY ( configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY )
|
||||
#define ipconfigDHCP_REGISTER_HOSTNAME 1
|
||||
#define ipconfigUSE_DNS 1
|
||||
//#define ipconfigUSE_LLMNR 1
|
||||
//#define ipconfigUSE_NBNS 1
|
||||
//#define ipconfigETHERNET_DRIVER_FILTERS_FRAME_TYPES 1
|
||||
//#define ipconfigDRIVER_INCLUDED_TX_IP_CHECKSUM 1
|
||||
//#define ipconfigDRIVER_INCLUDED_RX_IP_CHECKSUM 1
|
||||
|
|
|
|||
|
|
@ -0,0 +1,295 @@
|
|||
/*!
|
||||
\file gd32f10x_bkp.c
|
||||
\brief BKP driver
|
||||
|
||||
\version 2014-12-26, V1.0.0, firmware for GD32F10x
|
||||
\version 2017-06-20, V2.0.0, firmware for GD32F10x
|
||||
\version 2018-07-31, V2.1.0, firmware for GD32F10x
|
||||
\version 2020-09-30, V2.2.0, firmware for GD32F10x
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright (c) 2020, GigaDevice Semiconductor Inc.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
3. Neither the name of the copyright holder nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "gd32f10x_bkp.h"
|
||||
|
||||
/* BKP register bits offset */
|
||||
#define BKP_TAMPER_BITS_OFFSET ((uint32_t)8U)
|
||||
|
||||
/*!
|
||||
\brief reset BKP registers
|
||||
\param[in] none
|
||||
\param[out] none
|
||||
\retval none
|
||||
*/
|
||||
void bkp_deinit(void)
|
||||
{
|
||||
/* reset BKP domain register*/
|
||||
rcu_bkp_reset_enable();
|
||||
rcu_bkp_reset_disable();
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief write BKP data register
|
||||
\param[in] register_number: refer to bkp_data_register_enum
|
||||
only one parameter can be selected which is shown as below:
|
||||
\arg BKP_DATA_x(x = 0..41): bkp data register number x
|
||||
\param[in] data: the data to be write in BKP data register
|
||||
\param[out] none
|
||||
\retval none
|
||||
*/
|
||||
void bkp_data_write(bkp_data_register_enum register_number, uint16_t data)
|
||||
{
|
||||
if((register_number >= BKP_DATA_10) && (register_number <= BKP_DATA_41)){
|
||||
BKP_DATA10_41(register_number - 1U) = data;
|
||||
}else if((register_number >= BKP_DATA_0) && (register_number <= BKP_DATA_9)){
|
||||
BKP_DATA0_9(register_number - 1U) = data;
|
||||
}else{
|
||||
/* illegal parameters */
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief read BKP data register
|
||||
\param[in] register_number: refer to bkp_data_register_enum
|
||||
only one parameter can be selected which is shown as below:
|
||||
\arg BKP_DATA_x(x = 0..41): bkp data register number x
|
||||
\param[out] none
|
||||
\retval data of BKP data register
|
||||
*/
|
||||
uint16_t bkp_data_read(bkp_data_register_enum register_number)
|
||||
{
|
||||
uint16_t data = 0U;
|
||||
|
||||
/* get the data from the BKP data register */
|
||||
if((register_number >= BKP_DATA_10) && (register_number <= BKP_DATA_41)){
|
||||
data = BKP_DATA10_41(register_number - 1U);
|
||||
}else if((register_number >= BKP_DATA_0) && (register_number <= BKP_DATA_9)){
|
||||
data = BKP_DATA0_9(register_number - 1U);
|
||||
}else{
|
||||
/* illegal parameters */
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief enable RTC clock calibration output
|
||||
\param[in] none
|
||||
\param[out] none
|
||||
\retval none
|
||||
*/
|
||||
void bkp_rtc_calibration_output_enable(void)
|
||||
{
|
||||
BKP_OCTL |= (uint16_t)BKP_OCTL_COEN;
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief disable RTC clock calibration output
|
||||
\param[in] none
|
||||
\param[out] none
|
||||
\retval none
|
||||
*/
|
||||
void bkp_rtc_calibration_output_disable(void)
|
||||
{
|
||||
BKP_OCTL &= (uint16_t)~BKP_OCTL_COEN;
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief enable RTC alarm or second signal output
|
||||
\param[in] none
|
||||
\param[out] none
|
||||
\retval none
|
||||
*/
|
||||
void bkp_rtc_signal_output_enable(void)
|
||||
{
|
||||
BKP_OCTL |= (uint16_t)BKP_OCTL_ASOEN;
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief disable RTC alarm or second signal output
|
||||
\param[in] none
|
||||
\param[out] none
|
||||
\retval none
|
||||
*/
|
||||
void bkp_rtc_signal_output_disable(void)
|
||||
{
|
||||
BKP_OCTL &= (uint16_t)~BKP_OCTL_ASOEN;
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief select RTC output
|
||||
\param[in] outputsel: RTC output selection
|
||||
only one parameter can be selected which is shown as below:
|
||||
\arg RTC_OUTPUT_ALARM_PULSE: RTC alarm pulse is selected as the RTC output
|
||||
\arg RTC_OUTPUT_SECOND_PULSE: RTC second pulse is selected as the RTC output
|
||||
\param[out] none
|
||||
\retval none
|
||||
*/
|
||||
void bkp_rtc_output_select(uint16_t outputsel)
|
||||
{
|
||||
uint16_t ctl = 0U;
|
||||
|
||||
/* configure BKP_OCTL_ROSEL with outputsel */
|
||||
ctl = BKP_OCTL;
|
||||
ctl &= (uint16_t)~BKP_OCTL_ROSEL;
|
||||
ctl |= outputsel;
|
||||
BKP_OCTL = ctl;
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief set RTC clock calibration value
|
||||
\param[in] value: RTC clock calibration value
|
||||
\arg 0x00 - 0x7F
|
||||
\param[out] none
|
||||
\retval none
|
||||
*/
|
||||
void bkp_rtc_calibration_value_set(uint8_t value)
|
||||
{
|
||||
uint16_t ctl;
|
||||
|
||||
/* configure BKP_OCTL_RCCV with value */
|
||||
ctl = BKP_OCTL;
|
||||
ctl &= (uint16_t)~BKP_OCTL_RCCV;
|
||||
ctl |= (uint16_t)OCTL_RCCV(value);
|
||||
BKP_OCTL = ctl;
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief enable tamper detection
|
||||
\param[in] none
|
||||
\param[out] none
|
||||
\retval none
|
||||
*/
|
||||
void bkp_tamper_detection_enable(void)
|
||||
{
|
||||
BKP_TPCTL |= (uint16_t)BKP_TPCTL_TPEN;
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief disable tamper detection
|
||||
\param[in] none
|
||||
\param[out] none
|
||||
\retval none
|
||||
*/
|
||||
void bkp_tamper_detection_disable(void)
|
||||
{
|
||||
BKP_TPCTL &= (uint16_t)~BKP_TPCTL_TPEN;
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief set tamper pin active level
|
||||
\param[in] level: tamper active level
|
||||
only one parameter can be selected which is shown as below:
|
||||
\arg TAMPER_PIN_ACTIVE_HIGH: the tamper pin is active high
|
||||
\arg TAMPER_PIN_ACTIVE_LOW: the tamper pin is active low
|
||||
\param[out] none
|
||||
\retval none
|
||||
*/
|
||||
void bkp_tamper_active_level_set(uint16_t level)
|
||||
{
|
||||
uint16_t ctl = 0U;
|
||||
|
||||
/* configure BKP_TPCTL_TPAL with level */
|
||||
ctl = BKP_TPCTL;
|
||||
ctl &= (uint16_t)~BKP_TPCTL_TPAL;
|
||||
ctl |= level;
|
||||
BKP_TPCTL = ctl;
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief enable tamper interrupt
|
||||
\param[in] none
|
||||
\param[out] none
|
||||
\retval none
|
||||
*/
|
||||
void bkp_interrupt_enable(void)
|
||||
{
|
||||
BKP_TPCS |= (uint16_t)BKP_TPCS_TPIE;
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief disable tamper interrupt
|
||||
\param[in] none
|
||||
\param[out] none
|
||||
\retval none
|
||||
*/
|
||||
void bkp_interrupt_disable(void)
|
||||
{
|
||||
BKP_TPCS &= (uint16_t)~BKP_TPCS_TPIE;
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief get tamper flag state
|
||||
\param[in] none
|
||||
\param[out] none
|
||||
\retval FlagStatus: SET or RESET
|
||||
*/
|
||||
FlagStatus bkp_flag_get(void)
|
||||
{
|
||||
if(RESET != (BKP_TPCS & BKP_FLAG_TAMPER)){
|
||||
return SET;
|
||||
}else{
|
||||
return RESET;
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief clear tamper flag state
|
||||
\param[in] none
|
||||
\param[out] none
|
||||
\retval none
|
||||
*/
|
||||
void bkp_flag_clear(void)
|
||||
{
|
||||
BKP_TPCS |= (uint16_t)(BKP_FLAG_TAMPER >> BKP_TAMPER_BITS_OFFSET);
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief get tamper interrupt flag state
|
||||
\param[in] none
|
||||
\param[out] none
|
||||
\retval FlagStatus: SET or RESET
|
||||
*/
|
||||
FlagStatus bkp_interrupt_flag_get(void)
|
||||
{
|
||||
if(RESET != (BKP_TPCS & BKP_INT_FLAG_TAMPER)){
|
||||
return SET;
|
||||
}else{
|
||||
return RESET;
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief clear tamper interrupt flag state
|
||||
\param[in] none
|
||||
\param[out] none
|
||||
\retval none
|
||||
*/
|
||||
void bkp_interrupt_flag_clear(void)
|
||||
{
|
||||
BKP_TPCS |= (uint16_t)(BKP_INT_FLAG_TAMPER >> BKP_TAMPER_BITS_OFFSET);
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
|
|
@ -153,7 +153,24 @@
|
|||
<Name>UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0GD32F10x_CL -FS08000000 -FL040000 -FP0($$Device:GD32F107VC$Flash\GD32F10x_CL.FLM))</Name>
|
||||
</SetRegEntry>
|
||||
</TargetDriverDllRegistry>
|
||||
<Breakpoint/>
|
||||
<Breakpoint>
|
||||
<Bp>
|
||||
<Number>0</Number>
|
||||
<Type>0</Type>
|
||||
<LineNumber>255</LineNumber>
|
||||
<EnabledFlag>1</EnabledFlag>
|
||||
<Address>0</Address>
|
||||
<ByteObject>0</ByteObject>
|
||||
<HtxType>0</HtxType>
|
||||
<ManyObjects>0</ManyObjects>
|
||||
<SizeOfObject>0</SizeOfObject>
|
||||
<BreakByAccess>0</BreakByAccess>
|
||||
<BreakIfRCount>0</BreakIfRCount>
|
||||
<Filename>.\DemoTasks\SimpleTCPEchoServer.c</Filename>
|
||||
<ExecCommand></ExecCommand>
|
||||
<Expression></Expression>
|
||||
</Bp>
|
||||
</Breakpoint>
|
||||
<WatchWindow1>
|
||||
<Ww>
|
||||
<count>0</count>
|
||||
|
|
@ -230,12 +247,17 @@
|
|||
<WinNumber>1</WinNumber>
|
||||
<ItemText>prvServerConnectionInstance_Handle</ItemText>
|
||||
</Ww>
|
||||
<Ww>
|
||||
<count>15</count>
|
||||
<WinNumber>1</WinNumber>
|
||||
<ItemText>pvBuffer</ItemText>
|
||||
</Ww>
|
||||
</WatchWindow1>
|
||||
<MemoryWindow1>
|
||||
<Mm>
|
||||
<WinNumber>1</WinNumber>
|
||||
<SubType>0</SubType>
|
||||
<ItemText>pucUDPPayloadBuffer</ItemText>
|
||||
<ItemText>0x200083E0</ItemText>
|
||||
<AccSizeX>0</AccSizeX>
|
||||
</Mm>
|
||||
</MemoryWindow1>
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ struct rf_switch_config
|
|||
void vRFSwitchInit(struct rf_switch_config *config, uint32_t portA, uint32_t pinA, uint32_t portB, uint32_t pinB, uint32_t portC, uint32_t pinC);
|
||||
void vRFSwitchEnable(struct rf_switch_config *config);
|
||||
void vRFSwitchDisable(struct rf_switch_config *config);
|
||||
void vSwitchRFOut(struct rf_switch_config *config, RF_OUT_ENUM state);
|
||||
RF_OUT_ENUM xSwitchRFOut(struct rf_switch_config *config, RF_OUT_ENUM state);
|
||||
RF_OUT_ENUM xGetRFSwitchState(struct rf_switch_config *config);
|
||||
|
||||
#endif /*RF_SWITCH_DRIVER_H_*/
|
||||
|
|
|
|||
26
main.c
26
main.c
|
|
@ -67,9 +67,9 @@
|
|||
|
||||
#define TEST_RUNNER_TASK_STACK_SIZE 512
|
||||
|
||||
#define mainCREATE_SIMPLE_UDP_CLIENT_SERVER_TASKS 1
|
||||
#define mainCREATE_SIMPLE_UDP_CLIENT_SERVER_TASKS 0
|
||||
#define mainCREATE_TCP_ECHO_TASKS_SINGLE 0
|
||||
#define mainCREATE_TCP_ECHO_SERVER_TASK 0
|
||||
#define mainCREATE_TCP_ECHO_SERVER_TASK 1
|
||||
|
||||
/* Simple UDP client and server task parameters. */
|
||||
#define mainSIMPLE_UDP_CLIENT_SERVER_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 )
|
||||
|
|
@ -84,8 +84,8 @@
|
|||
#define mainECHO_SERVER_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 )
|
||||
|
||||
/* Define a name that will be used for LLMNR and NBNS searches. */
|
||||
//#define mainHOST_NAME "RTOSDemo"
|
||||
//#define mainDEVICE_NICK_NAME "windows_demo"
|
||||
#define mainHOST_NAME "GD32F107C_TCP_UDP_SERVER"
|
||||
#define mainDEVICE_NICK_NAME "GD32F107C"
|
||||
|
||||
#ifdef DEBUG
|
||||
#define BKPT_DEBUG() __BKPT();
|
||||
|
|
@ -338,14 +338,14 @@ static void prvMiscInitialisation( void )
|
|||
|
||||
/* Seed the random number generator. */
|
||||
xTimeNow = rtc_counter_get();
|
||||
FreeRTOS_debug_printf( ("Seed for randomiser: %d\r\n", (unsigned)xTimeNow ) );
|
||||
FreeRTOS_debug_printf( ("Seed for randomiser: 0x%08X\r\n", (unsigned)xTimeNow ) );
|
||||
prvSRand( ( uint32_t ) xTimeNow );
|
||||
|
||||
( void ) xApplicationGetRandomNumber( &ulRandomNumbers[ 0 ] );
|
||||
( void ) xApplicationGetRandomNumber( &ulRandomNumbers[ 1 ] );
|
||||
( void ) xApplicationGetRandomNumber( &ulRandomNumbers[ 2 ] );
|
||||
( void ) xApplicationGetRandomNumber( &ulRandomNumbers[ 3 ] );
|
||||
FreeRTOS_debug_printf( ("Random numbers: %08X %08X %08X %08X\r\n",
|
||||
FreeRTOS_debug_printf( ("Random numbers: 0x%08X 0x%08X 0x%08X 0x%08X\r\n",
|
||||
ulRandomNumbers[ 0 ],
|
||||
ulRandomNumbers[ 1 ],
|
||||
ulRandomNumbers[ 2 ],
|
||||
|
|
@ -365,6 +365,20 @@ int main(void)
|
|||
while(1);
|
||||
}
|
||||
|
||||
BaseType_t xApplicationDNSQueryHook( const char * pcName )
|
||||
{
|
||||
#ifdef DEBUG
|
||||
return TRUE;
|
||||
#endif
|
||||
}
|
||||
/**
|
||||
* @brief pcApplicationHostnameHook( void )
|
||||
*/
|
||||
const char * pcApplicationHostnameHook( void )
|
||||
{
|
||||
return mainHOST_NAME;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief xApplicationDHCPHook( eDHCPCallbackPhase_t eDHCPPhase, uint32_t ulIPAddress )
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -8,14 +8,13 @@
|
|||
void vRFSwitchInit(struct rf_switch_config *config, uint32_t portA, uint32_t pinA, uint32_t portB, uint32_t pinB, uint32_t portC, uint32_t pinC)
|
||||
{
|
||||
config->enable = 0;
|
||||
config->rfOutState = RF_OUT_01;
|
||||
config->rfOutState = xSwitchRFOut(config, RF_OUT_01);
|
||||
config->portA = portA;
|
||||
config->portB = portB;
|
||||
config->portC = portC;
|
||||
config->pinA = pinA;
|
||||
config->pinB = pinB;
|
||||
config->pinC = pinC;
|
||||
vSwitchRFOut(config, config->rfOutState);
|
||||
config->pinC = pinC;
|
||||
}
|
||||
|
||||
/**! \func void vRFSwitchEnable(struct rf_switch_config *config)
|
||||
|
|
@ -37,7 +36,7 @@ void vRFSwitchDisable(struct rf_switch_config *config)
|
|||
/**! \func void vSwitchRFOut(struct rf_switch_config *config, RF_OUT_ENUM state)
|
||||
* \brief Switch between RF out state
|
||||
*/
|
||||
void vSwitchRFOut(struct rf_switch_config *config, RF_OUT_ENUM state)
|
||||
RF_OUT_ENUM xSwitchRFOut(struct rf_switch_config *config, RF_OUT_ENUM state)
|
||||
{
|
||||
config->rfOutState = state;
|
||||
|
||||
|
|
@ -55,6 +54,7 @@ void vSwitchRFOut(struct rf_switch_config *config, RF_OUT_ENUM state)
|
|||
gpio_bit_set(config->portC, config->pinC);
|
||||
else
|
||||
gpio_bit_reset(config->portC, config->pinC);
|
||||
return state;
|
||||
}
|
||||
|
||||
/**! \func RF_OUT_ENUM xGetRFSwitchState(struct rf_switch_config *config)
|
||||
|
|
|
|||
Loading…
Reference in New Issue