Added control of Elasticity buffer size in PHY
This commit is contained in:
parent
0fe1ed1c56
commit
a39a483b53
|
|
@ -228,6 +228,7 @@ static const TickType_t xSendTimeOut = pdMS_TO_TICKS( 5000 );
|
||||||
TickType_t xTimeOnShutdown;
|
TickType_t xTimeOnShutdown;
|
||||||
uint8_t *pucRxBuffer;
|
uint8_t *pucRxBuffer;
|
||||||
|
|
||||||
|
|
||||||
xConnectedSocket = ( Socket_t ) pvParameters;
|
xConnectedSocket = ( Socket_t ) pvParameters;
|
||||||
|
|
||||||
/* Attempt to create the buffer used to receive the string to be echoed
|
/* Attempt to create the buffer used to receive the string to be echoed
|
||||||
|
|
@ -251,26 +252,43 @@ uint8_t *pucRxBuffer;
|
||||||
|
|
||||||
/* If data was received, echo it back. */
|
/* If data was received, echo it back. */
|
||||||
if( lBytes >= 0 )
|
if( lBytes >= 0 )
|
||||||
{
|
{
|
||||||
RF_OUT_ENUM state = -1;
|
RF_OUT_ENUM state = -1;
|
||||||
if (!strcmp("RF01", (char*)pucRxBuffer))
|
int8_t enable = -1;
|
||||||
state = xSwitchRFOut(&rfSwitchConfig, RF_OUT_01);
|
|
||||||
|
if (!strcmp("RF_ON", (char*)pucRxBuffer))
|
||||||
|
{
|
||||||
|
vRFSwitchEnable(&rfSwitchConfig);
|
||||||
|
enable = true;
|
||||||
|
}
|
||||||
|
else if (!strcmp("RF_OFF", (char*)pucRxBuffer))
|
||||||
|
{
|
||||||
|
vRFSwitchDisable(&rfSwitchConfig);
|
||||||
|
enable = false;
|
||||||
|
}
|
||||||
|
else if (!strcmp("RF01", (char*)pucRxBuffer))
|
||||||
|
state = xRFSwitchSet(&rfSwitchConfig, RF_OUT_01);
|
||||||
else if (!strcmp("RF02", (char*)pucRxBuffer))
|
else if (!strcmp("RF02", (char*)pucRxBuffer))
|
||||||
state = xSwitchRFOut(&rfSwitchConfig, RF_OUT_02);
|
state = xRFSwitchSet(&rfSwitchConfig, RF_OUT_02);
|
||||||
else if (!strcmp("RF03", (char*)pucRxBuffer))
|
else if (!strcmp("RF03", (char*)pucRxBuffer))
|
||||||
state = xSwitchRFOut(&rfSwitchConfig, RF_OUT_03);
|
state = xRFSwitchSet(&rfSwitchConfig, RF_OUT_03);
|
||||||
else if (!strcmp("RF04", (char*)pucRxBuffer))
|
else if (!strcmp("RF04", (char*)pucRxBuffer))
|
||||||
state = xSwitchRFOut(&rfSwitchConfig, RF_OUT_04);
|
state = xRFSwitchSet(&rfSwitchConfig, RF_OUT_04);
|
||||||
else if (!strcmp("RF05", (char*)pucRxBuffer))
|
else if (!strcmp("RF05", (char*)pucRxBuffer))
|
||||||
state = xSwitchRFOut(&rfSwitchConfig, RF_OUT_05);
|
state = xRFSwitchSet(&rfSwitchConfig, RF_OUT_05);
|
||||||
else if (!strcmp("RF06", (char*)pucRxBuffer))
|
else if (!strcmp("RF06", (char*)pucRxBuffer))
|
||||||
state = xSwitchRFOut(&rfSwitchConfig, RF_OUT_06);
|
state = xRFSwitchSet(&rfSwitchConfig, RF_OUT_06);
|
||||||
else if (!strcmp("RF07", (char*)pucRxBuffer))
|
else if (!strcmp("RF07", (char*)pucRxBuffer))
|
||||||
state = xSwitchRFOut(&rfSwitchConfig, RF_OUT_07);
|
state = xRFSwitchSet(&rfSwitchConfig, RF_OUT_07);
|
||||||
else if (!strcmp("RF08", (char*)pucRxBuffer))
|
else if (!strcmp("RF08", (char*)pucRxBuffer))
|
||||||
state = xSwitchRFOut(&rfSwitchConfig, RF_OUT_08);
|
state = xRFSwitchSet(&rfSwitchConfig, RF_OUT_08);
|
||||||
if (RF_OUT_01 <= state && state <= RF_OUT_08)
|
|
||||||
|
if ( RF_OUT_01 <= state && state <= RF_OUT_08 )
|
||||||
FreeRTOS_debug_printf(("Switched to %s\n", (char*)pucRxBuffer));
|
FreeRTOS_debug_printf(("Switched to %s\n", (char*)pucRxBuffer));
|
||||||
|
else if ( enable == 1 )
|
||||||
|
FreeRTOS_debug_printf(("RF switch ON\n"));
|
||||||
|
else if ( enable == 0 )
|
||||||
|
FreeRTOS_debug_printf(("RF switch OFF\n"));
|
||||||
else
|
else
|
||||||
FreeRTOS_debug_printf(("Wrong command\n"));
|
FreeRTOS_debug_printf(("Wrong command\n"));
|
||||||
lSent = 0;
|
lSent = 0;
|
||||||
|
|
|
||||||
|
|
@ -78,6 +78,7 @@
|
||||||
#include "Driver_ETH_MAC.h"
|
#include "Driver_ETH_MAC.h"
|
||||||
#include "Driver_ETH_PHY.h"
|
#include "Driver_ETH_PHY.h"
|
||||||
#include "gd32f10x_enet.h"
|
#include "gd32f10x_enet.h"
|
||||||
|
#include "PHY_DP83848C.h"
|
||||||
|
|
||||||
//#ifdef RTE_Drivers_PHY_DP83848C /* Driver PHY DP83848C */
|
//#ifdef RTE_Drivers_PHY_DP83848C /* Driver PHY DP83848C */
|
||||||
|
|
||||||
|
|
@ -636,6 +637,9 @@ BaseType_t xNetworkInterfaceInitialise( void )
|
||||||
ARM_ETH_MAC_ADDRESS_BROADCAST);
|
ARM_ETH_MAC_ADDRESS_BROADCAST);
|
||||||
mac->Control(ARM_ETH_MAC_CONTROL_TX, 1);
|
mac->Control(ARM_ETH_MAC_CONTROL_TX, 1);
|
||||||
mac->Control(ARM_ETH_MAC_CONTROL_RX, 1);
|
mac->Control(ARM_ETH_MAC_CONTROL_RX, 1);
|
||||||
|
|
||||||
|
#warning "mac->Control(0x17, 0x23); check if this configuration fixes DP83848 Elasticity buffer problem. Refer to https://habr.com/ru/post/682172/"
|
||||||
|
mac->Control(REG_RBR, RBR_RMII_MODE | RBR_ELAST_BUF);
|
||||||
return pdPASS;
|
return pdPASS;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -157,7 +157,7 @@
|
||||||
<Bp>
|
<Bp>
|
||||||
<Number>0</Number>
|
<Number>0</Number>
|
||||||
<Type>0</Type>
|
<Type>0</Type>
|
||||||
<LineNumber>255</LineNumber>
|
<LineNumber>603</LineNumber>
|
||||||
<EnabledFlag>1</EnabledFlag>
|
<EnabledFlag>1</EnabledFlag>
|
||||||
<Address>0</Address>
|
<Address>0</Address>
|
||||||
<ByteObject>0</ByteObject>
|
<ByteObject>0</ByteObject>
|
||||||
|
|
@ -166,7 +166,39 @@
|
||||||
<SizeOfObject>0</SizeOfObject>
|
<SizeOfObject>0</SizeOfObject>
|
||||||
<BreakByAccess>0</BreakByAccess>
|
<BreakByAccess>0</BreakByAccess>
|
||||||
<BreakIfRCount>0</BreakIfRCount>
|
<BreakIfRCount>0</BreakIfRCount>
|
||||||
<Filename>.\DemoTasks\SimpleTCPEchoServer.c</Filename>
|
<Filename>.\FreeRTOS\source\portable\NetworkInterface\board_family\NetworkInterface.c</Filename>
|
||||||
|
<ExecCommand></ExecCommand>
|
||||||
|
<Expression></Expression>
|
||||||
|
</Bp>
|
||||||
|
<Bp>
|
||||||
|
<Number>1</Number>
|
||||||
|
<Type>0</Type>
|
||||||
|
<LineNumber>642</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>.\FreeRTOS\source\portable\NetworkInterface\board_family\NetworkInterface.c</Filename>
|
||||||
|
<ExecCommand></ExecCommand>
|
||||||
|
<Expression></Expression>
|
||||||
|
</Bp>
|
||||||
|
<Bp>
|
||||||
|
<Number>2</Number>
|
||||||
|
<Type>0</Type>
|
||||||
|
<LineNumber>602</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>.\FreeRTOS\source\portable\NetworkInterface\board_family\NetworkInterface.c</Filename>
|
||||||
<ExecCommand></ExecCommand>
|
<ExecCommand></ExecCommand>
|
||||||
<Expression></Expression>
|
<Expression></Expression>
|
||||||
</Bp>
|
</Bp>
|
||||||
|
|
@ -252,12 +284,27 @@
|
||||||
<WinNumber>1</WinNumber>
|
<WinNumber>1</WinNumber>
|
||||||
<ItemText>pvBuffer</ItemText>
|
<ItemText>pvBuffer</ItemText>
|
||||||
</Ww>
|
</Ww>
|
||||||
|
<Ww>
|
||||||
|
<count>16</count>
|
||||||
|
<WinNumber>1</WinNumber>
|
||||||
|
<ItemText>pxCurrentTCB</ItemText>
|
||||||
|
</Ww>
|
||||||
|
<Ww>
|
||||||
|
<count>17</count>
|
||||||
|
<WinNumber>1</WinNumber>
|
||||||
|
<ItemText>receiveBufferDescriptor</ItemText>
|
||||||
|
</Ww>
|
||||||
|
<Ww>
|
||||||
|
<count>18</count>
|
||||||
|
<WinNumber>1</WinNumber>
|
||||||
|
<ItemText>xNetworkEventQueue</ItemText>
|
||||||
|
</Ww>
|
||||||
</WatchWindow1>
|
</WatchWindow1>
|
||||||
<MemoryWindow1>
|
<MemoryWindow1>
|
||||||
<Mm>
|
<Mm>
|
||||||
<WinNumber>1</WinNumber>
|
<WinNumber>1</WinNumber>
|
||||||
<SubType>0</SubType>
|
<SubType>0</SubType>
|
||||||
<ItemText>0x200083E0</ItemText>
|
<ItemText>frame</ItemText>
|
||||||
<AccSizeX>0</AccSizeX>
|
<AccSizeX>0</AccSizeX>
|
||||||
</Mm>
|
</Mm>
|
||||||
</MemoryWindow1>
|
</MemoryWindow1>
|
||||||
|
|
@ -324,6 +371,12 @@
|
||||||
<pszMrulep></pszMrulep>
|
<pszMrulep></pszMrulep>
|
||||||
<pSingCmdsp></pSingCmdsp>
|
<pSingCmdsp></pSingCmdsp>
|
||||||
<pMultCmdsp></pMultCmdsp>
|
<pMultCmdsp></pMultCmdsp>
|
||||||
|
<SystemViewers>
|
||||||
|
<Entry>
|
||||||
|
<Name>System Viewer\ENET_DMA</Name>
|
||||||
|
<WinId>35905</WinId>
|
||||||
|
</Entry>
|
||||||
|
</SystemViewers>
|
||||||
</TargetOption>
|
</TargetOption>
|
||||||
</Target>
|
</Target>
|
||||||
|
|
||||||
|
|
@ -385,7 +438,7 @@
|
||||||
<GroupNumber>1</GroupNumber>
|
<GroupNumber>1</GroupNumber>
|
||||||
<FileNumber>5</FileNumber>
|
<FileNumber>5</FileNumber>
|
||||||
<FileType>1</FileType>
|
<FileType>1</FileType>
|
||||||
<tvExp>0</tvExp>
|
<tvExp>1</tvExp>
|
||||||
<tvExpOptDlg>0</tvExpOptDlg>
|
<tvExpOptDlg>0</tvExpOptDlg>
|
||||||
<bDave2>0</bDave2>
|
<bDave2>0</bDave2>
|
||||||
<PathWithFileName>.\PHY\PHY_DP83848C.c</PathWithFileName>
|
<PathWithFileName>.\PHY\PHY_DP83848C.c</PathWithFileName>
|
||||||
|
|
@ -721,7 +774,7 @@
|
||||||
|
|
||||||
<Group>
|
<Group>
|
||||||
<GroupName>::Compiler</GroupName>
|
<GroupName>::Compiler</GroupName>
|
||||||
<tvExp>0</tvExp>
|
<tvExp>1</tvExp>
|
||||||
<tvExpOptDlg>0</tvExpOptDlg>
|
<tvExpOptDlg>0</tvExpOptDlg>
|
||||||
<cbSel>0</cbSel>
|
<cbSel>0</cbSel>
|
||||||
<RteFlg>1</RteFlg>
|
<RteFlg>1</RteFlg>
|
||||||
|
|
@ -737,7 +790,7 @@
|
||||||
|
|
||||||
<Group>
|
<Group>
|
||||||
<GroupName>::RTOS</GroupName>
|
<GroupName>::RTOS</GroupName>
|
||||||
<tvExp>0</tvExp>
|
<tvExp>1</tvExp>
|
||||||
<tvExpOptDlg>0</tvExpOptDlg>
|
<tvExpOptDlg>0</tvExpOptDlg>
|
||||||
<cbSel>0</cbSel>
|
<cbSel>0</cbSel>
|
||||||
<RteFlg>1</RteFlg>
|
<RteFlg>1</RteFlg>
|
||||||
|
|
|
||||||
|
|
@ -341,7 +341,7 @@
|
||||||
<MiscControls>-D DEBUG -Wno-pragma-pack -Wno-macro-redefined</MiscControls>
|
<MiscControls>-D DEBUG -Wno-pragma-pack -Wno-macro-redefined</MiscControls>
|
||||||
<Define></Define>
|
<Define></Define>
|
||||||
<Undefine></Undefine>
|
<Undefine></Undefine>
|
||||||
<IncludePath>.\FreeRTOS\source\portable\NetworkInterface\include;.\FreeRTOS\source\include;.\FreeRTOS\source\portable\Compiler\Keil;.\DemoTasks\include;..\GigaDevice_test;.\include</IncludePath>
|
<IncludePath>.\FreeRTOS\source\portable\NetworkInterface\include;.\FreeRTOS\source\include;.\FreeRTOS\source\portable\Compiler\Keil;.\DemoTasks\include;..\GigaDevice_test;.\include;.\PHY</IncludePath>
|
||||||
</VariousControls>
|
</VariousControls>
|
||||||
</Cads>
|
</Cads>
|
||||||
<Aads>
|
<Aads>
|
||||||
|
|
|
||||||
|
|
@ -31,12 +31,23 @@ struct rf_switch_config
|
||||||
uint32_t pinB;
|
uint32_t pinB;
|
||||||
uint32_t portC;
|
uint32_t portC;
|
||||||
uint32_t pinC;
|
uint32_t pinC;
|
||||||
|
uint32_t portEn;
|
||||||
|
uint32_t pinEn;
|
||||||
};
|
};
|
||||||
|
|
||||||
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 vRFSwitchInit(struct rf_switch_config *pConfig,
|
||||||
void vRFSwitchEnable(struct rf_switch_config *config);
|
uint32_t portA,
|
||||||
void vRFSwitchDisable(struct rf_switch_config *config);
|
uint32_t pinA,
|
||||||
RF_OUT_ENUM xSwitchRFOut(struct rf_switch_config *config, RF_OUT_ENUM state);
|
uint32_t portB,
|
||||||
RF_OUT_ENUM xGetRFSwitchState(struct rf_switch_config *config);
|
uint32_t pinB,
|
||||||
|
uint32_t portC,
|
||||||
|
uint32_t pinC,
|
||||||
|
uint32_t portEn,
|
||||||
|
uint32_t pinEn);
|
||||||
|
|
||||||
|
void vRFSwitchEnable(struct rf_switch_config *pConfig);
|
||||||
|
void vRFSwitchDisable(struct rf_switch_config *pConfig);
|
||||||
|
RF_OUT_ENUM xRFSwitchSet(struct rf_switch_config *pConfig, RF_OUT_ENUM state);
|
||||||
|
RF_OUT_ENUM xRFSwitchGetState(struct rf_switch_config *pConfig);
|
||||||
|
|
||||||
#endif /*RF_SWITCH_DRIVER_H_*/
|
#endif /*RF_SWITCH_DRIVER_H_*/
|
||||||
|
|
|
||||||
4
main.c
4
main.c
|
|
@ -26,6 +26,7 @@
|
||||||
#define RF_SWITCH_PIN_A GPIO_PIN_10
|
#define RF_SWITCH_PIN_A GPIO_PIN_10
|
||||||
#define RF_SWITCH_PIN_B GPIO_PIN_11
|
#define RF_SWITCH_PIN_B GPIO_PIN_11
|
||||||
#define RF_SWITCH_PIN_C GPIO_PIN_12
|
#define RF_SWITCH_PIN_C GPIO_PIN_12
|
||||||
|
#define RF_SWITCH_PIN_EN GPIO_PIN_13
|
||||||
|
|
||||||
#define LED2_USER GPIO_PIN_0
|
#define LED2_USER GPIO_PIN_0
|
||||||
#define LED5_TICK GPIO_PIN_1
|
#define LED5_TICK GPIO_PIN_1
|
||||||
|
|
@ -242,6 +243,7 @@ static void vInitMCU(void)
|
||||||
gpio_init(LED5_TICK_PORT, GPIO_MODE_OUT_PP, GPIO_OSPEED_2MHZ, LED5_TICK);
|
gpio_init(LED5_TICK_PORT, GPIO_MODE_OUT_PP, GPIO_OSPEED_2MHZ, LED5_TICK);
|
||||||
gpio_bit_set(LED5_TICK_PORT, LED5_TICK);
|
gpio_bit_set(LED5_TICK_PORT, LED5_TICK);
|
||||||
|
|
||||||
|
|
||||||
/* Enable PLL2 to generate 50MHz clocks */
|
/* Enable PLL2 to generate 50MHz clocks */
|
||||||
if (ERROR == xInitPLL2()) FreeRTOS_debug_printf(("PLL2 initialization failed\n"));
|
if (ERROR == xInitPLL2()) FreeRTOS_debug_printf(("PLL2 initialization failed\n"));
|
||||||
|
|
||||||
|
|
@ -355,7 +357,7 @@ static void prvMiscInitialisation( void )
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
vInitMCU();
|
vInitMCU();
|
||||||
vRFSwitchInit(&rfSwitchConfig, RF_SWITCH_PORT, RF_SWITCH_PIN_A, RF_SWITCH_PORT, RF_SWITCH_PIN_B, RF_SWITCH_PORT, RF_SWITCH_PIN_C);
|
vRFSwitchInit(&rfSwitchConfig, RF_SWITCH_PORT, RF_SWITCH_PIN_A, RF_SWITCH_PORT, RF_SWITCH_PIN_B, RF_SWITCH_PORT, RF_SWITCH_PIN_C, RF_SWITCH_PORT, RF_SWITCH_PIN_EN);
|
||||||
prvMiscInitialisation();
|
prvMiscInitialisation();
|
||||||
xTaskCreate( vTaskToggleLed, "ToggleLed", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY+1, &vTaskToggleLed_Handle);
|
xTaskCreate( vTaskToggleLed, "ToggleLed", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY+1, &vTaskToggleLed_Handle);
|
||||||
xTaskCreate( vTaskHelloWorld, "HelloWorld", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY+1, &vTaskHelloWorld_Handle);
|
xTaskCreate( vTaskHelloWorld, "HelloWorld", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY+1, &vTaskHelloWorld_Handle);
|
||||||
|
|
|
||||||
|
|
@ -5,62 +5,81 @@
|
||||||
/**! \func void vRFSwitchInit(struct rf_switch_config *config)
|
/**! \func void vRFSwitchInit(struct rf_switch_config *config)
|
||||||
* \brief Initialize RF Switch
|
* \brief Initialize RF Switch
|
||||||
*/
|
*/
|
||||||
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 vRFSwitchInit(struct rf_switch_config *pConfig,
|
||||||
{
|
uint32_t portA,
|
||||||
config->enable = 0;
|
uint32_t pinA,
|
||||||
config->rfOutState = xSwitchRFOut(config, RF_OUT_01);
|
uint32_t portB,
|
||||||
config->portA = portA;
|
uint32_t pinB,
|
||||||
config->portB = portB;
|
uint32_t portC,
|
||||||
config->portC = portC;
|
uint32_t pinC,
|
||||||
config->pinA = pinA;
|
uint32_t portEn,
|
||||||
config->pinB = pinB;
|
uint32_t pinEn)
|
||||||
config->pinC = pinC;
|
{
|
||||||
|
/* Configure GPIO Output function for RF Switch interface */
|
||||||
|
gpio_init(portA, GPIO_MODE_OUT_PP, GPIO_OSPEED_2MHZ, pinA);
|
||||||
|
gpio_init(portB, GPIO_MODE_OUT_PP, GPIO_OSPEED_2MHZ, pinB);
|
||||||
|
gpio_init(portC, GPIO_MODE_OUT_PP, GPIO_OSPEED_2MHZ, pinC);
|
||||||
|
gpio_init(portEn, GPIO_MODE_OUT_PP, GPIO_OSPEED_2MHZ, pinEn);
|
||||||
|
|
||||||
|
vRFSwitchDisable(pConfig);
|
||||||
|
pConfig->rfOutState = xRFSwitchSet(pConfig, RF_OUT_01);
|
||||||
|
pConfig->portA = portA;
|
||||||
|
pConfig->portB = portB;
|
||||||
|
pConfig->portC = portC;
|
||||||
|
pConfig->portEn = portEn;
|
||||||
|
pConfig->pinA = pinA;
|
||||||
|
pConfig->pinB = pinB;
|
||||||
|
pConfig->pinC = pinC;
|
||||||
|
pConfig->pinEn = pinEn;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**! \func void vRFSwitchEnable(struct rf_switch_config *config)
|
/**! \func void vRFSwitchEnable(struct rf_switch_config *config)
|
||||||
* \brief Enable RF Switch
|
* \brief Enable RF Switch
|
||||||
*/
|
*/
|
||||||
void vRFSwitchEnable(struct rf_switch_config *config)
|
void vRFSwitchEnable(struct rf_switch_config *pConfig)
|
||||||
{
|
{
|
||||||
config->enable = 1;
|
pConfig->enable = 1;
|
||||||
|
gpio_bit_set(pConfig->portEn, pConfig->pinEn);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**! \func void vRFSwitchDisable(struct rf_switch_config *config)
|
/**! \func void vRFSwitchDisable(struct rf_switch_config *config)
|
||||||
* \brief Disable RF Switch
|
* \brief Disable RF Switch
|
||||||
*/
|
*/
|
||||||
void vRFSwitchDisable(struct rf_switch_config *config)
|
void vRFSwitchDisable(struct rf_switch_config *pConfig)
|
||||||
{
|
{
|
||||||
config->enable = 0;
|
pConfig->enable = 0;
|
||||||
|
gpio_bit_reset(pConfig->portEn, pConfig->pinEn);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**! \func void vSwitchRFOut(struct rf_switch_config *config, RF_OUT_ENUM state)
|
/**! \func void xRFSwitchSet(struct rf_switch_config *config, RF_OUT_ENUM state)
|
||||||
* \brief Switch between RF out state
|
* \brief Switch between RF out state
|
||||||
*/
|
*/
|
||||||
RF_OUT_ENUM xSwitchRFOut(struct rf_switch_config *config, RF_OUT_ENUM state)
|
RF_OUT_ENUM xRFSwitchSet(struct rf_switch_config *pConfig, RF_OUT_ENUM state)
|
||||||
{
|
{
|
||||||
config->rfOutState = state;
|
pConfig->rfOutState = state;
|
||||||
|
|
||||||
if (state & 0x01)
|
if (state & 0x01)
|
||||||
gpio_bit_set(config->portA, config->pinA);
|
gpio_bit_set(pConfig->portA, pConfig->pinA);
|
||||||
else
|
else
|
||||||
gpio_bit_reset(config->portA, config->pinA);
|
gpio_bit_reset(pConfig->portA, pConfig->pinA);
|
||||||
|
|
||||||
if (state & 0x02)
|
if (state & 0x02)
|
||||||
gpio_bit_set(config->portB, config->pinB);
|
gpio_bit_set(pConfig->portB, pConfig->pinB);
|
||||||
else
|
else
|
||||||
gpio_bit_reset(config->portB, config->pinB);
|
gpio_bit_reset(pConfig->portB, pConfig->pinB);
|
||||||
|
|
||||||
if (state & 0x04)
|
if (state & 0x04)
|
||||||
gpio_bit_set(config->portC, config->pinC);
|
gpio_bit_set(pConfig->portC, pConfig->pinC);
|
||||||
else
|
else
|
||||||
gpio_bit_reset(config->portC, config->pinC);
|
gpio_bit_reset(pConfig->portC, pConfig->pinC);
|
||||||
|
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**! \func RF_OUT_ENUM xGetRFSwitchState(struct rf_switch_config *config)
|
/**! \func RF_OUT_ENUM xRFSwitchGetState(struct rf_switch_config *config)
|
||||||
* \brief Get RF Switch State
|
* \brief Get RF Switch State
|
||||||
*/
|
*/
|
||||||
RF_OUT_ENUM xGetRFSwitchState(struct rf_switch_config *config)
|
RF_OUT_ENUM xRFSwitchGetState(struct rf_switch_config *pConfig)
|
||||||
{
|
{
|
||||||
return config->rfOutState;
|
return pConfig->rfOutState;
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue