資源簡介
基于STM32F051的LoRa透傳的示例代碼,該代碼在設備上驗證可正常收發,所用的LoRa模塊是安信可科技生產的LoRa02版本的模塊
代碼片段和文件信息
/*
?*?THE?FOLLOWING?FIRMWARE?IS?PROVIDED:?(1)?“AS?IS“?WITH?NO?WARRANTY;?AND?
?*?(2)TO?ENABLE?ACCESS?TO?CODING?INFORMATION?TO?GUIDE?AND?FACILITATE?CUSTOMER.
?*?CONSEQUENTLY?SEMTECH?SHALL?NOT?BE?HELD?LIABLE?FOR?ANY?DIRECT?INDIRECT?OR
?*?CONSEQUENTIAL?DAMAGES?WITH?RESPECT?TO?ANY?CLAIMS?ARISING?FROM?THE?CONTENT
?*?OF?SUCH?FIRMWARE?AND/OR?THE?USE?MADE?BY?CUSTOMERS?OF?THE?CODING?INFORMATION
?*?CONTAINED?HEREIN?IN?CONNECTION?WITH?THEIR?PRODUCTS.
?*?
?*?Copyright?(C)?SEMTECH?S.A.
?*/
/*!?
?*?\file???????bleeper.c
?*?\brief????????
?*
?*?\version????1.0
?*?\date???????Nov?21?2012
?*?\author?????Miguel?Luis
?*/
#include??
#include?“spi.h“
#include?“i2c.h“
#include?“led.h“
#include?“bleeper.h“
//?System?tick?(1ms)
volatile?uint32_t?TickCounter?=?0;
void?InitUnusedGPIO(?void?)?;
void?SelectorInit(?void?);
uint8_t?GetSelectorValue(?void?);
void?SetSelectorStandBy(?void?);
void?SetSelectorSleep(?void?);
void?BoardInit(?void?)
{
????uint8_t?i;
????/*?Setup?SysTick?Timer?for?1?us?interrupts?(?not?too?often?to?save?power?)?*/
????if(?SysTick_Config(?SystemCoreClock?/?1000?)?)
????{?
????????/*?Capture?error?*/?
????????while?(1);
????}
????//?Initialize?unused?GPIO?to?optimize?power?consumption
????InitUnusedGPIO(?);
????//?Initialize?Selector
????SelectorInit(?);
????//?Initialize?SPI
????SpiInit(?);
????
????//?Initialize?LED
????for(?i?=?0;?i?????{
????????LedInit(?(?tLed?)i?);
????}
????LedOn(?LED1?);
????LedOn(?LED2?);
????LedOn(?LED3?);
????LongDelay(?1?);
????LedOff(?LED1?);
????LedOff(?LED2?);
????LedOff(?LED3?);
}
void?Delay?(?uint32_t?delay?)
{
????//?Wait?delay?ms
????uint32_t?startTick?=?TickCounter;
????while(?(?TickCounter?-?startTick?)?}
void?LongDelay?(?uint8_t?delay?)
{
????uint32_t?longDelay;
????uint32_t?startTick;
????longDelay?=?delay?*?1000;
????//?Wait?delay?s
????startTick?=?TickCounter;
????while(?(?TickCounter?-?startTick?)?}
void?InitUnusedGPIO(?void?)?
{???
????GPIO_InitTypeDef?GPIO_InitStructure;
????RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOA?ENABLE);?//?enable?clock?of?the?IO?bank?A
????RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOB?ENABLE);?//?enable?clock?of?the?IO?bank?B
????RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOC?ENABLE);?//?enable?clock?of?the?IO?bank?C
????
????GPIO_StructInit(&GPIO_InitStructure);
????//?activate?pullups?on?C8?to?C12?(SDIO)
????GPIO_InitStructure.GPIO_PuPd??=?GPIO_PuPd_UP;
????GPIO_InitStructure.GPIO_Pin?=?GPIO_Pin_8|GPIO_Pin_9|GPIO_Pin_10|GPIO_Pin_11|GPIO_Pin_12;
????GPIO_Init(GPIOC?&GPIO_InitStructure);
????//?->?save?10?to?50?礎
????
????//?activate?pullups?on?B10?and?B11?(I睠)
????//GPIO_InitStructure.GPIO_PuPd??=?GPIO_PuPd_UP;
????//GPIO_InitStructure.GPIO_Pin?=?GPIO_Pin_10|GPIO_Pin_11;
????//GPIO_Init(GPIOB?&GPIO_InitStructure);
????//?->?dubious?influence?(might?increase?power?a?little?bit)
????
????//?activate?pulldowns?on?B
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2017-12-20?15:08??LoRaSTM32F051V3(透傳)\
?????文件????????5435??2017-12-19?14:11??LoRaSTM32F051V3(透傳)\.mxproject
?????目錄???????????0??2017-12-20?15:07??LoRaSTM32F051V3(透傳)\12xx\
?????目錄???????????0??2017-12-20?15:07??LoRaSTM32F051V3(透傳)\12xx\platform\
?????目錄???????????0??2017-12-20?15:07??LoRaSTM32F051V3(透傳)\12xx\platform\bleeper\
?????文件????????6266??2014-07-23?15:31??LoRaSTM32F051V3(透傳)\12xx\platform\bleeper\bleeper.c
?????文件????????2137??2014-07-23?15:31??LoRaSTM32F051V3(透傳)\12xx\platform\bleeper\bleeper.h
?????文件?????????820??2014-07-23?15:31??LoRaSTM32F051V3(透傳)\12xx\platform\bleeper\fifo.c
?????文件?????????684??2014-07-23?15:31??LoRaSTM32F051V3(透傳)\12xx\platform\bleeper\fifo.h
?????文件???????21349??2014-07-23?15:31??LoRaSTM32F051V3(透傳)\12xx\platform\bleeper\i2c.c
?????文件????????4174??2014-07-23?15:31??LoRaSTM32F051V3(透傳)\12xx\platform\bleeper\i2c.h
?????文件????????3470??2014-07-23?15:31??LoRaSTM32F051V3(透傳)\12xx\platform\bleeper\led.c
?????文件????????3277??2014-07-23?15:31??LoRaSTM32F051V3(透傳)\12xx\platform\bleeper\led.h
?????文件????????8195??2014-07-23?15:31??LoRaSTM32F051V3(透傳)\12xx\platform\bleeper\spi.c
?????文件?????????765??2014-07-23?15:31??LoRaSTM32F051V3(透傳)\12xx\platform\bleeper\spi.h
?????文件???????12001??2014-07-23?15:31??LoRaSTM32F051V3(透傳)\12xx\platform\bleeper\startup_stm32l1xx_hd.s
?????文件????????3434??2014-07-23?15:31??LoRaSTM32F051V3(透傳)\12xx\platform\bleeper\stm32l1xx_conf.h
?????文件????????4936??2014-07-23?15:31??LoRaSTM32F051V3(透傳)\12xx\platform\bleeper\stm32l1xx_it.c
?????文件????????2195??2014-07-23?15:31??LoRaSTM32F051V3(透傳)\12xx\platform\bleeper\stm32l1xx_it.h
?????文件???????12795??2014-07-23?15:31??LoRaSTM32F051V3(透傳)\12xx\platform\bleeper\sx1272-Hal.c
?????文件????????2804??2017-12-20?13:11??LoRaSTM32F051V3(透傳)\12xx\platform\platform.h
?????目錄???????????0??2017-12-20?15:07??LoRaSTM32F051V3(透傳)\12xx\platform\stm32libs\
?????目錄???????????0??2017-12-20?15:07??LoRaSTM32F051V3(透傳)\12xx\platform\stm32libs\CMSIS\
?????目錄???????????0??2017-12-20?15:07??LoRaSTM32F051V3(透傳)\12xx\platform\stm32libs\CMSIS\CM3\
?????文件???????99832??2014-07-23?15:31??LoRaSTM32F051V3(透傳)\12xx\platform\stm32libs\CMSIS\CM3\core_cm3.h
?????文件???????17146??2014-07-23?15:31??LoRaSTM32F051V3(透傳)\12xx\platform\stm32libs\CMSIS\CM3\core_cmFunc.h
?????文件???????20513??2014-07-23?15:31??LoRaSTM32F051V3(透傳)\12xx\platform\stm32libs\CMSIS\CM3\core_cmInstr.h
?????文件??????637871??2014-07-23?15:31??LoRaSTM32F051V3(透傳)\12xx\platform\stm32libs\CMSIS\CM3\stm32f10x.h
?????文件??????492021??2014-07-23?15:31??LoRaSTM32F051V3(透傳)\12xx\platform\stm32libs\CMSIS\CM3\stm32f2xx.h
?????文件??????476018??2014-07-23?15:31??LoRaSTM32F051V3(透傳)\12xx\platform\stm32libs\CMSIS\CM3\stm32l1xx.h
?????文件???????29741??2014-07-23?15:31??LoRaSTM32F051V3(透傳)\12xx\platform\stm32libs\CMSIS\CM3\system_stm32f10x.c
............此處省略2792個文件信息
- 上一篇:程序員考試同步輔導 考點串講、真題詳解與強化訓練.pdf
- 下一篇:2.rar
評論
共有 條評論