rel_1.6.0 init

This commit is contained in:
guocheng.kgc 2020-06-18 20:06:52 +08:00 committed by shengdong.dsd
commit 27b3e2883d
19359 changed files with 8093121 additions and 0 deletions

View file

@ -0,0 +1,158 @@
/*
/ _____) _ | |
( (____ _____ ____ _| |_ _____ ____| |__
\____ \| ___ | (_ _) ___ |/ ___) _ \
_____) ) ____| | | || |_| ____( (___| | | |
(______/|_____)_|_|_| \__)_____)\____)_| |_|
(C)2015 Semtech
Description: End device comissioning parameters
License: Revised BSD License, see LICENSE.TXT file include in the project
Maintainer: Miguel Luis and Gregory Cristian
*/
/******************************************************************************
* @file comissioning.h
* @author MCD Application Team
* @version V1.1.1
* @date 01-June-2017
* @brief End device comissioning parameters
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2017 STMicroelectronics International N.V.
* All rights reserved.</center></h2>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted, provided that the following conditions are met:
*
* 1. Redistribution of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. Neither the name of STMicroelectronics nor the names of other
* contributors to this software may be used to endorse or promote products
* derived from this software without specific written permission.
* 4. This software, including modifications and/or derivative works of this
* software, must execute solely and exclusively on microcontroller or
* microprocessor devices manufactured by or for STMicroelectronics.
* 5. Redistribution and use of this software other than as permitted under
* this license is void and will automatically terminate your rights under
* this license.
*
* THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY
* RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT
* SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
******************************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __LORA_COMISSIONING_H__
#define __LORA_COMISSIONING_H__
#ifdef __cplusplus
extern "C" {
#endif
/* Exported types ------------------------------------------------------------*/
/* Exported constants --------------------------------------------------------*/
/* External variables --------------------------------------------------------*/
/* Exported macros -----------------------------------------------------------*/
/* Exported functions ------------------------------------------------------- */
/**
* When set to 1 the application uses the Over-the-Air activation procedure
* When set to 0 the application uses the Personalization activation procedure
*/
#define OVER_THE_AIR_ACTIVATION 1
/**
* Indicates if the end-device is to be connected to a private or public network
*/
#define LORAWAN_PUBLIC_NETWORK true
/**
* When set to 1 DevEui is LORAWAN_DEVICE_EUI
* When set to 0 DevEui is automatically generated by calling
* BoardGetUniqueId function
*/
#define STATIC_DEVICE_EUI 0
/**
* Mote device IEEE EUI (big endian)
*
* \remark see STATIC_DEVICE_EUI comments
*/
#define LORAWAN_DEVICE_EUI { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 }
/**
* Application IEEE EUI (big endian)
*/
#define LORAWAN_APPLICATION_EUI { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 }
/**
* AES encryption/decryption cipher application key
*/
#define LORAWAN_APPLICATION_KEY { 0x2B, 0x7E, 0x15, 0x16, 0x28, 0xAE, 0xD2, 0xA6, 0xAB, 0xF7, 0x15, 0x88, 0x09, 0xCF, 0x4F, 0x3C }
/**
* Current network ID
*/
#define LORAWAN_NETWORK_ID ( uint32_t )0
/**
* When set to 1 DevAdd is LORAWAN_DEVICE_ADDRESS
* When set to 0 DevAdd is automatically generated using
* a pseudo random generator seeded with a value derived from
* BoardUniqueId value
*/
#define STATIC_DEVICE_ADDRESS 0
/**
* Device address on the network (big endian)
*
* \remark see STATIC_DEVICE_ADDRESS comments
*/
#define LORAWAN_DEVICE_ADDRESS ( uint32_t )0x0100000a
/**
* AES encryption/decryption cipher network session key
*/
#define LORAWAN_NWKSKEY { 0x2B, 0x7E, 0x15, 0x16, 0x28, 0xAE, 0xD2, 0xA6, 0xAB, 0xF7, 0x15, 0x88, 0x09, 0xCF, 0x4F, 0x3C }
/**
* AES encryption/decryption cipher application session key
*/
#define LORAWAN_APPSKEY { 0x2B, 0x7E, 0x15, 0x16, 0x28, 0xAE, 0xD2, 0xA6, 0xAB, 0xF7, 0x15, 0x88, 0x09, 0xCF, 0x4F, 0x3C }
/**
* Multicast address
*/
#define LORAWAN_MULTICAST_ADDRESS 0x06344bf2
/**
* AES encryption/decryption cipher network session key for multicast
*/
#define LORAWAN_MULTICAST_NWKSKEY { 0x65, 0xe4, 0x48, 0x3d, 0xe3, 0xa9, 0xce, 0xb1, 0x50, 0xd8, 0x86, 0xf3, 0x61, 0x46, 0x02, 0xb5 }
/**
* AES encryption/decryption cipher application session key for multicast
*/
#define LORAWAN_MULTICAST_APPSKEY { 0xc2, 0x65, 0x67, 0xa3, 0xec, 0xd3, 0x96, 0x67, 0xd6, 0x23, 0xf8, 0x7a, 0xe1, 0x6c, 0x12, 0x23 }
#ifdef __cplusplus
}
#endif
#endif /* __LORA_COMISSIONING_H__ */

View file

@ -0,0 +1,115 @@
/******************************************************************************
* @file debug.h
* @author MCD Application Team
* @version V1.1.1
* @date 01-June-2017
* @brief Header for driver debug.c module
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2017 STMicroelectronics International N.V.
* All rights reserved.</center></h2>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted, provided that the following conditions are met:
*
* 1. Redistribution of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. Neither the name of STMicroelectronics nor the names of other
* contributors to this software may be used to endorse or promote products
* derived from this software without specific written permission.
* 4. This software, including modifications and/or derivative works of this
* software, must execute solely and exclusively on microcontroller or
* microprocessor devices manufactured by or for STMicroelectronics.
* 5. Redistribution and use of this software other than as permitted under
* this license is void and will automatically terminate your rights under
* this license.
*
* THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY
* RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT
* SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
******************************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __DEBUG_H__
#define __DEBUG_H__
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include <string.h>
#include <stdio.h>
#include "hw_conf.h"
#include "vcom.h"
/* Exported types ------------------------------------------------------------*/
/* Exported constants --------------------------------------------------------*/
/* External variables --------------------------------------------------------*/
/* Exported macros -----------------------------------------------------------*/
#ifdef LORA_DEBUG
#define DBG_GPIO_WRITE(gpio, n, x) HW_GPIO_Write(gpio, n, (GPIO_PinState)(x))
#define DBG_GPIO_SET(gpio, n) gpio->BSRR = n
#define DBG_GPIO_RST(gpio, n) gpio->BRR = n
#define DBG_RTC_OUTPUT LL_RTC_ALARMOUT_DISABLE /* LL_RTC_ALARMOUT_ALMA on PC13 */
#define DBG(x) do { x } while (0)
#ifdef LORA_TRACE
#include "hw_rtc.h"
#define DBG_PRINTF(format, ...) do {DBG_Send("[%d][%s:%4d] " format "", HW_RTC_GetTimerValue(), __FILE__, __LINE__, ##__VA_ARGS__);}while(0==1)//DBG_Send(__VA_ARGS__)//vcom_Send(__VA_ARGS__)
#define LOG_PRINTF(format, ...) do {DBG_Send(format, HW_RTC_GetTimerValue(), ##__VA_ARGS__);}while(0==1)
#define DBG_PRINTF_CRITICAL(...)
#else /*TRACE*/
#define DBG_PRINTF(...)
#define DBG_PRINTF_CRITICAL(...)
#endif /*TRACE*/
#else /* DEBUG */
#define DBG_GPIO_WRITE(gpio, n, x)
#define DBG_GPIO_SET(gpio, n)
#define DBG_GPIO_RST(gpio, n)
#define DBG(x) do { } while (0)
#define DBG_PRINTF(...)
#define DBG_PRINTF_CRITICAL(...)
#define DBG_RTC_OUTPUT LL_RTC_ALARMOUT_DISABLE
#endif /* DEBUG */
/* Exported functions ------------------------------------------------------- */
/**
* @brief Initializes the debug
* @param None
* @retval None
*/
void DBG_Init(void);
#ifdef __cplusplus
}
#endif
#endif /* __DEBUG_H__*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View file

