+ *
+ * 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_COMMISSIONING_H__
+#define __LORA_COMMISSIONING_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 }
+
+#if( OVER_THE_AIR_ACTIVATION == 0 )
+
+/*!
+ * 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 }
+
+#endif /* OVER_THE_AIR_ACTIVATION == 0 */
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __LORA_COMMISSIONING_H__ */
diff --git a/Inc/debug.h b/Inc/debug.h
new file mode 100755
index 0000000..5889438
--- /dev/null
+++ b/Inc/debug.h
@@ -0,0 +1,125 @@
+ /******************************************************************************
+ * @file debug.h
+ * @author MCD Application Team
+ * @version V1.1.2
+ * @date 08-September-2017
+ * @brief Header for driver debug.c module
+ ******************************************************************************
+ * @attention
+ *
+ *
+ *
+ * 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
+#include
+#include "hw_conf.h"
+#include "vcom.h"
+
+/* Exported types ------------------------------------------------------------*/
+/* Exported constants --------------------------------------------------------*/
+/* External variables --------------------------------------------------------*/
+/* Exported macros -----------------------------------------------------------*/
+/* Exported functions ------------------------------------------------------- */
+
+void DBG_Init( void );
+
+void Error_Handler( void );
+
+#ifdef DEBUG
+
+#define DBG_GPIO_WRITE( gpio, n, x ) HAL_GPIO_WritePin( 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 RTC_OUTPUT_DISABLE; /* RTC_OUTPUT_ALARMA on PC13 */
+
+#define DBG( x ) do{ x } while(0)
+
+#ifdef TRACE
+
+#define DBG_PRINTF(...) vcom_Send(__VA_ARGS__)
+
+#define DBG_PRINTF_CRITICAL(...) vcom_Send_Lp(__VA_ARGS__)
+
+#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 RTC_OUTPUT_DISABLE;
+
+#endif /* DEBUG */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __DEBUG_H__*/
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/Inc/hw.h b/Inc/hw.h
new file mode 100755
index 0000000..949923f
--- /dev/null
+++ b/Inc/hw.h
@@ -0,0 +1,88 @@
+/*
+ / _____) _ | |
+( (____ _____ ____ _| |_ _____ ____| |__
+ \____ \| ___ | (_ _) ___ |/ ___) _ \
+ _____) ) ____| | | || |_| ____( (___| | | |
+(______/|_____)_|_|_| \__)_____)\____)_| |_|
+ (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.2
+ * @date 08-September-2017
+ * @brief contains all hardware driver
+ ******************************************************************************
+ * @attention
+ *
+ *
+ *
+ * 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
+#include
+#include
+#include "stm32l0xx.h"
+#include "stm32l0xx_hal.h"
+#include "stm32l0xx_hw_conf.h"
+#include "hw_conf.h"
+#include "hw_gpio.h"
+#include "hw_spi.h"
+#include "hw_rtc.h"
+#include "hw_msp.h"
+#include "debug.h"
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __HW_H__ */
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
+
diff --git a/Inc/hw_conf.h b/Inc/hw_conf.h
new file mode 100755
index 0000000..2916631
--- /dev/null
+++ b/Inc/hw_conf.h
@@ -0,0 +1,148 @@
+/*
+ / _____) _ | |
+( (____ _____ ____ _| |_ _____ ____| |__
+ \____ \| ___ | (_ _) ___ |/ ___) _ \
+ _____) ) ____| | | || |_| ____( (___| | | |
+(______/|_____)_|_|_| \__)_____)\____)_| |_|
+ (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.2
+ * @date 08-September-2017
+ * @brief contains hardware configuration Macros and Constants
+ ******************************************************************************
+ * @attention
+ *
+ *
+ *
+ * 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
+
+/* Includes ------------------------------------------------------------------*/
+
+#ifdef USE_STM32F0XX_NUCLEO
+ #include "stm32f0xx_hal.h"
+ #include "stm32f0xx_nucleo.h"
+ #include "stm32f0xx_hal_conf.h"
+ #error "create stm32f0xx_hw_conf.h "
+#endif
+
+#ifdef USE_STM32F1XX_NUCLEO
+ #include "stm32f1xx_hal.h"
+ #include "stm32f1xx_nucleo.h"
+ #include "stm32f1xx_hal_conf.h"
+ #error "create stm32f1xx_hw_conf.h "
+#endif
+
+#ifdef USE_STM32F3XX_NUCLEO
+ #include "stm32f3xx_hal.h"
+ #include "stm32f3xx_nucleo.h"
+ #include "stm32f3xx_hal_conf.h"
+ #error "create stm32f3xx_hw_conf.h "
+#endif
+
+#ifdef USE_STM32F4XX_NUCLEO
+ #include "stm32f4xx_hal.h"
+ #include "stm32f4xx_nucleo.h"
+ #include "stm32f4xx_hal_conf.h"
+ #error "create stm32f4xx_hw_conf.h "
+#endif
+
+#ifdef USE_STM32L0XX_NUCLEO
+ #include "stm32l0xx_hal.h"
+ #include "stm32l0xx_nucleo.h"
+ #include "stm32l0xx_hal_conf.h"
+ #include "stm32l0xx_hw_conf.h"
+#endif
+
+#ifdef USE_STM32L1XX_NUCLEO
+ #include "stm32l1xx_hal.h"
+ #include "stm32l1xx_nucleo.h"
+ #include "stm32l1xx_hal_conf.h"
+ #include "stm32l1xx_hw_conf.h"
+#endif
+
+#ifdef USE_STM32L4XX_NUCLEO
+ #include "stm32l4xx_hal.h"
+ #include "stm32l4xx_nucleo.h"
+ #include "stm32l4xx_hal_conf.h"
+ #include "stm32l4xx_hw_conf.h"
+#endif
+
+#ifdef USE_B_L072Z_LRWAN1
+ #include "stm32l0xx_hal.h"
+ #include "b-l072z-lrwan1.h"
+ #include "stm32l0xx_hal_conf.h"
+ #include "mlm32l0xx_hw_conf.h"
+#endif
+
+/* --------Preprocessor compile swicth------------ */
+/* debug swicthes in debug.h */
+//#define DEBUG
+//#define TRACE
+
+/* uncomment below line to never enter lowpower modes in main.c*/
+//#define LOW_POWER_DISABLE
+
+/* debug swicthes in bsp.c */
+//#define SENSOR_ENABLED
+
+
+/* Exported types ------------------------------------------------------------*/
+/* Exported constants --------------------------------------------------------*/
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __HW_CONF_H__ */
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/Inc/hw_gpio.h b/Inc/hw_gpio.h
new file mode 100755
index 0000000..3b30503
--- /dev/null
+++ b/Inc/hw_gpio.h
@@ -0,0 +1,154 @@
+/*
+ / _____) _ | |
+( (____ _____ ____ _| |_ _____ ____| |__
+ \____ \| ___ | (_ _) ___ |/ ___) _ \
+ _____) ) ____| | | || |_| ____( (___| | | |
+(______/|_____)_|_|_| \__)_____)\____)_| |_|
+ (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.2
+ * @date 08-September-2017
+ * @brief Header for driver hw_rtc.c module
+ ******************************************************************************
+ * @attention
+ *
+ *
+ *
+ * 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
+
+
+/* Exported types ------------------------------------------------------------*/
+
+typedef void( GpioIrqHandler )( void );
+
+/* Exported constants --------------------------------------------------------*/
+/* External variables --------------------------------------------------------*/
+/* Exported macros -----------------------------------------------------------*/
+/* Exported functions ------------------------------------------------------- */
+
+
+/*!
+ * GPIO IRQ handler function prototype
+ */
+
+
+IRQn_Type MSP_GetIRQn( uint16_t gpioPin);
+
+
+/*!
+ * @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 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
+ */
+void HW_GPIO_Write( GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin, uint32_t value );
+
+/*!
+ * @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 );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __HW_GPIO_H__ */
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
+
diff --git a/Inc/hw_msp.h b/Inc/hw_msp.h
new file mode 100755
index 0000000..b2cbc44
--- /dev/null
+++ b/Inc/hw_msp.h
@@ -0,0 +1,221 @@
+
+/*
+ / _____) _ | |
+( (____ _____ ____ _| |_ _____ ____| |__
+ \____ \| ___ | (_ _) ___ |/ ___) _ \
+ _____) ) ____| | | || |_| ____( (___| | | |
+(______/|_____)_|_|_| \__)_____)\____)_| |_|
+ (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.2
+ * @date 08-September-2017
+ * @brief Header for driver hw msp module
+ ******************************************************************************
+ * @attention
+ *
+ *
+ *
+ * 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 ------------------------------------------------------------------*/
+/* Exported types ------------------------------------------------------------*/
+/* 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: __HAL_RCC_GPIOA_CLK_ENABLE(); break; \
+ case GPIOB_BASE: __HAL_RCC_GPIOB_CLK_ENABLE(); break; \
+ case GPIOC_BASE: __HAL_RCC_GPIOC_CLK_ENABLE(); break; \
+ case GPIOD_BASE: __HAL_RCC_GPIOD_CLK_ENABLE(); break; \
+ case GPIOH_BASE: default: __HAL_RCC_GPIOH_CLK_ENABLE(); \
+ } \
+ } while(0)
+
+#define RCC_GPIO_CLK_DISABLE( __GPIO_PORT__ ) \
+do { \
+ switch( __GPIO_PORT__) \
+ { \
+ case GPIOA_BASE: __HAL_RCC_GPIOA_CLK_DISABLE(); break; \
+ case GPIOB_BASE: __HAL_RCC_GPIOB_CLK_DISABLE(); break; \
+ case GPIOC_BASE: __HAL_RCC_GPIOC_CLK_DISABLE(); break; \
+ case GPIOD_BASE: __HAL_RCC_GPIOD_CLK_DISABLE(); break; \
+ case GPIOH_BASE: default: __HAL_RCC_GPIOH_CLK_ENABLE(); \
+ } \
+ } while(0)
+
+/* Exported functions ------------------------------------------------------- */
+
+/*!
+ * \brief Get the current temperature
+ *
+ * \retval value temperature in degreeCelcius( q7.8 )
+ */
+uint16_t HW_GetTemperatureLevel( void );
+/*!
+ * \brief Get the current battery level
+ *
+ * \retval value battery level ( 0: very low, 254: fully charged )
+ */
+uint8_t HW_GetBatteryLevel( void );
+/*!
+ * \brief Initializes the boards peripherals.
+ */
+void HW_Init( void );
+
+ /*!
+ * \brief De-initializes the target board peripherals to decrease power
+ * consumption.
+ */
+
+void HW_DeInit( void );
+/*!
+ * Returns a pseudo random seed generated using the MCU Unique ID
+ *
+ * \retval seed Generated pseudo random seed
+ */
+uint32_t HW_GetRandomSeed( void );
+
+/*!
+ * \brief Gets the board 64 bits unique ID
+ *
+ * \param [IN] id Pointer to an array that will contain the Unique ID
+ */
+void HW_GetUniqueId( uint8_t *id );
+
+ /*!
+ * \brief Initializes the HW and enters stope mode
+ */
+void HW_EnterStopMode( void);
+
+/*!
+ * \brief Exits stop mode and Initializes the HW
+ */
+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);
+
+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;
+
+/* ADC */
+
+/*!
+ * \brief Initializes the ADC input
+ *
+ * \param [IN] scl ADC input pin name to be used
+ */
+void HW_AdcInit( void );
+
+/*!
+ * \brief DeInitializes the ADC
+ *
+ * \param [IN] none
+ */
+void HW_AdcDeInit( void );
+
+/*!
+ * \brief Read the analogue voltage value
+ *
+ * \param [IN] Channel to read
+ * \retval value Analogue pin value
+ */
+uint16_t HW_AdcReadChannel( uint32_t Channel);
+
+/*!
+ * \brief Configures the sytem Clock at start-up
+ *
+ * \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);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __HW_MSP_H__ */
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/Inc/hw_rtc.h b/Inc/hw_rtc.h
new file mode 100755
index 0000000..60fa37b
--- /dev/null
+++ b/Inc/hw_rtc.h
@@ -0,0 +1,179 @@
+/*
+ / _____) _ | |
+( (____ _____ ____ _| |_ _____ ____| |__
+ \____ \| ___ | (_ _) ___ |/ ___) _ \
+ _____) ) ____| | | || |_| ____( (___| | | |
+(______/|_____)_|_|_| \__)_____)\____)_| |_|
+ (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.2
+ * @date 08-September-2017
+ * @brief Header for driver hw_rtc.c module
+ ******************************************************************************
+ * @attention
+ *
+ *
+ *
+ * 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 Reference + timeout
+ * @param timeout Duration of the Timer in ticks
+ */
+void HW_RTC_SetAlarm( uint32_t timeout );
+
+/*!
+ * @brief Get the RTC timer elapsed time since the last Reference was set
+ * @retval RTC Elapsed time in ticks
+ */
+uint32_t HW_RTC_GetTimerElapsedTime( void );
+
+/*!
+ * @brief Get the RTC timer value
+ * @retval none
+ */
+uint32_t HW_RTC_GetTimerValue( void );
+
+/*!
+ * @brief Set the RTC timer Reference
+ * @retval Timer Reference Value in Ticks
+ */
+uint32_t HW_RTC_SetTimerContext( void );
+
+/*!
+ * @brief Get the RTC timer Reference
+ * @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 a delay of delay ms by polling RTC
+ * @param delay in ms
+ * @param none
+ * @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 returns the wake up time in us
+ * @param none
+ * @retval wake up time in ticks
+ */
+int16_t HW_RTC_getMcuWakeUpTime( void );
+
+/*!
+ * @brief converts time in ms to time in ticks
+ * @param [IN] 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 [IN] time in timer ticks
+ * @retval returns 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****/
diff --git a/Inc/hw_spi.h b/Inc/hw_spi.h
new file mode 100755
index 0000000..d34457d
--- /dev/null
+++ b/Inc/hw_spi.h
@@ -0,0 +1,126 @@
+/*
+ / _____) _ | |
+( (____ _____ ____ _| |_ _____ ____| |__
+ \____ \| ___ | (_ _) ___ |/ ___) _ \
+ _____) ) ____| | | || |_| ____( (___| | | |
+(______/|_____)_|_|_| \__)_____)\____)_| |_|
+ (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.2
+ * @date 08-September-2017
+ * @brief Header for driver hw_spi.c module
+ ******************************************************************************
+ * @attention
+ *
+ *
+ *
+ * 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
+
+/* Exported types ------------------------------------------------------------*/
+/* Exported constants --------------------------------------------------------*/
+/* External variables --------------------------------------------------------*/
+/* Exported macros -----------------------------------------------------------*/
+/* Exported functions ------------------------------------------------------- */
+
+/*!
+ * @brief Initializes the SPI object and MCU peripheral
+ *
+ * @param [IN] none
+ */
+void HW_SPI_Init( void );
+
+/*!
+ * @brief De-initializes the SPI object and MCU peripheral
+ *
+ * @param [IN] none
+ */
+void HW_SPI_DeInit( void );
+
+/*!
+ * @brief Initializes the SPI IOs
+ *
+ * @param [IN] none
+ */
+void HW_SPI_IoInit( void );
+
+/*!
+ * @brief De-initializes the SPI IOs
+ *
+ * @param [IN] none
+ */
+void HW_SPI_IoDeInit( void );
+
+/*!
+ * @brief Sends outData and receives inData
+ *
+ * @param [IN] outData Byte to be sent
+ * @retval inData Received byte.
+ */
+uint16_t HW_SPI_InOut( uint16_t outData );
+
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __HW_SPI_H__ */
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
+
+
+
+
+
+
+
+
diff --git a/Inc/stm32l0xx_hal_conf.h b/Inc/stm32l0xx_hal_conf.h
old mode 100644
new mode 100755
index 50600da..e982c76
--- a/Inc/stm32l0xx_hal_conf.h
+++ b/Inc/stm32l0xx_hal_conf.h
@@ -1,46 +1,58 @@
/**
******************************************************************************
* @file stm32l0xx_hal_conf.h
- * @brief HAL configuration file.
+ * @author MCD Application Team
+ * @version V1.1.2
+ * @date 08-September-2017
+ * @brief HAL configuration file.
******************************************************************************
* @attention
*
- *
*
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- * 1. Redistributions 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 its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted, provided that the following conditions are met:
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 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.
+ * 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
+#ifndef __STM32L0xx_HAL_CONF_H__
+#define __STM32L0xx_HAL_CONF_H__
#ifdef __cplusplus
extern "C" {
#endif
-#include "main.h"
/* Exported types ------------------------------------------------------------*/
/* Exported constants --------------------------------------------------------*/
@@ -48,38 +60,36 @@
/**
* @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_CRYP_MODULE_ENABLED */
-/*#define HAL_COMP_MODULE_ENABLED */
-/*#define HAL_CRC_MODULE_ENABLED */
-/*#define HAL_CRYP_MODULE_ENABLED */
-/*#define HAL_DAC_MODULE_ENABLED */
-/*#define HAL_FIREWALL_MODULE_ENABLED */
-/*#define HAL_I2S_MODULE_ENABLED */
-/*#define HAL_IWDG_MODULE_ENABLED */
-/*#define HAL_LCD_MODULE_ENABLED */
-/*#define HAL_LPTIM_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_PCD_MODULE_ENABLED */
-#define HAL_GPIO_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_I2C_MODULE_ENABLED
-#define HAL_RCC_MODULE_ENABLED
#define HAL_FLASH_MODULE_ENABLED
-#define HAL_PWR_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 ####################*/
/**
@@ -88,11 +98,11 @@
* (when HSE is used as system clock source, directly or through the PLL).
*/
#if !defined (HSE_VALUE)
- #define HSE_VALUE ((uint32_t)8000000U) /*!< Value of the External oscillator in Hz */
+ #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)100U) /*!< Time out for HSE start up, in ms */
+ #define HSE_STARTUP_TIMEOUT ((uint32_t)5000) /*!< Time out for HSE start up, in ms */
#endif /* HSE_STARTUP_TIMEOUT */
/**
@@ -100,23 +110,22 @@
* This value is the default MSI range value after Reset.
*/
#if !defined (MSI_VALUE)
- #define MSI_VALUE ((uint32_t)2097000U) /*!< Value of the Internal oscillator in Hz*/
+ #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)16000000U) /*!< Value of the Internal oscillator in Hz*/
+ #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)48000000U) /*!< Value of the Internal High Speed oscillator for USB in Hz.
+#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 */
@@ -125,22 +134,24 @@
* @brief Internal Low Speed oscillator (LSI) value.
*/
#if !defined (LSI_VALUE)
- #define LSI_VALUE ((uint32_t)37000U) /*!< LSI Typical Value in Hz*/
+ #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.*/
+ 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)32768U) /*!< Value of the External oscillator in Hz*/
+ #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)5000U) /*!< Time out for LSE start up, in ms */
-#endif /* 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. */
@@ -148,19 +159,19 @@
/**
* @brief This is the HAL system configuration section
*/
-#define VDD_VALUE ((uint32_t)3300U) /*!< Value of VDD in mv */
-#define TICK_INT_PRIORITY ((uint32_t)0U) /*!< tick interrupt priority */
-#define USE_RTOS 0U
-#define PREFETCH_ENABLE 0U
-#define PREREAD_ENABLE 1U
-#define BUFFER_CACHE_DISABLE 0U
+#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 1U */
+/* #define USE_FULL_ASSERT 1 */
/* Includes ------------------------------------------------------------------*/
/**
@@ -170,7 +181,7 @@
#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 */
@@ -178,7 +189,7 @@
#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 */
@@ -190,7 +201,7 @@
#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 */
@@ -203,10 +214,6 @@
#include "stm32l0xx_hal_dac.h"
#endif /* HAL_DAC_MODULE_ENABLED */
-#ifdef HAL_FIREWALL_MODULE_ENABLED
- #include "stm32l0xx_hal_firewall.h"
-#endif /* HAL_FIREWALL_MODULE_ENABLED */
-
#ifdef HAL_FLASH_MODULE_ENABLED
#include "stm32l0xx_hal_flash.h"
#endif /* HAL_FLASH_MODULE_ENABLED */
@@ -241,7 +248,6 @@
#ifdef HAL_RTC_MODULE_ENABLED
#include "stm32l0xx_hal_rtc.h"
-
#endif /* HAL_RTC_MODULE_ENABLED */
#ifdef HAL_SPI_MODULE_ENABLED
@@ -294,18 +300,19 @@
* If expr is true, it returns no value.
* @retval None
*/
- #define assert_param(expr) ((expr) ? (void)0U : assert_failed((uint8_t *)__FILE__, __LINE__))
+ #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)0U)
+ #define assert_param(expr) ((void)0)
#endif /* USE_FULL_ASSERT */
#ifdef __cplusplus
}
#endif
-#endif /* __STM32L0xx_HAL_CONF_H */
+#endif /* __STM32L0xx_HAL_CONF_H__ */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
+
diff --git a/Inc/stm32l0xx_hw_conf.h b/Inc/stm32l0xx_hw_conf.h
new file mode 100755
index 0000000..e244dcd
--- /dev/null
+++ b/Inc/stm32l0xx_hw_conf.h
@@ -0,0 +1,176 @@
+/*
+ / _____) _ | |
+( (____ _____ ____ _| |_ _____ ____| |__
+ \____ \| ___ | (_ _) ___ |/ ___) _ \
+ _____) ) ____| | | || |_| ____( (___| | | |
+(______/|_____)_|_|_| \__)_____)\____)_| |_|
+ (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 stm32l0xx_hw_conf.h
+ * @author MCD Application Team
+ * @version V1.1.2
+ * @date 08-September-2017
+ * @brief contains hardaware configuration Macros and Constants
+ ******************************************************************************
+ * @attention
+ *
+ *
+ *
+ * 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_L0_H__
+#define __HW_CONF_L0_H__
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+/* Includes ------------------------------------------------------------------*/
+#include "hw.h"
+/* Exported types ------------------------------------------------------------*/
+/* Exported constants --------------------------------------------------------*/
+
+//#define RADIO_DIO_4
+//#define RADIO_DIO_5
+
+/* LORA I/O definition */
+
+
+#define RADIO_RESET_PORT GPIOA
+#define RADIO_RESET_PIN GPIO_PIN_0
+
+#define RADIO_MOSI_PORT GPIOA
+#define RADIO_MOSI_PIN GPIO_PIN_7
+
+#define RADIO_MISO_PORT GPIOA
+#define RADIO_MISO_PIN GPIO_PIN_6
+
+#define RADIO_SCLK_PORT GPIOA
+#define RADIO_SCLK_PIN GPIO_PIN_5
+
+#define RADIO_NSS_PORT GPIOB
+#define RADIO_NSS_PIN GPIO_PIN_6
+
+#define RADIO_DIO_0_PORT GPIOA
+#define RADIO_DIO_0_PIN GPIO_PIN_10
+
+#define RADIO_DIO_1_PORT GPIOB
+#define RADIO_DIO_1_PIN GPIO_PIN_3
+
+#define RADIO_DIO_2_PORT GPIOB
+#define RADIO_DIO_2_PIN GPIO_PIN_5
+
+#define RADIO_DIO_3_PORT GPIOB
+#define RADIO_DIO_3_PIN GPIO_PIN_4
+
+#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_ANT_SWITCH_PORT GPIOC
+#define RADIO_ANT_SWITCH_PIN GPIO_PIN_1
+
+#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 */
+
+#ifdef USE_STM32L0XX_NUCLEO
+#define ADC_READ_CHANNEL ADC_CHANNEL_4
+#define ADCCLK_ENABLE() __HAL_RCC_ADC1_CLK_ENABLE() ;
+#define ADCCLK_DISABLE() __HAL_RCC_ADC1_CLK_DISABLE() ;
+#endif
+
+
+/* --------------------------- RTC HW definition -------------------------------- */
+
+#define RTC_OUTPUT DBG_RTC_OUTPUT
+
+#define RTC_Alarm_IRQn RTC_IRQn
+/* --------------------------- USART HW definition -------------------------------*/
+
+
+#define USARTX USART2
+#define USARTX_CLK_ENABLE() __USART2_CLK_ENABLE();
+#define USARTX_RX_GPIO_CLK_ENABLE() __GPIOA_CLK_ENABLE()
+#define USARTX_TX_GPIO_CLK_ENABLE() __GPIOA_CLK_ENABLE()
+
+#define USARTX_FORCE_RESET() __USART2_FORCE_RESET()
+#define USARTX_RELEASE_RESET() __USART2_RELEASE_RESET()
+
+
+#define USARTX_TX_PIN GPIO_PIN_2
+#define USARTX_TX_GPIO_PORT GPIOA
+#define USARTX_TX_AF GPIO_AF4_USART2
+#define USARTX_RX_PIN GPIO_PIN_3
+#define USARTX_RX_GPIO_PORT GPIOA
+#define USARTX_RX_AF GPIO_AF4_USART2
+
+/* Definition for USARTx's NVIC */
+#define USARTX_IRQn USART2_IRQn
+#define USARTX_IRQHandler USART2_IRQHandler
+
+
+#define LED_Toggle( x )
+#define LED_On( x )
+#define LED_Off( x )
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __HW_CONF_L0_H__ */
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/Inc/stm32l0xx_it.h b/Inc/stm32l0xx_it.h
old mode 100644
new mode 100755
index c70422a..ca3b41a
--- a/Inc/stm32l0xx_it.h
+++ b/Inc/stm32l0xx_it.h
@@ -1,60 +1,93 @@
-/**
- ******************************************************************************
+/*
+ / _____) _ | |
+( (____ _____ ____ _| |_ _____ ____| |__
+ \____ \| ___ | (_ _) ___ |/ ___) _ \
+ _____) ) ____| | | || |_| ____( (___| | | |
+(______/|_____)_|_|_| \__)_____)\____)_| |_|
+ (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 stm32l0xx_it.h
- * @brief This file contains the headers of the interrupt handlers.
+ * @author MCD Application Team
+ * @version V1.1.2
+ * @date 08-September-2017
+ * @brief manages interupt
******************************************************************************
+ * @attention
+ *
+ *
*
- * COPYRIGHT(c) 2017 STMicroelectronics
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted, provided that the following conditions are met:
*
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- * 1. Redistributions 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 its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
+ * 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 THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 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.
+ * 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_IT_H
-#define __STM32L0xx_IT_H
+#ifndef __STM32L0xx_IT_H__
+#define __STM32L0xx_IT_H__
#ifdef __cplusplus
- extern "C" {
-#endif
+extern "C" {
+#endif
/* Includes ------------------------------------------------------------------*/
-#include "stm32l0xx_hal.h"
-#include "main.h"
/* Exported types ------------------------------------------------------------*/
/* Exported constants --------------------------------------------------------*/
/* Exported macro ------------------------------------------------------------*/
/* Exported functions ------------------------------------------------------- */
+void NMI_Handler(void);
+void HardFault_Handler(void);
+void MemManage_Handler(void);
+void BusFault_Handler(void);
+void UsageFault_Handler(void);
void SVC_Handler(void);
+void DebugMon_Handler(void);
void PendSV_Handler(void);
void SysTick_Handler(void);
+void EXTI4_15_IRQHandler(void);
+void TIM21_IRQHandler(void);
#ifdef __cplusplus
}
#endif
-#endif /* __STM32L0xx_IT_H */
+#endif /* __STM32L0xx_IT_H__ */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/Inc/vcom.h b/Inc/vcom.h
new file mode 100755
index 0000000..e7ecf5f
--- /dev/null
+++ b/Inc/vcom.h
@@ -0,0 +1,142 @@
+/*
+ / _____) _ | |
+( (____ _____ ____ _| |_ _____ ____| |__
+ \____ \| ___ | (_ _) ___ |/ ___) _ \
+ _____) ) ____| | | || |_| ____( (___| | | |
+(______/|_____)_|_|_| \__)_____)\____)_| |_|
+ (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.2
+ * @date 08-September-2017
+ * @brief Header for vcom.c module
+ ******************************************************************************
+ * @attention
+ *
+ *
+ *
+ * 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 ------------------------------------------------------------------*/
+/* Exported types ------------------------------------------------------------*/
+/* Exported constants --------------------------------------------------------*/
+/* External variables --------------------------------------------------------*/
+
+/* Exported functions ------------------------------------------------------- */
+
+/**
+* @brief Init the VCOM.
+* @param None
+* @return None
+*/
+void vcom_Init(void);
+
+ /**
+* @brief DeInit the VCOM.
+* @param None
+* @return None
+*/
+void vcom_DeInit(void);
+
+ /**
+* @brief Init the VCOM IOs.
+* @param None
+* @return None
+*/
+void vcom_IoInit(void);
+
+ /**
+* @brief DeInit the VCOM IOs.
+* @param None
+* @return None
+*/
+void vcom_IoDeInit(void);
+
+/**
+* @brief Records string on circular Buffer and set SW interrupt
+* @note Set NVIC to call vcom_Send
+* @param string
+* @return None
+*/
+void vcom_Send( char *format, ... );
+
+/**
+* @brief Sends circular Buffer on com port in IT mode
+* @note called from low Priority interrupt
+* @param None
+* @return None
+*/
+void vcom_Print( void);
+
+/**
+* @brief Records string on circular Buffer
+* @note To be called only from critical section from low power section
+* Other wise use vcom_Send
+* @param string
+* @return None
+*/
+void vcom_Send_Lp( char *format, ... );
+
+/* Exported macros -----------------------------------------------------------*/
+#if 1
+#define PRINTF(...) vcom_Send(__VA_ARGS__)
+#else
+#define PRINTF(...)
+#endif
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __VCOM_H__*/
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/Src/debug.c b/Src/debug.c
new file mode 100755
index 0000000..e12ea95
--- /dev/null
+++ b/Src/debug.c
@@ -0,0 +1,119 @@
+
+/******************************************************************************
+ * @file debug.c
+ * @author MCD Application Team
+ * @version V1.1.2
+ * @date 08-September-2017
+ * @brief debug API
+ ******************************************************************************
+ * @attention
+ *
+ *
+ *
+ * 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.
+ *
+ ******************************************************************************
+ */
+
+/* Includes ------------------------------------------------------------------*/
+#include "hw.h"
+
+/**
+ * @brief Initializes the debug
+ * @param None
+ * @retval None
+ */
+void DBG_Init( void )
+{
+#ifdef DEBUG
+ GPIO_InitTypeDef gpioinitstruct = {0};
+
+ /* Enable the GPIO_B Clock */
+ __HAL_RCC_GPIOB_CLK_ENABLE();
+
+ /* Configure the GPIO pin */
+ gpioinitstruct.Mode = GPIO_MODE_OUTPUT_PP;
+ gpioinitstruct.Pull = GPIO_PULLUP;
+ gpioinitstruct.Speed = GPIO_SPEED_HIGH;
+
+ gpioinitstruct.Pin = (GPIO_PIN_12 | GPIO_PIN_13| GPIO_PIN_14 | GPIO_PIN_15);
+ HAL_GPIO_Init(GPIOB, &gpioinitstruct);
+
+ /* Reset debug Pins */
+ HAL_GPIO_WritePin(GPIOB, GPIO_PIN_12, GPIO_PIN_RESET);
+ HAL_GPIO_WritePin(GPIOB, GPIO_PIN_13, GPIO_PIN_RESET);
+ HAL_GPIO_WritePin(GPIOB, GPIO_PIN_14, GPIO_PIN_RESET);
+ HAL_GPIO_WritePin(GPIOB, GPIO_PIN_15, GPIO_PIN_RESET);
+#if 0
+ HAL_RCC_MCOConfig(RCC_MCO1, RCC_MCO1SOURCE_SYSCLK, RCC_MCODIV_1);
+#endif
+
+ __HAL_RCC_DBGMCU_CLK_ENABLE( );
+
+ HAL_DBGMCU_EnableDBGSleepMode( );
+ HAL_DBGMCU_EnableDBGStopMode( );
+ HAL_DBGMCU_EnableDBGStandbyMode( );
+
+#else /* DEBUG */
+ /* sw interface off*/
+ GPIO_InitTypeDef GPIO_InitStructure ={0};
+
+ GPIO_InitStructure.Mode = GPIO_MODE_ANALOG;
+ GPIO_InitStructure.Pull = GPIO_NOPULL;
+ GPIO_InitStructure.Pin = (GPIO_PIN_13 | GPIO_PIN_14);
+ __GPIOA_CLK_ENABLE() ;
+ HAL_GPIO_Init(GPIOA, &GPIO_InitStructure);
+ __GPIOA_CLK_DISABLE() ;
+
+ __HAL_RCC_DBGMCU_CLK_ENABLE( );
+ HAL_DBGMCU_DisableDBGSleepMode( );
+ HAL_DBGMCU_DisableDBGStopMode( );
+ HAL_DBGMCU_DisableDBGStandbyMode( );
+ __HAL_RCC_DBGMCU_CLK_DISABLE( );
+#endif
+}
+
+/**
+ * @brief Error_Handler
+ * @param None
+ * @retval None
+ */
+void Error_Handler(void)
+{
+ DBG_PRINTF("Error_Handler\n\r");
+ while(1);
+}
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
+
+
diff --git a/Src/hw_gpio.c b/Src/hw_gpio.c
new file mode 100755
index 0000000..5f4c2e8
--- /dev/null
+++ b/Src/hw_gpio.c
@@ -0,0 +1,191 @@
+/*
+ / _____) _ | |
+( (____ _____ ____ _| |_ _____ ____| |__
+ \____ \| ___ | (_ _) ___ |/ ___) _ \
+ _____) ) ____| | | || |_| ____( (___| | | |
+(______/|_____)_|_|_| \__)_____)\____)_| |_|
+ (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.c
+ * @author MCD Application Team
+ * @version V1.1.2
+ * @date 08-September-2017
+ * @brief driver for GPIO
+ ******************************************************************************
+ * @attention
+ *
+ *
+ *
+ * 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.
+ *
+ ******************************************************************************
+ */
+
+/* Includes ------------------------------------------------------------------*/
+#include "hw.h"
+
+/* Private typedef -----------------------------------------------------------*/
+/* Private define ------------------------------------------------------------*/
+/* Private macro -------------------------------------------------------------*/
+/* Private variables ---------------------------------------------------------*/
+static GpioIrqHandler *GpioIrq[16] = { NULL };
+
+/* Private function prototypes -----------------------------------------------*/
+
+static uint8_t HW_GPIO_GetBitPos(uint16_t GPIO_Pin);
+
+/* 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* port, uint16_t GPIO_Pin, GPIO_InitTypeDef* initStruct)
+{
+
+ RCC_GPIO_CLK_ENABLE( (uint32_t) port);
+
+ initStruct->Pin = GPIO_Pin ;
+
+ HAL_GPIO_Init( port, initStruct );
+}
+
+/*!
+ * @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 )
+{
+ IRQn_Type IRQnb;
+
+ uint32_t BitPos = HW_GPIO_GetBitPos( GPIO_Pin ) ;
+
+ if ( irqHandler != NULL)
+ {
+ GpioIrq[ BitPos ] = irqHandler;
+
+ IRQnb = MSP_GetIRQn( GPIO_Pin );
+
+ HAL_NVIC_SetPriority( IRQnb , prio, 0);
+
+ HAL_NVIC_EnableIRQ( IRQnb );
+ }
+}
+
+/*!
+ * @brief Execute the interrupt from the object
+ *
+ * @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 )
+{
+ uint32_t BitPos = HW_GPIO_GetBitPos( GPIO_Pin );
+
+ if ( GpioIrq[ BitPos ] != NULL)
+ {
+ GpioIrq[ BitPos ] ( );
+ }
+}
+
+/*!
+ * @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
+ */
+void HW_GPIO_Write( GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin, uint32_t value )
+{
+ HAL_GPIO_WritePin( GPIOx, GPIO_Pin , (GPIO_PinState) value );
+}
+
+/*!
+ * @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 )
+{
+ return HAL_GPIO_ReadPin( GPIOx, GPIO_Pin);
+}
+
+/* Private functions ---------------------------------------------------------*/
+
+/*!
+ * @brief Get the position of the bit set in the GPIO_Pin
+ * @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 the position of the bit
+ */
+static uint8_t HW_GPIO_GetBitPos(uint16_t GPIO_Pin)
+{
+ uint8_t PinPos=0;
+
+ if ( ( GPIO_Pin & 0xFF00 ) != 0) { PinPos |= 0x8; }
+ if ( ( GPIO_Pin & 0xF0F0 ) != 0) { PinPos |= 0x4; }
+ if ( ( GPIO_Pin & 0xCCCC ) != 0) { PinPos |= 0x2; }
+ if ( ( GPIO_Pin & 0xAAAA ) != 0) { PinPos |= 0x1; }
+
+ return PinPos;
+}
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/Src/hw_rtc.c b/Src/hw_rtc.c
new file mode 100755
index 0000000..5056fc2
--- /dev/null
+++ b/Src/hw_rtc.c
@@ -0,0 +1,632 @@
+/*
+ / _____) _ | |
+( (____ _____ ____ _| |_ _____ ____| |__
+ \____ \| ___ | (_ _) ___ |/ ___) _ \
+ _____) ) ____| | | || |_| ____( (___| | | |
+(______/|_____)_|_|_| \__)_____)\____)_| |_|
+ (C)2013 Semtech
+
+Description: MCU RTC timer
+
+License: Revised BSD License, see LICENSE.TXT file include in the project
+
+Maintainer: Miguel Luis and Gregory Cristian
+*/
+ /*******************************************************************************
+ * @file hw_rtc.c
+ * @author MCD Application Team
+ * @version V1.1.2
+ * @date 08-September-2017
+ * @brief driver for RTC
+ ******************************************************************************
+ * @attention
+ *
+ *
*
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- * 1. Redistributions 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 its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted, provided that the following conditions are met:
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 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.
+ * 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.
*
******************************************************************************
*/
/* Includes ------------------------------------------------------------------*/
-#include "main.h"
-#include "stm32l0xx_hal.h"
-#include "i2c.h"
-#include "rtc.h"
-#include "spi.h"
-#include "usart.h"
-#include "gpio.h"
-
-/* USER CODE BEGIN Includes */
-
-/* USER CODE END Includes */
-
-/* Private variables ---------------------------------------------------------*/
-
-/* USER CODE BEGIN PV */
-/* Private variables ---------------------------------------------------------*/
-
-/* USER CODE END PV */
-
+#include "hw.h"
+#include "low_power.h"
+#include "lora.h"
+//#include "bsp.h"
+#include "timeServer.h"
+#include "vcom.h"
+
+/* Private typedef -----------------------------------------------------------*/
+/* Private define ------------------------------------------------------------*/
+/*!
+ * CAYENNE_LPP is myDevices Application server.
+ */
+//#define CAYENNE_LPP
+#define LPP_DATATYPE_DIGITAL_INPUT 0x0
+#define LPP_DATATYPE_DIGITAL_OUTPUT 0x1
+#define LPP_DATATYPE_HUMIDITY 0x68
+#define LPP_DATATYPE_TEMPERATURE 0x67
+#define LPP_DATATYPE_BAROMETER 0x73
+
+#define LPP_APP_PORT 99
+
+/*!
+ * Defines the application data transmission duty cycle. 5s, value in [ms].
+ */
+#define APP_TX_DUTYCYCLE 10000
+/*!
+ * LoRaWAN Adaptive Data Rate
+ * @note Please note that when ADR is enabled the end-device should be static
+ */
+#define LORAWAN_ADR_ON 1
+/*!
+ * LoRaWAN confirmed messages
+ */
+#define LORAWAN_CONFIRMED_MSG DISABLE
+/*!
+ * LoRaWAN application port
+ * @note do not use 224. It is reserved for certification
+ */
+#define LORAWAN_APP_PORT 2
+/*!
+ * Number of trials for the join request.
+ */
+#define JOINREQ_NBTRIALS 3
+
+/* Private macro -------------------------------------------------------------*/
/* Private function prototypes -----------------------------------------------*/
-void SystemClock_Config(void);
-/* USER CODE BEGIN PFP */
-/* Private function prototypes -----------------------------------------------*/
-
-/* USER CODE END PFP */
+/* call back when LoRa will transmit a frame*/
+static void LoraTxData(lora_AppData_t *AppData, FunctionalState *IsTxConfirmed);
-/* USER CODE BEGIN 0 */
+/* call back when LoRa has received a frame*/
+static void LoraRxData(lora_AppData_t *AppData);
-/* USER CODE END 0 */
+/* Private variables ---------------------------------------------------------*/
+/* load call backs*/
+static LoRaMainCallback_t LoRaMainCallbacks = {HW_GetBatteryLevel,
+ HW_GetUniqueId,
+ HW_GetRandomSeed,
+ LoraTxData,
+ LoraRxData};
+
+/*!
+ * Specifies the state of the application LED
+ */
+static uint8_t AppLedStateOn = RESET;
+
+
+#ifdef USE_B_L072Z_LRWAN1
+/*!
+ * Timer to handle the application Tx Led to toggle
+ */
+static TimerEvent_t TxLedTimer;
+static void OnTimerLedEvent( void );
+#endif
+/* !
+ *Initialises the Lora Parameters
+ */
+static LoRaParam_t LoRaParamInit = {TX_ON_TIMER,
+ APP_TX_DUTYCYCLE,
+ CLASS_A,
+ LORAWAN_ADR_ON,
+ DR_0,
+ LORAWAN_PUBLIC_NETWORK,
+ JOINREQ_NBTRIALS};
+
+/* Private functions ---------------------------------------------------------*/
+/**
+ * @brief Main program
+ * @param None
+ * @retval None
+ */
int main(void)
{
+ /* STM32 HAL library initialization*/
+ HAL_Init();
- /* USER CODE BEGIN 1 */
-
- /* USER CODE END 1 */
+ /* Configure the system clock*/
+ SystemClock_Config();
- /* MCU Configuration----------------------------------------------------------*/
+ /* Configure the debug mode*/
+ DBG_Init();
- /* Reset of all peripherals, Initializes the Flash interface and the Systick. */
- HAL_Init();
+ /* Configure the hardware*/
+ HW_Init();
- /* USER CODE BEGIN Init */
+ /* USER CODE BEGIN 1 */
+ /* USER CODE END 1 */
- /* USER CODE END Init */
+ /* Configure the Lora Stack*/
+ lora_Init(&LoRaMainCallbacks, &LoRaParamInit);
- /* Configure the system clock */
- SystemClock_Config();
+ PRINTF("starting!!!\n\r");
- /* USER CODE BEGIN SysInit */
+ /* main loop*/
+ while (1) {
+ /* run the LoRa class A state machine*/
+ lora_fsm();
- /* USER CODE END SysInit */
-
- /* Initialize all configured peripherals */
- MX_GPIO_Init();
- MX_I2C1_Init();
- MX_SPI1_Init();
- MX_USART1_UART_Init();
- MX_USART2_UART_Init();
- MX_RTC_Init();
-
- /* USER CODE BEGIN 2 */
-
- /* USER CODE END 2 */
-
- /* Infinite loop */
- /* USER CODE BEGIN WHILE */
- while (1)
- {
- /* USER CODE END WHILE */
-
- /* USER CODE BEGIN 3 */
-
- }
- /* USER CODE END 3 */
+ DISABLE_IRQ();
+ /* if an interrupt has occurred after DISABLE_IRQ, it is kept pending
+ * and cortex will not enter low power anyway */
+ if (lora_getDeviceState() == DEVICE_STATE_SLEEP) {
+#ifndef LOW_POWER_DISABLE
+ LowPower_Handler();
+#endif
+ }
+ ENABLE_IRQ();
+ /* USER CODE BEGIN 2 */
+ /* USER CODE END 2 */
+ }
}
-/** System Clock Configuration
-*/
-void SystemClock_Config(void)
+static void LoraTxData(lora_AppData_t *AppData, FunctionalState *IsTxConfirmed)
{
+ /* USER CODE BEGIN 3 */
- RCC_OscInitTypeDef RCC_OscInitStruct;
- RCC_ClkInitTypeDef RCC_ClkInitStruct;
- RCC_PeriphCLKInitTypeDef PeriphClkInit;
-
- /**Configure the main internal regulator output voltage
- */
- __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);
-
- /**Initializes the CPU, AHB and APB busses clocks
- */
- RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI|RCC_OSCILLATORTYPE_LSI;
- RCC_OscInitStruct.HSIState = RCC_HSI_ON;
- RCC_OscInitStruct.HSICalibrationValue = 16;
- RCC_OscInitStruct.LSIState = RCC_LSI_ON;
- RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
- RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI;
- RCC_OscInitStruct.PLL.PLLMUL = RCC_PLLMUL_3;
- RCC_OscInitStruct.PLL.PLLDIV = RCC_PLLDIV_2;
- if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
- {
- _Error_Handler(__FILE__, __LINE__);
- }
-
- /**Initializes the CPU, AHB and APB busses clocks
- */
- RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK
- |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2;
- RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
- RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
- RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1;
- RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;
-
- if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_1) != HAL_OK)
- {
- _Error_Handler(__FILE__, __LINE__);
- }
-
- PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_USART1|RCC_PERIPHCLK_USART2
- |RCC_PERIPHCLK_I2C1|RCC_PERIPHCLK_RTC;
- PeriphClkInit.Usart1ClockSelection = RCC_USART1CLKSOURCE_PCLK2;
- PeriphClkInit.Usart2ClockSelection = RCC_USART2CLKSOURCE_PCLK1;
- PeriphClkInit.I2c1ClockSelection = RCC_I2C1CLKSOURCE_PCLK1;
- PeriphClkInit.RTCClockSelection = RCC_RTCCLKSOURCE_LSI;
- if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit) != HAL_OK)
- {
- _Error_Handler(__FILE__, __LINE__);
- }
-
- /**Configure the Systick interrupt time
- */
- HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq()/1000);
-
- /**Configure the Systick
- */
- HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK);
-
- /* SysTick_IRQn interrupt configuration */
- HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0);
-}
+ AppData->Port = LORAWAN_APP_PORT;
-/* USER CODE BEGIN 4 */
+ //TODO
-/* USER CODE END 4 */
+ *IsTxConfirmed = LORAWAN_CONFIRMED_MSG;
-/**
- * @brief This function is executed in case of error occurrence.
- * @param None
- * @retval None
- */
-void _Error_Handler(char * file, int line)
-{
- /* USER CODE BEGIN Error_Handler_Debug */
- /* User can add his own implementation to report the HAL error return state */
- while(1)
- {
- }
- /* USER CODE END Error_Handler_Debug */
-}
+ AppData->BuffSize = 0;
-#ifdef USE_FULL_ASSERT
+ /* USER CODE END 3 */
+}
-/**
- * @brief Reports the name of the source file and the source line number
- * where the assert_param error has occurred.
- * @param file: pointer to the source file name
- * @param line: assert_param error line source number
- * @retval None
- */
-void assert_failed(uint8_t* file, uint32_t line)
+static void LoraRxData(lora_AppData_t *AppData)
{
- /* USER CODE BEGIN 6 */
- /* User can add his own implementation to report the file name and line number,
- ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */
- /* USER CODE END 6 */
-
+ /* USER CODE BEGIN 4 */
+ switch (AppData->Port) {
+ case LORAWAN_APP_PORT:
+
+ break;
+ case LPP_APP_PORT: {
+
+ break;
+ }
+ default:
+ break;
+ }
+ /* USER CODE END 4 */
}
-#endif
-
-/**
- * @}
- */
-
-/**
- * @}
-*/
-
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/Src/stm32l0xx_hal_msp.c b/Src/stm32l0xx_hal_msp.c
old mode 100644
new mode 100755
index 79aac7b..5e056b1
--- a/Src/stm32l0xx_hal_msp.c
+++ b/Src/stm32l0xx_hal_msp.c
@@ -1,83 +1,224 @@
-/**
- ******************************************************************************
- * File Name : stm32l0xx_hal_msp.c
- * Description : This file provides code for the MSP Initialization
- * and de-Initialization codes.
+
+ /******************************************************************************
+ * @file stm32l0xx_hal_msp.c
+ * @author MCD Application Team
+ * @version V1.1.2
+ * @date 08-September-2017
+ * @brief msp file for HAL
******************************************************************************
- ** This notice applies to any and all portions of this file
- * that are not between comment pairs USER CODE BEGIN and
- * USER CODE END. Other portions of this file, whether
- * inserted by the user or by software development tools
- * are owned by their respective copyright owners.
+ * @attention
*
- * COPYRIGHT(c) 2017 STMicroelectronics
+ *
*
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- * 1. Redistributions 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 its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted, provided that the following conditions are met:
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 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.
+ * 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.
*
******************************************************************************
*/
+
/* Includes ------------------------------------------------------------------*/
-#include "stm32l0xx_hal.h"
+#include "hw.h"
+#include "low_power.h"
+#include "delay.h"
+#include "timeServer.h"
+/* when fast wake up is enabled, the mcu wakes up in ~20us * and
+ * does not wait for the VREFINT to be settled. THis is ok for
+ * most of the case except when adc must be used in this case before
+ *starting the adc, you must make sure VREFINT is settled*/
+#define ENABLE_FAST_WAKEUP
-extern void _Error_Handler(char *, int);
-/* USER CODE BEGIN 0 */
+/* Private typedef -----------------------------------------------------------*/
+/* Private define ------------------------------------------------------------*/
+/* Private macro -------------------------------------------------------------*/
+/* Private variables ---------------------------------------------------------*/
+/* Private function prototypes -----------------------------------------------*/
+/* Private functions ---------------------------------------------------------*/
-/* USER CODE END 0 */
/**
- * Initializes the Global MSP.
+ * @brief This function configures the source of the time base.
+ * @brief don't enable systick
+ * @param TickPriority: Tick interrupt priority.
+ * @retval HAL status
*/
-void HAL_MspInit(void)
+HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority)
{
- /* USER CODE BEGIN MspInit 0 */
+ /* Return function status */
+ return HAL_OK;
+}
- /* USER CODE END MspInit 0 */
+/**
+ * @brief This function provides delay (in ms)
+ * @param Delay: specifies the delay time length, in milliseconds.
+ * @retval None
+ */
+void HAL_Delay(__IO uint32_t Delay)
+{
+ DelayMs( Delay ); /* based on RTC */
+}
- __HAL_RCC_SYSCFG_CLK_ENABLE();
+/**
+ * @brief Initializes the MSP.
+ * @retval None
+ */
+void HAL_MspInit(void)
+{
__HAL_RCC_PWR_CLK_ENABLE();
+
+ /* Disable the Power Voltage Detector */
+ HAL_PWR_DisablePVD( );
+
+ /* Enables the Ultra Low Power mode */
+ HAL_PWREx_EnableUltraLowPower( );
+
+ __HAL_FLASH_SLEEP_POWERDOWN_ENABLE();
+
+ /*In debug mode, e.g. when DBGMCU is activated, Arm core has always clocks
+ * And will not wait that the FLACH is ready to be read. It can miss in this
+ * case the first instruction. To overcome this issue, the flash remain clcoked during sleep mode
+ */
+ DBG( __HAL_FLASH_SLEEP_POWERDOWN_DISABLE(); );
+
+#ifdef ENABLE_FAST_WAKEUP
+ /*Enable fast wakeUp*/
+ HAL_PWREx_EnableFastWakeUp( );
+#else
+ HAL_PWREx_DisableFastWakeUp( );
+#endif
+}
- /* System interrupt init*/
- /* SVC_IRQn interrupt configuration */
- HAL_NVIC_SetPriority(SVC_IRQn, 0, 0);
- /* PendSV_IRQn interrupt configuration */
- HAL_NVIC_SetPriority(PendSV_IRQn, 0, 0);
- /* SysTick_IRQn interrupt configuration */
- HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0);
+/**
+ * @brief RTC MSP Initialization
+ * This function configures the hardware resources used in this example:
+ * - Peripheral's clock enable
+ * @param hrtc: RTC handle pointer
+ * @note Care must be taken when HAL_RCCEx_PeriphCLKConfig() is used to select
+ * the RTC clock source; in this case the Backup domain will be reset in
+ * order to modify the RTC Clock source, as consequence RTC registers (including
+ * the backup registers) and RCC_CSR register are set to their reset values.
+ * @retval None
+ */
+void HAL_RTC_MspInit(RTC_HandleTypeDef *hrtc)
+{
+ RCC_OscInitTypeDef RCC_OscInitStruct;
+ RCC_PeriphCLKInitTypeDef PeriphClkInitStruct;
- /* USER CODE BEGIN MspInit 1 */
+ /*##-1- Configue the RTC clock soucre ######################################*/
+ /* -a- Enable LSE Oscillator */
+ RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_LSE;
+ RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE;
+ RCC_OscInitStruct.LSEState = RCC_LSE_ON;
+ if(HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
+ {
+ Error_Handler();
+ }
- /* USER CODE END MspInit 1 */
+ /* -b- Select LSI as RTC clock source */
+ PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_RTC;
+ PeriphClkInitStruct.RTCClockSelection = RCC_RTCCLKSOURCE_LSE;
+ if(HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK)
+ {
+ Error_Handler();
+ }
+
+ /*##-2- Enable the RTC peripheral Clock ####################################*/
+ /* Enable RTC Clock */
+ __HAL_RCC_RTC_ENABLE();
+
+ /*##-3- Configure the NVIC for RTC Alarm ###################################*/
+ HAL_NVIC_SetPriority(RTC_Alarm_IRQn, 0x0, 0);
+ HAL_NVIC_EnableIRQ(RTC_Alarm_IRQn);
}
-/* USER CODE BEGIN 1 */
+/**
+ * @brief RTC MSP De-Initialization
+ * This function freeze the hardware resources used in this example:
+ * - Disable the Peripheral's clock
+ * @param hrtc: RTC handle pointer
+ * @retval None
+ */
+void HAL_RTC_MspDeInit(RTC_HandleTypeDef *hrtc)
+{
+ /* Reset peripherals */
+ __HAL_RCC_RTC_DISABLE();
+}
-/* USER CODE END 1 */
/**
- * @}
+ * @brief Alarm A callback.
+ * @param hrtc: RTC handle
+ * @retval None
*/
+void HAL_RTC_AlarmAEventCallback(RTC_HandleTypeDef *hrtc)
+{
+ TimerIrqHandler( );
+}
+
+/**
+ * @brief EXTI line detection callbacks.
+ * @param GPIO_Pin: Specifies the pins connected to the EXTI line.
+ * @retval None
+ */
+void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
+{
+ HW_GPIO_IrqHandler( GPIO_Pin );
+}
/**
- * @}
+ * @brief Gets IRQ number as a function of the GPIO_Pin.
+ * @param GPIO_Pin: Specifies the pins connected to the EXTI line.
+ * @retval IRQ number
*/
+IRQn_Type MSP_GetIRQn( uint16_t GPIO_Pin)
+{
+ switch( GPIO_Pin )
+ {
+ case GPIO_PIN_0:
+ case GPIO_PIN_1: return EXTI0_1_IRQn;
+ case GPIO_PIN_2:
+ case GPIO_PIN_3: return EXTI2_3_IRQn;
+ case GPIO_PIN_4:
+ case GPIO_PIN_5:
+ case GPIO_PIN_6:
+ case GPIO_PIN_7:
+ case GPIO_PIN_8:
+ case GPIO_PIN_9:
+ case GPIO_PIN_10:
+ case GPIO_PIN_11:
+ case GPIO_PIN_12:
+ case GPIO_PIN_13:
+ case GPIO_PIN_14:
+ case GPIO_PIN_15:
+ default: return EXTI4_15_IRQn;
+ }
+}
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/Src/stm32l0xx_hw.c b/Src/stm32l0xx_hw.c
new file mode 100755
index 0000000..7f6d5d9
--- /dev/null
+++ b/Src/stm32l0xx_hw.c
@@ -0,0 +1,335 @@
+/*
+ / _____) _ | |
+( (____ _____ ____ _| |_ _____ ____| |__
+ \____ \| ___ | (_ _) ___ |/ ___) _ \
+ _____) ) ____| | | || |_| ____( (___| | | |
+(______/|_____)_|_|_| \__)_____)\____)_| |_|
+ (C)2013 Semtech
+
+Description: Target board general functions implementation
+
+License: Revised BSD License, see LICENSE.TXT file include in the project
+
+Maintainer: Miguel Luis and Gregory Cristian
+*/
+ /*******************************************************************************
+ * @file stm32l0xx_hw.c
+ * @author MCD Application Team
+ * @version V1.1.2
+ * @date 08-September-2017
+ * @brief system hardware driver
+ ******************************************************************************
+ * @attention
+ *
+ *
*
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- * 1. Redistributions 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 its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted, provided that the following conditions are met:
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 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.
+ * 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.
*
******************************************************************************
*/
+
/* Includes ------------------------------------------------------------------*/
-#include "stm32l0xx_hal.h"
-#include "stm32l0xx.h"
+#include "hw.h"
#include "stm32l0xx_it.h"
+#include "low_power.h"
-/* USER CODE BEGIN 0 */
+/** @addtogroup STM32L1xx_HAL_Examples
+ * @{
+ */
-/* USER CODE END 0 */
+/** @addtogroup SPI_FullDuplex_ComPolling
+ * @{
+ */
-/* External variables --------------------------------------------------------*/
+/* Private typedef -----------------------------------------------------------*/
+/* Private define ------------------------------------------------------------*/
+/* Private macro -------------------------------------------------------------*/
+/* Private variables ---------------------------------------------------------*/
+/* Private function prototypes -----------------------------------------------*/
+/* Private functions ---------------------------------------------------------*/
/******************************************************************************/
-/* Cortex-M0+ Processor Interruption and Exception Handlers */
+/* Cortex-M3 Processor Exceptions Handlers */
/******************************************************************************/
/**
-* @brief This function handles System service call via SWI instruction.
-*/
-void SVC_Handler(void)
+ * @brief This function handles NMI exception.
+ * @param None
+ * @retval None
+ */
+
+void NMI_Handler(void)
{
- /* USER CODE BEGIN SVC_IRQn 0 */
+}
+
- /* USER CODE END SVC_IRQn 0 */
- /* USER CODE BEGIN SVC_IRQn 1 */
+/**
+ * @brief This function handles Hard Fault exception.
+ * @param None
+ * @retval None
+ */
+
+
+void HardFault_Handler(void)
+{
+ while(1)
+ {
+ __NOP();
+ }
- /* USER CODE END SVC_IRQn 1 */
}
+
/**
-* @brief This function handles Pendable request for system service.
-*/
-void PendSV_Handler(void)
+ * @brief This function handles Memory Manage exception.
+ * @param None
+ * @retval None
+ */
+void MemManage_Handler(void)
{
- /* USER CODE BEGIN PendSV_IRQn 0 */
+ /* Go to infinite loop when Memory Manage exception occurs */
+ while (1)
+ {
+ }
+}
- /* USER CODE END PendSV_IRQn 0 */
- /* USER CODE BEGIN PendSV_IRQn 1 */
+/**
+ * @brief This function handles Bus Fault exception.
+ * @param None
+ * @retval None
+ */
+void BusFault_Handler(void)
+{
+ /* Go to infinite loop when Bus Fault exception occurs */
+ while (1)
+ {
+ }
+}
- /* USER CODE END PendSV_IRQn 1 */
+/**
+ * @brief This function handles Usage Fault exception.
+ * @param None
+ * @retval None
+ */
+void UsageFault_Handler(void)
+{
+ /* Go to infinite loop when Usage Fault exception occurs */
+ while (1)
+ {
+ }
}
/**
-* @brief This function handles System tick timer.
-*/
-void SysTick_Handler(void)
+ * @brief This function handles SVCall exception.
+ * @param None
+ * @retval None
+ */
+void SVC_Handler(void)
{
- /* USER CODE BEGIN SysTick_IRQn 0 */
+}
- /* USER CODE END SysTick_IRQn 0 */
- HAL_IncTick();
- HAL_SYSTICK_IRQHandler();
- /* USER CODE BEGIN SysTick_IRQn 1 */
+/**
+ * @brief This function handles Debug Monitor exception.
+ * @param None
+ * @retval None
+ */
+void DebugMon_Handler(void)
+{
+}
- /* USER CODE END SysTick_IRQn 1 */
+/**
+ * @brief This function handles PendSVC exception.
+ * @param None
+ * @retval None
+ */
+void PendSV_Handler(void)
+{
+}
+
+/**
+ * @brief This function handles SysTick Handler.
+ * @param None
+ * @retval None
+ */
+void SysTick_Handler(void)
+{
+ HAL_IncTick();
}
/******************************************************************************/
-/* STM32L0xx Peripheral Interrupt Handlers */
-/* Add here the Interrupt Handlers for the used peripherals. */
-/* For the available peripheral interrupt handler names, */
-/* please refer to the startup file (startup_stm32l0xx.s). */
+/* STM32L1xx Peripherals Interrupt Handlers */
+/* Add here the Interrupt Handler for the used peripheral(s) (PPP), for the */
+/* available peripheral interrupt handler's name please refer to the startup */
+/* file (startup_stm32l1xx.s). */
/******************************************************************************/
-/* USER CODE BEGIN 1 */
+/**
+ * @brief This function handles PPP interrupt request.
+ * @param None
+ * @retval None
+ */
+/*void PPP_IRQHandler(void)
+{
+}*/
+
+void USART2_IRQHandler( void )
+{
+ vcom_Print( );
+}
+
+void RTC_IRQHandler( void )
+{
+ HW_RTC_IrqHandler ( );
+}
+
+void EXTI0_1_IRQHandler( void )
+{
+ HAL_GPIO_EXTI_IRQHandler( GPIO_PIN_0 );
+
+ HAL_GPIO_EXTI_IRQHandler( GPIO_PIN_1 );
+}
+
+void EXTI2_3_IRQHandler( void )
+{
+ HAL_GPIO_EXTI_IRQHandler( GPIO_PIN_2 );
+
+ HAL_GPIO_EXTI_IRQHandler( GPIO_PIN_3 );
+}
+
+
+void EXTI4_15_IRQHandler( void )
+{
+ HAL_GPIO_EXTI_IRQHandler( GPIO_PIN_4 );
+
+ HAL_GPIO_EXTI_IRQHandler( GPIO_PIN_5 );
+
+ HAL_GPIO_EXTI_IRQHandler( GPIO_PIN_6 );
+
+ HAL_GPIO_EXTI_IRQHandler( GPIO_PIN_7 );
+
+ HAL_GPIO_EXTI_IRQHandler( GPIO_PIN_8 );
+
+ HAL_GPIO_EXTI_IRQHandler( GPIO_PIN_9 );
+
+ HAL_GPIO_EXTI_IRQHandler( GPIO_PIN_10 );
+
+ HAL_GPIO_EXTI_IRQHandler( GPIO_PIN_11 );
+
+ HAL_GPIO_EXTI_IRQHandler( GPIO_PIN_12 );
+
+ HAL_GPIO_EXTI_IRQHandler( GPIO_PIN_13 );
+
+ HAL_GPIO_EXTI_IRQHandler( GPIO_PIN_14 );
+
+ HAL_GPIO_EXTI_IRQHandler( GPIO_PIN_15 );
+}
-/* USER CODE END 1 */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/Src/system.tmp b/Src/system.tmp
deleted file mode 100644
index 753c729..0000000
--- a/Src/system.tmp
+++ /dev/null
@@ -1,13 +0,0 @@
-#n
-#t__HAL_RCC_SYSCFG_CLK_ENABLE();
-#t__HAL_RCC_PWR_CLK_ENABLE();
-#n
-#t/* System interrupt init*/
-#t/* SVC_IRQn interrupt configuration */
-#tNVIC_SetPriority(SVC_IRQn, 0);
-#t/* PendSV_IRQn interrupt configuration */
-#tNVIC_SetPriority(PendSV_IRQn, 0);
-#t/* SysTick_IRQn interrupt configuration */
-#tNVIC_SetPriority(SysTick_IRQn, 0);
-#n
-#n
diff --git a/Src/vcom.c b/Src/vcom.c
new file mode 100755
index 0000000..a8f2cbc
--- /dev/null
+++ b/Src/vcom.c
@@ -0,0 +1,262 @@
+ /******************************************************************************
+ * @file vcom.c
+ * @author MCD Application Team
+ * @version V1.1.2
+ * @date 08-September-2017
+ * @brief manages virtual com port
+ ******************************************************************************
+ * @attention
+ *
+ *
+ *
+ * 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.
+ *
+ ******************************************************************************
+ */
+
+#include "hw.h"
+#include "vcom.h"
+#include
+
+
+/* Private typedef -----------------------------------------------------------*/
+/* Private define ------------------------------------------------------------*/
+#define BUFSIZE 256
+#define USARTX_IRQn USART2_IRQn
+/* Private macro -------------------------------------------------------------*/
+/* Private variables ---------------------------------------------------------*/
+
+/* buffer */
+static char buff[BUFSIZE];
+/* buffer write index*/
+__IO uint16_t iw=0;
+/* buffer read index*/
+static uint16_t ir=0;
+/* Uart Handle */
+static UART_HandleTypeDef UartHandle;
+
+/* Private function prototypes -----------------------------------------------*/
+/* Functions Definition ------------------------------------------------------*/
+
+void vcom_Init(void)
+{
+ /*## Configure the UART peripheral ######################################*/
+ /* Put the USART peripheral in the Asynchronous mode (UART Mode) */
+ /* UART1 configured as follow:
+ - Word Length = 8 Bits
+ - Stop Bit = One Stop bit
+ - Parity = ODD parity
+ - BaudRate = 921600 baud
+ - Hardware flow control disabled (RTS and CTS signals) */
+ UartHandle.Instance = USARTX;
+
+ UartHandle.Init.BaudRate = 115200;
+ UartHandle.Init.WordLength = UART_WORDLENGTH_8B;
+ UartHandle.Init.StopBits = UART_STOPBITS_1;
+ UartHandle.Init.Parity = UART_PARITY_NONE;
+ UartHandle.Init.HwFlowCtl = UART_HWCONTROL_NONE;
+ UartHandle.Init.Mode = UART_MODE_TX_RX;
+
+ if(HAL_UART_Init(&UartHandle) != HAL_OK)
+ {
+ /* Initialization Error */
+ Error_Handler();
+ }
+
+ HAL_NVIC_SetPriority(USARTX_IRQn, 0x1, 0);
+ HAL_NVIC_EnableIRQ(USARTX_IRQn);
+}
+
+
+void vcom_DeInit(void)
+{
+#if 1
+ HAL_UART_DeInit(&UartHandle);
+#endif
+}
+
+void vcom_Send( char *format, ... )
+{
+ va_list args;
+ va_start(args, format);
+ uint8_t len;
+ uint8_t lenTop;
+ char tempBuff[128];
+
+ BACKUP_PRIMASK();
+ DISABLE_IRQ();
+
+ /*convert into string at buff[0] of length iw*/
+ len = vsprintf(&tempBuff[0], format, args);
+
+ if (iw+len0 )
+ {
+ BACKUP_PRIMASK();
+ DISABLE_IRQ();
+
+ CurChar = &buff[ir];
+ ir= (ir+1) %BUFSIZE;
+
+ RESTORE_PRIMASK();
+
+ HAL_UART_Transmit(&UartHandle,(uint8_t *) CurChar, 1, 300);
+ }
+ HAL_NVIC_ClearPendingIRQ(USARTX_IRQn);
+}
+
+void vcom_Send_Lp( char *format, ... )
+{
+ va_list args;
+ va_start(args, format);
+ uint8_t len;
+ uint8_t lenTop;
+ char tempBuff[128];
+
+ BACKUP_PRIMASK();
+ DISABLE_IRQ();
+
+ /*convert into string at buff[0] of length iw*/
+ len = vsprintf(&tempBuff[0], format, args);
+
+ if (iw+len
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ * 1. Redistributions 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 its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 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 "main.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_CRYP_MODULE_ENABLED */
+/*#define HAL_COMP_MODULE_ENABLED */
+/*#define HAL_CRC_MODULE_ENABLED */
+/*#define HAL_CRYP_MODULE_ENABLED */
+/*#define HAL_DAC_MODULE_ENABLED */
+/*#define HAL_FIREWALL_MODULE_ENABLED */
+/*#define HAL_I2S_MODULE_ENABLED */
+/*#define HAL_IWDG_MODULE_ENABLED */
+/*#define HAL_LCD_MODULE_ENABLED */
+/*#define HAL_LPTIM_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_PCD_MODULE_ENABLED */
+#define HAL_GPIO_MODULE_ENABLED
+#define HAL_DMA_MODULE_ENABLED
+#define HAL_I2C_MODULE_ENABLED
+#define HAL_RCC_MODULE_ENABLED
+#define HAL_FLASH_MODULE_ENABLED
+#define HAL_PWR_MODULE_ENABLED
+#define HAL_CORTEX_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)8000000U) /*!< Value of the External oscillator in Hz */
+#endif /* HSE_VALUE */
+
+#if !defined (HSE_STARTUP_TIMEOUT)
+ #define HSE_STARTUP_TIMEOUT ((uint32_t)100U) /*!< 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)2097000U) /*!< 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)16000000U) /*!< 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)48000000U) /*!< 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)37000U) /*!< 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)32768U) /*!< Value of the External oscillator in Hz*/
+#endif /* LSE_VALUE */
+
+#if !defined (LSE_STARTUP_TIMEOUT)
+ #define LSE_STARTUP_TIMEOUT ((uint32_t)5000U) /*!< Time out for LSE start up, in ms */
+#endif /* LSE_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)3300U) /*!< Value of VDD in mv */
+#define TICK_INT_PRIORITY ((uint32_t)0U) /*!< tick interrupt priority */
+#define USE_RTOS 0U
+#define PREFETCH_ENABLE 0U
+#define PREREAD_ENABLE 1U
+#define BUFFER_CACHE_DISABLE 0U
+
+/* ########################## Assert Selection ############################## */
+/**
+ * @brief Uncomment the line below to expanse the "assert_param" macro in the
+ * HAL drivers code
+ */
+/* #define USE_FULL_ASSERT 1U */
+
+/* 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_FIREWALL_MODULE_ENABLED
+ #include "stm32l0xx_hal_firewall.h"
+#endif /* HAL_FIREWALL_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)0U : assert_failed((uint8_t *)__FILE__, __LINE__))
+/* Exported functions ------------------------------------------------------- */
+ void assert_failed(uint8_t* file, uint32_t line);
+#else
+ #define assert_param(expr) ((void)0U)
+#endif /* USE_FULL_ASSERT */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __STM32L0xx_HAL_CONF_H */
+
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/Src/license.tmp b/junk/stm32l0xx_hal_msp.c-mx
similarity index 58%
rename from Src/license.tmp
rename to junk/stm32l0xx_hal_msp.c-mx
index b1e2416..79aac7b 100644
--- a/Src/license.tmp
+++ b/junk/stm32l0xx_hal_msp.c-mx
@@ -1,3 +1,9 @@
+/**
+ ******************************************************************************
+ * File Name : stm32l0xx_hal_msp.c
+ * Description : This file provides code for the MSP Initialization
+ * and de-Initialization codes.
+ ******************************************************************************
** This notice applies to any and all portions of this file
* that are not between comment pairs USER CODE BEGIN and
* USER CODE END. Other portions of this file, whether
@@ -28,3 +34,50 @@
* 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.
*
+ ******************************************************************************
+ */
+/* Includes ------------------------------------------------------------------*/
+#include "stm32l0xx_hal.h"
+
+extern void _Error_Handler(char *, int);
+/* USER CODE BEGIN 0 */
+
+/* USER CODE END 0 */
+/**
+ * Initializes the Global MSP.
+ */
+void HAL_MspInit(void)
+{
+ /* USER CODE BEGIN MspInit 0 */
+
+ /* USER CODE END MspInit 0 */
+
+ __HAL_RCC_SYSCFG_CLK_ENABLE();
+ __HAL_RCC_PWR_CLK_ENABLE();
+
+ /* System interrupt init*/
+ /* SVC_IRQn interrupt configuration */
+ HAL_NVIC_SetPriority(SVC_IRQn, 0, 0);
+ /* PendSV_IRQn interrupt configuration */
+ HAL_NVIC_SetPriority(PendSV_IRQn, 0, 0);
+ /* SysTick_IRQn interrupt configuration */
+ HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0);
+
+ /* USER CODE BEGIN MspInit 1 */
+
+ /* USER CODE END MspInit 1 */
+}
+
+/* USER CODE BEGIN 1 */
+
+/* USER CODE END 1 */
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/junk/stm32l0xx_it.c-mx b/junk/stm32l0xx_it.c-mx
new file mode 100644
index 0000000..63ff080
--- /dev/null
+++ b/junk/stm32l0xx_it.c-mx
@@ -0,0 +1,99 @@
+/**
+ ******************************************************************************
+ * @file stm32l0xx_it.c
+ * @brief Interrupt Service Routines.
+ ******************************************************************************
+ *
+ * COPYRIGHT(c) 2017 STMicroelectronics
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ * 1. Redistributions 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 its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 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.
+ *
+ ******************************************************************************
+ */
+/* Includes ------------------------------------------------------------------*/
+#include "stm32l0xx_hal.h"
+#include "stm32l0xx.h"
+#include "stm32l0xx_it.h"
+
+/* USER CODE BEGIN 0 */
+
+/* USER CODE END 0 */
+
+/* External variables --------------------------------------------------------*/
+
+/******************************************************************************/
+/* Cortex-M0+ Processor Interruption and Exception Handlers */
+/******************************************************************************/
+
+/**
+* @brief This function handles System service call via SWI instruction.
+*/
+void SVC_Handler(void)
+{
+ /* USER CODE BEGIN SVC_IRQn 0 */
+
+ /* USER CODE END SVC_IRQn 0 */
+ /* USER CODE BEGIN SVC_IRQn 1 */
+
+ /* USER CODE END SVC_IRQn 1 */
+}
+
+/**
+* @brief This function handles Pendable request for system service.
+*/
+void PendSV_Handler(void)
+{
+ /* USER CODE BEGIN PendSV_IRQn 0 */
+
+ /* USER CODE END PendSV_IRQn 0 */
+ /* USER CODE BEGIN PendSV_IRQn 1 */
+
+ /* USER CODE END PendSV_IRQn 1 */
+}
+
+/**
+* @brief This function handles System tick timer.
+*/
+void SysTick_Handler(void)
+{
+ /* USER CODE BEGIN SysTick_IRQn 0 */
+
+ /* USER CODE END SysTick_IRQn 0 */
+ HAL_IncTick();
+ HAL_SYSTICK_IRQHandler();
+ /* USER CODE BEGIN SysTick_IRQn 1 */
+
+ /* USER CODE END SysTick_IRQn 1 */
+}
+
+/******************************************************************************/
+/* STM32L0xx Peripheral Interrupt Handlers */
+/* Add here the Interrupt Handlers for the used peripherals. */
+/* For the available peripheral interrupt handler names, */
+/* please refer to the startup file (startup_stm32l0xx.s). */
+/******************************************************************************/
+
+/* USER CODE BEGIN 1 */
+
+/* USER CODE END 1 */
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/junk/stm32l0xx_it.h b/junk/stm32l0xx_it.h
new file mode 100644
index 0000000..c70422a
--- /dev/null
+++ b/junk/stm32l0xx_it.h
@@ -0,0 +1,60 @@
+/**
+ ******************************************************************************
+ * @file stm32l0xx_it.h
+ * @brief This file contains the headers of the interrupt handlers.
+ ******************************************************************************
+ *
+ * COPYRIGHT(c) 2017 STMicroelectronics
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ * 1. Redistributions 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 its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 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_IT_H
+#define __STM32L0xx_IT_H
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+/* Includes ------------------------------------------------------------------*/
+#include "stm32l0xx_hal.h"
+#include "main.h"
+/* Exported types ------------------------------------------------------------*/
+/* Exported constants --------------------------------------------------------*/
+/* Exported macro ------------------------------------------------------------*/
+/* Exported functions ------------------------------------------------------- */
+
+void SVC_Handler(void);
+void PendSV_Handler(void);
+void SysTick_Handler(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __STM32L0xx_IT_H */
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/Src/system_stm32l0xx.c b/junk/system_stm32l0xx.c-
similarity index 100%
rename from Src/system_stm32l0xx.c
rename to junk/system_stm32l0xx.c-
diff --git a/Src/usart.c b/junk/usart.c
similarity index 100%
rename from Src/usart.c
rename to junk/usart.c
diff --git a/Inc/usart.h b/junk/usart.h
similarity index 100%
rename from Inc/usart.h
rename to junk/usart.h