資源簡介
EMTECH 的LORA芯片 sx1268。實現了基本的收發,有需要的請下載,也請大家繼續完善。還有sx1276,sx1278,及官方例子。
代碼片段和文件信息
#include?“radio.h“
#include?“debug.h“
#include?“string.h“
//#define?USE_CONFIG_PUBLIC_NETOWRK
#define?RADIO_DEBUG
#define?RF_FREQUENCY? 433000000
#define?TX_BUFFER_base? 0x0
#define?RX_BUFFER_base? 0x0
unsigned?char?radio_irq_flag?=?0;
t_RADIO_MSG?radio_msg_rx;
t_RADIO_MSG?radio_msg_tx;
t_MODULATION_PARAMS?radio_modulation_params?=?{
.sf?=?SF10
.bw?=?LORA_BW_500
.cr?=?LORA_CR_4_5
.ldro?=?LowDataRateOptimize_OFF
};
t_PACKET_PARAMS_LORA?radio_packet_params_lora?=?{
.preamble_Length?=?12
.header_type?=?0
.payload_length?=?255
.crc_type?=?0
.invert_IQ?=?0
};
t_RADIO_TIMEOUT?radio_timeout_lora?=?{
.timeout_tx?=?TIMEOUT_ENABLE
.timeout_rx?=?TIMEOUT_DISABLE?
};
t_PA_OPTIMAL_SETTINGS?radio_pa_optimal_setting?=?{
//+22dBm
.paDutyCycle?=?0x04
.hpMax =?0x07
.deviceSel?=?0x0
.paLut?=?0x1
#if?0
//+20dBm
.paDutyCycle?=?0x03
.hpMax =?0x05
.deviceSel?=?0x0
.paLut?=?0x1
//+17dBm
.paDutyCycle?=?0x02
.hpMax =?0x03
.deviceSel?=?0x0
.paLut?=?0x1
//+14dBm
.paDutyCycle?=?0x04
.hpMax =?0x06
.deviceSel?=?0x0
.paLut?=?0x1
//+10dBm
.paDutyCycle?=?0x00
.hpMax =?0x03
.deviceSel?=?0x0
.paLut?=?0x1
#endif
};
t_PACKET_STATUS?radio_packet_status;
t_RADIO_INST?radio?=?{
.name?=?“lora“
.modulation_params?=?&radio_modulation_params
.packet_params_lora?=?&radio_packet_params_lora
.pa_optimal_setting?=?&radio_pa_optimal_setting
.packet_status?=?&radio_packet_status
.radio_irq_flag?=?0
.irq_mask?=?IRQ_TX_DONE|RX_DONE|IRQ_TIMEOUT
.status_running?=?IDLE
};
void?radio_Init(void)
{
#ifdef?USART_DEBUG
#ifdef?RADIO_DEBUG
printf(“%s?\r\n“__FUNCTION__);
#endif
#endif
sx126x_HwInit();
sx126x_Reset();
sx126x_SetStandby(STDBY_RC);
sx126x_SetDIO3AsTCXOCtrl(DIO3_1V70xFF);
sx126x_Calibrate(0x7f);//Calibrate?all
sx126x_SetStandby(STDBY_XOSC);
sx126x_SetPacketType(PACKET_TYPE_LORA);
#ifdef?USE_CONFIG_PUBLIC_NETOWRK
????//?Change?LoRa?modem?Sync?Word?for?Public?Networks
???
sx126x_WriteRegisterByte(SyncWordMSB0x34);
sx126x_WriteRegisterByte(SyncWordLSB0x44);
#else
????//?Change?LoRa?modem?SyncWord?for?Private?Networks
????sx126x_WriteRegisterByte(SyncWordMSB0x14);
sx126x_WriteRegisterByte(SyncWordLSB0x24);
#endif
//sx126x_SetDIO2AsRfSwitchCtrl(0x1);
sx126x_SetRfFrequency(RF_FREQUENCY);
sx126x_CalibrateImage(RF_FREQUENCY);
sx126x_SetTxParams(dBm22_PSET_RAMP_200U);
sx126x_SetPacketParams(radio.packet_params_lora);
sx126x_SetBufferbaseAddress(TX_BUFFER_baseRX_BUFFER_base);
sx126x_SetModulationParams(radio.modulation_params);
sx126x_SetDioIrqParams(radio.irq_maskradio.irq_mask0x0000x000);//IRQ_TX_DONE|RX_DONE|IRQ_TIMEOUT
sx126x_SetPaConfig(radio.pa_optimal_setting);
radio_StartRx();//default?rx?mode
}
void?radio_Reset(void)
{
sx126x_Reset();
sx126x_SetStan
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????????280??2018-04-16?14:16??sx12xx\STM32_SX1278_RX_Test\Doc\readme.txt
?????文件????????399??2011-05-09?18:17??sx12xx\STM32_SX1278_RX_Test\keilkill.bat
?????文件??????17273??2010-06-07?10:25??sx12xx\STM32_SX1278_RX_Test\Libraries\CMSIS\core_cm3.c
?????文件??????85714??2011-02-09?14:59??sx12xx\STM32_SX1278_RX_Test\Libraries\CMSIS\core_cm3.h
?????文件??????15766??2011-03-10?10:52??sx12xx\STM32_SX1278_RX_Test\Libraries\CMSIS\startup\startup_stm32f10x_cl.s
?????文件??????15503??2011-03-10?10:52??sx12xx\STM32_SX1278_RX_Test\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
?????文件??????15692??2011-03-10?10:52??sx12xx\STM32_SX1278_RX_Test\Libraries\CMSIS\startup\startup_stm32f10x_hd_vl.s
?????文件??????12376??2011-03-10?10:52??sx12xx\STM32_SX1278_RX_Test\Libraries\CMSIS\startup\startup_stm32f10x_ld.s
?????文件??????13656??2011-03-10?10:52??sx12xx\STM32_SX1278_RX_Test\Libraries\CMSIS\startup\startup_stm32f10x_ld_vl.s
?????文件??????12765??2011-03-10?10:52??sx12xx\STM32_SX1278_RX_Test\Libraries\CMSIS\startup\startup_stm32f10x_md.s
?????文件??????14073??2011-03-10?10:51??sx12xx\STM32_SX1278_RX_Test\Libraries\CMSIS\startup\startup_stm32f10x_md_vl.s
?????文件??????15955??2011-03-10?10:51??sx12xx\STM32_SX1278_RX_Test\Libraries\CMSIS\startup\startup_stm32f10x_xl.s
?????文件?????633941??2011-03-10?10:51??sx12xx\STM32_SX1278_RX_Test\Libraries\CMSIS\stm32f10x.h
?????文件??????36557??2011-03-10?10:51??sx12xx\STM32_SX1278_RX_Test\Libraries\CMSIS\system_stm32f10x.c
?????文件???????2085??2011-03-10?10:51??sx12xx\STM32_SX1278_RX_Test\Libraries\CMSIS\system_stm32f10x.h
?????文件???????8982??2011-03-10?10:47??sx12xx\STM32_SX1278_RX_Test\Libraries\FWlib\inc\misc.h
?????文件??????21690??2011-03-10?10:47??sx12xx\STM32_SX1278_RX_Test\Libraries\FWlib\inc\stm32f10x_adc.h
?????文件???????7555??2011-03-10?10:47??sx12xx\STM32_SX1278_RX_Test\Libraries\FWlib\inc\stm32f10x_bkp.h
?????文件??????27559??2011-03-10?10:47??sx12xx\STM32_SX1278_RX_Test\Libraries\FWlib\inc\stm32f10x_can.h
?????文件???????6573??2011-03-10?10:47??sx12xx\STM32_SX1278_RX_Test\Libraries\FWlib\inc\stm32f10x_cec.h
?????文件???????2162??2011-03-10?10:47??sx12xx\STM32_SX1278_RX_Test\Libraries\FWlib\inc\stm32f10x_crc.h
?????文件??????15233??2011-03-10?10:47??sx12xx\STM32_SX1278_RX_Test\Libraries\FWlib\inc\stm32f10x_dac.h
?????文件???????3818??2011-03-10?10:47??sx12xx\STM32_SX1278_RX_Test\Libraries\FWlib\inc\stm32f10x_dbgmcu.h
?????文件??????20754??2011-03-10?10:47??sx12xx\STM32_SX1278_RX_Test\Libraries\FWlib\inc\stm32f10x_dma.h
?????文件???????6824??2011-03-10?10:47??sx12xx\STM32_SX1278_RX_Test\Libraries\FWlib\inc\stm32f10x_exti.h
?????文件??????25445??2011-03-10?10:47??sx12xx\STM32_SX1278_RX_Test\Libraries\FWlib\inc\stm32f10x_flash.h
?????文件??????27016??2011-03-10?10:47??sx12xx\STM32_SX1278_RX_Test\Libraries\FWlib\inc\stm32f10x_fsmc.h
?????文件??????20175??2011-03-10?10:47??sx12xx\STM32_SX1278_RX_Test\Libraries\FWlib\inc\stm32f10x_gpio.h
?????文件??????30029??2011-03-10?10:47??sx12xx\STM32_SX1278_RX_Test\Libraries\FWlib\inc\stm32f10x_i2c.h
?????文件???????3828??2011-03-10?10:47??sx12xx\STM32_SX1278_RX_Test\Libraries\FWlib\inc\stm32f10x_iwdg.h
............此處省略1752個文件信息
評論
共有 條評論