@ -0,0 +1,169 @@
/*
/ _____) _ | |
( (____ _____ ____ _| |_ _____ ____| |__
\____ \| ___ | (_ _) ___ |/ ___) _ \
_____) ) ____| | | || |_| ____( (___| | | |
(______/|_____)_|_|_| \__)_____)\____)_| |_|
(C)2013 Semtech
Description: contains hardaware configuration Macros and Constants
License: Revised BSD License, see LICENSE.TXT file include in the project
Maintainer: Miguel Luis and Gregory Cristian
*/
/******************************************************************************
* @file eml3047_hw_conf.h
* @author MCD Application Team
* @version V1.1.1
* @date 01-June-2017
* @brief contains hardaware configuration Macros and Constants
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2017 STMicroelectronics International N.V.
* All rights reserved.</center></h2>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted, provided that the following conditions are met:
*
* 1. Redistribution of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. Neither the name of STMicroelectronics nor the names of other
* contributors to this software may be used to endorse or promote products
* derived from this software without specific written permission.
* 4. This software, including modifications and/or derivative works of this
* software, must execute solely and exclusively on microcontroller or
* microprocessor devices manufactured by or for STMicroelectronics.
* 5. Redistribution and use of this software other than as permitted under
* this license is void and will automatically terminate your rights under
* this license.
*
* THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY
* RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT
* SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
******************************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __EML3047_HW_CONF_H__
#define __EML3047_HW_CONF_H__
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
/* Exported types ------------------------------------------------------------*/
/* Exported constants --------------------------------------------------------*/
/* LORA I/O definition */
#define RADIO_RESET_PORT GPIOB
#define RADIO_RESET_PIN GPIO_PIN_0
#define RADIO_MOSI_PORT GPIOB
#define RADIO_MOSI_PIN GPIO_PIN_5
#define RADIO_MISO_PORT GPIOB
#define RADIO_MISO_PIN GPIO_PIN_4
#define RADIO_SCLK_PORT GPIOA
#define RADIO_SCLK_PIN GPIO_PIN_5
#define RADIO_NSS_PORT GPIOA
#define RADIO_NSS_PIN GPIO_PIN_4
#define RADIO_DIO_0_PORT GPIOB
#define RADIO_DIO_0_PIN GPIO_PIN_6
#define RADIO_DIO_1_PORT GPIOA
#define RADIO_DIO_1_PIN GPIO_PIN_12
#define RADIO_DIO_2_PORT GPIOA
#define RADIO_DIO_2_PIN GPIO_PIN_11
#define RADIO_DIO_3_PORT GPIOA
#define RADIO_DIO_3_PIN GPIO_PIN_8
#ifdef RADIO_DIO_4
#define RADIO_DIO_4_PORT GPIOA
#define RADIO_DIO_4_PIN GPIO_PIN_9
#endif
#ifdef RADIO_DIO_5
#define RADIO_DIO_5_PORT GPIOC
#define RADIO_DIO_5_PIN GPIO_PIN_7
#endif
//#define RADIO_TCXO_VCC_PORT GPIOA
//#define RADIO_TCXO_VCC_PIN GPIO_PIN_12
#define RADIO_ANT_SWITCH_PORT GPIOA
#define RADIO_ANT_SWITCH_PIN GPIO_PIN_7
#define BAT_LEVEL_PORT GPIOA
#define BAT_LEVEL_PIN GPIO_PIN_4
/* SPI MACRO redefinition */
#define SPI_CLK_ENABLE() __HAL_RCC_SPI1_CLK_ENABLE()
#define SPI1_AF GPIO_AF0_SPI1
/* ADC MACRO redefinition */
#define BAT_LEVEL_PORT GPIOA //CRF2
#define BAT_LEVEL_PIN GPIO_PIN_4
#define ADC_READ_CHANNEL ADC_CHANNEL_4
#define ADCCLK_ENABLE() __HAL_RCC_ADC1_CLK_ENABLE();
#define ADCCLK_DISABLE() __HAL_RCC_ADC1_CLK_DISABLE();
/* --------------------------- RTC HW definition -------------------------------- */
#define RTC_OUTPUT DBG_RTC_OUTPUT
#define RTC_Alarm_IRQn RTC_IRQn
/* --------------------------- UART HW definition -------------------------------*/
/* Definition for UARTx clock resources */
#define UARTX LPUART1
#define UARTX_CLK_ENABLE() LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_LPUART1)
#define UARTX_RX_GPIO_CLK_ENABLE() LL_IOP_GRP1_EnableClock(RCC_IOPENR_GPIOBEN)
#define UARTX_TX_GPIO_CLK_ENABLE() LL_IOP_GRP1_EnableClock(RCC_IOPENR_GPIOBEN)
#define UARTX_FORCE_RESET() LL_APB1_GRP1_ForceReset(LL_APB1_GRP1_PERIPH_LPUART1)
#define UARTX_RELEASE_RESET() LL_APB1_GRP1_ReleaseReset(LL_APB1_GRP1_PERIPH_LPUART1)
#define UARTX_TX_PIN GPIO_PIN_2
#define UARTX_TX_GPIO_PORT GPIOA
#define UARTX_TX_AF GPIO_AF6_LPUART1
#define UARTX_RX_PIN GPIO_PIN_3
#define UARTX_RX_GPIO_PORT GPIOA
#define UARTX_RX_AF GPIO_AF6_LPUART1
/* Definition for USARTx's NVIC */
#define UARTX_IRQn LPUART1_IRQn
#define UARTX_IRQHandler LPUART1_IRQHandler
#ifdef __cplusplus
}
#endif
#endif /* __32L082MLM_HW_CONF_H__ */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View file

@ -0,0 +1,117 @@
/*
/ _____) _ | |
( (____ _____ ____ _| |_ _____ ____| |__
\____ \| ___ | (_ _) ___ |/ ___) _ \
_____) ) ____| | | || |_| ____( (___| | | |
(______/|_____)_|_|_| \__)_____)\____)_| |_|
(C)2013 Semtech
Description: Bleeper board GPIO driver implementation
License: Revised BSD License, see LICENSE.TXT file include in the project
Maintainer: Miguel Luis and Gregory Cristian
*/
/******************************************************************************
* @file mlm32l0xx_it.h
* @author MCD Application Team
* @version V1.1.1
* @date 01-June-2017
* @brief manages interupt
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2017 STMicroelectronics International N.V.
* All rights reserved.</center></h2>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted, provided that the following conditions are met:
*
* 1. Redistribution of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. Neither the name of STMicroelectronics nor the names of other
* contributors to this software may be used to endorse or promote products
* derived from this software without specific written permission.
* 4. This software, including modifications and/or derivative works of this
* software, must execute solely and exclusively on microcontroller or
* microprocessor devices manufactured by or for STMicroelectronics.
* 5. Redistribution and use of this software other than as permitted under
* this license is void and will automatically terminate your rights under
* this license.
*
* THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY
* RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT
* SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
******************************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __32L082MLM_IT_H__
#define __32L082MLM_IT_H__
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
/* Exported types ------------------------------------------------------------*/
/* Exported constants --------------------------------------------------------*/
/* Exported macro ------------------------------------------------------------*/
/* Exported functions ------------------------------------------------------- */
/**
* @brief RTC IRQ Handler on the RTC Alarm
* @param None
* @retval None
*/
void RTC_IRQHandler(void);
/**
* @brief Handles External lines 0 to 1 interrupt request.
* @param None
* @retval None
*/
void EXTI0_1_IRQHandler(void);
/**
* @brief Handles External lines 2 to 3 interrupt request.
* @param None
* @retval None
*/
void EXTI2_3_IRQHandler(void);
/**
* @brief Handles External lines 4 to 15 interrupt request.
* @param None
* @retval None
*/
void EXTI4_15_IRQHandler(void);
/**
* @brief vcom IRQ Handler
* @param None
* @retval None
*/
void UARTX_IRQHandler(void);
#ifdef __cplusplus
}
#endif
#endif /* __32L082MLM_IT_H__ */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View file

