License headers and code style fixes.
This commit is contained in:
parent
875bfd0a1a
commit
fc65757114
|
@ -25,7 +25,7 @@ CONTIKI_CPU_ARCH= watchdog.c \
|
||||||
clock.c
|
clock.c
|
||||||
|
|
||||||
ifdef GCC
|
ifdef GCC
|
||||||
CONTIKI_CPU_PORT= sysmem.c \
|
CONTIKI_CPU_PORT= syscalls.c \
|
||||||
console.c \
|
console.c \
|
||||||
crt.c \
|
crt.c \
|
||||||
uart.c
|
uart.c
|
||||||
|
|
|
@ -46,7 +46,8 @@ static volatile unsigned long seconds = 0;
|
||||||
static volatile clock_time_t ticks;
|
static volatile clock_time_t ticks;
|
||||||
void st_lib_sys_tick_handler(void);
|
void st_lib_sys_tick_handler(void);
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
void st_lib_sys_tick_handler(void)
|
void
|
||||||
|
st_lib_sys_tick_handler(void)
|
||||||
{
|
{
|
||||||
ticks++;
|
ticks++;
|
||||||
if((ticks % CLOCK_SECOND) == 0) {
|
if((ticks % CLOCK_SECOND) == 0) {
|
||||||
|
@ -60,29 +61,34 @@ void st_lib_sys_tick_handler(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
void clock_init(void)
|
void
|
||||||
|
clock_init(void)
|
||||||
{
|
{
|
||||||
ticks = 0;
|
ticks = 0;
|
||||||
st_lib_hal_systick_clk_source_config(SYSTICK_CLKSOURCE_HCLK);
|
st_lib_hal_systick_clk_source_config(SYSTICK_CLKSOURCE_HCLK);
|
||||||
st_lib_hal_systick_config(RELOAD_VALUE);
|
st_lib_hal_systick_config(RELOAD_VALUE);
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
unsigned long clock_seconds(void)
|
unsigned long
|
||||||
|
clock_seconds(void)
|
||||||
{
|
{
|
||||||
return seconds;
|
return seconds;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
void clock_set_seconds(unsigned long sec)
|
void
|
||||||
|
clock_set_seconds(unsigned long sec)
|
||||||
{
|
{
|
||||||
seconds = sec;
|
seconds = sec;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
clock_time_t clock_time(void)
|
clock_time_t
|
||||||
|
clock_time(void)
|
||||||
{
|
{
|
||||||
return ticks;
|
return ticks;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
void clock_delay(unsigned int i)
|
void
|
||||||
|
clock_delay(unsigned int i)
|
||||||
{
|
{
|
||||||
for(; i > 0; i--) {
|
for(; i > 0; i--) {
|
||||||
unsigned int j;
|
unsigned int j;
|
||||||
|
@ -93,7 +99,8 @@ void clock_delay(unsigned int i)
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
/* Wait for a multiple of clock ticks (7.8 ms at 128 Hz). */
|
/* Wait for a multiple of clock ticks (7.8 ms at 128 Hz). */
|
||||||
void clock_wait(clock_time_t t)
|
void
|
||||||
|
clock_wait(clock_time_t t)
|
||||||
{
|
{
|
||||||
clock_time_t start;
|
clock_time_t start;
|
||||||
start = clock_time();
|
start = clock_time();
|
||||||
|
|
|
@ -1,38 +1,32 @@
|
||||||
/**
|
/*
|
||||||
******************************************************************************
|
* Copyright (c) 2012, STMicroelectronics.
|
||||||
* @file console.c
|
* All rights reserved.
|
||||||
* @author AST
|
|
||||||
* @version V1.0.0
|
|
||||||
* @date 26-Aug-2014
|
|
||||||
* @brief This file provides implementation of standard input/output
|
|
||||||
******************************************************************************
|
|
||||||
* @attention
|
|
||||||
*
|
*
|
||||||
* <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
|
* Redistribution and use in source and binary forms, with or without
|
||||||
*
|
* modification, are permitted provided that the following conditions
|
||||||
* Redistribution and use in source and binary forms, with or without modification,
|
* are met:
|
||||||
* are permitted provided that the following conditions are met:
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
* 1. Redistributions of source code must retain the above copyright notice,
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* this list of conditions and the following disclaimer.
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
* documentation and/or other materials provided with the distribution.
|
||||||
* and/or other materials provided with the distribution.
|
* 3. Neither the name of the Institute nor the names of its contributors
|
||||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
|
||||||
* may be used to endorse or promote products derived from this software
|
* may be used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
* without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
|
* SUCH DAMAGE.
|
||||||
|
*
|
||||||
*
|
*
|
||||||
******************************************************************************
|
|
||||||
*/
|
*/
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -49,7 +43,8 @@ extern st_lib_uart_handle_typedef st_lib_uart_handle;
|
||||||
* @brief Initialises Nucleo UART port for user IO
|
* @brief Initialises Nucleo UART port for user IO
|
||||||
* @retval 0
|
* @retval 0
|
||||||
*/
|
*/
|
||||||
int console_init(void)
|
int
|
||||||
|
console_init(void)
|
||||||
{
|
{
|
||||||
st_lib_uart_handle.Instance = USART2;
|
st_lib_uart_handle.Instance = USART2;
|
||||||
|
|
||||||
|
@ -69,7 +64,8 @@ int console_init(void)
|
||||||
* @param ch Character to send
|
* @param ch Character to send
|
||||||
* @retval Character sent
|
* @retval Character sent
|
||||||
*/
|
*/
|
||||||
int uart_send_char(int ch)
|
int
|
||||||
|
uart_send_char(int ch)
|
||||||
{
|
{
|
||||||
st_lib_hal_uart_transmit(&st_lib_uart_handle, (uint8_t *)&ch, 1, HAL_MAX_DELAY);
|
st_lib_hal_uart_transmit(&st_lib_uart_handle, (uint8_t *)&ch, 1, HAL_MAX_DELAY);
|
||||||
return ch;
|
return ch;
|
||||||
|
@ -78,7 +74,8 @@ int uart_send_char(int ch)
|
||||||
/** @brief Receives a character from serial port
|
/** @brief Receives a character from serial port
|
||||||
* @retval Character received
|
* @retval Character received
|
||||||
*/
|
*/
|
||||||
int uart_receive_char(void)
|
int
|
||||||
|
uart_receive_char(void)
|
||||||
{
|
{
|
||||||
uint8_t ch;
|
uint8_t ch;
|
||||||
st_lib_hal_uart_receive(&st_lib_uart_handle, &ch, 1, HAL_MAX_DELAY);
|
st_lib_hal_uart_receive(&st_lib_uart_handle, &ch, 1, HAL_MAX_DELAY);
|
||||||
|
@ -106,7 +103,8 @@ size_t __read(int Handle, unsigned char *Buf, size_t Bufsize);
|
||||||
* @param bufsize Number of characters to read
|
* @param bufsize Number of characters to read
|
||||||
* @retval Number of characters read
|
* @retval Number of characters read
|
||||||
*/
|
*/
|
||||||
size_t __read(int handle, unsigned char *buf, size_t bufsize)
|
size_t
|
||||||
|
__read(int handle, unsigned char *buf, size_t bufsize)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -120,14 +118,14 @@ size_t __read(int handle, unsigned char *buf, size_t bufsize)
|
||||||
|
|
||||||
return bufsize;
|
return bufsize;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @brief IAR specific low level standard output
|
/** @brief IAR specific low level standard output
|
||||||
* @param handle IAR internal handle
|
* @param handle IAR internal handle
|
||||||
* @param buf Buffer containing characters to be written to stdout
|
* @param buf Buffer containing characters to be written to stdout
|
||||||
* @param bufsize Number of characters to write
|
* @param bufsize Number of characters to write
|
||||||
* @retval Number of characters read
|
* @retval Number of characters read
|
||||||
*/
|
*/
|
||||||
size_t __write(int handle, const unsigned char * buf, size_t bufsize)
|
size_t
|
||||||
|
__write(int handle, const unsigned char *buf, size_t bufsize)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -149,16 +147,17 @@ size_t __write(int handle, const unsigned char * buf, size_t bufsize)
|
||||||
* @param f File pointer
|
* @param f File pointer
|
||||||
* @retval Character printed
|
* @retval Character printed
|
||||||
*/
|
*/
|
||||||
int fputc(int ch, FILE *f)
|
int
|
||||||
|
fputc(int ch, FILE *f)
|
||||||
{
|
{
|
||||||
return uart_send_char(ch);
|
return uart_send_char(ch);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @brief fgetc call for standard input implementation
|
/** @brief fgetc call for standard input implementation
|
||||||
* @param f File pointer
|
* @param f File pointer
|
||||||
* @retval Character acquired from standard input
|
* @retval Character acquired from standard input
|
||||||
*/
|
*/
|
||||||
int fgetc(FILE *f)
|
int
|
||||||
|
fgetc(FILE *f)
|
||||||
{
|
{
|
||||||
return uart_receive_char();
|
return uart_receive_char();
|
||||||
}
|
}
|
||||||
|
@ -169,16 +168,17 @@ int fgetc(FILE *f)
|
||||||
* @param ch Character to print
|
* @param ch Character to print
|
||||||
* @retval Character printed
|
* @retval Character printed
|
||||||
*/
|
*/
|
||||||
int __io_putchar(int ch)
|
int
|
||||||
|
__io_putchar(int ch)
|
||||||
{
|
{
|
||||||
return uart_send_char(ch);
|
return uart_send_char(ch);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @brief getchar call for standard input implementation
|
/** @brief getchar call for standard input implementation
|
||||||
* @param None
|
* @param None
|
||||||
* @retval Character acquired from standard input
|
* @retval Character acquired from standard input
|
||||||
*/
|
*/
|
||||||
int __io_getchar(void)
|
int
|
||||||
|
__io_getchar(void)
|
||||||
{
|
{
|
||||||
return uart_receive_char();
|
return uart_receive_char();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,38 +1,32 @@
|
||||||
/**
|
/*
|
||||||
******************************************************************************
|
* Copyright (c) 2012, STMicroelectronics.
|
||||||
* @file console.h
|
* All rights reserved.
|
||||||
* @author AST
|
|
||||||
* @version V1.0.0
|
|
||||||
* @date 26-Aug-2014
|
|
||||||
* @brief This file provides implementation of standard input/output
|
|
||||||
******************************************************************************
|
|
||||||
* @attention
|
|
||||||
*
|
*
|
||||||
* <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
|
* Redistribution and use in source and binary forms, with or without
|
||||||
*
|
* modification, are permitted provided that the following conditions
|
||||||
* Redistribution and use in source and binary forms, with or without modification,
|
* are met:
|
||||||
* are permitted provided that the following conditions are met:
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
* 1. Redistributions of source code must retain the above copyright notice,
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* this list of conditions and the following disclaimer.
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
* documentation and/or other materials provided with the distribution.
|
||||||
* and/or other materials provided with the distribution.
|
* 3. Neither the name of the Institute nor the names of its contributors
|
||||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
|
||||||
* may be used to endorse or promote products derived from this software
|
* may be used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
* without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
|
* SUCH DAMAGE.
|
||||||
|
*
|
||||||
*
|
*
|
||||||
******************************************************************************
|
|
||||||
*/
|
*/
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
#if defined(__IAR_SYSTEMS_ICC__)
|
#if defined(__IAR_SYSTEMS_ICC__)
|
||||||
|
|
|
@ -1,84 +1,86 @@
|
||||||
/**
|
/*
|
||||||
******************************************************************************
|
* Copyright (c) 2012, STMicroelectronics.
|
||||||
* @file main.c
|
* All rights reserved.
|
||||||
* @author System LAB
|
|
||||||
* @version V1.0.0
|
|
||||||
* @date 17-June-2015
|
|
||||||
* @brief source file
|
|
||||||
******************************************************************************
|
|
||||||
* @attention
|
|
||||||
*
|
*
|
||||||
* <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
|
* Redistribution and use in source and binary forms, with or without
|
||||||
*
|
* modification, are permitted provided that the following conditions
|
||||||
* Redistribution and use in source and binary forms, with or without modification,
|
* are met:
|
||||||
* are permitted provided that the following conditions are met:
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
* 1. Redistributions of source code must retain the above copyright notice,
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* this list of conditions and the following disclaimer.
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
* documentation and/or other materials provided with the distribution.
|
||||||
* and/or other materials provided with the distribution.
|
* 3. Neither the name of the Institute nor the names of its contributors
|
||||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
|
||||||
* may be used to endorse or promote products derived from this software
|
* may be used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
* without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
|
* SUCH DAMAGE.
|
||||||
|
*
|
||||||
*
|
*
|
||||||
******************************************************************************
|
|
||||||
*/
|
*/
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
int _lseek (int file,
|
int
|
||||||
|
_lseek(int file,
|
||||||
int ptr,
|
int ptr,
|
||||||
int dir)
|
int dir)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
int _close (int file)
|
int
|
||||||
|
_close(int file)
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
void _exit (int n)
|
void
|
||||||
|
_exit(int n)
|
||||||
{
|
{
|
||||||
/* FIXME: return code is thrown away. */
|
/* FIXME: return code is thrown away. */
|
||||||
while(1) ;
|
while(1) ;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
int _kill (int n, int m)
|
int
|
||||||
|
_kill(int n, int m)
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
int _fstat(int file, struct stat *st)
|
int
|
||||||
|
_fstat(int file, struct stat *st)
|
||||||
{
|
{
|
||||||
st->st_mode = S_IFCHR;
|
st->st_mode = S_IFCHR;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
int _isatty (int fd)
|
int
|
||||||
|
_isatty(int fd)
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
fd = fd;
|
fd = fd;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
int _getpid (int n)
|
int
|
||||||
|
_getpid(int n)
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
int _open (const char * path, int flags, ...)
|
int
|
||||||
|
_open(const char *path, int flags, ...)
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,39 +1,34 @@
|
||||||
/**
|
/*
|
||||||
******************************************************************************
|
* Copyright (c) 2012, STMicroelectronics.
|
||||||
* @file console.c
|
* All rights reserved.
|
||||||
* @author AST
|
|
||||||
* @version V1.0.0
|
|
||||||
* @date 26-Aug-2014
|
|
||||||
* @brief This file provides implementation of standard input/output
|
|
||||||
******************************************************************************
|
|
||||||
* @attention
|
|
||||||
*
|
*
|
||||||
* <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
|
* Redistribution and use in source and binary forms, with or without
|
||||||
*
|
* modification, are permitted provided that the following conditions
|
||||||
* Redistribution and use in source and binary forms, with or without modification,
|
* are met:
|
||||||
* are permitted provided that the following conditions are met:
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
* 1. Redistributions of source code must retain the above copyright notice,
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* this list of conditions and the following disclaimer.
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
* documentation and/or other materials provided with the distribution.
|
||||||
* and/or other materials provided with the distribution.
|
* 3. Neither the name of the Institute nor the names of its contributors
|
||||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
|
||||||
* may be used to endorse or promote products derived from this software
|
* may be used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
* without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
|
* SUCH DAMAGE.
|
||||||
|
*
|
||||||
*
|
*
|
||||||
******************************************************************************
|
|
||||||
*/
|
*/
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
/*
|
/*
|
||||||
* Implementation of multithreading in ARM Cortex-M3. To be done.
|
* Implementation of multithreading in ARM Cortex-M3. To be done.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -47,7 +47,8 @@ volatile uint32_t rtimer_clock = 0uL;
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
st_lib_tim_handle_typedef htim2;
|
st_lib_tim_handle_typedef htim2;
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
void st_lib_tim2_irq_handler(void)
|
void
|
||||||
|
st_lib_tim2_irq_handler(void)
|
||||||
{
|
{
|
||||||
/* clear interrupt pending flag */
|
/* clear interrupt pending flag */
|
||||||
st_lib_hal_tim_clear_it(&htim2, TIM_IT_UPDATE);
|
st_lib_hal_tim_clear_it(&htim2, TIM_IT_UPDATE);
|
||||||
|
@ -55,7 +56,8 @@ void st_lib_tim2_irq_handler(void)
|
||||||
rtimer_clock++;
|
rtimer_clock++;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
void rtimer_arch_init(void)
|
void
|
||||||
|
rtimer_arch_init(void)
|
||||||
{
|
{
|
||||||
st_lib_tim_clock_config_typedef s_clock_source_config;
|
st_lib_tim_clock_config_typedef s_clock_source_config;
|
||||||
st_lib_tim_oc_init_typedef s_config_oc;
|
st_lib_tim_oc_init_typedef s_config_oc;
|
||||||
|
@ -79,7 +81,6 @@ void rtimer_arch_init(void)
|
||||||
s_config_oc.OCPolarity = TIM_OCPOLARITY_HIGH;
|
s_config_oc.OCPolarity = TIM_OCPOLARITY_HIGH;
|
||||||
st_lib_hal_tim_oc_config_channel(&htim2, &s_config_oc, TIM_CHANNEL_1);
|
st_lib_hal_tim_oc_config_channel(&htim2, &s_config_oc, TIM_CHANNEL_1);
|
||||||
|
|
||||||
|
|
||||||
st_lib_hal_tim_clear_flag(&htim2, TIM_FLAG_UPDATE);
|
st_lib_hal_tim_clear_flag(&htim2, TIM_FLAG_UPDATE);
|
||||||
|
|
||||||
/* Enable TIM2 Update interrupt */
|
/* Enable TIM2 Update interrupt */
|
||||||
|
@ -89,16 +90,16 @@ void rtimer_arch_init(void)
|
||||||
|
|
||||||
st_lib_hal_nvic_set_priority((st_lib_irq_n_type)TIM2_IRQn, 0, 0);
|
st_lib_hal_nvic_set_priority((st_lib_irq_n_type)TIM2_IRQn, 0, 0);
|
||||||
st_lib_hal_nvic_enable_irq((st_lib_irq_n_type)(TIM2_IRQn));
|
st_lib_hal_nvic_enable_irq((st_lib_irq_n_type)(TIM2_IRQn));
|
||||||
|
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
rtimer_clock_t rtimer_arch_now(void)
|
rtimer_clock_t
|
||||||
|
rtimer_arch_now(void)
|
||||||
{
|
{
|
||||||
return rtimer_clock;
|
return rtimer_clock;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
void rtimer_arch_schedule(rtimer_clock_t t)
|
void
|
||||||
|
rtimer_arch_schedule(rtimer_clock_t t)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
66
cpu/arm/stm32l152/syscalls.c
Normal file
66
cpu/arm/stm32l152/syscalls.c
Normal file
|
@ -0,0 +1,66 @@
|
||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
/*
|
||||||
|
* Function implementation taken and adapted from:
|
||||||
|
* cpu/stm32w108/e_stdio/src/syscalls.c
|
||||||
|
*/
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
#include <errno.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
extern int errno;
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
/* Register name faking - works in collusion with the linker. */
|
||||||
|
register char *stack_ptr asm ("sp");
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
caddr_t
|
||||||
|
_sbrk(int incr)
|
||||||
|
{
|
||||||
|
extern char end; /* Defined by the linker */
|
||||||
|
static char *heap_end;
|
||||||
|
char *prev_heap_end;
|
||||||
|
|
||||||
|
if(heap_end == 0) {
|
||||||
|
heap_end = &end;
|
||||||
|
}
|
||||||
|
prev_heap_end = heap_end;
|
||||||
|
if(heap_end + incr > stack_ptr) {
|
||||||
|
_write(1, "Heap and stack collision\n", 25);
|
||||||
|
/*abort ();*/
|
||||||
|
errno = ENOMEM;
|
||||||
|
return (caddr_t)-1;
|
||||||
|
}
|
||||||
|
|
||||||
|
heap_end += incr;
|
||||||
|
return (caddr_t)prev_heap_end;
|
||||||
|
}
|
||||||
|
/*---------------------------------------------------------------------------*/
|
|
@ -1,67 +0,0 @@
|
||||||
/**
|
|
||||||
*****************************************************************************
|
|
||||||
**
|
|
||||||
** File : sysmem.c
|
|
||||||
**
|
|
||||||
** Author : Ac6
|
|
||||||
**
|
|
||||||
** Abstract : System Workbench Minimal System Memory calls file
|
|
||||||
**
|
|
||||||
** For more information about which c-functions
|
|
||||||
** need which of these lowlevel functions
|
|
||||||
** please consult the Newlib libc-manual
|
|
||||||
**
|
|
||||||
** Environment : System Workbench for MCU
|
|
||||||
**
|
|
||||||
** Distribution: The file is distributed as is, without any warranty
|
|
||||||
** of any kind.
|
|
||||||
**
|
|
||||||
** (c)Copyright System Workbench for MCU.
|
|
||||||
** You may use this file as-is or modify it according to the needs of your
|
|
||||||
** project. Distribution of this file (unmodified or modified) is not
|
|
||||||
** permitted. System Workbench for MCU permit registered System Workbench(R) users the
|
|
||||||
** rights to distribute the assembled, compiled & linked contents of this
|
|
||||||
** file as part of an application binary file, provided that it is built
|
|
||||||
** using the System Workbench for MCU toolchain.
|
|
||||||
**
|
|
||||||
*****************************************************************************
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Includes */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
#include <errno.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Variables */
|
|
||||||
extern int errno;
|
|
||||||
register char * stack_ptr asm("sp");
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Functions */
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/**
|
|
||||||
_sbrk
|
|
||||||
Increase program data space. Malloc and related functions depend on this
|
|
||||||
**/
|
|
||||||
caddr_t _sbrk(int incr)
|
|
||||||
{
|
|
||||||
extern char end asm("end");
|
|
||||||
static char *heap_end;
|
|
||||||
char *prev_heap_end;
|
|
||||||
|
|
||||||
if (heap_end == 0) {
|
|
||||||
heap_end = &end;
|
|
||||||
}
|
|
||||||
|
|
||||||
prev_heap_end = heap_end;
|
|
||||||
if (heap_end + incr > stack_ptr) {
|
|
||||||
errno = ENOMEM;
|
|
||||||
return (caddr_t) -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
heap_end += incr;
|
|
||||||
|
|
||||||
return (caddr_t) prev_heap_end;
|
|
||||||
}
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
|
|
|
@ -1,38 +1,32 @@
|
||||||
/**
|
/*
|
||||||
******************************************************************************
|
* Copyright (c) 2012, STMicroelectronics.
|
||||||
* @file cpu/arm/stm32l152/uart.c
|
* All rights reserved.
|
||||||
* @author System LAB
|
|
||||||
* @version V1.0.0
|
|
||||||
* @date 17-June-2015
|
|
||||||
* @brief Source file for UART read/write
|
|
||||||
******************************************************************************
|
|
||||||
* @attention
|
|
||||||
*
|
*
|
||||||
* <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
|
* Redistribution and use in source and binary forms, with or without
|
||||||
*
|
* modification, are permitted provided that the following conditions
|
||||||
* Redistribution and use in source and binary forms, with or without modification,
|
* are met:
|
||||||
* are permitted provided that the following conditions are met:
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
* 1. Redistributions of source code must retain the above copyright notice,
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* this list of conditions and the following disclaimer.
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
* documentation and/or other materials provided with the distribution.
|
||||||
* and/or other materials provided with the distribution.
|
* 3. Neither the name of the Institute nor the names of its contributors
|
||||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
|
||||||
* may be used to endorse or promote products derived from this software
|
* may be used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
* without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
|
* SUCH DAMAGE.
|
||||||
|
*
|
||||||
*
|
*
|
||||||
******************************************************************************
|
|
||||||
*/
|
*/
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
#include "console.h"
|
#include "console.h"
|
||||||
|
|
|
@ -37,30 +37,25 @@
|
||||||
void
|
void
|
||||||
watchdog_init(void)
|
watchdog_init(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
void
|
void
|
||||||
watchdog_start(void)
|
watchdog_start(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
void
|
void
|
||||||
watchdog_periodic(void)
|
watchdog_periodic(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
void
|
void
|
||||||
watchdog_stop(void)
|
watchdog_stop(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
void
|
void
|
||||||
watchdog_reboot(void)
|
watchdog_reboot(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
|
@ -94,20 +94,17 @@ PROCESS_THREAD(sensor_demo_process, ev, data)
|
||||||
SENSORS_ACTIVATE(gyroscope_sensor);
|
SENSORS_ACTIVATE(gyroscope_sensor);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
while(1)
|
while(1) {
|
||||||
{
|
|
||||||
etimer_set(&etimer, PRINT_INTERVAL);
|
etimer_set(&etimer, PRINT_INTERVAL);
|
||||||
|
|
||||||
PROCESS_WAIT_EVENT();
|
PROCESS_WAIT_EVENT();
|
||||||
if (ev == sensors_event && data == &button_sensor)
|
if(ev == sensors_event && data == &button_sensor) {
|
||||||
{
|
|
||||||
printf("Sensor event detected: Button Pressed.\n\n");
|
printf("Sensor event detected: Button Pressed.\n\n");
|
||||||
printf("Toggling Leds\n");
|
printf("Toggling Leds\n");
|
||||||
_button_pressed++;
|
_button_pressed++;
|
||||||
leds_toggle(LEDS_ALL);
|
leds_toggle(LEDS_ALL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
printf("Button state:\t%s (pressed %lu times)\n", button_sensor.value(0) ? "Released" : "Pressed",
|
printf("Button state:\t%s (pressed %lu times)\n", button_sensor.value(0) ? "Released" : "Pressed",
|
||||||
_button_pressed);
|
_button_pressed);
|
||||||
|
|
||||||
|
|
|
@ -1,38 +1,32 @@
|
||||||
/**
|
/*
|
||||||
******************************************************************************
|
* Copyright (c) 2012, STMicroelectronics.
|
||||||
* @file platform/stm32nucleo-spirit1/contiki-conf.h
|
* All rights reserved.
|
||||||
* @author System LAB
|
|
||||||
* @version V1.0.0
|
|
||||||
* @date 17-May-2015
|
|
||||||
* @brief Contiki configuration parameters
|
|
||||||
******************************************************************************
|
|
||||||
* @attention
|
|
||||||
*
|
*
|
||||||
* <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
|
* Redistribution and use in source and binary forms, with or without
|
||||||
*
|
* modification, are permitted provided that the following conditions
|
||||||
* Redistribution and use in source and binary forms, with or without modification,
|
* are met:
|
||||||
* are permitted provided that the following conditions are met:
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
* 1. Redistributions of source code must retain the above copyright notice,
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* this list of conditions and the following disclaimer.
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
* documentation and/or other materials provided with the distribution.
|
||||||
* and/or other materials provided with the distribution.
|
* 3. Neither the name of the Institute nor the names of its contributors
|
||||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
|
||||||
* may be used to endorse or promote products derived from this software
|
* may be used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
* without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
|
* SUCH DAMAGE.
|
||||||
|
*
|
||||||
*
|
*
|
||||||
******************************************************************************
|
|
||||||
*/
|
*/
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
#ifndef __CONTIKI_CONF_H__
|
#ifndef __CONTIKI_CONF_H__
|
||||||
|
@ -62,12 +56,9 @@
|
||||||
#define RIMESTATS_CONF_ENABLED 0
|
#define RIMESTATS_CONF_ENABLED 0
|
||||||
#define RIMESTATS_CONF_ON 0
|
#define RIMESTATS_CONF_ON 0
|
||||||
|
|
||||||
|
|
||||||
/* Network setup for IPv6 */
|
/* Network setup for IPv6 */
|
||||||
|
|
||||||
#define CXMAC_CONF_ANNOUNCEMENTS 0
|
#define CXMAC_CONF_ANNOUNCEMENTS 0
|
||||||
|
|
||||||
|
|
||||||
/* A trick to resolve a compilation error with IAR. */
|
/* A trick to resolve a compilation error with IAR. */
|
||||||
#ifdef __ICCARM__
|
#ifdef __ICCARM__
|
||||||
#define UIP_CONF_DS6_AADDR_NBU 1
|
#define UIP_CONF_DS6_AADDR_NBU 1
|
||||||
|
@ -86,7 +77,6 @@
|
||||||
#define PROCESS_CONF_STATS 1
|
#define PROCESS_CONF_STATS 1
|
||||||
/*#define PROCESS_CONF_FASTPOLL 4*/
|
/*#define PROCESS_CONF_FASTPOLL 4*/
|
||||||
|
|
||||||
|
|
||||||
#define LINKADDR_CONF_SIZE 8
|
#define LINKADDR_CONF_SIZE 8
|
||||||
|
|
||||||
#define UIP_CONF_LL_802154 1
|
#define UIP_CONF_LL_802154 1
|
||||||
|
@ -100,10 +90,9 @@
|
||||||
#endif /* UIP_CONF_DS6_ROUTE_NBU */
|
#endif /* UIP_CONF_DS6_ROUTE_NBU */
|
||||||
|
|
||||||
#define UIP_CONF_ND6_SEND_RA 0
|
#define UIP_CONF_ND6_SEND_RA 0
|
||||||
#define UIP_CONF_ND6_REACHABLE_TIME 600000 //90000// 600000
|
#define UIP_CONF_ND6_REACHABLE_TIME 600000 /* 90000// 600000 */
|
||||||
#define UIP_CONF_ND6_RETRANS_TIMER 10000
|
#define UIP_CONF_ND6_RETRANS_TIMER 10000
|
||||||
|
|
||||||
|
|
||||||
#define UIP_CONF_IPV6 1
|
#define UIP_CONF_IPV6 1
|
||||||
#ifndef UIP_CONF_IPV6_QUEUE_PKT
|
#ifndef UIP_CONF_IPV6_QUEUE_PKT
|
||||||
#define UIP_CONF_IPV6_QUEUE_PKT 0
|
#define UIP_CONF_IPV6_QUEUE_PKT 0
|
||||||
|
@ -111,13 +100,12 @@
|
||||||
#define UIP_CONF_IP_FORWARD 0
|
#define UIP_CONF_IP_FORWARD 0
|
||||||
#ifndef UIP_CONF_BUFFER_SIZE
|
#ifndef UIP_CONF_BUFFER_SIZE
|
||||||
#define UIP_CONF_BUFFER_SIZE 280
|
#define UIP_CONF_BUFFER_SIZE 280
|
||||||
//#define UIP_CONF_BUFFER_SIZE 600
|
/* #define UIP_CONF_BUFFER_SIZE 600 */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define SICSLOWPAN_CONF_MAXAGE 4
|
#define SICSLOWPAN_CONF_MAXAGE 4
|
||||||
#define SICSLOWPAN_CONF_MAX_ADDR_CONTEXTS 2
|
#define SICSLOWPAN_CONF_MAX_ADDR_CONTEXTS 2
|
||||||
|
|
||||||
|
|
||||||
#ifndef SICSLOWPAN_CONF_MAX_MAC_TRANSMISSIONS
|
#ifndef SICSLOWPAN_CONF_MAX_MAC_TRANSMISSIONS
|
||||||
#define SICSLOWPAN_CONF_MAX_MAC_TRANSMISSIONS 5
|
#define SICSLOWPAN_CONF_MAX_MAC_TRANSMISSIONS 5
|
||||||
#endif /* SICSLOWPAN_CONF_MAX_MAC_TRANSMISSIONS */
|
#endif /* SICSLOWPAN_CONF_MAX_MAC_TRANSMISSIONS */
|
||||||
|
|
|
@ -1,39 +1,34 @@
|
||||||
/**
|
/*
|
||||||
******************************************************************************
|
* Copyright (c) 2012, STMicroelectronics.
|
||||||
* @file contiki-spirit1-main.c
|
* All rights reserved.
|
||||||
* @author System LAB
|
|
||||||
* @version V1.0.0
|
|
||||||
* @date 17-June-2015
|
|
||||||
* @brief Contiki main file for stm32nucleo-spirit1 platform
|
|
||||||
******************************************************************************
|
|
||||||
* @attention
|
|
||||||
*
|
*
|
||||||
* <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
|
* Redistribution and use in source and binary forms, with or without
|
||||||
*
|
* modification, are permitted provided that the following conditions
|
||||||
* Redistribution and use in source and binary forms, with or without modification,
|
* are met:
|
||||||
* are permitted provided that the following conditions are met:
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
* 1. Redistributions of source code must retain the above copyright notice,
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* this list of conditions and the following disclaimer.
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
* documentation and/or other materials provided with the distribution.
|
||||||
* and/or other materials provided with the distribution.
|
* 3. Neither the name of the Institute nor the names of its contributors
|
||||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
|
||||||
* may be used to endorse or promote products derived from this software
|
* may be used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
* without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
|
* SUCH DAMAGE.
|
||||||
|
*
|
||||||
*
|
*
|
||||||
******************************************************************************
|
|
||||||
*/
|
*/
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
/**
|
/**
|
||||||
* \addtogroup stm32nucleo-spirit1
|
* \addtogroup stm32nucleo-spirit1
|
||||||
* @{
|
* @{
|
||||||
|
@ -121,17 +116,20 @@ static void set_rime_addr(void);
|
||||||
void stm32cube_hal_init();
|
void stm32cube_hal_init();
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
#if 0
|
#if 0
|
||||||
static void panic_main(void)
|
static void
|
||||||
|
panic_main(void)
|
||||||
{
|
{
|
||||||
volatile uint16_t k;
|
volatile uint16_t k;
|
||||||
while(1) {
|
while(1) {
|
||||||
leds_toggle(LEDS_ALL);
|
leds_toggle(LEDS_ALL);
|
||||||
for(k = 0; k < 0xffff/8; k += 1) { }
|
for(k = 0; k < 0xffff / 8; k += 1) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
int main (int argc, char *argv[])
|
int
|
||||||
|
main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
stm32cube_hal_init();
|
stm32cube_hal_init();
|
||||||
|
|
||||||
|
@ -146,7 +144,6 @@ int main (int argc, char *argv[])
|
||||||
process_init();
|
process_init();
|
||||||
process_start(&etimer_process, NULL);
|
process_start(&etimer_process, NULL);
|
||||||
|
|
||||||
|
|
||||||
/* Restore node id if such has been stored in external mem */
|
/* Restore node id if such has been stored in external mem */
|
||||||
node_id_restore(); /* also configures node_mac[] */
|
node_id_restore(); /* also configures node_mac[] */
|
||||||
|
|
||||||
|
@ -158,7 +155,6 @@ int main (int argc, char *argv[])
|
||||||
|
|
||||||
energest_init();
|
energest_init();
|
||||||
|
|
||||||
|
|
||||||
#if NETSTACK_CONF_WITH_IPV6
|
#if NETSTACK_CONF_WITH_IPV6
|
||||||
memcpy(&uip_lladdr.addr, node_mac, sizeof(uip_lladdr.addr));
|
memcpy(&uip_lladdr.addr, node_mac, sizeof(uip_lladdr.addr));
|
||||||
|
|
||||||
|
@ -185,7 +181,8 @@ int main (int argc, char *argv[])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static void set_rime_addr(void)
|
static void
|
||||||
|
set_rime_addr(void)
|
||||||
{
|
{
|
||||||
linkaddr_t addr;
|
linkaddr_t addr;
|
||||||
|
|
||||||
|
|
|
@ -1,39 +1,34 @@
|
||||||
/**
|
/*
|
||||||
******************************************************************************
|
* Copyright (c) 2012, STMicroelectronics.
|
||||||
* @file acceleration-sensor.c
|
* All rights reserved.
|
||||||
* @author System LAB
|
|
||||||
* @version V1.0.0
|
|
||||||
* @date 17-June-2015
|
|
||||||
* @brief Enable aceleration sensor functionality
|
|
||||||
******************************************************************************
|
|
||||||
* @attention
|
|
||||||
*
|
*
|
||||||
* <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
|
* Redistribution and use in source and binary forms, with or without
|
||||||
*
|
* modification, are permitted provided that the following conditions
|
||||||
* Redistribution and use in source and binary forms, with or without modification,
|
* are met:
|
||||||
* are permitted provided that the following conditions are met:
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
* 1. Redistributions of source code must retain the above copyright notice,
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* this list of conditions and the following disclaimer.
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
* documentation and/or other materials provided with the distribution.
|
||||||
* and/or other materials provided with the distribution.
|
* 3. Neither the name of the Institute nor the names of its contributors
|
||||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
|
||||||
* may be used to endorse or promote products derived from this software
|
* may be used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
* without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
|
* SUCH DAMAGE.
|
||||||
|
*
|
||||||
*
|
*
|
||||||
******************************************************************************
|
|
||||||
*/
|
*/
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
/**
|
/**
|
||||||
* \addtogroup stm32nucleo-spirit1-temperature-sensor
|
* \addtogroup stm32nucleo-spirit1-temperature-sensor
|
||||||
* @{
|
* @{
|
||||||
|
@ -50,7 +45,8 @@
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static int _active = 1;
|
static int _active = 1;
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static void init(void)
|
static void
|
||||||
|
init(void)
|
||||||
{
|
{
|
||||||
/*Acceleration and Gyroscope sensors share the same hw*/
|
/*Acceleration and Gyroscope sensors share the same hw*/
|
||||||
if(!st_lib_bsp_imu_6axes_is_initialized()) {
|
if(!st_lib_bsp_imu_6axes_is_initialized()) {
|
||||||
|
@ -60,22 +56,26 @@ static void init(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static void activate(void)
|
static void
|
||||||
|
activate(void)
|
||||||
{
|
{
|
||||||
_active = 1;
|
_active = 1;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static void deactivate(void)
|
static void
|
||||||
|
deactivate(void)
|
||||||
{
|
{
|
||||||
_active = 0;
|
_active = 0;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static int active(void)
|
static int
|
||||||
|
active(void)
|
||||||
{
|
{
|
||||||
return _active;
|
return _active;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static int value(int type)
|
static int
|
||||||
|
value(int type)
|
||||||
{
|
{
|
||||||
int32_t ret_val = 0;
|
int32_t ret_val = 0;
|
||||||
volatile st_lib_axes_raw_typedef axes_raw_data;
|
volatile st_lib_axes_raw_typedef axes_raw_data;
|
||||||
|
@ -104,7 +104,8 @@ static int value(int type)
|
||||||
return ret_val;
|
return ret_val;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static int configure(int type, int value)
|
static int
|
||||||
|
configure(int type, int value)
|
||||||
{
|
{
|
||||||
switch(type) {
|
switch(type) {
|
||||||
case SENSORS_HW_INIT:
|
case SENSORS_HW_INIT:
|
||||||
|
@ -122,7 +123,8 @@ static int configure(int type, int value)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static int status(int type)
|
static int
|
||||||
|
status(int type)
|
||||||
{
|
{
|
||||||
switch(type) {
|
switch(type) {
|
||||||
case SENSORS_READY:
|
case SENSORS_READY:
|
||||||
|
|
|
@ -1,38 +1,32 @@
|
||||||
/**
|
/*
|
||||||
******************************************************************************
|
* Copyright (c) 2012, STMicroelectronics.
|
||||||
* @file acceleration-sensor.h
|
* All rights reserved.
|
||||||
* @author System LAB
|
|
||||||
* @version V1.0.0
|
|
||||||
* @date 17-June-2015
|
|
||||||
* @brief Enable aceleration sensor functionality
|
|
||||||
******************************************************************************
|
|
||||||
* @attention
|
|
||||||
*
|
*
|
||||||
* <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
|
* Redistribution and use in source and binary forms, with or without
|
||||||
*
|
* modification, are permitted provided that the following conditions
|
||||||
* Redistribution and use in source and binary forms, with or without modification,
|
* are met:
|
||||||
* are permitted provided that the following conditions are met:
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
* 1. Redistributions of source code must retain the above copyright notice,
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* this list of conditions and the following disclaimer.
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
* documentation and/or other materials provided with the distribution.
|
||||||
* and/or other materials provided with the distribution.
|
* 3. Neither the name of the Institute nor the names of its contributors
|
||||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
|
||||||
* may be used to endorse or promote products derived from this software
|
* may be used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
* without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
|
* SUCH DAMAGE.
|
||||||
|
*
|
||||||
*
|
*
|
||||||
******************************************************************************
|
|
||||||
*/
|
*/
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,39 +1,34 @@
|
||||||
/**
|
/*
|
||||||
******************************************************************************
|
* Copyright (c) 2012, STMicroelectronics.
|
||||||
* @file platform/stm32nucleo-spirit1/dev/button-sensor.c
|
* All rights reserved.
|
||||||
* @author System LAB
|
|
||||||
* @version V1.0.0
|
|
||||||
* @date 17-June-2015
|
|
||||||
* @brief Enable button sensor functionality
|
|
||||||
******************************************************************************
|
|
||||||
* @attention
|
|
||||||
*
|
*
|
||||||
* <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
|
* Redistribution and use in source and binary forms, with or without
|
||||||
*
|
* modification, are permitted provided that the following conditions
|
||||||
* Redistribution and use in source and binary forms, with or without modification,
|
* are met:
|
||||||
* are permitted provided that the following conditions are met:
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
* 1. Redistributions of source code must retain the above copyright notice,
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* this list of conditions and the following disclaimer.
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
* documentation and/or other materials provided with the distribution.
|
||||||
* and/or other materials provided with the distribution.
|
* 3. Neither the name of the Institute nor the names of its contributors
|
||||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
|
||||||
* may be used to endorse or promote products derived from this software
|
* may be used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
* without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
|
* SUCH DAMAGE.
|
||||||
|
*
|
||||||
*
|
*
|
||||||
******************************************************************************
|
|
||||||
*/
|
*/
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
/**
|
/**
|
||||||
* \addtogroup stm32nucleo-spirit1-peripherals
|
* \addtogroup stm32nucleo-spirit1-peripherals
|
||||||
* @{
|
* @{
|
||||||
|
@ -48,7 +43,8 @@
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static int _active = 0;
|
static int _active = 0;
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static void init(void)
|
static void
|
||||||
|
init(void)
|
||||||
{
|
{
|
||||||
/* See spirit1_appli.c for the Callback: it triggers the relevant
|
/* See spirit1_appli.c for the Callback: it triggers the relevant
|
||||||
* sensors_changed event
|
* sensors_changed event
|
||||||
|
@ -56,27 +52,32 @@ static void init(void)
|
||||||
st_lib_bsp_pb_init(BUTTON_USER, BUTTON_MODE_EXTI);
|
st_lib_bsp_pb_init(BUTTON_USER, BUTTON_MODE_EXTI);
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static void activate(void)
|
static void
|
||||||
|
activate(void)
|
||||||
{
|
{
|
||||||
_active = 1;
|
_active = 1;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static void deactivate(void)
|
static void
|
||||||
|
deactivate(void)
|
||||||
{
|
{
|
||||||
_active = 0;
|
_active = 0;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static int active(void)
|
static int
|
||||||
|
active(void)
|
||||||
{
|
{
|
||||||
return active;
|
return active;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static int value(int type)
|
static int
|
||||||
|
value(int type)
|
||||||
{
|
{
|
||||||
return st_lib_bsp_pb_get_state(BUTTON_USER);
|
return st_lib_bsp_pb_get_state(BUTTON_USER);
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static int configure(int type, int value)
|
static int
|
||||||
|
configure(int type, int value)
|
||||||
{
|
{
|
||||||
switch(type) {
|
switch(type) {
|
||||||
case SENSORS_HW_INIT:
|
case SENSORS_HW_INIT:
|
||||||
|
@ -94,7 +95,8 @@ static int configure(int type, int value)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static int status(int type)
|
static int
|
||||||
|
status(int type)
|
||||||
{
|
{
|
||||||
switch(type) {
|
switch(type) {
|
||||||
case SENSORS_READY:
|
case SENSORS_READY:
|
||||||
|
|
|
@ -1,39 +1,34 @@
|
||||||
/**
|
/*
|
||||||
******************************************************************************
|
* Copyright (c) 2012, STMicroelectronics.
|
||||||
* @file gyroscope-sensor.c
|
* All rights reserved.
|
||||||
* @author System LAB
|
|
||||||
* @version V1.0.0
|
|
||||||
* @date 17-June-2015
|
|
||||||
* @brief Enable aceleration sensor functionality
|
|
||||||
******************************************************************************
|
|
||||||
* @attention
|
|
||||||
*
|
*
|
||||||
* <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
|
* Redistribution and use in source and binary forms, with or without
|
||||||
*
|
* modification, are permitted provided that the following conditions
|
||||||
* Redistribution and use in source and binary forms, with or without modification,
|
* are met:
|
||||||
* are permitted provided that the following conditions are met:
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
* 1. Redistributions of source code must retain the above copyright notice,
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* this list of conditions and the following disclaimer.
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
* documentation and/or other materials provided with the distribution.
|
||||||
* and/or other materials provided with the distribution.
|
* 3. Neither the name of the Institute nor the names of its contributors
|
||||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
|
||||||
* may be used to endorse or promote products derived from this software
|
* may be used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
* without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
|
* SUCH DAMAGE.
|
||||||
|
*
|
||||||
*
|
*
|
||||||
******************************************************************************
|
|
||||||
*/
|
*/
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
/**
|
/**
|
||||||
* \addtogroup stm32nucleo-spirit1-gyroscope-sensor
|
* \addtogroup stm32nucleo-spirit1-gyroscope-sensor
|
||||||
* @{
|
* @{
|
||||||
|
@ -50,7 +45,8 @@
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static int _active = 1;
|
static int _active = 1;
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static void init(void)
|
static void
|
||||||
|
init(void)
|
||||||
{
|
{
|
||||||
/*Acceleration and Gyroscope sensors share the same hw*/
|
/*Acceleration and Gyroscope sensors share the same hw*/
|
||||||
if(!st_lib_bsp_imu_6axes_is_initialized()) {
|
if(!st_lib_bsp_imu_6axes_is_initialized()) {
|
||||||
|
@ -60,22 +56,26 @@ static void init(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static void activate(void)
|
static void
|
||||||
|
activate(void)
|
||||||
{
|
{
|
||||||
_active = 1;
|
_active = 1;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static void deactivate(void)
|
static void
|
||||||
|
deactivate(void)
|
||||||
{
|
{
|
||||||
_active = 0;
|
_active = 0;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static int active(void)
|
static int
|
||||||
|
active(void)
|
||||||
{
|
{
|
||||||
return _active;
|
return _active;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static int value(int type)
|
static int
|
||||||
|
value(int type)
|
||||||
{
|
{
|
||||||
int32_t ret_val = 0;
|
int32_t ret_val = 0;
|
||||||
volatile st_lib_axes_raw_typedef axes_raw_data;
|
volatile st_lib_axes_raw_typedef axes_raw_data;
|
||||||
|
@ -104,7 +104,8 @@ static int value(int type)
|
||||||
return ret_val;
|
return ret_val;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static int configure(int type, int value)
|
static int
|
||||||
|
configure(int type, int value)
|
||||||
{
|
{
|
||||||
switch(type) {
|
switch(type) {
|
||||||
case SENSORS_HW_INIT:
|
case SENSORS_HW_INIT:
|
||||||
|
@ -122,7 +123,8 @@ static int configure(int type, int value)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static int status(int type)
|
static int
|
||||||
|
status(int type)
|
||||||
{
|
{
|
||||||
switch(type) {
|
switch(type) {
|
||||||
case SENSORS_READY:
|
case SENSORS_READY:
|
||||||
|
|
|
@ -1,38 +1,32 @@
|
||||||
/**
|
/*
|
||||||
******************************************************************************
|
* Copyright (c) 2012, STMicroelectronics.
|
||||||
* @file gyroscope-sensor.h
|
* All rights reserved.
|
||||||
* @author System LAB
|
|
||||||
* @version V1.0.0
|
|
||||||
* @date 17-June-2015
|
|
||||||
* @brief Enable aceleration sensor functionality
|
|
||||||
******************************************************************************
|
|
||||||
* @attention
|
|
||||||
*
|
*
|
||||||
* <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
|
* Redistribution and use in source and binary forms, with or without
|
||||||
*
|
* modification, are permitted provided that the following conditions
|
||||||
* Redistribution and use in source and binary forms, with or without modification,
|
* are met:
|
||||||
* are permitted provided that the following conditions are met:
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
* 1. Redistributions of source code must retain the above copyright notice,
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* this list of conditions and the following disclaimer.
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
* documentation and/or other materials provided with the distribution.
|
||||||
* and/or other materials provided with the distribution.
|
* 3. Neither the name of the Institute nor the names of its contributors
|
||||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
|
||||||
* may be used to endorse or promote products derived from this software
|
* may be used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
* without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
|
* SUCH DAMAGE.
|
||||||
|
*
|
||||||
*
|
*
|
||||||
******************************************************************************
|
|
||||||
*/
|
*/
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,39 +1,34 @@
|
||||||
/**
|
/*
|
||||||
******************************************************************************
|
* Copyright (c) 2012, STMicroelectronics.
|
||||||
* @file humidity-sensor.c
|
* All rights reserved.
|
||||||
* @author System LAB
|
|
||||||
* @version V1.0.0
|
|
||||||
* @date 17-June-2015
|
|
||||||
* @brief Enable humidity sensor functionality
|
|
||||||
******************************************************************************
|
|
||||||
* @attention
|
|
||||||
*
|
*
|
||||||
* <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
|
* Redistribution and use in source and binary forms, with or without
|
||||||
*
|
* modification, are permitted provided that the following conditions
|
||||||
* Redistribution and use in source and binary forms, with or without modification,
|
* are met:
|
||||||
* are permitted provided that the following conditions are met:
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
* 1. Redistributions of source code must retain the above copyright notice,
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* this list of conditions and the following disclaimer.
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
* documentation and/or other materials provided with the distribution.
|
||||||
* and/or other materials provided with the distribution.
|
* 3. Neither the name of the Institute nor the names of its contributors
|
||||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
|
||||||
* may be used to endorse or promote products derived from this software
|
* may be used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
* without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
|
* SUCH DAMAGE.
|
||||||
|
*
|
||||||
*
|
*
|
||||||
******************************************************************************
|
|
||||||
*/
|
*/
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
/**
|
/**
|
||||||
* \addtogroup stm32nucleo-spirit1-humidity-sensor
|
* \addtogroup stm32nucleo-spirit1-humidity-sensor
|
||||||
* @{
|
* @{
|
||||||
|
@ -50,7 +45,8 @@
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static int _active = 1;
|
static int _active = 1;
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static void init(void)
|
static void
|
||||||
|
init(void)
|
||||||
{
|
{
|
||||||
/*Temperature and Humity sensors share the same hw*/
|
/*Temperature and Humity sensors share the same hw*/
|
||||||
if(!st_lib_bsp_hum_temp_is_initialized()) {
|
if(!st_lib_bsp_hum_temp_is_initialized()) {
|
||||||
|
@ -59,22 +55,26 @@ static void init(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static void activate(void)
|
static void
|
||||||
|
activate(void)
|
||||||
{
|
{
|
||||||
_active = 1;
|
_active = 1;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static void deactivate(void)
|
static void
|
||||||
|
deactivate(void)
|
||||||
{
|
{
|
||||||
_active = 0;
|
_active = 0;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static int active(void)
|
static int
|
||||||
|
active(void)
|
||||||
{
|
{
|
||||||
return _active;
|
return _active;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static int value(int type)
|
static int
|
||||||
|
value(int type)
|
||||||
{
|
{
|
||||||
uint32_t humidity;
|
uint32_t humidity;
|
||||||
volatile float humidity_value;
|
volatile float humidity_value;
|
||||||
|
@ -85,7 +85,8 @@ static int value(int type)
|
||||||
return humidity;
|
return humidity;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static int configure(int type, int value)
|
static int
|
||||||
|
configure(int type, int value)
|
||||||
{
|
{
|
||||||
switch(type) {
|
switch(type) {
|
||||||
case SENSORS_HW_INIT:
|
case SENSORS_HW_INIT:
|
||||||
|
@ -103,7 +104,8 @@ static int configure(int type, int value)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static int status(int type)
|
static int
|
||||||
|
status(int type)
|
||||||
{
|
{
|
||||||
switch(type) {
|
switch(type) {
|
||||||
case SENSORS_READY:
|
case SENSORS_READY:
|
||||||
|
|
|
@ -1,38 +1,32 @@
|
||||||
/**
|
/*
|
||||||
******************************************************************************
|
* Copyright (c) 2012, STMicroelectronics.
|
||||||
* @file humidity-sensor.h
|
* All rights reserved.
|
||||||
* @author System LAB
|
|
||||||
* @version V1.0.0
|
|
||||||
* @date 17-June-2015
|
|
||||||
* @brief Enable humidity sensor functionality
|
|
||||||
******************************************************************************
|
|
||||||
* @attention
|
|
||||||
*
|
*
|
||||||
* <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
|
* Redistribution and use in source and binary forms, with or without
|
||||||
*
|
* modification, are permitted provided that the following conditions
|
||||||
* Redistribution and use in source and binary forms, with or without modification,
|
* are met:
|
||||||
* are permitted provided that the following conditions are met:
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
* 1. Redistributions of source code must retain the above copyright notice,
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* this list of conditions and the following disclaimer.
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
* documentation and/or other materials provided with the distribution.
|
||||||
* and/or other materials provided with the distribution.
|
* 3. Neither the name of the Institute nor the names of its contributors
|
||||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
|
||||||
* may be used to endorse or promote products derived from this software
|
* may be used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
* without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
|
* SUCH DAMAGE.
|
||||||
|
*
|
||||||
*
|
*
|
||||||
******************************************************************************
|
|
||||||
*/
|
*/
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,39 +1,34 @@
|
||||||
/**
|
/*
|
||||||
******************************************************************************
|
* Copyright (c) 2012, STMicroelectronics.
|
||||||
* @file platform/stm32nucleo-spirit1/dev/leds-arch.c
|
* All rights reserved.
|
||||||
* @author System LAB
|
|
||||||
* @version V1.0.0
|
|
||||||
* @date 17-June-2015
|
|
||||||
* @brief Contiki LEDs API binding for the boards in use: Nucleo and SPIRIT1
|
|
||||||
******************************************************************************
|
|
||||||
* @attention
|
|
||||||
*
|
*
|
||||||
* <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
|
* Redistribution and use in source and binary forms, with or without
|
||||||
*
|
* modification, are permitted provided that the following conditions
|
||||||
* Redistribution and use in source and binary forms, with or without modification,
|
* are met:
|
||||||
* are permitted provided that the following conditions are met:
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
* 1. Redistributions of source code must retain the above copyright notice,
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* this list of conditions and the following disclaimer.
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
* documentation and/or other materials provided with the distribution.
|
||||||
* and/or other materials provided with the distribution.
|
* 3. Neither the name of the Institute nor the names of its contributors
|
||||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
|
||||||
* may be used to endorse or promote products derived from this software
|
* may be used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
* without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
|
* SUCH DAMAGE.
|
||||||
|
*
|
||||||
*
|
*
|
||||||
******************************************************************************
|
|
||||||
*/
|
*/
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
/**
|
/**
|
||||||
* \addtogroup stm32nucleo-spirit1-peripherals
|
* \addtogroup stm32nucleo-spirit1-peripherals
|
||||||
* @{
|
* @{
|
||||||
|
@ -57,7 +52,8 @@ extern const uint16_t st_lib_a_led_gpio_pin[];
|
||||||
extern st_lib_gpio_typedef *st_lib_gpio_port[];
|
extern st_lib_gpio_typedef *st_lib_gpio_port[];
|
||||||
extern const uint16_t st_lib_gpio_pin[];
|
extern const uint16_t st_lib_gpio_pin[];
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
void leds_arch_init(void)
|
void
|
||||||
|
leds_arch_init(void)
|
||||||
{
|
{
|
||||||
/* We have at least one led, the one on the Nucleo (GREEN)*/
|
/* We have at least one led, the one on the Nucleo (GREEN)*/
|
||||||
st_lib_bsp_led_init(LED2);
|
st_lib_bsp_led_init(LED2);
|
||||||
|
@ -72,7 +68,8 @@ void leds_arch_init(void)
|
||||||
#endif /*COMPILE_SENSORS*/
|
#endif /*COMPILE_SENSORS*/
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
unsigned char leds_arch_get(void)
|
unsigned char
|
||||||
|
leds_arch_get(void)
|
||||||
{
|
{
|
||||||
unsigned char ret = 0;
|
unsigned char ret = 0;
|
||||||
if(st_lib_hal_gpio_read_pin(st_lib_gpio_port[LED2], st_lib_gpio_pin[LED2])) {
|
if(st_lib_hal_gpio_read_pin(st_lib_gpio_port[LED2], st_lib_gpio_pin[LED2])) {
|
||||||
|
@ -92,7 +89,8 @@ unsigned char leds_arch_get(void)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
void leds_arch_set(unsigned char leds)
|
void
|
||||||
|
leds_arch_set(unsigned char leds)
|
||||||
{
|
{
|
||||||
if(leds & LEDS_GREEN) {
|
if(leds & LEDS_GREEN) {
|
||||||
st_lib_bsp_led_on(LED2);
|
st_lib_bsp_led_on(LED2);
|
||||||
|
|
|
@ -1,39 +1,34 @@
|
||||||
/**
|
/*
|
||||||
******************************************************************************
|
* Copyright (c) 2012, STMicroelectronics.
|
||||||
* @file magneto-sensor.c
|
* All rights reserved.
|
||||||
* @author System LAB
|
|
||||||
* @version V1.0.0
|
|
||||||
* @date 17-June-2015
|
|
||||||
* @brief Enable magneto sensor functionality
|
|
||||||
******************************************************************************
|
|
||||||
* @attention
|
|
||||||
*
|
*
|
||||||
* <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
|
* Redistribution and use in source and binary forms, with or without
|
||||||
*
|
* modification, are permitted provided that the following conditions
|
||||||
* Redistribution and use in source and binary forms, with or without modification,
|
* are met:
|
||||||
* are permitted provided that the following conditions are met:
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
* 1. Redistributions of source code must retain the above copyright notice,
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* this list of conditions and the following disclaimer.
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
* documentation and/or other materials provided with the distribution.
|
||||||
* and/or other materials provided with the distribution.
|
* 3. Neither the name of the Institute nor the names of its contributors
|
||||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
|
||||||
* may be used to endorse or promote products derived from this software
|
* may be used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
* without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
|
* SUCH DAMAGE.
|
||||||
|
*
|
||||||
*
|
*
|
||||||
******************************************************************************
|
|
||||||
*/
|
*/
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
/**
|
/**
|
||||||
* \addtogroup stm32nucleo-spirit1-magneto-sensor
|
* \addtogroup stm32nucleo-spirit1-magneto-sensor
|
||||||
* @{
|
* @{
|
||||||
|
@ -50,28 +45,33 @@
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static int _active = 1;
|
static int _active = 1;
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static void init(void)
|
static void
|
||||||
|
init(void)
|
||||||
{
|
{
|
||||||
BSP_MAGNETO_Init();
|
BSP_MAGNETO_Init();
|
||||||
_active = 1;
|
_active = 1;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static void activate(void)
|
static void
|
||||||
|
activate(void)
|
||||||
{
|
{
|
||||||
_active = 1;
|
_active = 1;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static void deactivate(void)
|
static void
|
||||||
|
deactivate(void)
|
||||||
{
|
{
|
||||||
_active = 0;
|
_active = 0;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static int active(void)
|
static int
|
||||||
|
active(void)
|
||||||
{
|
{
|
||||||
return _active;
|
return _active;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static int value(int type)
|
static int
|
||||||
|
value(int type)
|
||||||
{
|
{
|
||||||
int32_t ret_val = 0;
|
int32_t ret_val = 0;
|
||||||
volatile st_lib_axes_raw_typedef axes_raw_data;
|
volatile st_lib_axes_raw_typedef axes_raw_data;
|
||||||
|
@ -100,7 +100,8 @@ static int value(int type)
|
||||||
return ret_val;
|
return ret_val;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static int configure(int type, int value)
|
static int
|
||||||
|
configure(int type, int value)
|
||||||
{
|
{
|
||||||
switch(type) {
|
switch(type) {
|
||||||
case SENSORS_HW_INIT:
|
case SENSORS_HW_INIT:
|
||||||
|
@ -118,7 +119,8 @@ static int configure(int type, int value)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static int status(int type)
|
static int
|
||||||
|
status(int type)
|
||||||
{
|
{
|
||||||
switch(type) {
|
switch(type) {
|
||||||
case SENSORS_READY:
|
case SENSORS_READY:
|
||||||
|
|
|
@ -1,38 +1,32 @@
|
||||||
/**
|
/*
|
||||||
******************************************************************************
|
* Copyright (c) 2012, STMicroelectronics.
|
||||||
* @file magneto-sensor.h
|
* All rights reserved.
|
||||||
* @author System LAB
|
|
||||||
* @version V1.0.0
|
|
||||||
* @date 17-June-2015
|
|
||||||
* @brief Enable magneto sensor functionality
|
|
||||||
******************************************************************************
|
|
||||||
* @attention
|
|
||||||
*
|
*
|
||||||
* <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
|
* Redistribution and use in source and binary forms, with or without
|
||||||
*
|
* modification, are permitted provided that the following conditions
|
||||||
* Redistribution and use in source and binary forms, with or without modification,
|
* are met:
|
||||||
* are permitted provided that the following conditions are met:
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
* 1. Redistributions of source code must retain the above copyright notice,
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* this list of conditions and the following disclaimer.
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
* documentation and/or other materials provided with the distribution.
|
||||||
* and/or other materials provided with the distribution.
|
* 3. Neither the name of the Institute nor the names of its contributors
|
||||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
|
||||||
* may be used to endorse or promote products derived from this software
|
* may be used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
* without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
|
* SUCH DAMAGE.
|
||||||
|
*
|
||||||
*
|
*
|
||||||
******************************************************************************
|
|
||||||
*/
|
*/
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,39 +1,34 @@
|
||||||
/**
|
/*
|
||||||
******************************************************************************
|
* Copyright (c) 2012, STMicroelectronics.
|
||||||
* @file pressure-sensor.c
|
* All rights reserved.
|
||||||
* @author System LAB
|
|
||||||
* @version V1.0.0
|
|
||||||
* @date 17-June-2015
|
|
||||||
* @brief Enable pressure sensor functionality
|
|
||||||
******************************************************************************
|
|
||||||
* @attention
|
|
||||||
*
|
*
|
||||||
* <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
|
* Redistribution and use in source and binary forms, with or without
|
||||||
*
|
* modification, are permitted provided that the following conditions
|
||||||
* Redistribution and use in source and binary forms, with or without modification,
|
* are met:
|
||||||
* are permitted provided that the following conditions are met:
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
* 1. Redistributions of source code must retain the above copyright notice,
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* this list of conditions and the following disclaimer.
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
* documentation and/or other materials provided with the distribution.
|
||||||
* and/or other materials provided with the distribution.
|
* 3. Neither the name of the Institute nor the names of its contributors
|
||||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
|
||||||
* may be used to endorse or promote products derived from this software
|
* may be used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
* without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
|
* SUCH DAMAGE.
|
||||||
|
*
|
||||||
*
|
*
|
||||||
******************************************************************************
|
|
||||||
*/
|
*/
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
/**
|
/**
|
||||||
* \addtogroup stm32nucleo-spirit1-pressure-sensor
|
* \addtogroup stm32nucleo-spirit1-pressure-sensor
|
||||||
* @{
|
* @{
|
||||||
|
@ -50,28 +45,33 @@
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static int _active = 1;
|
static int _active = 1;
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static void init(void)
|
static void
|
||||||
|
init(void)
|
||||||
{
|
{
|
||||||
st_lib_bsp_pressure_init();
|
st_lib_bsp_pressure_init();
|
||||||
_active = 1;
|
_active = 1;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static void activate(void)
|
static void
|
||||||
|
activate(void)
|
||||||
{
|
{
|
||||||
_active = 1;
|
_active = 1;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static void deactivate(void)
|
static void
|
||||||
|
deactivate(void)
|
||||||
{
|
{
|
||||||
_active = 0;
|
_active = 0;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static int active(void)
|
static int
|
||||||
|
active(void)
|
||||||
{
|
{
|
||||||
return _active;
|
return _active;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static int value(int type)
|
static int
|
||||||
|
value(int type)
|
||||||
{
|
{
|
||||||
uint16_t pressure;
|
uint16_t pressure;
|
||||||
volatile float pressure_value;
|
volatile float pressure_value;
|
||||||
|
@ -82,7 +82,8 @@ static int value(int type)
|
||||||
return pressure;
|
return pressure;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static int configure(int type, int value)
|
static int
|
||||||
|
configure(int type, int value)
|
||||||
{
|
{
|
||||||
switch(type) {
|
switch(type) {
|
||||||
case SENSORS_HW_INIT:
|
case SENSORS_HW_INIT:
|
||||||
|
@ -100,7 +101,8 @@ static int configure(int type, int value)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static int status(int type)
|
static int
|
||||||
|
status(int type)
|
||||||
{
|
{
|
||||||
switch(type) {
|
switch(type) {
|
||||||
case SENSORS_READY:
|
case SENSORS_READY:
|
||||||
|
|
|
@ -1,38 +1,32 @@
|
||||||
/**
|
/*
|
||||||
******************************************************************************
|
* Copyright (c) 2012, STMicroelectronics.
|
||||||
* @file pressure-sensor.h
|
* All rights reserved.
|
||||||
* @author System LAB
|
|
||||||
* @version V1.0.0
|
|
||||||
* @date 17-June-2015
|
|
||||||
* @brief Enable pressure sensor functionality
|
|
||||||
******************************************************************************
|
|
||||||
* @attention
|
|
||||||
*
|
*
|
||||||
* <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
|
* Redistribution and use in source and binary forms, with or without
|
||||||
*
|
* modification, are permitted provided that the following conditions
|
||||||
* Redistribution and use in source and binary forms, with or without modification,
|
* are met:
|
||||||
* are permitted provided that the following conditions are met:
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
* 1. Redistributions of source code must retain the above copyright notice,
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* this list of conditions and the following disclaimer.
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
* documentation and/or other materials provided with the distribution.
|
||||||
* and/or other materials provided with the distribution.
|
* 3. Neither the name of the Institute nor the names of its contributors
|
||||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
|
||||||
* may be used to endorse or promote products derived from this software
|
* may be used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
* without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
|
* SUCH DAMAGE.
|
||||||
|
*
|
||||||
*
|
*
|
||||||
******************************************************************************
|
|
||||||
*/
|
*/
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,39 +1,34 @@
|
||||||
/**
|
/*
|
||||||
******************************************************************************
|
* Copyright (c) 2012, STMicroelectronics.
|
||||||
* @file platform/stm32nucleo-spirit1/dev/radio-sensor.c
|
* All rights reserved.
|
||||||
* @author System LAB
|
|
||||||
* @version V1.0.0
|
|
||||||
* @date 7-September-2015
|
|
||||||
* @brief Enable radio sensor functionality
|
|
||||||
******************************************************************************
|
|
||||||
* @attention
|
|
||||||
*
|
*
|
||||||
* <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
|
* Redistribution and use in source and binary forms, with or without
|
||||||
*
|
* modification, are permitted provided that the following conditions
|
||||||
* Redistribution and use in source and binary forms, with or without modification,
|
* are met:
|
||||||
* are permitted provided that the following conditions are met:
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
* 1. Redistributions of source code must retain the above copyright notice,
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* this list of conditions and the following disclaimer.
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
* documentation and/or other materials provided with the distribution.
|
||||||
* and/or other materials provided with the distribution.
|
* 3. Neither the name of the Institute nor the names of its contributors
|
||||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
|
||||||
* may be used to endorse or promote products derived from this software
|
* may be used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
* without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
|
* SUCH DAMAGE.
|
||||||
|
*
|
||||||
*
|
*
|
||||||
******************************************************************************
|
|
||||||
*/
|
*/
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
/**
|
/**
|
||||||
* \addtogroup stm32nucleo-spirit1-peripherals
|
* \addtogroup stm32nucleo-spirit1-peripherals
|
||||||
* @{
|
* @{
|
||||||
|
@ -50,27 +45,32 @@
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static int _active;
|
static int _active;
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static void init(void)
|
static void
|
||||||
|
init(void)
|
||||||
{
|
{
|
||||||
/*Nothing to do at the moment, can be used in the future.*/
|
/*Nothing to do at the moment, can be used in the future.*/
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static void activate(void)
|
static void
|
||||||
|
activate(void)
|
||||||
{
|
{
|
||||||
_active = 1;
|
_active = 1;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static void deactivate(void)
|
static void
|
||||||
|
deactivate(void)
|
||||||
{
|
{
|
||||||
_active = 0;
|
_active = 0;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static int active(void)
|
static int
|
||||||
|
active(void)
|
||||||
{
|
{
|
||||||
return _active;
|
return _active;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static int value(int type)
|
static int
|
||||||
|
value(int type)
|
||||||
{
|
{
|
||||||
int32_t radio_sensor;
|
int32_t radio_sensor;
|
||||||
float radio_sensor_value;
|
float radio_sensor_value;
|
||||||
|
@ -79,20 +79,21 @@ static int value(int type)
|
||||||
case RADIO_SENSOR_LAST_PACKET:
|
case RADIO_SENSOR_LAST_PACKET:
|
||||||
/*TODO: check which method of getting these value is more appropriate */
|
/*TODO: check which method of getting these value is more appropriate */
|
||||||
radio_sensor_value = DBM_VALUE(packetbuf_attr(PACKETBUF_ATTR_RSSI));
|
radio_sensor_value = DBM_VALUE(packetbuf_attr(PACKETBUF_ATTR_RSSI));
|
||||||
//radio_sensor_value = st_lib_spirit_qi_get_rssi_dbm();
|
/* radio_sensor_value = st_lib_spirit_qi_get_rssi_dbm(); */
|
||||||
radio_sensor = (int32_t)(radio_sensor_value * 10);
|
radio_sensor = (int32_t)(radio_sensor_value * 10);
|
||||||
break;
|
break;
|
||||||
case RADIO_SENSOR_LAST_VALUE:
|
case RADIO_SENSOR_LAST_VALUE:
|
||||||
default:
|
default:
|
||||||
/*TODO: check which method of getting these value is more appropriate */
|
/*TODO: check which method of getting these value is more appropriate */
|
||||||
radio_sensor = packetbuf_attr(PACKETBUF_ATTR_LINK_QUALITY);
|
radio_sensor = packetbuf_attr(PACKETBUF_ATTR_LINK_QUALITY);
|
||||||
//radio_sensor = (int32_t) st_lib_spirit_qi_get_lqi();
|
/* radio_sensor = (int32_t) st_lib_spirit_qi_get_lqi(); */
|
||||||
}
|
}
|
||||||
|
|
||||||
return radio_sensor;
|
return radio_sensor;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static int configure(int type, int value)
|
static int
|
||||||
|
configure(int type, int value)
|
||||||
{
|
{
|
||||||
switch(type) {
|
switch(type) {
|
||||||
case SENSORS_HW_INIT:
|
case SENSORS_HW_INIT:
|
||||||
|
@ -110,7 +111,8 @@ static int configure(int type, int value)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static int status(int type)
|
static int
|
||||||
|
status(int type)
|
||||||
{
|
{
|
||||||
switch(type) {
|
switch(type) {
|
||||||
case SENSORS_READY:
|
case SENSORS_READY:
|
||||||
|
@ -123,3 +125,4 @@ static int status(int type)
|
||||||
SENSORS_SENSOR(radio_sensor, RADIO_SENSOR, value, configure, status);
|
SENSORS_SENSOR(radio_sensor, RADIO_SENSOR, value, configure, status);
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
|
|
|
@ -1,38 +1,32 @@
|
||||||
/**
|
/*
|
||||||
******************************************************************************
|
* Copyright (c) 2012, STMicroelectronics.
|
||||||
* @file platform/stm32nucleo-spirit1/dev/sensor-common.h
|
* All rights reserved.
|
||||||
* @author System LAB
|
|
||||||
* @version V1.0.0
|
|
||||||
* @date 17-June-2015
|
|
||||||
* @brief Common defines for sensors data structurers
|
|
||||||
******************************************************************************
|
|
||||||
* @attention
|
|
||||||
*
|
*
|
||||||
* <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
|
* Redistribution and use in source and binary forms, with or without
|
||||||
*
|
* modification, are permitted provided that the following conditions
|
||||||
* Redistribution and use in source and binary forms, with or without modification,
|
* are met:
|
||||||
* are permitted provided that the following conditions are met:
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
* 1. Redistributions of source code must retain the above copyright notice,
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* this list of conditions and the following disclaimer.
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
* documentation and/or other materials provided with the distribution.
|
||||||
* and/or other materials provided with the distribution.
|
* 3. Neither the name of the Institute nor the names of its contributors
|
||||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
|
||||||
* may be used to endorse or promote products derived from this software
|
* may be used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
* without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
|
* SUCH DAMAGE.
|
||||||
|
*
|
||||||
*
|
*
|
||||||
******************************************************************************
|
|
||||||
*/
|
*/
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,39 +1,34 @@
|
||||||
/**
|
/*
|
||||||
******************************************************************************
|
* Copyright (c) 2012, STMicroelectronics.
|
||||||
* @file platform/stm32nucleo-spirit1/dev/temperature-sensor.c
|
* All rights reserved.
|
||||||
* @author System LAB
|
|
||||||
* @version V1.0.0
|
|
||||||
* @date 17-June-2015
|
|
||||||
* @brief Enable temperature sensor functionality
|
|
||||||
******************************************************************************
|
|
||||||
* @attention
|
|
||||||
*
|
*
|
||||||
* <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
|
* Redistribution and use in source and binary forms, with or without
|
||||||
*
|
* modification, are permitted provided that the following conditions
|
||||||
* Redistribution and use in source and binary forms, with or without modification,
|
* are met:
|
||||||
* are permitted provided that the following conditions are met:
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
* 1. Redistributions of source code must retain the above copyright notice,
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* this list of conditions and the following disclaimer.
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
* documentation and/or other materials provided with the distribution.
|
||||||
* and/or other materials provided with the distribution.
|
* 3. Neither the name of the Institute nor the names of its contributors
|
||||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
|
||||||
* may be used to endorse or promote products derived from this software
|
* may be used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
* without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
|
* SUCH DAMAGE.
|
||||||
|
*
|
||||||
*
|
*
|
||||||
******************************************************************************
|
|
||||||
*/
|
*/
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
/**
|
/**
|
||||||
* \addtogroup stm32nucleo-spirit1-temperature-sensor
|
* \addtogroup stm32nucleo-spirit1-temperature-sensor
|
||||||
* @{
|
* @{
|
||||||
|
@ -50,7 +45,8 @@
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static int _active = 0;
|
static int _active = 0;
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static void init(void)
|
static void
|
||||||
|
init(void)
|
||||||
{
|
{
|
||||||
/*Temperature and Humity sensors share the same hw*/
|
/*Temperature and Humity sensors share the same hw*/
|
||||||
if(!st_lib_bsp_hum_temp_is_initialized()) {
|
if(!st_lib_bsp_hum_temp_is_initialized()) {
|
||||||
|
@ -59,22 +55,26 @@ static void init(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static void activate(void)
|
static void
|
||||||
|
activate(void)
|
||||||
{
|
{
|
||||||
_active = 1;
|
_active = 1;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static void deactivate(void)
|
static void
|
||||||
|
deactivate(void)
|
||||||
{
|
{
|
||||||
_active = 0;
|
_active = 0;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static int active(void)
|
static int
|
||||||
|
active(void)
|
||||||
{
|
{
|
||||||
return _active;
|
return _active;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static int value(int type)
|
static int
|
||||||
|
value(int type)
|
||||||
{
|
{
|
||||||
int32_t temperature;
|
int32_t temperature;
|
||||||
volatile float temperature_value;
|
volatile float temperature_value;
|
||||||
|
@ -84,7 +84,8 @@ static int value(int type)
|
||||||
return temperature;
|
return temperature;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static int configure(int type, int value)
|
static int
|
||||||
|
configure(int type, int value)
|
||||||
{
|
{
|
||||||
switch(type) {
|
switch(type) {
|
||||||
case SENSORS_HW_INIT:
|
case SENSORS_HW_INIT:
|
||||||
|
@ -102,7 +103,8 @@ static int configure(int type, int value)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static int status(int type)
|
static int
|
||||||
|
status(int type)
|
||||||
{
|
{
|
||||||
switch(type) {
|
switch(type) {
|
||||||
case SENSORS_READY:
|
case SENSORS_READY:
|
||||||
|
|
|
@ -1,38 +1,32 @@
|
||||||
/**
|
/*
|
||||||
******************************************************************************
|
* Copyright (c) 2012, STMicroelectronics.
|
||||||
* @file platform/stm32nucleo-spirit1/dev/temperature-sensor.h
|
* All rights reserved.
|
||||||
* @author System LAB
|
|
||||||
* @version V1.0.0
|
|
||||||
* @date 17-June-2015
|
|
||||||
* @brief Enable temperature sensor functionality
|
|
||||||
******************************************************************************
|
|
||||||
* @attention
|
|
||||||
*
|
*
|
||||||
* <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
|
* Redistribution and use in source and binary forms, with or without
|
||||||
*
|
* modification, are permitted provided that the following conditions
|
||||||
* Redistribution and use in source and binary forms, with or without modification,
|
* are met:
|
||||||
* are permitted provided that the following conditions are met:
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
* 1. Redistributions of source code must retain the above copyright notice,
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* this list of conditions and the following disclaimer.
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
* documentation and/or other materials provided with the distribution.
|
||||||
* and/or other materials provided with the distribution.
|
* 3. Neither the name of the Institute nor the names of its contributors
|
||||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
|
||||||
* may be used to endorse or promote products derived from this software
|
* may be used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
* without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
|
* SUCH DAMAGE.
|
||||||
|
*
|
||||||
*
|
*
|
||||||
******************************************************************************
|
|
||||||
*/
|
*/
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,38 +1,32 @@
|
||||||
/**
|
/*
|
||||||
******************************************************************************
|
* Copyright (c) 2012, STMicroelectronics.
|
||||||
* @file platform/stm32nucleo-spirit1/dev/uart1.h
|
* All rights reserved.
|
||||||
* @author System LAB
|
|
||||||
* @version V1.0.0
|
|
||||||
* @date 17-June-2015
|
|
||||||
* @brief Include file for BAUD2UBR macro
|
|
||||||
******************************************************************************
|
|
||||||
* @attention
|
|
||||||
*
|
*
|
||||||
* <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
|
* Redistribution and use in source and binary forms, with or without
|
||||||
*
|
* modification, are permitted provided that the following conditions
|
||||||
* Redistribution and use in source and binary forms, with or without modification,
|
* are met:
|
||||||
* are permitted provided that the following conditions are met:
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
* 1. Redistributions of source code must retain the above copyright notice,
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* this list of conditions and the following disclaimer.
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
* documentation and/or other materials provided with the distribution.
|
||||||
* and/or other materials provided with the distribution.
|
* 3. Neither the name of the Institute nor the names of its contributors
|
||||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
|
||||||
* may be used to endorse or promote products derived from this software
|
* may be used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
* without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
|
* SUCH DAMAGE.
|
||||||
|
*
|
||||||
*
|
*
|
||||||
******************************************************************************
|
|
||||||
*/
|
*/
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,38 +1,32 @@
|
||||||
/**
|
/*
|
||||||
******************************************************************************
|
* Copyright (c) 2012, STMicroelectronics.
|
||||||
* @file hw-config.h
|
* All rights reserved.
|
||||||
* @author System LAB
|
|
||||||
* @version V1.0.0
|
|
||||||
* @date 17-May-2015
|
|
||||||
* @brief Header file for Hardware Configuration & Setup
|
|
||||||
******************************************************************************
|
|
||||||
* @attention
|
|
||||||
*
|
*
|
||||||
* <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
|
* Redistribution and use in source and binary forms, with or without
|
||||||
*
|
* modification, are permitted provided that the following conditions
|
||||||
* Redistribution and use in source and binary forms, with or without modification,
|
* are met:
|
||||||
* are permitted provided that the following conditions are met:
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
* 1. Redistributions of source code must retain the above copyright notice,
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* this list of conditions and the following disclaimer.
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
* documentation and/or other materials provided with the distribution.
|
||||||
* and/or other materials provided with the distribution.
|
* 3. Neither the name of the Institute nor the names of its contributors
|
||||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
|
||||||
* may be used to endorse or promote products derived from this software
|
* may be used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
* without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
|
* SUCH DAMAGE.
|
||||||
|
*
|
||||||
*
|
*
|
||||||
******************************************************************************
|
|
||||||
*/
|
*/
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
#ifndef __HW_CONFIG_H
|
#ifndef __HW_CONFIG_H
|
||||||
|
@ -63,7 +57,6 @@
|
||||||
#define I2Cx_EV_IRQHandler I2C1_EV_IRQHandler
|
#define I2Cx_EV_IRQHandler I2C1_EV_IRQHandler
|
||||||
#define I2Cx_ER_IRQHandler I2C1_ER_IRQHandler
|
#define I2Cx_ER_IRQHandler I2C1_ER_IRQHandler
|
||||||
|
|
||||||
|
|
||||||
#define I2Cx I2C1
|
#define I2Cx I2C1
|
||||||
#define I2Cx_CLK_ENABLE() __I2C1_CLK_ENABLE()
|
#define I2Cx_CLK_ENABLE() __I2C1_CLK_ENABLE()
|
||||||
#define I2Cx_SDA_GPIO_CLK_ENABLE() __GPIOB_CLK_ENABLE()
|
#define I2Cx_SDA_GPIO_CLK_ENABLE() __GPIOB_CLK_ENABLE()
|
||||||
|
@ -111,7 +104,6 @@
|
||||||
#define USARTx_TX_AF GPIO_AF7_USART2
|
#define USARTx_TX_AF GPIO_AF7_USART2
|
||||||
#define USARTx_RX_AF GPIO_AF7_USART2
|
#define USARTx_RX_AF GPIO_AF7_USART2
|
||||||
|
|
||||||
|
|
||||||
/* Enable sensor mask */
|
/* Enable sensor mask */
|
||||||
#define PRESSURE_SENSOR 0x00000001
|
#define PRESSURE_SENSOR 0x00000001
|
||||||
#define TEMPERATURE_SENSOR 0x00000002
|
#define TEMPERATURE_SENSOR 0x00000002
|
||||||
|
|
|
@ -1,38 +1,32 @@
|
||||||
/**
|
/*
|
||||||
******************************************************************************
|
* Copyright (c) 2012, STMicroelectronics.
|
||||||
* @file platform/stm32nucleo-spirit1/node-id.c
|
* All rights reserved.
|
||||||
* @author System LAB
|
|
||||||
* @version V1.0.0
|
|
||||||
* @date 17-June-2015
|
|
||||||
* @brief Source file for node Id
|
|
||||||
******************************************************************************
|
|
||||||
* @attention
|
|
||||||
*
|
*
|
||||||
* <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
|
* Redistribution and use in source and binary forms, with or without
|
||||||
*
|
* modification, are permitted provided that the following conditions
|
||||||
* Redistribution and use in source and binary forms, with or without modification,
|
* are met:
|
||||||
* are permitted provided that the following conditions are met:
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
* 1. Redistributions of source code must retain the above copyright notice,
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* this list of conditions and the following disclaimer.
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
* documentation and/or other materials provided with the distribution.
|
||||||
* and/or other materials provided with the distribution.
|
* 3. Neither the name of the Institute nor the names of its contributors
|
||||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
|
||||||
* may be used to endorse or promote products derived from this software
|
* may be used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
* without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
|
* SUCH DAMAGE.
|
||||||
|
*
|
||||||
*
|
*
|
||||||
******************************************************************************
|
|
||||||
*/
|
*/
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
#include "node-id.h"
|
#include "node-id.h"
|
||||||
|
@ -47,7 +41,8 @@ volatile uint32_t device_id[3];
|
||||||
#define DEVICE_ID_REG1 (*((volatile uint32_t *)0x1FF80054))
|
#define DEVICE_ID_REG1 (*((volatile uint32_t *)0x1FF80054))
|
||||||
#define DEVICE_ID_REG2 (*((volatile uint32_t *)0x1FF80064))
|
#define DEVICE_ID_REG2 (*((volatile uint32_t *)0x1FF80064))
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
void node_id_restore(void)
|
void
|
||||||
|
node_id_restore(void)
|
||||||
{
|
{
|
||||||
device_id[0] = DEVICE_ID_REG0;
|
device_id[0] = DEVICE_ID_REG0;
|
||||||
device_id[1] = DEVICE_ID_REG1;
|
device_id[1] = DEVICE_ID_REG1;
|
||||||
|
|
|
@ -1,38 +1,32 @@
|
||||||
/**
|
/*
|
||||||
******************************************************************************
|
* Copyright (c) 2012, STMicroelectronics.
|
||||||
* @file platform/stm32nucleo-spirit1/platform-conf.h
|
* All rights reserved.
|
||||||
* @author System LAB
|
|
||||||
* @version V1.0.0
|
|
||||||
* @date 17-May-2015
|
|
||||||
* @brief Configuration parameters
|
|
||||||
******************************************************************************
|
|
||||||
* @attention
|
|
||||||
*
|
*
|
||||||
* <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
|
* Redistribution and use in source and binary forms, with or without
|
||||||
*
|
* modification, are permitted provided that the following conditions
|
||||||
* Redistribution and use in source and binary forms, with or without modification,
|
* are met:
|
||||||
* are permitted provided that the following conditions are met:
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
* 1. Redistributions of source code must retain the above copyright notice,
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* this list of conditions and the following disclaimer.
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
* documentation and/or other materials provided with the distribution.
|
||||||
* and/or other materials provided with the distribution.
|
* 3. Neither the name of the Institute nor the names of its contributors
|
||||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
|
||||||
* may be used to endorse or promote products derived from this software
|
* may be used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
* without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
|
* SUCH DAMAGE.
|
||||||
|
*
|
||||||
*
|
*
|
||||||
******************************************************************************
|
|
||||||
*/
|
*/
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,38 +1,32 @@
|
||||||
/**
|
/*
|
||||||
******************************************************************************
|
* Copyright (c) 2012, STMicroelectronics.
|
||||||
* @file main.c
|
* All rights reserved.
|
||||||
* @author System LAB
|
|
||||||
* @version V1.0.0
|
|
||||||
* @date 17-June-2015
|
|
||||||
* @brief Source file for SPIRIT1
|
|
||||||
******************************************************************************
|
|
||||||
* @attention
|
|
||||||
*
|
*
|
||||||
* <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
|
* Redistribution and use in source and binary forms, with or without
|
||||||
*
|
* modification, are permitted provided that the following conditions
|
||||||
* Redistribution and use in source and binary forms, with or without modification,
|
* are met:
|
||||||
* are permitted provided that the following conditions are met:
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
* 1. Redistributions of source code must retain the above copyright notice,
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* this list of conditions and the following disclaimer.
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
* documentation and/or other materials provided with the distribution.
|
||||||
* and/or other materials provided with the distribution.
|
* 3. Neither the name of the Institute nor the names of its contributors
|
||||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
|
||||||
* may be used to endorse or promote products derived from this software
|
* may be used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
* without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
|
* SUCH DAMAGE.
|
||||||
|
*
|
||||||
*
|
*
|
||||||
******************************************************************************
|
|
||||||
*/
|
*/
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
#include "stm32l1xx.h"
|
#include "stm32l1xx.h"
|
||||||
|
@ -62,7 +56,8 @@ spirit1_arch_refresh_status(void)
|
||||||
/* Puts the SPI chip select low to start the transaction */
|
/* Puts the SPI chip select low to start the transaction */
|
||||||
st_lib_radio_spi_cs_low();
|
st_lib_radio_spi_cs_low();
|
||||||
|
|
||||||
for (volatile uint16_t index = 0; index < CS_TO_SCLK_DELAY; index++);
|
for(volatile uint16_t index = 0; index < CS_TO_SCLK_DELAY; index++) {
|
||||||
|
}
|
||||||
|
|
||||||
/* Write the aHeader bytes and read the SPIRIT1 status bytes */
|
/* Write the aHeader bytes and read the SPIRIT1 status bytes */
|
||||||
st_lib_hal_spi_transmit_receive(&st_lib_p_spi_handle, (uint8_t *)&header[0], (uint8_t *)&mcstate, 1, spi_timeout);
|
st_lib_hal_spi_transmit_receive(&st_lib_p_spi_handle, (uint8_t *)&header[0], (uint8_t *)&mcstate, 1, spi_timeout);
|
||||||
|
@ -80,7 +75,4 @@ spirit1_arch_refresh_status(void)
|
||||||
IRQ_ENABLE();
|
IRQ_ENABLE();
|
||||||
|
|
||||||
return mcstate;
|
return mcstate;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -10,22 +10,22 @@
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
* 3. Neither the name of the copyright holder nor the names of its
|
* 3. Neither the name of the Institute nor the names of its contributors
|
||||||
* contributors may be used to endorse or promote products derived
|
* may be used to endorse or promote products derived from this software
|
||||||
* from this software without specific prior written permission.
|
* 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.
|
||||||
*
|
*
|
||||||
* 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,38 +1,32 @@
|
||||||
/**
|
/*
|
||||||
******************************************************************************
|
* Copyright (c) 2012, STMicroelectronics.
|
||||||
* @file spirit1.c
|
* All rights reserved.
|
||||||
* @author System LAB
|
|
||||||
* @version V1.0.0
|
|
||||||
* @date 17-June-2015
|
|
||||||
* @brief Source file for SPIRIT1
|
|
||||||
******************************************************************************
|
|
||||||
* @attention
|
|
||||||
*
|
*
|
||||||
* <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
|
* Redistribution and use in source and binary forms, with or without
|
||||||
*
|
* modification, are permitted provided that the following conditions
|
||||||
* Redistribution and use in source and binary forms, with or without modification,
|
* are met:
|
||||||
* are permitted provided that the following conditions are met:
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
* 1. Redistributions of source code must retain the above copyright notice,
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* this list of conditions and the following disclaimer.
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
* documentation and/or other materials provided with the distribution.
|
||||||
* and/or other materials provided with the distribution.
|
* 3. Neither the name of the Institute nor the names of its contributors
|
||||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
|
||||||
* may be used to endorse or promote products derived from this software
|
* may be used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
* without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
|
* SUCH DAMAGE.
|
||||||
|
*
|
||||||
*
|
*
|
||||||
******************************************************************************
|
|
||||||
*/
|
*/
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
#include "spirit1.h"
|
#include "spirit1.h"
|
||||||
|
@ -47,7 +41,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "st-lib.h"
|
#include "st-lib.h"
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
//MGR extern st_lib_spirit_irqs st_lib_x_irq_status;
|
/* MGR extern st_lib_spirit_irqs st_lib_x_irq_status; */
|
||||||
extern volatile st_lib_spirit_flag_status rx_timeout;
|
extern volatile st_lib_spirit_flag_status rx_timeout;
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
#define XXX_ACK_WORKAROUND 1
|
#define XXX_ACK_WORKAROUND 1
|
||||||
|
@ -81,8 +75,8 @@ extern volatile st_lib_spirit_flag_status rx_timeout;
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static volatile unsigned int spirit_on = OFF;
|
static volatile unsigned int spirit_on = OFF;
|
||||||
static volatile uint8_t receiving_packet = 0;
|
static volatile uint8_t receiving_packet = 0;
|
||||||
static packetbuf_attr_t last_rssi = 0 ; //MGR
|
static packetbuf_attr_t last_rssi = 0; /* MGR */
|
||||||
static packetbuf_attr_t last_lqi = 0 ; //MGR
|
static packetbuf_attr_t last_lqi = 0; /* MGR */
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
/*
|
/*
|
||||||
* The buffers which hold incoming data.
|
* The buffers which hold incoming data.
|
||||||
|
@ -97,8 +91,8 @@ static int just_got_an_ack = 0; /* Interrupt callback just detected an ack */
|
||||||
#if NULLRDC_CONF_802154_AUTOACK
|
#if NULLRDC_CONF_802154_AUTOACK
|
||||||
#define ACK_LEN 3
|
#define ACK_LEN 3
|
||||||
static int wants_an_ack = 0; /* The packet sent expects an ack */
|
static int wants_an_ack = 0; /* The packet sent expects an ack */
|
||||||
//static int just_got_an_ack = 0; /* Interrupt callback just detected an ack */
|
/* static int just_got_an_ack = 0; / * Interrupt callback just detected an ack * / */
|
||||||
//#define ACKPRINTF printf
|
/* #define ACKPRINTF printf */
|
||||||
#define ACKPRINTF(...)
|
#define ACKPRINTF(...)
|
||||||
#endif /* NULLRDC_CONF_802154_AUTOACK */
|
#endif /* NULLRDC_CONF_802154_AUTOACK */
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
@ -155,7 +149,8 @@ spirit1_strobe(uint8_t s)
|
||||||
st_lib_spirit_cmd_strobe_command(s);
|
st_lib_spirit_cmd_strobe_command(s);
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
void spirit_set_ready_state(void)
|
void
|
||||||
|
spirit_set_ready_state(void)
|
||||||
{
|
{
|
||||||
PRINTF("READY IN\n");
|
PRINTF("READY IN\n");
|
||||||
|
|
||||||
|
@ -202,7 +197,7 @@ spirit_radio_init(void)
|
||||||
|
|
||||||
/* Configures the SPIRIT1 radio part */
|
/* Configures the SPIRIT1 radio part */
|
||||||
st_lib_s_radio_init x_radio_init = {
|
st_lib_s_radio_init x_radio_init = {
|
||||||
// XTAL_FREQUENCY,
|
/* XTAL_FREQUENCY, */
|
||||||
XTAL_OFFSET_PPM,
|
XTAL_OFFSET_PPM,
|
||||||
BASE_FREQUENCY,
|
BASE_FREQUENCY,
|
||||||
CHANNEL_SPACE,
|
CHANNEL_SPACE,
|
||||||
|
@ -327,8 +322,8 @@ spirit_radio_transmit(unsigned short payload_len)
|
||||||
spirit1_strobe(SPIRIT1_STROBE_TX);
|
spirit1_strobe(SPIRIT1_STROBE_TX);
|
||||||
just_got_an_ack = 0;
|
just_got_an_ack = 0;
|
||||||
BUSYWAIT_UNTIL(SPIRIT1_STATUS() == SPIRIT1_STATE_TX, 1 * RTIMER_SECOND / 1000);
|
BUSYWAIT_UNTIL(SPIRIT1_STATUS() == SPIRIT1_STATE_TX, 1 * RTIMER_SECOND / 1000);
|
||||||
//BUSYWAIT_UNTIL(SPIRIT1_STATUS() != SPIRIT1_STATE_TX, 4 * RTIMER_SECOND/1000); //For GFSK with high data rate
|
/* BUSYWAIT_UNTIL(SPIRIT1_STATUS() != SPIRIT1_STATE_TX, 4 * RTIMER_SECOND/1000); //For GFSK with high data rate */
|
||||||
BUSYWAIT_UNTIL(SPIRIT1_STATUS() != SPIRIT1_STATE_TX, 50 * RTIMER_SECOND/1000); //For FSK with low data rate
|
BUSYWAIT_UNTIL(SPIRIT1_STATUS() != SPIRIT1_STATE_TX, 50 * RTIMER_SECOND / 1000); /* For FSK with low data rate */
|
||||||
|
|
||||||
/* Reset radio - needed for immediate RX of ack */
|
/* Reset radio - needed for immediate RX of ack */
|
||||||
CLEAR_TXBUF();
|
CLEAR_TXBUF();
|
||||||
|
@ -373,16 +368,17 @@ spirit_radio_transmit(unsigned short payload_len)
|
||||||
return RADIO_TX_OK;
|
return RADIO_TX_OK;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static int spirit_radio_send(const void *payload, unsigned short payload_len)
|
static int
|
||||||
|
spirit_radio_send(const void *payload, unsigned short payload_len)
|
||||||
{
|
{
|
||||||
if(spirit_radio_prepare(payload, payload_len) == RADIO_TX_ERR) {
|
if(spirit_radio_prepare(payload, payload_len) == RADIO_TX_ERR) {
|
||||||
return RADIO_TX_ERR;
|
return RADIO_TX_ERR;
|
||||||
}
|
}
|
||||||
return spirit_radio_transmit(payload_len);
|
return spirit_radio_transmit(payload_len);
|
||||||
|
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static int spirit_radio_read(void *buf, unsigned short bufsize)
|
static int
|
||||||
|
spirit_radio_read(void *buf, unsigned short bufsize)
|
||||||
{
|
{
|
||||||
PRINTF("READ IN\n");
|
PRINTF("READ IN\n");
|
||||||
|
|
||||||
|
@ -409,8 +405,8 @@ static int spirit_radio_read(void *buf, unsigned short bufsize)
|
||||||
/* Copies the packet received */
|
/* Copies the packet received */
|
||||||
memcpy(buf, spirit_rxbuf + 1, spirit_rxbuf[0]);
|
memcpy(buf, spirit_rxbuf + 1, spirit_rxbuf[0]);
|
||||||
|
|
||||||
packetbuf_set_attr(PACKETBUF_ATTR_RSSI, last_rssi); //MGR
|
packetbuf_set_attr(PACKETBUF_ATTR_RSSI, last_rssi); /* MGR */
|
||||||
packetbuf_set_attr(PACKETBUF_ATTR_LINK_QUALITY, last_lqi); //MGR
|
packetbuf_set_attr(PACKETBUF_ATTR_LINK_QUALITY, last_lqi); /* MGR */
|
||||||
bufsize = spirit_rxbuf[0];
|
bufsize = spirit_rxbuf[0];
|
||||||
CLEAR_RXBUF();
|
CLEAR_RXBUF();
|
||||||
|
|
||||||
|
@ -418,7 +414,6 @@ static int spirit_radio_read(void *buf, unsigned short bufsize)
|
||||||
|
|
||||||
return bufsize;
|
return bufsize;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static int
|
static int
|
||||||
|
@ -523,7 +518,8 @@ spirit_radio_off(void)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static int spirit_radio_on(void)
|
static int
|
||||||
|
spirit_radio_on(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
PRINTF("Spirit1: on\n");
|
PRINTF("Spirit1: on\n");
|
||||||
|
@ -537,7 +533,7 @@ static int spirit_radio_on(void)
|
||||||
if(SPIRIT1_STATUS() != SPIRIT1_STATE_READY) {
|
if(SPIRIT1_STATUS() != SPIRIT1_STATE_READY) {
|
||||||
PRINTF("Spirit1: failed to turn on\n");
|
PRINTF("Spirit1: failed to turn on\n");
|
||||||
while(1) ;
|
while(1) ;
|
||||||
//return 1;
|
/* return 1; */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* now we go to Rx */
|
/* now we go to Rx */
|
||||||
|
@ -546,7 +542,7 @@ static int spirit_radio_on(void)
|
||||||
if(SPIRIT1_STATUS() != SPIRIT1_STATE_RX) {
|
if(SPIRIT1_STATUS() != SPIRIT1_STATE_RX) {
|
||||||
PRINTF("Spirit1: failed to enter rx\n");
|
PRINTF("Spirit1: failed to enter rx\n");
|
||||||
while(1) ;
|
while(1) ;
|
||||||
//return 1;
|
/* return 1; */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Enables the mcu to get IRQ from the SPIRIT1 */
|
/* Enables the mcu to get IRQ from the SPIRIT1 */
|
||||||
|
@ -585,7 +581,6 @@ PROCESS_THREAD(spirit_radio_process, ev, data)
|
||||||
linkaddr_cmp((linkaddr_t *)&info154.dest_addr,
|
linkaddr_cmp((linkaddr_t *)&info154.dest_addr,
|
||||||
&linkaddr_node_addr)) {
|
&linkaddr_node_addr)) {
|
||||||
|
|
||||||
|
|
||||||
#if !XXX_ACK_WORKAROUND
|
#if !XXX_ACK_WORKAROUND
|
||||||
/* Send an ACK packet */
|
/* Send an ACK packet */
|
||||||
uint8_t ack_frame[ACK_LEN] = {
|
uint8_t ack_frame[ACK_LEN] = {
|
||||||
|
@ -633,7 +628,7 @@ PROCESS_THREAD(spirit_radio_process, ev, data)
|
||||||
void
|
void
|
||||||
spirit1_interrupt_callback(void)
|
spirit1_interrupt_callback(void)
|
||||||
{
|
{
|
||||||
#define INTPRINTF(...) // PRINTF
|
#define INTPRINTF(...) /* PRINTF */
|
||||||
st_lib_spirit_irqs x_irq_status;
|
st_lib_spirit_irqs x_irq_status;
|
||||||
if(spirit_spi_busy() || interrupt_callback_in_progress) {
|
if(spirit_spi_busy() || interrupt_callback_in_progress) {
|
||||||
process_poll(&spirit_radio_process);
|
process_poll(&spirit_radio_process);
|
||||||
|
@ -689,8 +684,8 @@ spirit1_interrupt_callback(void)
|
||||||
|
|
||||||
process_poll(&spirit_radio_process);
|
process_poll(&spirit_radio_process);
|
||||||
|
|
||||||
last_rssi = (packetbuf_attr_t) st_lib_spirit_qi_get_rssi(); //MGR
|
last_rssi = (packetbuf_attr_t)st_lib_spirit_qi_get_rssi(); /* MGR */
|
||||||
last_lqi = (packetbuf_attr_t) st_lib_spirit_qi_get_lqi(); //MGR
|
last_lqi = (packetbuf_attr_t)st_lib_spirit_qi_get_lqi(); /* MGR */
|
||||||
|
|
||||||
receiving_packet = 0;
|
receiving_packet = 0;
|
||||||
|
|
||||||
|
@ -705,8 +700,7 @@ spirit1_interrupt_callback(void)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(x_irq_status.IRQ_RX_DATA_DISC)
|
if(x_irq_status.IRQ_RX_DATA_DISC) {
|
||||||
{
|
|
||||||
/* RX command - to ensure the device will be ready for the next reception */
|
/* RX command - to ensure the device will be ready for the next reception */
|
||||||
if(x_irq_status.IRQ_RX_TIMEOUT) {
|
if(x_irq_status.IRQ_RX_TIMEOUT) {
|
||||||
st_lib_spirit_cmd_strobe_flush_rx_fifo();
|
st_lib_spirit_cmd_strobe_flush_rx_fifo();
|
||||||
|
|
|
@ -1,38 +1,32 @@
|
||||||
/**
|
/*
|
||||||
******************************************************************************
|
* Copyright (c) 2012, STMicroelectronics.
|
||||||
* @file st-lib.h
|
* All rights reserved.
|
||||||
* @author System LAB
|
|
||||||
* @version V1.0.0
|
|
||||||
* @date 30-July-2015
|
|
||||||
* @brief Contiki style wrapping library for STM32Cube HAL APIs
|
|
||||||
******************************************************************************
|
|
||||||
* @attention
|
|
||||||
*
|
*
|
||||||
* <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
|
* Redistribution and use in source and binary forms, with or without
|
||||||
*
|
* modification, are permitted provided that the following conditions
|
||||||
* Redistribution and use in source and binary forms, with or without modification,
|
* are met:
|
||||||
* are permitted provided that the following conditions are met:
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
* 1. Redistributions of source code must retain the above copyright notice,
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* this list of conditions and the following disclaimer.
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
* documentation and/or other materials provided with the distribution.
|
||||||
* and/or other materials provided with the distribution.
|
* 3. Neither the name of the Institute nor the names of its contributors
|
||||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
|
||||||
* may be used to endorse or promote products derived from this software
|
* may be used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
* without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
|
* SUCH DAMAGE.
|
||||||
|
*
|
||||||
*
|
*
|
||||||
******************************************************************************
|
|
||||||
*/
|
*/
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
/**
|
/**
|
||||||
|
@ -73,7 +67,6 @@
|
||||||
#define st_lib_spirit_spi_write_linear_fifo(...) SpiritSpiWriteLinearFifo(__VA_ARGS__)
|
#define st_lib_spirit_spi_write_linear_fifo(...) SpiritSpiWriteLinearFifo(__VA_ARGS__)
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
/* radio_gpio.h */
|
/* radio_gpio.h */
|
||||||
#include "radio_gpio.h"
|
#include "radio_gpio.h"
|
||||||
|
@ -241,7 +234,6 @@
|
||||||
/* stm32l1xx_hal_rcc.h */
|
/* stm32l1xx_hal_rcc.h */
|
||||||
#include "stm32l1xx_hal_rcc.h"
|
#include "stm32l1xx_hal_rcc.h"
|
||||||
|
|
||||||
|
|
||||||
#define st_lib_tim2_clk_enable(...) __TIM2_CLK_ENABLE(__VA_ARGS__)
|
#define st_lib_tim2_clk_enable(...) __TIM2_CLK_ENABLE(__VA_ARGS__)
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
@ -274,7 +266,6 @@
|
||||||
#define st_lib_hal_tim_oc_config_channel(...) HAL_TIM_OC_ConfigChannel(__VA_ARGS__)
|
#define st_lib_hal_tim_oc_config_channel(...) HAL_TIM_OC_ConfigChannel(__VA_ARGS__)
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
/* stm32l1xx_hal_uart.h */
|
/* stm32l1xx_hal_uart.h */
|
||||||
#include "stm32l1xx_hal_uart.h"
|
#include "stm32l1xx_hal_uart.h"
|
||||||
|
|
|
@ -1,30 +1,34 @@
|
||||||
/**
|
/*
|
||||||
******************************************************************************
|
* Copyright (c) 2012, STMicroelectronics.
|
||||||
* @file stm32l-spirit1-config.h
|
* All rights reserved.
|
||||||
* @author MCD Application Team
|
|
||||||
* @version V3.4.0
|
|
||||||
* @date 29-June-2012
|
|
||||||
* @brief Evaluation board specific configuration file.
|
|
||||||
******************************************************************************
|
|
||||||
* @attention
|
|
||||||
*
|
*
|
||||||
* <h2><center>© COPYRIGHT 2012 STMicroelectronics</center></h2>
|
* 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.
|
||||||
*
|
*
|
||||||
* Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
|
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||||
* You may not use this file except in compliance with the License.
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
* You may obtain a copy of the License at:
|
* 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.
|
||||||
*
|
*
|
||||||
* http://www.st.com/software_license_agreement_liberty_v2
|
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*
|
|
||||||
******************************************************************************
|
|
||||||
*/
|
*/
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||||
#ifndef __STM32L_SPIRIT1_CONFIG_H
|
#ifndef __STM32L_SPIRIT1_CONFIG_H
|
||||||
#define __STM32L_SPIRIT1_CONFIG_H
|
#define __STM32L_SPIRIT1_CONFIG_H
|
||||||
|
|
|
@ -1,37 +1,32 @@
|
||||||
/**
|
/*
|
||||||
******************************************************************************
|
* Copyright (c) 2012, STMicroelectronics.
|
||||||
* @file uart-msg.c
|
* All rights reserved.
|
||||||
* @author System LAB
|
|
||||||
* @version V1.0.0
|
|
||||||
* @date 17-June-2015
|
|
||||||
******************************************************************************
|
|
||||||
* @attention
|
|
||||||
*
|
*
|
||||||
* <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
|
* Redistribution and use in source and binary forms, with or without
|
||||||
*
|
* modification, are permitted provided that the following conditions
|
||||||
* Redistribution and use in source and binary forms, with or without modification,
|
* are met:
|
||||||
* are permitted provided that the following conditions are met:
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
* 1. Redistributions of source code must retain the above copyright notice,
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* this list of conditions and the following disclaimer.
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
* documentation and/or other materials provided with the distribution.
|
||||||
* and/or other materials provided with the distribution.
|
* 3. Neither the name of the Institute nor the names of its contributors
|
||||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
|
||||||
* may be used to endorse or promote products derived from this software
|
* may be used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
* without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
|
* SUCH DAMAGE.
|
||||||
|
*
|
||||||
*
|
*
|
||||||
******************************************************************************
|
|
||||||
*/
|
*/
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
#include "contiki.h"
|
#include "contiki.h"
|
||||||
|
@ -55,7 +50,8 @@ static unsigned char databyte[1] = {0};
|
||||||
* the configuration information for the specified UART module.
|
* the configuration information for the specified UART module.
|
||||||
* @retval None
|
* @retval None
|
||||||
*/
|
*/
|
||||||
void st_lib_hal_uart_rx_cplt_callback(st_lib_uart_handle_typedef *huart)
|
void
|
||||||
|
st_lib_hal_uart_rx_cplt_callback(st_lib_uart_handle_typedef *huart)
|
||||||
{
|
{
|
||||||
slip_input_byte(databyte[0]);
|
slip_input_byte(databyte[0]);
|
||||||
st_lib_hal_uart_receive_it(&st_lib_uart_handle, databyte, 1);
|
st_lib_hal_uart_receive_it(&st_lib_uart_handle, databyte, 1);
|
||||||
|
@ -71,7 +67,7 @@ void
|
||||||
slip_arch_init(unsigned long ubr)
|
slip_arch_init(unsigned long ubr)
|
||||||
{
|
{
|
||||||
st_lib_hal_uart_enable_it(&st_lib_uart_handle, UART_IT_RXNE);
|
st_lib_hal_uart_enable_it(&st_lib_uart_handle, UART_IT_RXNE);
|
||||||
//uart1_set_input(slip_input_byte);
|
/* uart1_set_input(slip_input_byte); */
|
||||||
}
|
}
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
void
|
void
|
||||||
|
@ -86,7 +82,8 @@ slip_arch_writeb(unsigned char c)
|
||||||
* @param msg the pointer to the message to be sent
|
* @param msg the pointer to the message to be sent
|
||||||
* @retval None
|
* @retval None
|
||||||
*/
|
*/
|
||||||
void uart_send_msg(char *msg)
|
void
|
||||||
|
uart_send_msg(char *msg)
|
||||||
{
|
{
|
||||||
st_lib_hal_uart_transmit(&st_lib_uart_handle, (uint8_t *)msg, 1, 5000);
|
st_lib_hal_uart_transmit(&st_lib_uart_handle, (uint8_t *)msg, 1, 5000);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue