int main(void) { MCU_Init(); LEDG_OFF(); LEDR1_OFF(); LEDR2_OFF(); memset( TxBuf, 0, ( size_t )TxBufSize); //GetChipId(); //获取芯片ID //Flash_Read((uint32_t)0x0800FFF0,gateway_mac,6); //Flash_Read((uint32_t)0x0800FFE0,net_id,2); //Print_Array(gateway_mac,6,s1); //Print_Array(net_id,2,s2); //初始化Radio驱动 Radio = RadioDriverInit( ); Radio->Init( ); Radio->StartRx( ); //printf("The radio have been init!!\r\n"); while(1) { OnSlave(); if(receive_flag==true) { receive_flag=false; Config_Handler(ReceiveBuff); } // IWDG_ReloadCounter(); // SignalBw [0: 7.8kHz, 1: 10.4 kHz, 2: 15.6 kHz, 3: 20.8 kHz, 4: 31.2 kHz,5: 41.6 kHz, 6: 62.5 kHz, 7: 125 kHz, 8: 250 kHz, 9: 500 kHz, other: Reserved] //SX1276LoRaSetSignalBandwidth(8); //SpreadingFactor [6: 64, 7: 128, 8: 256, 9: 512, 10: 1024, 11: 2048, 12: 4096 chips] // SX1276LoRaSetSpreadingFactor( uint8_t factor ); // ErrorCoding [1: 4/5, 2: 4/6, 3: 4/7, 4: 4/8] // SX1276LoRaSetErrorCoding( uint8_t value ); //// DMA_Cmd(DMA1_Channel4,ENABLE); //// USART_DMACmd(USART1, USART_DMAReq_Tx, ENABLE); } }
/******************************************************************* ** main : Main program function ** ******************************************************************** ** In : - ** ** Out : - ** *******************************************************************/ int main (void){ InitMicro(); _Monitor_Init(); _Monitor_SoftBreak; InitRFChip(); // Main Loop while(1){ if(EnableMaster){ OnMaster(); } else{ OnSlave(); } } return 0; }
/* * Main application entry point. */ int main( void ) { Radio = RadioDriverInit( ); Radio->Init( ); Radio->StartRx( ); while( 1 ) { if( EnableMaster == true ) { OnMaster( ); } else { OnSlave( ); } #if( PLATFORM == SX12xxEiger ) && ( USE_UART == 1 ) UartProcess( ); { uint8_t data = 0; if( UartGetChar( &data ) == UART_OK ) { UartPutChar( data ); } } #endif } #ifdef __GNUC__ return 0; #endif }