@ -0,0 +1,109 @@
/*
/ _____) _ | |
( (____ _____ ____ _| |_ _____ ____| |__
\____ \| ___ | (_ _) ___ |/ ___) _ \
_____) ) ____| | | || |_| ____( (___| | | |
(______/|_____)_|_|_| \__)_____)\____)_| |_|
(C)2013 Semtech
Description: contains all hardware driver
License: Revised BSD License, see LICENSE.TXT file include in the project
Maintainer: Miguel Luis and Gregory Cristian
*/
/******************************************************************************
* @file hw.h
* @author MCD Application Team
* @version V1.1.1
* @date 01-June-2017
* @brief contains all hardware driver
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2017 STMicroelectronics International N.V.
* All rights reserved.</center></h2>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted, provided that the following conditions are met:
*
* 1. Redistribution of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. Neither the name of STMicroelectronics nor the names of other
* contributors to this software may be used to endorse or promote products
* derived from this software without specific written permission.
* 4. This software, including modifications and/or derivative works of this
* software, must execute solely and exclusively on microcontroller or
* microprocessor devices manufactured by or for STMicroelectronics.
* 5. Redistribution and use of this software other than as permitted under
* this license is void and will automatically terminate your rights under
* this license.
*
* THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY
* RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT
* SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
******************************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __HW_H__
#define __HW_H__
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include <math.h>
#include <stdbool.h>
#include <stdint.h>
#include "hw_conf.h"
#include "hw_gpio.h"
#include "hw_spi.h"
#include "hw_rtc.h"
#include "hw_msp.h"
#include "debug.h"
#include "vcom.h"
typedef enum
{
HW_UNLOCKED = 0x00U,
HW_LOCKED = 0x01U
} HW_LockTypeDef;
#define HW_LOCK(__HANDLE__) \
do { \
if ((__HANDLE__)->Lock == HW_LOCKED) \
{ \
return; \
} \
else \
{ \
(__HANDLE__)->Lock = HW_LOCKED; \
} \
} while (0)
#define HW_UNLOCK(__HANDLE__) \
do { \
(__HANDLE__)->Lock = HW_UNLOCKED; \
} while (0)
#ifdef __cplusplus
}
#endif
#endif /* __HW_H__ */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View file

@ -0,0 +1,117 @@
/*
/ _____) _ | |
( (____ _____ ____ _| |_ _____ ____| |__
\____ \| ___ | (_ _) ___ |/ ___) _ \
_____) ) ____| | | || |_| ____( (___| | | |
(______/|_____)_|_|_| \__)_____)\____)_| |_|
(C)2013 Semtech
Description: contains hardaware configuration Macros and Constants
License: Revised BSD License, see LICENSE.TXT file include in the project
Maintainer: Miguel Luis and Gregory Cristian
*/
/******************************************************************************
* @file hw_conf.h
* @author MCD Application Team
* @version V1.1.1
* @date 01-June-2017
* @brief contains hardware configuration Macros and Constants
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2017 STMicroelectronics International N.V.
* All rights reserved.</center></h2>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted, provided that the following conditions are met:
*
* 1. Redistribution of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. Neither the name of STMicroelectronics nor the names of other
* contributors to this software may be used to endorse or promote products
* derived from this software without specific written permission.
* 4. This software, including modifications and/or derivative works of this
* software, must execute solely and exclusively on microcontroller or
* microprocessor devices manufactured by or for STMicroelectronics.
* 5. Redistribution and use of this software other than as permitted under
* this license is void and will automatically terminate your rights under
* this license.
*
* THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY
* RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT
* SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
******************************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __HW_CONF_H__
#define __HW_CONF_H__
#ifdef __cplusplus
extern "C" {
#endif
#if !defined(USE_FULL_LL_DRIVER)
#error USE_FULL_LL_DRIVER must be defined
#endif
#if !defined(USE_B_EML3047)
#error Only USE_32L082MLM_DISCO is supported
#endif
/* Includes ------------------------------------------------------------------*/
#include "stm32l0xx_ll_adc.h"
#include "stm32l0xx_ll_bus.h"
#include "stm32l0xx_ll_cortex.h"
#include "stm32l0xx_ll_exti.h"
#include "stm32l0xx_ll_gpio.h"
#include "stm32l0xx_ll_pwr.h"
#include "stm32l0xx_ll_rcc.h"
#include "stm32l0xx_ll_rtc.h"
#include "stm32l0xx_ll_spi.h"
#include "stm32l0xx_ll_system.h"
#include "stm32l0xx_ll_lpuart.h"
#include "stm32l0xx_ll_usart.h"
#include "eml3047_hw_conf.h"
#ifdef USE_FULL_ASSERT
#include "stm32_assert.h"
#else
#define assert_param(expr) ((void)0U)
#endif
/* --------Preprocessor compile swicth------------ */
/* debug swicthes in debug.h */
#ifdef CONFIG_LINKWAN_AT
#define LORA_DEBUG
#define LORA_TRACE
#endif
/* uncomment below line to never enter lowpower modes in main.c*/
/* #define LOW_POWER_DISABLE */
/* Exported types ------------------------------------------------------------*/
/* Exported constants --------------------------------------------------------*/
#ifdef __cplusplus
}
#endif
#endif /* __HW_CONF_H__ */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View file

