[Mod] CMT2310 跳转前切换至Standby,成功免初始化

1. 新增Standby切换入口;
2. ping接收打印优化;
This commit is contained in:
gaoyang3513
2024-08-02 19:53:56 +08:00
parent 293d9b3be1
commit b7c27bc14f
8 changed files with 36 additions and 20 deletions

View File

@ -73,7 +73,7 @@ void Ebyte_Port_ReceiveCallback( uint16_t state, uint8_t *buffer, uint8_t lengt
{
uint8_t j, pcEchoLength;
uint8_t *p;
int8_t rx_data[32] = {0};
uint8_t rx_data[32] = {0};
/* <20><><EFBFBD><EFBFBD>: <20><><EFBFBD><EFBFBD> */
if( state &= 0x0002 ) {
@ -115,7 +115,7 @@ void Ebyte_Port_ReceiveCallback( uint16_t state, uint8_t *buffer, uint8_t lengt
if( ! PC_isConnected ) {
is_jump_main = 1;
snprintf(rx_data, sizeof(rx_data), "%s", buffer);
EBYTE_LOG("\r\n Receive Data: %s", rx_data);
EBYTE_LOG(" Receive Data: %s\r\n", rx_data);
}
Ebyte_BSP_LedControl( BSP_LED_1, OFF );

View File

@ -29,6 +29,7 @@ const Ebyte_RF_t Ebyte_RF =
{
Ebyte_E48x_Init,
Ebyte_E48x_SendPayload,
Ebyte_E48x_SetStandby,
Ebyte_E48x_SetSleep,
Ebyte_E48x_SetRx,
Ebyte_E48x_IntOrPollTask,

View File

@ -32,6 +32,7 @@ typedef struct
{
void ( *Init )( void );
void ( *Send )( uint8e_t *buffer, uint8e_t size , uint32e_t timeout);
void ( *EnterStandby )( uint8e_t command);
void ( *EnterSleepMode )( uint8e_t command);
void ( *EnterReceiveMode )( uint32e_t timeout );
void ( *StartPollTask)( void );

View File

@ -69,8 +69,6 @@ int ebyte_main( void )
Ebyte_RF.Init();
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
Ebyte_RF.EnterReceiveMode( 0 );
/* MCU <20><>ȫ<EFBFBD><C8AB><EFBFBD>ж<EFBFBD> */
// Ebyte_BSP_GlobalIntEnable();
EBYTE_LOG( "Start PingPong.....\r\n" );
EBYTE_LOG( "Please push button1 or button2.....\r\n" );
@ -88,7 +86,8 @@ int ebyte_main( void )
delay_1ms(100);
}
Ebyte_BSP_GlobalIntDisable();
Ebyte_RF.EnterStandby(0);
Ebyte_BSP_Deinit();
systick_deinit();
}
@ -147,7 +146,7 @@ void Task_Transmit( void )
{
pongLength = 5;
}else{
EBYTE_LOG( "\r\n Echo : pong \r\n" );
EBYTE_LOG( " Echo : pong \r\n" );
pongLength = 4;
}

View File

@ -64,6 +64,11 @@ void Ebyte_E48x_SetRx( uint32_t timeout )
vRadioReceive();
}
void Ebyte_E48x_SetStandby( uint8_t cmd )
{
vRadioStandby();
}
void Ebyte_E48x_SetSleep( uint8_t cmd )
{
return;

View File

@ -14,6 +14,7 @@ void Ebyte_E48x_Init( void );
void Ebyte_E48x_SendPayload( uint8_t *payload, uint8_t size, uint32_t timeout );
void Ebyte_E48x_SetRx( uint32_t timeout );
void Ebyte_E48x_SetSleep( uint8_t cmd );
void Ebyte_E48x_SetStandby( uint8_t cmd );
void Ebyte_E48x_IntOrPollTask( void );
void Ebyte_E48x_InterruptTrigger( void );
uint32_t Ebyte_E48x_GetName(void);

View File

@ -360,6 +360,14 @@ void vRadioTransmit(uint8_t* buffer, uint8_t length )
vRadioReceive();
}
void vRadioStandby( void )
{
bRadioGoStandby();
vRadioClearTxFifo();
vRadioClearRxFifo();
vRadioClearInterrupt();
}
uint8_t vRadioGetPacket(uint8_t *buffer,uint8_t *length)
{
uint8_t rx_length;

View File

@ -26,8 +26,9 @@ extern void vRadioGoRxInit( void );
extern void vRadioTransmit(uint8_t* buffer, uint8_t length );
extern void vRadioReceive(void);
extern uint8_t vRadioGetPacket(uint8_t *buffer,uint8_t *length);
extern void vRadioStandby(void);
extern uint8_t vRadioGetPacket(uint8_t *buffer,uint8_t *length);
extern void vRadioCheckLink(void);