资源简介
SX126X基于NucleoL152和NucleoL052开发板程序,程序结构清晰,配合相关文档容易上手理解。
代码片段和文件信息
/*!
* \file main.c
*
* \brief LoRaMote board USB DFU bootloader
*
* \copyright Revised BSD License see section \ref LICENSE.
*
* \code
* ______ _
* / _____) _ | |
* ( (____ _____ ____ _| |_ _____ ____| |__
* \____ \| ___ | (_ _) ___ |/ ___) _ \
* _____) ) ____| | | || |_| ____( (___| | | |
* (______/|_____)_|_|_| \__)_____)\____)_| |_|
* (C)2013-2017 Semtech
*
* \endcode
*
* \author Miguel Luis ( Semtech )
*
* \author Gregory Cristian ( Semtech )
*/
#include “board-config.h“
#include “i2c.h“
#include “gpio.h“
#include “sx9500.h“
#include “usbd_core.h“
#include “usbd_desc.h“
#include “usbd_dfu.h“
#include “usbd_dfu_flash.h“
extern PCD_HandleTypeDef hpcd;
USBD_HandleTypeDef USBD_Device;
pFunction JumpToApplication;
uint32_t JumpAddress;
/*
* Board peripherals objects
*/
Gpio_t Led1;
Gpio_t Led2;
Gpio_t Led3;
I2c_t I2c;
void SystemClockConfig( void );
static void DelayLoop( volatile uint32_t nCount )
{
volatile uint32_t index = 0;
for( index = ( 5000 * nCount ); index != 0; index-- )
{
}
}
int main( void )
{
uint8_t regValue = 0;
uint8_t status = 0;
uint16_t offset = 0;
/* STM32L1xx HAL library initialization:
- Configure the Flash prefetch
- Systick timer is configured by default as source of time base but user
can eventually implement his proper time base source (a general purpose
timer for example or other time source) keeping in mind that Time base
duration should be kept 1ms since PPP_TIMEOUT_VALUEs are defined and
handled in milliseconds basis.
- Set NVIC Group Priority to 4
- Low Level Initialization
*/
HAL_Init( );
SystemClockConfig( );
I2cInit( &I2c I2C_1 I2C_SCL I2C_SDA );
GpioInit( &Led1 LED_1 PIN_OUTPUT PIN_PUSH_PULL PIN_NO_PULL 1 );
GpioInit( &Led2 LED_2 PIN_OUTPUT PIN_PUSH_PULL PIN_NO_PULL 1 );
GpioInit( &Led3 LED_3 PIN_OUTPUT PIN_PUSH_PULL PIN_NO_PULL 1 );
// Init SAR
SX9500Init( );
DelayLoop( 100 );
SX9500Write( SX9500_REG_IRQMSK 0x10 );
SX9500Write( SX9500_REG_IRQSRC 0x10 );
do
{
SX9500Read( SX9500_REG_IRQSRC &status );
}while( ( status & 0x10 ) == 0x00 ); // While compensation for CS0 is pending
// Read 1st sensor offset
SX9500Read( SX9500_REG_OFFSETMSB ( uint8_t* )®Value );
offset = regValue << 8;
SX9500Read( SX9500_REG_OFFSETLSB ( uint8_t* )®Value );
offset |= regValue;
if( offset < 2000 )
{ /* Test if user code is programmed starting from address 0x08007000 */
if( ( ( *( volatile uint32_t* )USBD_DFU_APP_DEFAULT_ADD ) & 0x2FFE0000 ) == 0x20000000 )
{
/* Jump to user application */
JumpAddress = *( volatile uint32_t* ) ( USBD_DFU_APP_DEFAULT_ADD
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2018-04-04 07:13 SX126X-LoRaWAN-master\
文件 61 2018-04-04 07:13 SX126X-LoRaWAN-master\.gitignore
目录 0 2018-04-04 07:13 SX126X-LoRaWAN-master\.vscode\
文件 2669 2018-04-04 07:13 SX126X-LoRaWAN-master\.vscode\settings.json
文件 789 2018-04-04 07:13 SX126X-LoRaWAN-master\CMakeLists.txt
目录 0 2018-04-04 07:13 SX126X-LoRaWAN-master\Doc\
文件 512945 2018-04-04 07:13 SX126X-LoRaWAN-master\Doc\LoRaMote-schematic.pdf
文件 2025767 2018-04-04 07:13 SX126X-LoRaWAN-master\Doc\MoteII-datasheet.pdf
文件 904699 2018-04-04 07:13 SX126X-LoRaWAN-master\Doc\MoteII-schematic.pdf
文件 90921 2018-04-04 07:13 SX126X-LoRaWAN-master\Doc\NAMote72-schematic.pdf
文件 521 2018-04-04 07:13 SX126X-LoRaWAN-master\Doc\SAML21-platform.md
文件 278789 2018-04-04 07:13 SX126X-LoRaWAN-master\Doc\SX1276-Wing-Board-(03-91016-RA).pdf
文件 2020758 2018-04-04 07:13 SX126X-LoRaWAN-master\Doc\SensorNode-schematic.pdf
文件 11229 2018-04-04 07:13 SX126X-LoRaWAN-master\Doc\development-environment.md
文件 718857 2018-04-04 07:13 SX126X-LoRaWAN-master\Doc\iM880A_Datasheet.pdf
文件 802746 2018-04-04 07:13 SX126X-LoRaWAN-master\Doc\iM881A_Datasheet.pdf
文件 1343765 2018-04-04 07:13 SX126X-LoRaWAN-master\Doc\sx1261dvk1bas-e406v03a.pdf
文件 2037509 2018-04-04 07:13 SX126X-LoRaWAN-master\Doc\sx1262dvk1cas-e428v03a.pdf
文件 2104378 2018-04-04 07:13 SX126X-LoRaWAN-master\Doc\sx1262dvk1das-e449v01a.pdf
文件 168968 2018-04-04 07:13 SX126X-LoRaWAN-master\Doc\sx1272mb2das-e364v02a.pdf
文件 174250 2018-04-04 07:13 SX126X-LoRaWAN-master\Doc\sx1276mb1las-e311v02a.pdf
文件 173094 2018-04-04 07:13 SX126X-LoRaWAN-master\Doc\sx1276mb1mas-e315v01a.pdf
目录 0 2018-04-04 07:13 SX126X-LoRaWAN-master\Keil\
目录 0 2018-04-04 07:13 SX126X-LoRaWAN-master\Keil\NucleoL053\
目录 0 2018-04-04 07:13 SX126X-LoRaWAN-master\Keil\NucleoL053\LoRaMac\
目录 0 2018-04-04 07:13 SX126X-LoRaWAN-master\Keil\NucleoL053\LoRaMac\classA\
文件 107099 2018-04-04 07:13 SX126X-LoRaWAN-master\Keil\NucleoL053\LoRaMac\classA\LoRaMac.uvoptx
文件 230644 2018-04-04 07:13 SX126X-LoRaWAN-master\Keil\NucleoL053\LoRaMac\classA\LoRaMac.uvprojx
目录 0 2018-04-04 07:13 SX126X-LoRaWAN-master\Keil\NucleoL053\ping-pong\
文件 74337 2018-04-04 07:13 SX126X-LoRaWAN-master\Keil\NucleoL053\ping-pong\Ping-Pong.uvoptx
文件 86098 2018-04-04 07:13 SX126X-LoRaWAN-master\Keil\NucleoL053\ping-pong\Ping-Pong.uvprojx
............此处省略1557个文件信息
评论
共有 条评论