@ -0,0 +1,203 @@
/*
/ _____) _ | |
( (____ _____ ____ _| |_ _____ ____| |__
\____ \| ___ | (_ _) ___ |/ ___) _ \
_____) ) ____| | | || |_| ____( (___| | | |
(______/|_____)_|_|_| \__)_____)\____)_| |_|
(C)2013 Semtech
Description: Bleeper board GPIO driver implementation
License: Revised BSD License, see LICENSE.TXT file include in the project
Maintainer: Miguel Luis and Gregory Cristian
*/
/******************************************************************************
* @file hw_gpio.h
* @author MCD Application Team
* @version V1.1.1
* @date 01-June-2017
* @brief Header for driver hw_rtc.c module
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2017 STMicroelectronics International N.V.
* All rights reserved.</center></h2>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted, provided that the following conditions are met:
*
* 1. Redistribution of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. Neither the name of STMicroelectronics nor the names of other
* contributors to this software may be used to endorse or promote products
* derived from this software without specific written permission.
* 4. This software, including modifications and/or derivative works of this
* software, must execute solely and exclusively on microcontroller or
* microprocessor devices manufactured by or for STMicroelectronics.
* 5. Redistribution and use of this software other than as permitted under
* this license is void and will automatically terminate your rights under
* this license.
*
* THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY
* RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT
* SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
******************************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __HW_GPIO_H__
#define __HW_GPIO_H__
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "stm32l0xx_ll_gpio.h"
/*
* Force the include of HAL GPIO in order to benefit from enum and structure
* definition which are used in LoRa modules
* Note that the code size is slighty increased by about 40 bytes on classA application because
* "Pin" of structure "GPIO_InitTypeDef" is not used in our HW_GPIO_xxx() implementation
*/
#include "stm32l0xx_hal_gpio.h"
#include "stm32l0xx_hal_gpio_ex.h"
/* Exported types ------------------------------------------------------------*/
typedef void ( GpioIrqHandler )(void);
/* Exported constants --------------------------------------------------------*/
/* External variables --------------------------------------------------------*/
/* Exported macros -----------------------------------------------------------*/
/* Exported functions ------------------------------------------------------- */
/**
* @brief Initializes the given GPIO object
*
* @param GPIOx: where x can be (A..E and H)
* @param GPIO_Pin: specifies the port bit to be written.
* This parameter can be one of GPIO_PIN_x where x can be (0..15).
* All port bits are not necessarily available on all GPIOs.
* @param [IN] initStruct GPIO_InitTypeDef intit structure
* @retval None
*/
void HW_GPIO_Init(GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin, GPIO_InitTypeDef *initStruct);
/**
* @brief De-initializes the GPIOx peripheral registers to their default reset values.
* @param GPIOx: where x can be (A..E and H) to select the GPIO peripheral for STM32L0XX family devices.
* Note that GPIOE is not available on all devices.
* @param GPIO_Pin: specifies the port bit to be written.
* This parameter can be one of GPIO_PIN_x where x can be (0..15).
* All port bits are not necessarily available on all GPIOs.
* @retval None
* @note this is an implementation of HAL_GPIO_DeInit() using LL
*/
void HW_GPIO_DeInit(GPIO_TypeDef *GPIOx, uint32_t GPIO_Pin);
/**
* @brief This function handles EXTI interrupt request.
* @param GPIO_Pin: Specifies the pins connected to the EXTI line.
* @retval None
* @note this is an implementation of HAL_GPIO_EXTI_IRQHandler() using LL
*/
void HW_GPIO_EXTI_IRQHandler(uint16_t GPIO_Pin);
/**
* @brief Records the interrupt handler for the GPIO object
*
* @param GPIOx: where x can be (A..E and H)
* @param GPIO_Pin: specifies the port bit to be written.
* This parameter can be one of GPIO_PIN_x where x can be (0..15).
* All port bits are not necessarily available on all GPIOs.
* @param [IN] prio NVIC priority (0 is highest)
* @param [IN] irqHandler points to the function to execute
* @retval None
*/
void HW_GPIO_SetIrq(GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin, uint32_t prio, GpioIrqHandler *irqHandler);
/**
* @brief Execute the interrupt from the object
*
* @param GPIOx: where x can be (A..E and H)
* @param GPIO_Pin: specifies the port bit to be written.
* This parameter can be one of GPIO_PIN_x where x can be (0..15).
* All port bits are not necessarily available on all GPIOs.
* @retval None
*/
void HW_GPIO_IrqHandler(uint16_t GPIO_Pin);
/**
* @brief Writes the given value to the GPIO output
*
* @param GPIO_Pin: specifies the port bit to be written.
* This parameter can be one of GPIO_PIN_x where x can be (0..15).
* All port bits are not necessarily available on all GPIOs.
* @param [IN] value New GPIO output value
* @retval None
*/
__STATIC_INLINE void HW_GPIO_Write(GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin, uint32_t value)
{
/*
* Function HAL_GPIO_WritePin is inlined using LL Driver. It saves code size
* as the value to set is known at compile time most of the time
*/
if (value != RESET)
{
LL_GPIO_SetOutputPin(GPIOx, GPIO_Pin);
}
else
{
LL_GPIO_ResetOutputPin(GPIOx, GPIO_Pin);
}
}
/**
* @brief Reads the current GPIO input value
*
* @param GPIOx: where x can be (A..E and H)
* @param GPIO_Pin: specifies the port bit to be written.
* This parameter can be one of GPIO_PIN_x where x can be (0..15).
* All port bits are not necessarily available on all GPIOs.
* @retval value Current GPIO input value
*/
uint32_t HW_GPIO_Read(GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin);
/**
* @brief Toggles the specified GPIO pins.
* @param GPIOx: Where x can be (A..E and H) to select the GPIO peripheral for STM32L0xx family devices.
* Note that GPIOE is not available on all devices.
* All port bits are not necessarily available on all GPIOs.
* @param GPIO_Pin: Specifies the pins to be toggled.
* @retval None
*/
__STATIC_INLINE void HW_GPIO_TogglePin(GPIO_TypeDef *GPIOx, uint32_t PinMask)
{
LL_GPIO_TogglePin(GPIOx, PinMask);
}
#ifdef __cplusplus
}
#endif
#endif /* __HW_GPIO_H__ */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View file

@ -0,0 +1,214 @@
/*
/ _____) _ | |
( (____ _____ ____ _| |_ _____ ____| |__
\____ \| ___ | (_ _) ___ |/ ___) _ \
_____) ) ____| | | || |_| ____( (___| | | |
(______/|_____)_|_|_| \__)_____)\____)_| |_|
(C)2013 Semtech
Description: Header for driver hw msp module
License: Revised BSD License, see LICENSE.TXT file include in the project
Maintainer: Miguel Luis and Gregory Cristian
*/
/******************************************************************************
* @file hw_msp.h
* @author MCD Application Team
* @version V1.1.1
* @date 01-June-2017
* @brief Header for driver hw msp module
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2017 STMicroelectronics International N.V.
* All rights reserved.</center></h2>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted, provided that the following conditions are met:
*
* 1. Redistribution of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. Neither the name of STMicroelectronics nor the names of other
* contributors to this software may be used to endorse or promote products
* derived from this software without specific written permission.
* 4. This software, including modifications and/or derivative works of this
* software, must execute solely and exclusively on microcontroller or
* microprocessor devices manufactured by or for STMicroelectronics.
* 5. Redistribution and use of this software other than as permitted under
* this license is void and will automatically terminate your rights under
* this license.
*
* THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY
* RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT
* SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
******************************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __HW_MSP_H__
#define __HW_MSP_H__
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "hw_conf.h"
/* Exported types ------------------------------------------------------------*/
typedef enum
{
e_LOW_POWER_RTC = (1 << 0),
e_LOW_POWER_GPS = (1 << 1),
e_LOW_POWER_UART = (1 << 2), /* can be used to forbid stop mode in case of uart Xfer*/
} e_LOW_POWER_State_Id_t;
/* Exported constants --------------------------------------------------------*/
#define VDDA_VREFINT_CAL ((uint32_t) 3000)
#define BAT_CR2032 ((uint32_t) 3000)
#define VDD_BAT BAT_CR2032
#define VDD_MIN 1800
/* External variables --------------------------------------------------------*/
/* Exported macros -----------------------------------------------------------*/
/**
* @brief GPIOs Macro
*/
#define RCC_GPIO_CLK_ENABLE(__GPIO_PORT__) \
do { \
switch (__GPIO_PORT__) \
{ \
case GPIOA_BASE: LL_IOP_GRP1_EnableClock(LL_IOP_GRP1_PERIPH_GPIOA); break; \
case GPIOB_BASE: LL_IOP_GRP1_EnableClock(LL_IOP_GRP1_PERIPH_GPIOB); break; \
case GPIOC_BASE: LL_IOP_GRP1_EnableClock(LL_IOP_GRP1_PERIPH_GPIOC); break; \
case GPIOD_BASE: LL_IOP_GRP1_EnableClock(LL_IOP_GRP1_PERIPH_GPIOD); break; \
case GPIOH_BASE: default: LL_IOP_GRP1_EnableClock(LL_IOP_GRP1_PERIPH_GPIOH); \
} \
} while (0)
#define RCC_GPIO_CLK_DISABLE(__GPIO_PORT__) \
do { \
switch (__GPIO_PORT__) \
{ \
case GPIOA_BASE: LL_IOP_GRP1_DisableClock(LL_IOP_GRP1_PERIPH_GPIOA); break; \
case GPIOB_BASE: LL_IOP_GRP1_DisableClock(LL_IOP_GRP1_PERIPH_GPIOB); break; \
case GPIOC_BASE: LL_IOP_GRP1_DisableClock(LL_IOP_GRP1_PERIPH_GPIOC); break; \
case GPIOD_BASE: LL_IOP_GRP1_DisableClock(LL_IOP_GRP1_PERIPH_GPIOD); break; \
case GPIOH_BASE: default: LL_IOP_GRP1_DisableClock(LL_IOP_GRP1_PERIPH_GPIOH); \
} \
} while (0)
/* Exported functions ------------------------------------------------------- */
/**
* @brief This function return the battery level
* @param None
* @retval The battery level 0 (very low) to 254 (fully charged)
*/
uint8_t HW_GetBatteryLevel(void);
/**
* @brief Initializes the boards peripherals.
* @param None
* @retval None
*/
void HW_Init(void);
/**
* @brief De-initializes the target board peripherals to decrease power consumption.
* @param None
* @retval None
*/
void HW_DeInit(void);
/**
* @brief This function return a random seed
* @note Based on the device unique ID
* @param None
* @retval Unique number, used as a random seed
*/
uint32_t HW_GetRandomSeed(void);
/**
* @brief Gets the board 64 bits unique ID
* @param Pointer to an array that will contain the Unique ID
* @retval None
*/
void HW_GetUniqueId(uint8_t *id);
/**
* @brief Enters Low Power Stop Mode
* @note ARM exists the function when waking up
* @param None
* @retval None
*/
void HW_EnterStopMode(void);
/**
* @brief Exit Low Power Stop Mode
* @note Enable the pll at 32MHz
* @param None
* @retval None
*/
void HW_ExitStopMode(void);
/**
* @brief Enters Low Power Sleep Mode
* @note ARM exists the function when waking up
* @param None
* @retval None
*/
void HW_EnterSleepMode(void);
/**
* @brief Configures the sytem Clock at start-up, as follow :
* System Clock source = PLL (HSI)
* SYSCLK(Hz) = 32000000
* HCLK(Hz) = 32000000
* AHB Prescaler = 1
* APB1 Prescaler = 1
* APB2 Prescaler = 1
* HSI Frequency(Hz) = 16000000
* PLLMUL = 6
* PLLDIV = 3
* Flash Latency(WS) = 1
* @param None
* @retval None
*/
void SystemClock_Config(void);
/**
* @brief Configure all GPIO's to Analog input to reduce the power consumption
* @param None
* @retval None
*/
void HW_GpioInit(void);
void SYS_LED_OFF(void);
void SYS_LED_ON(void);
#ifdef __cplusplus
}
#endif
#endif /* __HW_MSP_H__ */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View file

