2015-10-09 19:40:39 +02:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2012, STMicroelectronics.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* 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 the Institute 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 INSTITUTE 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 INSTITUTE 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_CONFIG_H
|
|
|
|
#define __HW_CONFIG_H
|
|
|
|
/*---------------------------------------------------------------------------*/
|
|
|
|
#include "stm32l-spirit1-config.h"
|
|
|
|
/*---------------------------------------------------------------------------*/
|
|
|
|
#define UART_RxBufferSize 512
|
|
|
|
/*---------------------------------------------------------------------------*/
|
|
|
|
#define I2Cx I2C1
|
|
|
|
#define I2Cx_CLK_ENABLE() __I2C1_CLK_ENABLE()
|
|
|
|
#define I2Cx_SDA_GPIO_CLK_ENABLE() __GPIOB_CLK_ENABLE()
|
|
|
|
#define I2Cx_SCL_GPIO_CLK_ENABLE() __GPIOB_CLK_ENABLE()
|
|
|
|
/*---------------------------------------------------------------------------*/
|
|
|
|
#define I2Cx_FORCE_RESET() __I2C1_FORCE_RESET()
|
|
|
|
#define I2Cx_RELEASE_RESET() __I2C1_RELEASE_RESET()
|
|
|
|
/*---------------------------------------------------------------------------*/
|
|
|
|
/* Definition for I2Cx Pins */
|
|
|
|
#define I2Cx_SCL_PIN GPIO_PIN_8
|
|
|
|
#define I2Cx_SCL_GPIO_PORT GPIOB
|
|
|
|
#define I2Cx_SDA_PIN GPIO_PIN_9
|
|
|
|
#define I2Cx_SDA_GPIO_PORT GPIOB
|
|
|
|
#define I2Cx_SCL_SDA_AF GPIO_AF4_I2C1
|
|
|
|
|
|
|
|
/* Definition for I2Cx's NVIC */
|
|
|
|
#define I2Cx_EV_IRQn I2C1_EV_IRQn
|
|
|
|
#define I2Cx_ER_IRQn I2C1_ER_IRQn
|
|
|
|
#define I2Cx_EV_IRQHandler I2C1_EV_IRQHandler
|
|
|
|
#define I2Cx_ER_IRQHandler I2C1_ER_IRQHandler
|
|
|
|
|
|
|
|
#define I2Cx I2C1
|
|
|
|
#define I2Cx_CLK_ENABLE() __I2C1_CLK_ENABLE()
|
|
|
|
#define I2Cx_SDA_GPIO_CLK_ENABLE() __GPIOB_CLK_ENABLE()
|
|
|
|
#define I2Cx_SCL_GPIO_CLK_ENABLE() __GPIOB_CLK_ENABLE()
|
|
|
|
|
|
|
|
#define I2Cx_FORCE_RESET() __I2C1_FORCE_RESET()
|
|
|
|
#define I2Cx_RELEASE_RESET() __I2C1_RELEASE_RESET()
|
|
|
|
|
|
|
|
/* Definition for I2Cx Pins */
|
|
|
|
#define I2Cx_SCL_PIN GPIO_PIN_8
|
|
|
|
#define I2Cx_SCL_GPIO_PORT GPIOB
|
|
|
|
#define I2Cx_SDA_PIN GPIO_PIN_9
|
|
|
|
#define I2Cx_SDA_GPIO_PORT GPIOB
|
|
|
|
#define I2Cx_SCL_SDA_AF GPIO_AF4_I2C1
|
|
|
|
|
|
|
|
/* Definition for I2Cx's NVIC */
|
|
|
|
#define I2Cx_EV_IRQn I2C1_EV_IRQn
|
|
|
|
#define I2Cx_ER_IRQn I2C1_ER_IRQn
|
|
|
|
#define I2Cx_EV_IRQHandler I2C1_EV_IRQHandler
|
|
|
|
#define I2Cx_ER_IRQHandler I2C1_ER_IRQHandler
|
|
|
|
|
|
|
|
/* User can use this section to tailor USARTx/UARTx instance used and associated
|
|
|
|
resources */
|
|
|
|
/* Definition for USARTx clock resources */
|
|
|
|
#define USARTx USART2
|
|
|
|
#define USARTx_CLK_ENABLE() __USART2_CLK_ENABLE();
|
|
|
|
#define DMAx_CLK_ENABLE() __DMA1_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()
|
|
|
|
|
|
|
|
/* Definition for USARTx Pins */
|
|
|
|
#define USARTx_TX_PIN GPIO_PIN_2
|
|
|
|
#define USARTx_TX_GPIO_PORT GPIOA
|
|
|
|
|
|
|
|
#define USARTx_RX_PIN GPIO_PIN_3
|
|
|
|
#define USARTx_RX_GPIO_PORT GPIOA
|
|
|
|
|
|
|
|
/* Definition for USARTx's NVIC */
|
|
|
|
#define USARTx_IRQn USART2_IRQn
|
|
|
|
#define USARTx_IRQHandler USART2_IRQHandler
|
|
|
|
|
|
|
|
#define USARTx_TX_AF GPIO_AF7_USART2
|
|
|
|
#define USARTx_RX_AF GPIO_AF7_USART2
|
|
|
|
|
|
|
|
/* Enable sensor mask */
|
|
|
|
#define PRESSURE_SENSOR 0x00000001
|
|
|
|
#define TEMPERATURE_SENSOR 0x00000002
|
|
|
|
#define HUMIDITY_SENSOR 0x00000004
|
|
|
|
#define UV_SENSOR 0x00000008
|
|
|
|
#define ACCELEROMETER_SENSOR 0x00000010
|
|
|
|
#define GYROSCOPE_SENSOR 0x00000020
|
|
|
|
#define MAGNETIC_SENSOR 0x00000040
|
|
|
|
/*---------------------------------------------------------------------------*/
|
|
|
|
#endif /*__HW_CONFIG_H*/
|
|
|
|
/*---------------------------------------------------------------------------*/
|