@ -0,0 +1,177 @@
/*
/ _____) _ | |
( (____ _____ ____ _| |_ _____ ____| |__
\____ \| ___ | (_ _) ___ |/ ___) _ \
_____) ) ____| | | || |_| ____( (___| | | |
(______/|_____)_|_|_| \__)_____)\____)_| |_|
(C)2013 Semtech
Description: Bleeper board GPIO driver implementation
License: Revised BSD License, see LICENSE.TXT file include in the project
Maintainer: Miguel Luis and Gregory Cristian
*/
/******************************************************************************
* @file hw_rtc.h
* @author MCD Application Team
* @version V1.1.1
* @date 01-June-2017
* @brief Header for driver hw_rtc.c module
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2017 STMicroelectronics International N.V.
* All rights reserved.</center></h2>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted, provided that the following conditions are met:
*
* 1. Redistribution of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. Neither the name of STMicroelectronics nor the names of other
* contributors to this software may be used to endorse or promote products
* derived from this software without specific written permission.
* 4. This software, including modifications and/or derivative works of this
* software, must execute solely and exclusively on microcontroller or
* microprocessor devices manufactured by or for STMicroelectronics.
* 5. Redistribution and use of this software other than as permitted under
* this license is void and will automatically terminate your rights under
* this license.
*
* THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY
* RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT
* SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
******************************************************************************
*/
#ifndef __HW_RTC_H__
#define __HW_RTC_H__
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "utilities.h"
/* Exported types ------------------------------------------------------------*/
/* Exported constants --------------------------------------------------------*/
/* External variables --------------------------------------------------------*/
/* Exported macros -----------------------------------------------------------*/
/* Exported functions ------------------------------------------------------- */
/**
* @brief Initializes the RTC timer
* @note The timer is based on the RTC
* @param None
* @retval None
*/
void HW_RTC_Init(void);
/**
* @brief Stop the Alarm
* @param None
* @retval None
*/
void HW_RTC_StopAlarm(void);
/**
* @brief Return the minimum timeout the RTC is able to handle
* @param None
* @retval Minimum value for a timeout
*/
uint32_t HW_RTC_GetMinimumTimeout(void);
/**
* @brief Set the alarm
* @note The alarm is set at now (read in this funtion) + timeout
* @param Timeout Duration of the Timer ticks
* @retval None
*/
void HW_RTC_SetAlarm(uint32_t timeout);
/**
* @brief Get the RTC timer elapsed time since the last Alarm was set
* @param None
* @retval RTC Elapsed time in ticks
*/
uint32_t HW_RTC_GetTimerElapsedTime(void);
/**
* @brief Get the RTC timer value
* @param None
* @retval RTC Timer value in ticks
*/
uint32_t HW_RTC_GetTimerValue(void);
/**
* @brief Set the RTC timer Reference
* @param None
* @retval Timer Reference Value in Ticks
*/
uint32_t HW_RTC_SetTimerContext(void);
/**
* @brief Get the RTC timer Reference
* @param None
* @retval Timer Value in Ticks
*/
uint32_t HW_RTC_GetTimerContext(void);
/**
* @brief RTC IRQ Handler on the RTC Alarm
* @param None
* @retval None
*/
void HW_RTC_IrqHandler(void);
/**
* @brief Delay of delay ms by polling RTC
* @param Delay in ms
* @retval None
*/
void HW_RTC_DelayMs(uint32_t delay);
/**
* @brief Calculates the wake up time between wake up and mcu start
* @note Resolution in RTC_ALARM_TIME_BASE
* @param None
* @retval None
*/
void HW_RTC_setMcuWakeUpTime(void);
/**
* @brief Converts time in ms to time in ticks
* @param Time in milliseconds
* @retval Returns time in timer ticks
*/
uint32_t HW_RTC_ms2Tick(TimerTime_t timeMicroSec);
/**
* @brief Converts time in ticks to time in ms
* @param Time in timer ticks
* @retval Time in timer milliseconds
*/
TimerTime_t HW_RTC_Tick2ms(uint32_t tick);
#ifdef __cplusplus
}
#endif
#endif /* __HW_RTC_H__ */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View file

@ -0,0 +1,134 @@
/*
/ _____) _ | |
( (____ _____ ____ _| |_ _____ ____| |__
\____ \| ___ | (_ _) ___ |/ ___) _ \
_____) ) ____| | | || |_| ____( (___| | | |
(______/|_____)_|_|_| \__)_____)\____)_| |_|
(C)2013 Semtech
Description: Header for driver hw spi module
License: Revised BSD License, see LICENSE.TXT file include in the project
Maintainer: Miguel Luis and Gregory Cristian
*/
/******************************************************************************
* @file hw_spi.h
* @author MCD Application Team
* @version V1.1.1
* @date 01-June-2017
* @brief Header for driver hw_spi.c module
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2017 STMicroelectronics International N.V.
* All rights reserved.</center></h2>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted, provided that the following conditions are met:
*
* 1. Redistribution of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. Neither the name of STMicroelectronics nor the names of other
* contributors to this software may be used to endorse or promote products
* derived from this software without specific written permission.
* 4. This software, including modifications and/or derivative works of this
* software, must execute solely and exclusively on microcontroller or
* microprocessor devices manufactured by or for STMicroelectronics.
* 5. Redistribution and use of this software other than as permitted under
* this license is void and will automatically terminate your rights under
* this license.
*
* THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY
* RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT
* SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
******************************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __HW_SPI_H__
#define __HW_SPI_H__
#ifdef __cplusplus
extern "C" {
#endif
#include "hw_conf.h"
/* Exported types ------------------------------------------------------------*/
/* Exported constants --------------------------------------------------------*/
/* External variables --------------------------------------------------------*/
/* Exported macros -----------------------------------------------------------*/
/* Exported functions ------------------------------------------------------- */
/**
* @brief Initializes the SPI object and MCU peripheral
*
* @param [IN] None
* @retval None
*/
void HW_SPI_Init(void);
/**
* @brief De-initializes the SPI object and MCU peripheral
*
* @param [IN] None
* @retval None
*/
void HW_SPI_DeInit(void);
/**
* @brief Initializes the SPI IOs
*
* @param [IN] None
* @retval None
*/
void HW_SPI_IoInit(void);
/**
* @brief De-initializes the SPI IOs
*
* @param [IN] None
* @retval None
*/
void HW_SPI_IoDeInit(void);
/**
* @brief Sends outData and receives inData
*
* @param [IN] outData Byte to be sent
* @retval inData Received byte.
* @note This is an implementation of
* HAL_SPI_TransmitReceive(&hspi, (uint8_t *)&txData, (uint8_t*)&rxData, 1, HAL_MAX_DELAY);
*/
uint16_t HW_SPI_InOut(uint16_t outData);
#ifdef __cplusplus
}
#endif
#endif /* __HW_SPI_H__ */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View file

@ -0,0 +1,252 @@
/*
/ _____) _ | |
( (____ _____ ____ _| |_ _____ ____| |__
\____ \| ___ | (_ _) ___ |/ ___) _ \
_____) ) ____| | | || |_| ____( (___| | | |
(______/|_____)_|_|_| \__)_____)\____)_| |_|
(C)2013 Semtech
Description: LoRaMac classA device implementation
License: Revised BSD License, see LICENSE.TXT file include in the project
Maintainer: Miguel Luis, Gregory Cristian and Wael Guibene
*/
/******************************************************************************
* @file lora.h
* @author MCD Application Team
* @version V1.1.1
* @date 01-June-2017
* @brief lora API to drive the lora state Machine
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2017 STMicroelectronics International N.V.
* All rights reserved.</center></h2>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted, provided that the following conditions are met:
*
* 1. Redistribution of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. Neither the name of STMicroelectronics nor the names of other
* contributors to this software may be used to endorse or promote products
* derived from this software without specific written permission.
* 4. This software, including modifications and/or derivative works of this
* software, must execute solely and exclusively on microcontroller or
* microprocessor devices manufactured by or for STMicroelectronics.
* 5. Redistribution and use of this software other than as permitted under
* this license is void and will automatically terminate your rights under
* this license.
*
* THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY
* RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT
* SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
******************************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __LORA_MAIN_H__
#define __LORA_MAIN_H__
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "Comissioning.h"
#include "LoRaMac.h"
#include "region/Region.h"
/* Exported constants --------------------------------------------------------*/
/* Exported types ------------------------------------------------------------*/
/*!
* Application Data structure
*/
typedef struct
{
/*point to the LoRa App data buffer*/
uint8_t* Buff;
/*LoRa App data buffer size*/
uint8_t BuffSize;
/*Port on which the LoRa App is data is sent/ received*/
uint8_t Port;
} lora_AppData_t;
/*!
* LoRa State Machine states
*/
typedef enum eDevicState
{
DEVICE_STATE_INIT,
DEVICE_STATE_JOIN,
DEVICE_STATE_JOINED,
DEVICE_STATE_SEND,
DEVICE_STATE_CYCLE,
DEVICE_STATE_SLEEP
} DeviceState_t;
/*!
* LoRa State Machine states
*/
typedef enum eTxEventType
{
/*!
* @brief AppdataTransmition issue based on timer every TxDutyCycleTime
*/
TX_ON_TIMER,
/*!
* @brief AppdataTransmition external event plugged on OnSendEvent( )
*/
TX_ON_EVENT
} TxEventType_t;
/*!
* LoRa State Machine states
*/
typedef struct sLoRaParam
{
/*!
* @brief Event type
*
* @retval value battery level ( 0: very low, 254: fully charged )
*/
TxEventType_t TxEvent;
/*!
* @brief Application data transmission duty cycle in ms
*
* @note when TX_ON_TIMER Event type is selected
*/
uint32_t TxDutyCycleTime;
/*!
* @brief LoRaWAN device class
*/
DeviceClass_t Class;
/*!
* @brief Activation state of adaptativeDatarate
*/
bool AdrEnable;
/*!
* @brief Uplink datarate, if AdrEnable is off
*/
int8_t TxDatarate;
/*!
* @brief Enable or disable a public network
*
*/
bool EnablePublicNetwork;
/*!
* @brief Number of trials for the join request.
*/
uint8_t NbTrials;
} LoRaParam_t;
/* Lora Main callbacks*/
typedef struct sLoRaMainCallback
{
/*!
* @brief Get the current battery level
*
* @retval value battery level ( 0: very low, 254: fully charged )
*/
uint8_t ( *BoardGetBatteryLevel )( void );
/*!
* @brief Gets the board 64 bits unique ID
*
* @param [IN] id Pointer to an array that will contain the Unique ID
*/
void ( *BoardGetUniqueId ) ( uint8_t *id);
/*!
* Returns a pseudo random seed generated using the MCU Unique ID
*
* @retval seed Generated pseudo random seed
*/
uint32_t ( *BoardGetRandomSeed ) (void);
/*!
* @brief Prepares Tx Data to be sent on Lora network
*
* @param [IN] AppData is a buffer to fill
*
* @param [IN] port is a Application port on wicth Appdata will be sent
*
* @param [IN] length of the AppDataBuffer to send
*
* @param [IN] requests a confirmed Frame from the Network
*/
void ( *LoraTxData ) ( lora_AppData_t *AppData, FunctionalState* IsTxConfirmed);
/*!
* @brief Process Rx Data received from Lora network
*
* @param [IN] AppData is a buffer to process
*
* @param [IN] port is a Application port on wicth Appdata will be sent
*
* @param [IN] length is the number of recieved bytes
*/
void ( *LoraRxData ) ( lora_AppData_t *AppData);
} LoRaMainCallback_t;
/* External variables --------------------------------------------------------*/
/* Exported macros -----------------------------------------------------------*/
/* Exported functions ------------------------------------------------------- */
/**
* @brief Lora Initialisation
* @param [IN] LoRaMainCallback_t
* @param [IN] application parmaters
* @retval none
*/
void lora_Init (LoRaMainCallback_t *callbacks, LoRaParam_t* LoRaParam );
/**
* @brief run Lora classA state Machine
* @param [IN] none
* @retval none
*/
void lora_fsm( void );
/**
* @brief functionl requesting loRa state machine to send data
* @note function to link in mode TX_ON_EVENT
* @param none
* @retval none
*/
void OnSendEvent( void );
/**
* @brief API returns the state of the lora state machine
* @note return @DeviceState_t state
* @param [IN] none
* @retval return @FlagStatus
*/
DeviceState_t lora_getDeviceState( void );
#ifdef __cplusplus
}
#endif
#endif /*__LORA_MAIN_H__*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View file

@ -0,0 +1,35 @@
/*
* Copyright (C) 2015-2017 Alibaba Group Holding Limited
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __LORAWAN_PORT_H__
#define __LORAWAN_PORT_H__
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include <string.h>
#include <stdio.h>
#include "hal/lorawan.h"
#include "utilities.h"
#include <k_api.h>
typedef uint32_t time_ms_t;
typedef uint32_t time_tick_t;
extern hal_lrwan_dev_chg_mode_t aos_lrwan_chg_mode;
extern hal_lrwan_time_itf_t aos_lrwan_time_itf;
extern hal_lrwan_radio_ctrl_t aos_lrwan_radio_ctrl;
#ifdef __cplusplus
}
#endif
#endif /* lorawan_port.h */

View file

@ -0,0 +1,322 @@
/**
******************************************************************************
* @file stm32l0xx_hal_conf.h
* @author MCD Application Team
* @version V1.1.1
* @date 01-June-2017
* @brief HAL configuration file.
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2017 STMicroelectronics International N.V.
* All rights reserved.</center></h2>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted, provided that the following conditions are met:
*
* 1. Redistribution of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. Neither the name of STMicroelectronics nor the names of other
* contributors to this software may be used to endorse or promote products
* derived from this software without specific written permission.
* 4. This software, including modifications and/or derivative works of this
* software, must execute solely and exclusively on microcontroller or
* microprocessor devices manufactured by or for STMicroelectronics.
* 5. Redistribution and use of this software other than as permitted under
* this license is void and will automatically terminate your rights under
* this license.
*
* THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY
* RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT
* SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
******************************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __STM32L0xx_HAL_CONF_H__
#define __STM32L0xx_HAL_CONF_H__
#ifdef __cplusplus
extern "C" {
#endif
#include "stm32l0xx_hal_def.h"
/* Exported types ------------------------------------------------------------*/
/* Exported constants --------------------------------------------------------*/
/* ########################## Module Selection ############################## */
/**
* @brief This is the list of modules to be used in the HAL driver
*/
#define HAL_MODULE_ENABLED
#define HAL_ADC_MODULE_ENABLED
/* #define HAL_COMP_MODULE_ENABLED */
/* #define HAL_CRC_MODULE_ENABLED */
/* #define HAL_CRYP_MODULE_ENABLED */
/* #define HAL_DAC_MODULE_ENABLED */
#define HAL_DMA_MODULE_ENABLED
#define HAL_FLASH_MODULE_ENABLED
#define HAL_GPIO_MODULE_ENABLED
/* #define HAL_I2C_MODULE_ENABLED */
/* #define HAL_I2S_MODULE_ENABLED */
/* #define HAL_IWDG_MODULE_ENABLED */
/* #define HAL_LCD_MODULE_ENABLED */
/* #define HAL_LPTIM_MODULE_ENABLED */
#define HAL_PWR_MODULE_ENABLED
#define HAL_RCC_MODULE_ENABLED
/* #define HAL_RNG_MODULE_ENABLED */
#define HAL_RTC_MODULE_ENABLED
#define HAL_SPI_MODULE_ENABLED
/* #define HAL_TIM_MODULE_ENABLED */
/* #define HAL_TSC_MODULE_ENABLED */
#define HAL_UART_MODULE_ENABLED
/* #define HAL_USART_MODULE_ENABLED */
/* #define HAL_IRDA_MODULE_ENABLED */
/* #define HAL_SMARTCARD_MODULE_ENABLED */
/* #define HAL_SMBUS_MODULE_ENABLED */
/* #define HAL_WWDG_MODULE_ENABLED */
#define HAL_CORTEX_MODULE_ENABLED
/* #define HAL_PCD_MODULE_ENABLED */
/* ########################## Oscillator Values adaptation ####################*/
/**
* @brief Adjust the value of External High Speed oscillator (HSE) used in your application.
*
* This value is used by the RCC HAL module to compute the system frequency
* (when HSE is used as system clock source, directly or through the PLL).
*/
#if !defined (HSE_VALUE)
#define HSE_VALUE ((uint32_t)8000000) /**< Value of the External oscillator in Hz */
#endif /* HSE_VALUE */
#if !defined (HSE_STARTUP_TIMEOUT)
#define HSE_STARTUP_TIMEOUT ((uint32_t)5000) /**< Time out for HSE start up, in ms */
#endif /* HSE_STARTUP_TIMEOUT */
/**
* @brief Internal Multiple Speed oscillator (MSI) default value.
*
* This value is the default MSI range value after Reset.
*/
#if !defined (MSI_VALUE)
#define MSI_VALUE ((uint32_t)2000000) /**< Value of the Internal oscillator in Hz*/
#endif /* MSI_VALUE */
/**
* @brief Internal High Speed oscillator (HSI) value.
*
* This value is used by the RCC HAL module to compute the system frequency
* (when HSI is used as system clock source, directly or through the PLL).
*/
#if !defined (HSI_VALUE)
#define HSI_VALUE ((uint32_t)16000000) /**< Value of the Internal oscillator in Hz*/
#endif /* HSI_VALUE */
/**
* @brief Internal High Speed oscillator for USB (HSI48) value.
*/
#if !defined (HSI48_VALUE)
#define HSI48_VALUE ((uint32_t)48000000) /**< Value of the Internal High Speed oscillator for USB in Hz.
The real value may vary depending on the variations
in voltage and temperature. */
#endif /* HSI48_VALUE */
/**
* @brief Internal Low Speed oscillator (LSI) value.
*/
#if !defined (LSI_VALUE)
#define LSI_VALUE ((uint32_t)37000) /**< LSI Typical Value in Hz*/
#endif /* LSI_VALUE */ /**< Value of the Internal Low Speed oscillator in Hz
The real value may vary depending on the variations
in voltage and temperature.*/
/**
* @brief External Low Speed oscillator (LSE) value.
*
* This value is used by the UART, RTC HAL module to compute the system frequency
*/
#if !defined (LSE_VALUE)
#define LSE_VALUE ((uint32_t)32768) /**< Value of the External oscillator in Hz*/
#endif /* LSE_VALUE */
#if !defined (LSE_STARTUP_TIMEOUT)
#define LSE_STARTUP_TIMEOUT ((uint32_t)5000) /**< Time out for LSE start up, in ms */
#endif /* HSE_STARTUP_TIMEOUT */
/* Tip: To avoid modifying this file each time you need to use different HSE,
=== you can define the HSE value in your toolchain compiler preprocessor. */
/* ########################### System Configuration ######################### */
/**
* @brief This is the HAL system configuration section
*/
#define VDD_VALUE ((uint32_t)3300) /**< Value of VDD in mv */
#define TICK_INT_PRIORITY (((uint32_t)1 << __NVIC_PRIO_BITS) - 1) /**< tick interrupt priority */
#define USE_RTOS 0
#define PREFETCH_ENABLE 1
#define PREREAD_ENABLE 0
#define BUFFER_CACHE_DISABLE 0
/* ########################## Assert Selection ############################## */
/**
* @brief Uncomment the line below to expanse the "assert_param" macro in the
* HAL drivers code
*/
/* #define USE_FULL_ASSERT 1 */
/* Includes ------------------------------------------------------------------*/
/**
* @brief Include module's header file
*/
#ifdef HAL_RCC_MODULE_ENABLED
#include "stm32l0xx_hal_rcc.h"
#endif /* HAL_RCC_MODULE_ENABLED */
#ifdef HAL_GPIO_MODULE_ENABLED
#include "stm32l0xx_hal_gpio.h"
#endif /* HAL_GPIO_MODULE_ENABLED */
#ifdef HAL_DMA_MODULE_ENABLED
#include "stm32l0xx_hal_dma.h"
#endif /* HAL_DMA_MODULE_ENABLED */
#ifdef HAL_CORTEX_MODULE_ENABLED
#include "stm32l0xx_hal_cortex.h"
#endif /* HAL_CORTEX_MODULE_ENABLED */
#ifdef HAL_ADC_MODULE_ENABLED
#include "stm32l0xx_hal_adc.h"
#endif /* HAL_ADC_MODULE_ENABLED */
#ifdef HAL_COMP_MODULE_ENABLED
#include "stm32l0xx_hal_comp.h"
#endif /* HAL_COMP_MODULE_ENABLED */
#ifdef HAL_CRC_MODULE_ENABLED
#include "stm32l0xx_hal_crc.h"
#endif /* HAL_CRC_MODULE_ENABLED */
#ifdef HAL_CRYP_MODULE_ENABLED
#include "stm32l0xx_hal_cryp.h"
#endif /* HAL_CRYP_MODULE_ENABLED */
#ifdef HAL_DAC_MODULE_ENABLED
#include "stm32l0xx_hal_dac.h"
#endif /* HAL_DAC_MODULE_ENABLED */
#ifdef HAL_FLASH_MODULE_ENABLED
#include "stm32l0xx_hal_flash.h"
#endif /* HAL_FLASH_MODULE_ENABLED */
#ifdef HAL_I2C_MODULE_ENABLED
#include "stm32l0xx_hal_i2c.h"
#endif /* HAL_I2C_MODULE_ENABLED */
#ifdef HAL_I2S_MODULE_ENABLED
#include "stm32l0xx_hal_i2s.h"
#endif /* HAL_I2S_MODULE_ENABLED */
#ifdef HAL_IWDG_MODULE_ENABLED
#include "stm32l0xx_hal_iwdg.h"
#endif /* HAL_IWDG_MODULE_ENABLED */
#ifdef HAL_LCD_MODULE_ENABLED
#include "stm32l0xx_hal_lcd.h"
#endif /* HAL_LCD_MODULE_ENABLED */
#ifdef HAL_LPTIM_MODULE_ENABLED
#include "stm32l0xx_hal_lptim.h"
#endif /* HAL_LPTIM_MODULE_ENABLED */
#ifdef HAL_PWR_MODULE_ENABLED
#include "stm32l0xx_hal_pwr.h"
#endif /* HAL_PWR_MODULE_ENABLED */
#ifdef HAL_RNG_MODULE_ENABLED
#include "stm32l0xx_hal_rng.h"
#endif /* HAL_RNG_MODULE_ENABLED */
#ifdef HAL_RTC_MODULE_ENABLED
#include "stm32l0xx_hal_rtc.h"
#endif /* HAL_RTC_MODULE_ENABLED */
#ifdef HAL_SPI_MODULE_ENABLED
#include "stm32l0xx_hal_spi.h"
#endif /* HAL_SPI_MODULE_ENABLED */
#ifdef HAL_TIM_MODULE_ENABLED
#include "stm32l0xx_hal_tim.h"
#endif /* HAL_TIM_MODULE_ENABLED */
#ifdef HAL_TSC_MODULE_ENABLED
#include "stm32l0xx_hal_tsc.h"
#endif /* HAL_TSC_MODULE_ENABLED */
#ifdef HAL_UART_MODULE_ENABLED
#include "stm32l0xx_hal_uart.h"
#endif /* HAL_UART_MODULE_ENABLED */
#ifdef HAL_USART_MODULE_ENABLED
#include "stm32l0xx_hal_usart.h"
#endif /* HAL_USART_MODULE_ENABLED */
#ifdef HAL_IRDA_MODULE_ENABLED
#include "stm32l0xx_hal_irda.h"
#endif /* HAL_IRDA_MODULE_ENABLED */
#ifdef HAL_SMARTCARD_MODULE_ENABLED
#include "stm32l0xx_hal_smartcard.h"
#endif /* HAL_SMARTCARD_MODULE_ENABLED */
#ifdef HAL_SMBUS_MODULE_ENABLED
#include "stm32l0xx_hal_smbus.h"
#endif /* HAL_SMBUS_MODULE_ENABLED */
#ifdef HAL_WWDG_MODULE_ENABLED
#include "stm32l0xx_hal_wwdg.h"
#endif /* HAL_WWDG_MODULE_ENABLED */
#ifdef HAL_PCD_MODULE_ENABLED
#include "stm32l0xx_hal_pcd.h"
#endif /* HAL_PCD_MODULE_ENABLED */
/* Exported macro ------------------------------------------------------------*/
#ifdef USE_FULL_ASSERT
/**
* @brief The assert_param macro is used for function's parameters check.
* @param expr: If expr is false, it calls assert_failed function
* which reports the name of the source file and the source
* line number of the call that failed.
* If expr is true, it returns no value.
* @retval None
*/
#define assert_param(expr) ((expr) ? (void)0 : assert_failed((uint8_t *)__FILE__, __LINE__))
/* Exported functions ------------------------------------------------------- */
void assert_failed(uint8_t *file, uint32_t line);
#else
#define assert_param(expr) ((void)0)
#endif /* USE_FULL_ASSERT */
#ifdef __cplusplus
}
#endif
#endif /* __STM32L0xx_HAL_CONF_H__ */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View file

@ -0,0 +1,162 @@
/*
/ _____) _ | |
( (____ _____ ____ _| |_ _____ ____| |__
\____ \| ___ | (_ _) ___ |/ ___) _ \
_____) ) ____| | | || |_| ____( (___| | | |
(______/|_____)_|_|_| \__)_____)\____)_| |_|
(C)2013 Semtech
Description: virtual com port driver
License: Revised BSD License, see LICENSE.TXT file include in the project
Maintainer: Miguel Luis and Gregory Cristian
*/
/******************************************************************************
* @file vcom.h
* @author MCD Application Team
* @version V1.1.1
* @date 01-June-2017
* @brief Header for vcom.c module
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2017 STMicroelectronics International N.V.
* All rights reserved.</center></h2>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted, provided that the following conditions are met:
*
* 1. Redistribution of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. Neither the name of STMicroelectronics nor the names of other
* contributors to this software may be used to endorse or promote products
* derived from this software without specific written permission.
* 4. This software, including modifications and/or derivative works of this
* software, must execute solely and exclusively on microcontroller or
* microprocessor devices manufactured by or for STMicroelectronics.
* 5. Redistribution and use of this software other than as permitted under
* this license is void and will automatically terminate your rights under
* this license.
*
* THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY
* RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT
* SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
******************************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __VCOM_H__
#define __VCOM_H__
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "hw_conf.h"
/* Exported types ------------------------------------------------------------*/
/* Exported constants --------------------------------------------------------*/
/* External variables --------------------------------------------------------*/
/* Exported functions ------------------------------------------------------- */
/**
* @brief Init the VCOM.
* @param None
* @retval None
*/
void vcom_Init(void);
/**
* @brief DeInit the VCOM.
* @param None
* @retval None
*/
void vcom_DeInit(void);
/**
* @brief Init the VCOM IOs.
* @param None
* @retval None
*/
void vcom_IoInit(void);
/**
* @brief Init the VCOM RX
* @param None
* @retval None
*/
void vcom_ReceiveInit(void);
/**
* @brief DeInit the VCOM IOs.
* @param None
* @retval None
*/
void vcom_IoDeInit(void);
/**
* @brief Sends string on com port
* @param String
* @retval None
*/
void vcom_Send(const char *format, ...);
/**
* @brief Checks if a new character has been received on com port
* @param None
* @retval Returns SET if new character has been received on com port, RESET otherwise
*/
FlagStatus IsNewCharReceived(void);
/**
* @brief Gets new received characters on com port
* @param None
* @retval Returns the character
*/
uint8_t GetNewChar(void);
/**
* @brief vcom IRQ Handler
* @param None
* @retval None
*/
void vcom_IRQHandler(void);
void DBG_Send(const char *format, ...);
void DBG_Uart_Init(void);
void DBG_Uart_Deinit(void);
/* Exported macros -----------------------------------------------------------*/
#if 1
#include "debug.h"
#define PRINTF_RAW(...) DBG_Send(__VA_ARGS__)
#define PRINTF DBG_PRINTF
#else
#define PRINTF_RAW(...)
#define PRINTF(...)
#endif
#ifdef __cplusplus
}
#endif
#endif /* __VCOM_H__*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View file

@ -0,0 +1,89 @@
/*
/ _____) _ | |
( (____ _____ ____ _| |_ _____ ____| |__
\____ \| ___ | (_ _) ___ |/ ___) _ \
_____) ) ____| | | || |_| ____( (___| | | |
(______/|_____)_|_|_| \__)_____)\____)_| |_|
(C)2013 Semtech
Description: LoRaMac classA device implementation
License: Revised BSD License, see LICENSE.TXT file include in the project
Maintainer: Miguel Luis, Gregory Cristian and Wael Guibene
*/
/******************************************************************************
* @file version.h
* @author MCD Application Team
* @version V1.1.1
* @date 01-June-2017
* @brief defines the lora mac version
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2017 STMicroelectronics International N.V.
* All rights reserved.</center></h2>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted, provided that the following conditions are met:
*
* 1. Redistribution of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. Neither the name of STMicroelectronics nor the names of other
* contributors to this software may be used to endorse or promote products
* derived from this software without specific written permission.
* 4. This software, including modifications and/or derivative works of this
* software, must execute solely and exclusively on microcontroller or
* microprocessor devices manufactured by or for STMicroelectronics.
* 5. Redistribution and use of this software other than as permitted under
* this license is void and will automatically terminate your rights under
* this license.
*
* THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY
* RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT
* SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
******************************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __VERSION_H__
#define __VERSION_H__
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#define LORA_MAC_VERSION (uint32_t) 0x44020000
/* Exported constants --------------------------------------------------------*/
#define TEST_VERSION (uint32_t) 0x00000000 /*1 lsb is always 0 in releases */
#define LRWAN_VERSION (uint32_t) 0x00001110 /*3 next hex is i_cube release*/
#define VERSION (uint32_t) (LORA_MAC_VERSION | LRWAN_VERSION | TEST_VERSION)
#define AT_VERSION_STRING "3.1.3"
#define AT_VERSION_LORAWAN_STRING "1.0.2"
/* Exported types ------------------------------------------------------------*/
/* External variables --------------------------------------------------------*/
/* Exported macros -----------------------------------------------------------*/
/* Exported functions ------------------------------------------------------- */
#ifdef __cplusplus
}
#endif
#endif /*__VERSION_H__*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/