Compare commits

..

No commits in common. "1ba14d734c454912cf5b15fb5218b98293d07e13" and "8033e2dc5d1fe0398e320f75f4700d0064476d7b" have entirely different histories.

25 changed files with 215 additions and 986 deletions

View File

@ -5,6 +5,7 @@
* Nucleo F401RE port file. This file contain the implementation of driver * Nucleo F401RE port file. This file contain the implementation of driver
* calls for F401RE board. * calls for F401RE board.
* *
* Created on: May 23, 2020
* Author: Christos Choutouridis AEM: 8997 * Author: Christos Choutouridis AEM: 8997
* email : <cchoutou@ece.auth.gr> * email : <cchoutou@ece.auth.gr>
*/ */
@ -122,14 +123,7 @@ void HAL_Delay(uint32_t Delay) {
/* /*
* ================ Jiffies ====================== * ================ Jiffies ======================
*/ */
/*!
* Provide jiffy compatible set frequency functionality
* \param jf_freq The desire frequency
* \param jiffies The number of steps (jiffies)
* \return The status of the operation
* \arg 0 Success
* \arg 1 Fail
*/
int JF_setfreq (uint32_t jf_freq, uint32_t jiffies) { int JF_setfreq (uint32_t jf_freq, uint32_t jiffies) {
uint32_t psc=0; uint32_t psc=0;

View File

@ -5,6 +5,7 @@
* Nucleo F401RE port file. This file contain the implementation of driver * Nucleo F401RE port file. This file contain the implementation of driver
* calls for F401RE board. * calls for F401RE board.
* *
* Created on: May 23, 2020
* Author: Christos Choutouridis AEM: 8997 * Author: Christos Choutouridis AEM: 8997
* email : <cchoutou@ece.auth.gr> * email : <cchoutou@ece.auth.gr>
*/ */
@ -27,6 +28,7 @@ typedef enum {
}LLD_Status_en; }LLD_Status_en;
typedef uint8_t din_t; typedef uint8_t din_t;
//typedef int adc_t;
#define OFF (0) #define OFF (0)
#define ON (!OFF) #define ON (!OFF)

View File

@ -3,8 +3,20 @@
* \brief * \brief
* A target independent Alpharithmetic LCD driver * A target independent Alpharithmetic LCD driver
* *
* Author: Christos Choutouridis AEM: 8997 * Copyright (C) 2014 Houtouridis Christos (http://www.houtouridis.net)
* email : <cchoutou@ece.auth.gr> *
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 3
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */

View File

@ -3,8 +3,20 @@
* \brief * \brief
* A target independent Alpharithmetic LCD driver * A target independent Alpharithmetic LCD driver
* *
* Author: Christos Choutouridis AEM: 8997 * Copyright (C) 2014 Christos Choutouridis (http://www.houtouridis.net)
* email : <cchoutou@ece.auth.gr> *
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 3
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */

View File

@ -3,8 +3,20 @@
* \brief * \brief
* This file provides double ended queue capability based on a ring buffer * This file provides double ended queue capability based on a ring buffer
* *
* Author: Christos Choutouridis AEM: 8997 * Copyright (C) 2014 Houtouridis Christos <houtouridis.ch@gmail.com>
* email : <cchoutou@ece.auth.gr> *
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 3
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
#include "deque08.h" #include "deque08.h"

View File

@ -3,8 +3,20 @@
* \brief * \brief
* This file provides double ended queue capability based on a ring buffer * This file provides double ended queue capability based on a ring buffer
* *
* Author: Christos Choutouridis AEM: 8997 * Copyright (C) 2014 Houtouridis Christos <houtouridis.ch@gmail.com>
* email : <cchoutou@ece.auth.gr> *
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 3
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
#ifndef __deque08_h__ #ifndef __deque08_h__

View File

@ -1,8 +1,20 @@
/*! /*!
* \file driver_types.h * \file driver_types.h
* *
* Author: Christos Choutouridis AEM: 8997 * Copyright (C) 2020 Choutouridis Christos <cchoutou@ece.auth.gr>
* email : <cchoutou@ece.auth.gr> *
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 3
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */

View File

@ -1,8 +1,20 @@
/*! /*!
* \file hal.c * \file hal.c
* *
* Author: Christos Choutouridis AEM: 8997 * Copyright (C) 2020 Choutouridis Christos (http://www.houtouridis.net)
* email : <cchoutou@ece.auth.gr> *
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 3
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
#include "hal.h" #include "hal.h"
@ -18,6 +30,7 @@ proximity_t prox;
/*! /*!
* Initialize all hardware * Initialize all hardware
* @return
*/ */
int hal_hw_init (void) { int hal_hw_init (void) {
// Init base board // Init base board
@ -54,17 +67,14 @@ void lcd_init (void) {
alcd_init (&alcd, (alcd_funset_en)LCD_FUNSET_2L8); alcd_init (&alcd, (alcd_funset_en)LCD_FUNSET_2L8);
} }
//! lcd enable wrapper
__INLINE void lcd_enable (uint8_t en) { __INLINE void lcd_enable (uint8_t en) {
alcd_enable(&alcd, en); alcd_enable(&alcd, en);
} }
//!< lcd putchar wrapper
__INLINE int lcd_putchar (char c) { __INLINE int lcd_putchar (char c) {
return alcd_putchar(&alcd, c); return alcd_putchar(&alcd, c);
} }
//! lcd puts wrapper
int lcd_puts (const char *s) { int lcd_puts (const char *s) {
int i =0; int i =0;
while (alcd_putchar(&alcd, *s++)) while (alcd_putchar(&alcd, *s++))
@ -81,9 +91,6 @@ __INLINE void led_green (uint8_t en) { LED_GREEN (en); }
/* /*
* ========= Relay =========== * ========= Relay ===========
*/ */
/*!
* Create pulses to re-state reay coil
*/
void relay (uint8_t on) { void relay (uint8_t on) {
switch (on) { switch (on) {
case 0: case 0:
@ -106,23 +113,19 @@ void relay (uint8_t on) {
uint8_t ds18b20_rom[8]; uint8_t ds18b20_rom[8];
uint8_t zero_rom[8] = {0}; uint8_t zero_rom[8] = {0};
/*!
* Initialize temperature measurement system
*/
int temp_init (uint8_t resolution) { int temp_init (uint8_t resolution) {
if (!IS_TEMP_RESOLUTION(resolution)) if (!IS_TEMP_RESOLUTION(resolution))
return 1; return 1;
// link with hardware
ow_uart_link_rw (&ow, (ow_uart_rw_ft)SHIELD_1W_RW); ow_uart_link_rw (&ow, (ow_uart_rw_ft)SHIELD_1W_RW);
ow_uart_link_br (&ow, (ow_uart_br_ft)SHIELD_1W_UART_BR); ow_uart_link_br (&ow, (ow_uart_br_ft)SHIELD_1W_UART_BR);
ow_uart_set_timing (&ow, OW_UART_T_STANDARD); ow_uart_set_timing (&ow, OW_UART_T_STANDARD);
ow_uart_init (&ow); // init ow_uart_init (&ow);
ow_uart_search(&ow, ds18b20_rom);// do a search ow_uart_search(&ow, ds18b20_rom);
if (!memcmp ((const void*)ds18b20_rom, (const void*)zero_rom, 8)) if (!memcmp ((const void*)ds18b20_rom, (const void*)zero_rom, 8))
return 1; // if there is no DS18b20 error return 1;
// set resolution to 9-bit // set resolution to 9-bit
ow_uart_reset(&ow); ow_uart_reset(&ow);
@ -135,9 +138,6 @@ int temp_init (uint8_t resolution) {
return 0; return 0;
} }
/*!
* Temperature read functionality
*/
float temp_read (void) { float temp_read (void) {
uint8_t t[2]; uint8_t t[2];
@ -164,22 +164,11 @@ float temp_read (void) {
/* /*
* ========= Proximity =========== * ========= Proximity ===========
*/ */
/*!
* Initialize proximity system
* \param p Which proximity object to initialize
*/
void proximity_init (proximity_t* p){ void proximity_init (proximity_t* p){
for (int i =0 ; i<PROX_READINGS ; ++i) for (int i =0 ; i<PROX_READINGS ; ++i)
proximity(p); proximity(p);
} }
/*!
* Read proximity value in [cm]
* \note
* This function also implements an embedded averaging filter
* @param p Which proximity object to use
* @return The measured distance
*/
float_t proximity (proximity_t* p){ float_t proximity (proximity_t* p){
float_t ret; float_t ret;
clock_t t1, t2, mark; clock_t t1, t2, mark;
@ -202,14 +191,13 @@ float_t proximity (proximity_t* p){
return -1; return -1;
} while (SHIELD_ECHO()); } while (SHIELD_ECHO());
// Calculate distance
SystemCoreClockUpdate(); SystemCoreClockUpdate();
uint32_t c_usec = SystemCoreClock / 1000000; uint32_t c_usec = SystemCoreClock / 1000000;
// Load value // Load value
p->readings[p->iter++] = (c_usec) ? ((t2 - t1)/c_usec) / 58.2 : PROX_MAX_DISTANSE; p->readings[p->iter++] = (c_usec) ? ((t2 - t1)/c_usec) / 58.2 : PROX_MAX_DISTANSE;
p->iter %= PROX_READINGS; p->iter %= PROX_READINGS;
// Return filtered distance (moving average filter FIR) // Return filtered distance
ret =0; ret =0;
for (int i=0 ; i<PROX_READINGS ; ++i) for (int i=0 ; i<PROX_READINGS ; ++i)
ret += p->readings[i]; ret += p->readings[i];

View File

@ -1,8 +1,20 @@
/*! /*!
* \file hal.h * \file hal.h
* *
* Author: Christos Choutouridis AEM: 8997 * Copyright (C) 2020 Choutouridis Christos (http://www.houtouridis.net)
* email : <cchoutou@ece.auth.gr> *
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 3
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
#ifndef DRIVERS_HAL_H_ #ifndef DRIVERS_HAL_H_

View File

@ -1,10 +1,22 @@
/*! /*
* \file jiffies.c * \file jiffies.c
* \brief * \brief
* A target independent jiffy functionality * A target independent jiffy functionality
* *
* Author: Christos Choutouridis AEM: 8997 * Copyright (C) 2014 Houtouridis Christos (http://www.houtouridis.net)
* email : <cchoutou@ece.auth.gr> *
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 3
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
#include "jiffies.h" #include "jiffies.h"

View File

@ -1,10 +1,22 @@
/*! /*
* \file jiffies.h * \file jiffies.h
* \brief * \brief
* A target independent jiffy functionality * A target independent jiffy functionality
* *
* Author: Christos Choutouridis AEM: 8997 * Copyright (C) 2014 Houtouridis Christos (http://www.houtouridis.net)
* email : <cchoutou@ece.auth.gr> *
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 3
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
#ifndef __jiffies_h__ #ifndef __jiffies_h__

View File

@ -4,8 +4,20 @@
* A target independent 1-wire implementation using a microprocessor's uart * A target independent 1-wire implementation using a microprocessor's uart
* for bit timing * for bit timing
* *
* Author: Christos Choutouridis AEM: 8997 * Copyright (C) 2015 Choutouridis Christos (http://www.houtouridis.net)
* email : <cchoutou@ece.auth.gr> *
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 3
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
#include "onewire_uart.h" #include "onewire_uart.h"

View File

@ -12,8 +12,20 @@
* 3) A receive function even in blocking/polling mode * 3) A receive function even in blocking/polling mode
* 4) A baudrate set function * 4) A baudrate set function
* *
* Author: Christos Choutouridis AEM: 8997 * Copyright (C) 2016 Choutouridis Christos <cchoutou@ece.auth.gr>
* email : <cchoutou@ece.auth.gr> *
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 3
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
#ifndef __onewire_uart_h__ #ifndef __onewire_uart_h__

View File

@ -29,10 +29,6 @@ static void SHIELD_SR04_Port_Init (void);
* LCD_EN -- D14 -- PB9 * LCD_EN -- D14 -- PB9
* LCD_BL -- D2 -- PA10 * LCD_BL -- D2 -- PA10
*/ */
/*!
* LCD pin Initialize
*/
static void SHIELD_LCD_Port_Init (void) { static void SHIELD_LCD_Port_Init (void) {
GPIO_InitTypeDef GPIO_InitType; GPIO_InitTypeDef GPIO_InitType;
@ -60,10 +56,6 @@ void SHIELD_LCD_BL (uint8_t en) { _DOUTx(GPIOA, GPIO_PIN_10, en); }
* LED0 -- D4 -- PB5 * LED0 -- D4 -- PB5
* LED1 -- D3 -- PB3 * LED1 -- D3 -- PB3
*/ */
/*!
* LED pin initialize
*/
static void SHIELD_LED_Port_Init (void) { static void SHIELD_LED_Port_Init (void) {
GPIO_InitTypeDef GPIO_InitType; GPIO_InitTypeDef GPIO_InitType;
@ -82,10 +74,6 @@ void SHIELD_LED1 (uint8_t on) { _DOUTx(GPIOB, GPIO_PIN_3, on); }
* BR1 -- D10 -- PB6 * BR1 -- D10 -- PB6
* BR2 -- D9 -- PC7 * BR2 -- D9 -- PC7
*/ */
/*!
* H-Bridge pin initialize
*/
static void SHIELD_BRIDGE_Port_Init (void) { static void SHIELD_BRIDGE_Port_Init (void) {
GPIO_InitTypeDef GPIO_InitType; GPIO_InitTypeDef GPIO_InitType;
@ -107,10 +95,6 @@ void SHIELD_BR2 (uint8_t on) { _DOUTx(GPIOC, GPIO_PIN_7, on); }
* TRIG -- D11 -- PA7 * TRIG -- D11 -- PA7
* ECHO -- D12 -- PA6 * ECHO -- D12 -- PA6
*/ */
/*!
* SR04 pin initialize
*/
static void SHIELD_SR04_Port_Init (void) { static void SHIELD_SR04_Port_Init (void) {
GPIO_InitTypeDef GPIO_InitType; GPIO_InitTypeDef GPIO_InitType;
@ -134,7 +118,7 @@ uint8_t SHIELD_ECHO (void) { return _DINx (GPIOA, GPIO_PIN_6); }
* 1W_Tx -- PA11 (OD+PU) * 1W_Tx -- PA11 (OD+PU)
* 1W_Rx -- PA12 (I) * 1W_Rx -- PA12 (I)
*/ */
static UART_HandleTypeDef h1w_uart; //!< 1-wire uart handle static UART_HandleTypeDef h1w_uart;
/*! /*!
* \brief * \brief
@ -196,7 +180,7 @@ static LLD_Status_en _1W_UART_Init (void) {
/*! /*!
* Init the 1wire interface and allocate all resources for it * Init the KEY 1wire interface and allocate all resources for it
* \return The status of the operation * \return The status of the operation
* \arg LLD_OK Success * \arg LLD_OK Success
* \arg LLD_ERROR The Init failed. * \arg LLD_ERROR The Init failed.
@ -324,9 +308,6 @@ uint8_t SHIELD_1W_Tx (uint8_t byte) {
return 0; return 0;
} }
/*!
* Shield hardware initialization
*/
LLD_Status_en SHIELD_Init (void) { LLD_Status_en SHIELD_Init (void) {
SHIELD_LCD_Port_Init (); SHIELD_LCD_Port_Init ();
SHIELD_LED_Port_Init (); SHIELD_LED_Port_Init ();
@ -343,9 +324,9 @@ LLD_Status_en SHIELD_Init (void) {
* COM_Tx -- PA2 (PP) * COM_Tx -- PA2 (PP)
* COM_Rx -- PA3 (I) * COM_Rx -- PA3 (I)
*/ */
static UART_HandleTypeDef com_huart; //!< com uart handle static UART_HandleTypeDef com_huart;
static deque08_t _com_rxq; //!< deque object static deque08_t _com_rxq;
static byte_t _com_rxbuffer[COM_BUFFER_SIZE]; //!< buffer for deque static byte_t _com_rxbuffer[COM_BUFFER_SIZE];
/*! /*!
* \brief * \brief

Binary file not shown.

Before

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 499 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 262 KiB

View File

@ -1,601 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="210mm"
height="297mm"
viewBox="0 0 210 297"
version="1.1"
id="svg8"
inkscape:version="0.92.4 (5da689c313, 2019-01-14)"
sodipodi:docname="ui_states.svg">
<defs
id="defs2">
<marker
inkscape:stockid="Arrow1Lend"
orient="auto"
refY="0.0"
refX="0.0"
id="Arrow1Lend"
style="overflow:visible;"
inkscape:isstock="true">
<path
id="path991"
d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1;fill:#000000;fill-opacity:1"
transform="scale(0.8) rotate(180) translate(12.5,0)" />
</marker>
<marker
inkscape:stockid="Arrow1Lstart"
orient="auto"
refY="0.0"
refX="0.0"
id="Arrow1Lstart"
style="overflow:visible"
inkscape:isstock="true">
<path
id="path988"
d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1;fill:#000000;fill-opacity:1"
transform="scale(0.8) translate(12.5,0)" />
</marker>
<marker
inkscape:stockid="Arrow1Lend"
orient="auto"
refY="0"
refX="0"
id="Arrow1Lend-6"
style="overflow:visible"
inkscape:isstock="true">
<path
inkscape:connector-curvature="0"
id="path991-0"
d="M 0,0 5,-5 -12.5,0 5,5 Z"
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.00000003pt;stroke-opacity:1"
transform="matrix(-0.8,0,0,-0.8,-10,0)" />
</marker>
<marker
inkscape:stockid="Arrow1Lend"
orient="auto"
refY="0"
refX="0"
id="Arrow1Lend-6-1"
style="overflow:visible"
inkscape:isstock="true">
<path
inkscape:connector-curvature="0"
id="path991-0-3"
d="M 0,0 5,-5 -12.5,0 5,5 Z"
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.00000003pt;stroke-opacity:1"
transform="matrix(-0.8,0,0,-0.8,-10,0)" />
</marker>
<marker
inkscape:stockid="Arrow1Lend"
orient="auto"
refY="0"
refX="0"
id="Arrow1Lend-6-2"
style="overflow:visible"
inkscape:isstock="true">
<path
inkscape:connector-curvature="0"
id="path991-0-9"
d="M 0,0 5,-5 -12.5,0 5,5 Z"
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.00000003pt;stroke-opacity:1"
transform="matrix(-0.8,0,0,-0.8,-10,0)" />
</marker>
<marker
inkscape:stockid="Arrow1Lend"
orient="auto"
refY="0"
refX="0"
id="Arrow1Lend-6-2-0"
style="overflow:visible"
inkscape:isstock="true">
<path
inkscape:connector-curvature="0"
id="path991-0-9-9"
d="M 0,0 5,-5 -12.5,0 5,5 Z"
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.00000003pt;stroke-opacity:1"
transform="matrix(-0.8,0,0,-0.8,-10,0)" />
</marker>
<marker
inkscape:stockid="Arrow1Lend"
orient="auto"
refY="0"
refX="0"
id="Arrow1Lend-6-2-5"
style="overflow:visible"
inkscape:isstock="true">
<path
inkscape:connector-curvature="0"
id="path991-0-9-4"
d="M 0,0 5,-5 -12.5,0 5,5 Z"
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.00000003pt;stroke-opacity:1"
transform="matrix(-0.8,0,0,-0.8,-10,0)" />
</marker>
<marker
inkscape:stockid="Arrow1Lend"
orient="auto"
refY="0"
refX="0"
id="Arrow1Lend-6-2-4"
style="overflow:visible"
inkscape:isstock="true">
<path
inkscape:connector-curvature="0"
id="path991-0-9-3"
d="M 0,0 5,-5 -12.5,0 5,5 Z"
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.00000003pt;stroke-opacity:1"
transform="matrix(-0.8,0,0,-0.8,-10,0)" />
</marker>
<marker
inkscape:stockid="Arrow1Lend"
orient="auto"
refY="0"
refX="0"
id="Arrow1Lend-6-2-0-9"
style="overflow:visible"
inkscape:isstock="true">
<path
inkscape:connector-curvature="0"
id="path991-0-9-9-1"
d="M 0,0 5,-5 -12.5,0 5,5 Z"
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.00000003pt;stroke-opacity:1"
transform="matrix(-0.8,0,0,-0.8,-10,0)" />
</marker>
<marker
inkscape:stockid="Arrow1Lend"
orient="auto"
refY="0"
refX="0"
id="Arrow1Lend-9"
style="overflow:visible"
inkscape:isstock="true">
<path
inkscape:connector-curvature="0"
id="path991-4"
d="M 0,0 5,-5 -12.5,0 5,5 Z"
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.00000003pt;stroke-opacity:1"
transform="matrix(-0.8,0,0,-0.8,-10,0)" />
</marker>
<marker
inkscape:stockid="Arrow1Lend"
orient="auto"
refY="0"
refX="0"
id="Arrow1Lend-9-6"
style="overflow:visible"
inkscape:isstock="true">
<path
inkscape:connector-curvature="0"
id="path991-4-2"
d="M 0,0 5,-5 -12.5,0 5,5 Z"
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.00000003pt;stroke-opacity:1"
transform="matrix(-0.8,0,0,-0.8,-10,0)" />
</marker>
<marker
inkscape:stockid="Arrow1Lend"
orient="auto"
refY="0"
refX="0"
id="Arrow1Lend-9-6-9"
style="overflow:visible"
inkscape:isstock="true">
<path
inkscape:connector-curvature="0"
id="path991-4-2-1"
d="M 0,0 5,-5 -12.5,0 5,5 Z"
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.00000003pt;stroke-opacity:1"
transform="matrix(-0.8,0,0,-0.8,-10,0)" />
</marker>
<marker
inkscape:stockid="Arrow1Lend"
orient="auto"
refY="0"
refX="0"
id="Arrow1Lend-9-7"
style="overflow:visible"
inkscape:isstock="true">
<path
inkscape:connector-curvature="0"
id="path991-4-7"
d="M 0,0 5,-5 -12.5,0 5,5 Z"
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.00000003pt;stroke-opacity:1"
transform="matrix(-0.8,0,0,-0.8,-10,0)" />
</marker>
<marker
inkscape:stockid="Arrow1Lend"
orient="auto"
refY="0"
refX="0"
id="Arrow1Lend-9-7-1"
style="overflow:visible"
inkscape:isstock="true">
<path
inkscape:connector-curvature="0"
id="path991-4-7-9"
d="M 0,0 5,-5 -12.5,0 5,5 Z"
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.00000003pt;stroke-opacity:1"
transform="matrix(-0.8,0,0,-0.8,-10,0)" />
</marker>
<marker
inkscape:stockid="Arrow1Lend"
orient="auto"
refY="0"
refX="0"
id="Arrow1Lend-9-7-1-3"
style="overflow:visible"
inkscape:isstock="true">
<path
inkscape:connector-curvature="0"
id="path991-4-7-9-8"
d="M 0,0 5,-5 -12.5,0 5,5 Z"
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.00000003pt;stroke-opacity:1"
transform="matrix(-0.8,0,0,-0.8,-10,0)" />
</marker>
<marker
inkscape:stockid="Arrow1Lend"
orient="auto"
refY="0"
refX="0"
id="Arrow1Lend-9-6-9-4"
style="overflow:visible"
inkscape:isstock="true">
<path
inkscape:connector-curvature="0"
id="path991-4-2-1-9"
d="M 0,0 5,-5 -12.5,0 5,5 Z"
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.00000003pt;stroke-opacity:1"
transform="matrix(-0.8,0,0,-0.8,-10,0)" />
</marker>
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="0.7"
inkscape:cx="305.44261"
inkscape:cy="594.04646"
inkscape:document-units="mm"
inkscape:current-layer="layer1"
showgrid="false"
inkscape:window-width="1920"
inkscape:window-height="1011"
inkscape:window-x="0"
inkscape:window-y="32"
inkscape:window-maximized="1" />
<metadata
id="metadata5">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1">
<g
style="stroke-width:1.43562889"
id="g911"
transform="matrix(0.69672537,0,0,0.69639235,43.060245,27.179579)">
<ellipse
ry="11.496272"
rx="24.379465"
cy="97.585548"
cx="92.793152"
id="path815"
style="fill:none;stroke:#000000;stroke-width:0.71781445;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<flowRoot
transform="matrix(0.18461171,0,0,0.18461171,38.065515,17.935472)"
style="font-style:normal;font-weight:normal;font-size:40px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:2.05752659"
id="flowRoot817"
xml:space="preserve"><flowRegion
style="stroke-width:2.05752659"
id="flowRegion819"><rect
style="stroke-width:2.05752659"
y="408.94824"
x="210.71428"
height="219.28572"
width="340.71429"
id="rect821" /></flowRegion><flowPara
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:'Arial Black';-inkscape-font-specification:'Arial Black, ';stroke-width:2.67305756"
id="flowPara823">ST_INIT</flowPara></flowRoot> </g>
<g
style="stroke-width:1.43562889"
id="g918"
transform="matrix(0.69672537,0,0,0.69639235,54.309168,82.301952)">
<ellipse
ry="11.496272"
rx="30.33259"
cy="157.90475"
cx="62.271572"
id="path815-9"
style="fill:none;stroke:#000000;stroke-width:0.71781445;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<flowRoot
transform="matrix(0.18461171,0,0,0.18461171,1.3854042,78.254686)"
style="font-style:normal;font-weight:normal;font-size:40px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:2.05752659"
id="flowRoot817-0"
xml:space="preserve"><flowRegion
style="stroke-width:2.05752659"
id="flowRegion819-0"><rect
style="stroke-width:2.05752659"
y="408.94824"
x="210.71428"
height="219.28572"
width="340.71429"
id="rect821-2" /></flowRegion><flowPara
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:'Arial Black';-inkscape-font-specification:'Arial Black, ';stroke-width:2.67305756"
id="flowPara823-2">ST_COUNT</flowPara></flowRoot> </g>
<g
style="stroke-width:1.43562889"
id="g925"
transform="matrix(0.69672537,0,0,0.69639235,50.056064,4.1485435)">
<ellipse
ry="11.496272"
rx="24.379465"
cy="197.843"
cx="132.29842"
id="path815-6"
style="fill:none;stroke:#000000;stroke-width:0.71781445;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<flowRoot
transform="matrix(0.18461171,0,0,0.18461171,74.790787,118.19293)"
style="font-style:normal;font-weight:normal;font-size:40px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:2.05752659"
id="flowRoot817-9"
xml:space="preserve"><flowRegion
style="stroke-width:2.05752659"
id="flowRegion819-03"><rect
style="stroke-width:2.05752659"
y="408.94824"
x="210.71428"
height="219.28572"
width="340.71429"
id="rect821-5" /></flowRegion><flowPara
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:'Arial Black';-inkscape-font-specification:'Arial Black, ';stroke-width:2.67305756"
id="flowPara823-5">ST_USER</flowPara></flowRoot> </g>
<g
style="stroke-width:1.43562889"
id="g932"
transform="matrix(0.69672537,0,0,0.69639235,-53.783037,38.526733)">
<ellipse
ry="11.496272"
rx="33.673458"
cy="147.0618"
cx="167.44435"
id="path815-9-8"
style="fill:none;stroke:#000000;stroke-width:0.71781445;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<flowRoot
transform="matrix(0.18461171,0,0,0.18461171,101.78244,67.411724)"
style="font-style:normal;font-weight:normal;font-size:40px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:2.05752659"
id="flowRoot817-0-7"
xml:space="preserve"><flowRegion
style="stroke-width:2.05752659"
id="flowRegion819-0-1"><rect
style="stroke-width:2.05752659"
y="408.94824"
x="210.71428"
height="219.28572"
width="340.71429"
id="rect821-2-7" /></flowRegion><flowPara
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:'Arial Black';-inkscape-font-specification:'Arial Black, ';stroke-width:2.67305756"
id="flowPara823-2-0">ST_AVERAGE</flowPara></flowRoot> </g>
<path
style="fill:none;stroke:#000000;stroke-width:0.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#Arrow1Lend)"
d="m 122.93134,66.023775 c -3.65925,1.681276 -3.39681,0.755032 -7.29274,4.00432 -6.63268,5.531786 -8.54054,17.112752 -8.54054,17.112752"
id="path986"
inkscape:connector-curvature="0"
sodipodi:nodetypes="csc" />
<path
style="fill:none;stroke:#000000;stroke-width:0.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#Arrow1Lend-9)"
d="m 91.594559,98.052048 c -3.65925,1.68128 -8.717171,3.761652 -16.914443,11.621502 -10.334873,9.90947 -12.282313,22.72541 -12.282313,22.72541"
id="path986-5"
inkscape:connector-curvature="0"
sodipodi:nodetypes="csc" />
<path
style="fill:none;stroke:#000000;stroke-width:0.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#Arrow1Lend-9-6)"
d="m 122.0064,99.60807 c 3.62159,1.6499 10.23233,5.15907 15.44446,11.6215 4.95933,6.14898 11.21324,22.72541 11.21324,22.72541"
id="path986-5-5"
inkscape:connector-curvature="0"
sodipodi:nodetypes="csc" />
<path
style="fill:none;stroke:#000000;stroke-width:0.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#Arrow1Lend-9-7)"
d="m 77.19729,189.78093 c -3.65925,-1.68128 -9.891429,-3.88611 -13.60715,-11.24353 -5.377559,-10.648 -4.423096,-29.22929 -4.423096,-29.22929"
id="path986-5-4"
inkscape:connector-curvature="0"
sodipodi:nodetypes="csc" />
<path
style="fill:none;stroke:#000000;stroke-width:0.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#Arrow1Lend-9-6-9)"
d="m 118.37195,189.72846 c 4.32742,-0.47857 8.96054,-1.33731 18.6517,-11.22059 9.08993,-9.27014 12.41595,-29.00625 12.41595,-29.00625"
id="path986-5-5-1"
inkscape:connector-curvature="0"
sodipodi:nodetypes="csc" />
<path
style="fill:none;stroke:#000000;stroke-width:0.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#Arrow1Lend-9-7-1)"
d="m 77.971786,147.26982 c 3.65925,1.68128 7.899204,6.35401 11.339294,12.84994 4.243174,8.01239 5.462526,24.03211 5.462526,24.03211"
id="path986-5-4-1"
inkscape:connector-curvature="0"
sodipodi:nodetypes="csc" />
<path
style="fill:none;stroke:#000000;stroke-width:0.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#Arrow1Lend-9-7-1-3)"
d="m 74.663683,133.51806 c 2.750358,-2.45653 16.924642,-8.98074 31.132187,-8.89636 11.57642,0.0688 28.4717,9.76743 28.4717,9.76743"
id="path986-5-4-1-7"
inkscape:connector-curvature="0"
sodipodi:nodetypes="csc" />
<path
style="fill:none;stroke:#000000;stroke-width:0.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#Arrow1Lend-9-6-9-4)"
d="m 130.12937,147.76437 c -4.06015,2.34945 -7.62996,7.43829 -11.30178,14.02692 -4.21244,7.55875 -7.33783,23.66086 -7.33783,23.66086"
id="path986-5-5-1-3"
inkscape:connector-curvature="0"
sodipodi:nodetypes="csc" />
<flowRoot
xml:space="preserve"
id="flowRoot24698"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:40px;line-height:1.25;font-family:Arial;-inkscape-font-specification:Arial;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:2.6914711"
transform="matrix(0.09830435,0,0,0.09830435,83.615792,43.243707)"><flowRegion
id="flowRegion24700"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Arial;-inkscape-font-specification:Arial;stroke-width:3.79738355"><rect
id="rect24702"
width="106.06602"
height="97.984795"
x="244.45691"
y="225.50423"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Arial;-inkscape-font-specification:Arial;stroke-width:2.6914711" /></flowRegion><flowPara
id="flowPara24704"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Arial;-inkscape-font-specification:Arial;stroke-width:3.79738355">start</flowPara></flowRoot> <flowRoot
xml:space="preserve"
id="flowRoot24698-5-2-8"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:40px;line-height:1.25;font-family:Arial;-inkscape-font-specification:Arial;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:2.6914711"
transform="matrix(0.09830435,0,0,0.09830435,108.63996,81.165381)"><flowRegion
id="flowRegion24700-3-8-6"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Arial;-inkscape-font-specification:Arial;stroke-width:3.79738355"><rect
id="rect24702-3-5-9"
width="207.95738"
height="110.4809"
x="244.45691"
y="225.50423"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Arial;-inkscape-font-specification:Arial;stroke-width:2.6914711" /></flowRegion><flowPara
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0;font-family:Arial;-inkscape-font-specification:Arial;text-align:center;letter-spacing:0px;text-anchor:middle;stroke-width:3.79738355"
id="flowPara24734-0-3">proximity</flowPara></flowRoot> <flowRoot
xml:space="preserve"
id="flowRoot24698-5-2-7"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:40px;line-height:1.25;font-family:Arial;-inkscape-font-specification:Arial;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:2.6914711"
transform="matrix(0.09830435,0,0,0.09830435,32.720964,77.378204)"><flowRegion
id="flowRegion24700-3-8-4"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Arial;-inkscape-font-specification:Arial;stroke-width:3.79738355"><rect
id="rect24702-3-5-3"
width="207.95738"
height="110.4809"
x="244.45691"
y="225.50423"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Arial;-inkscape-font-specification:Arial;stroke-width:2.6914711" /></flowRegion><flowPara
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0;font-family:Arial;-inkscape-font-specification:Arial;text-align:center;letter-spacing:0px;text-anchor:middle;stroke-width:3.79738355"
id="flowPara24734-0-7">done</flowPara></flowRoot> <flowRoot
xml:space="preserve"
id="flowRoot24698-5-2-8-1"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:40px;line-height:1.25;font-family:Arial;-inkscape-font-specification:Arial;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:2.6914711"
transform="matrix(0.09830435,0,0,0.09830435,33.785864,80.708472)"><flowRegion
id="flowRegion24700-3-8-6-3"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Arial;-inkscape-font-specification:Arial;stroke-width:3.79738355"><rect
id="rect24702-3-5-9-9"
width="207.95738"
height="110.4809"
x="244.45691"
y="225.50423"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Arial;-inkscape-font-specification:Arial;stroke-width:2.6914711" /></flowRegion><flowPara
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0;font-family:Arial;-inkscape-font-specification:Arial;text-align:center;letter-spacing:0px;text-anchor:middle;stroke-width:3.79738355"
id="flowPara24734-0-3-6">measuring</flowPara></flowRoot> <flowRoot
xml:space="preserve"
id="flowRoot24698-5-2-8-4"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:40px;line-height:1.25;font-family:Arial;-inkscape-font-specification:Arial;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:2.6914711"
transform="matrix(0.09830435,0,0,0.09830435,70.145367,97.280685)"><flowRegion
id="flowRegion24700-3-8-6-2"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Arial;-inkscape-font-specification:Arial;stroke-width:3.79738355"><rect
id="rect24702-3-5-9-0"
width="207.95738"
height="110.4809"
x="244.45691"
y="225.50423"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Arial;-inkscape-font-specification:Arial;stroke-width:2.6914711" /></flowRegion><flowPara
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0;font-family:Arial;-inkscape-font-specification:Arial;text-align:center;letter-spacing:0px;text-anchor:middle;stroke-width:3.79738355"
id="flowPara24734-0-3-2">proximity</flowPara></flowRoot> <flowRoot
xml:space="preserve"
id="flowRoot24698-5-2-8-9"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:40px;line-height:1.25;font-family:Arial;-inkscape-font-specification:Arial;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:2.6914711"
transform="matrix(0.09830435,0,0,0.09830435,111.36366,155.62052)"><flowRegion
id="flowRegion24700-3-8-6-5"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Arial;-inkscape-font-specification:Arial;stroke-width:3.79738355"><rect
id="rect24702-3-5-9-7"
width="207.95738"
height="110.4809"
x="244.45691"
y="225.50423"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Arial;-inkscape-font-specification:Arial;stroke-width:2.6914711" /></flowRegion><flowPara
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0;font-family:Arial;-inkscape-font-specification:Arial;text-align:center;letter-spacing:0px;text-anchor:middle;stroke-width:3.79738355"
id="flowPara24734-0-3-4">proximity</flowPara></flowRoot> <flowRoot
xml:space="preserve"
id="flowRoot24698-5-2-7-6"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:40px;line-height:1.25;font-family:Arial;-inkscape-font-specification:Arial;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:2.6914711"
transform="matrix(0.09830435,0,0,0.09830435,22.41547,157.56353)"><flowRegion
id="flowRegion24700-3-8-4-4"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Arial;-inkscape-font-specification:Arial;stroke-width:3.79738355"><rect
id="rect24702-3-5-3-9"
width="207.95738"
height="110.4809"
x="244.45691"
y="225.50423"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Arial;-inkscape-font-specification:Arial;stroke-width:2.6914711" /></flowRegion><flowPara
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0;font-family:Arial;-inkscape-font-specification:Arial;text-align:center;letter-spacing:0px;text-anchor:middle;stroke-width:3.79738355"
id="flowPara24734-0-7-1">done</flowPara></flowRoot> <flowRoot
xml:space="preserve"
id="flowRoot24698-5-2-8-1-2"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:40px;line-height:1.25;font-family:Arial;-inkscape-font-specification:Arial;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:2.6914711"
transform="matrix(0.09830435,0,0,0.09830435,23.480368,160.89379)"><flowRegion
id="flowRegion24700-3-8-6-3-3"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Arial;-inkscape-font-specification:Arial;stroke-width:3.79738355"><rect
id="rect24702-3-5-9-9-1"
width="207.95738"
height="110.4809"
x="244.45691"
y="225.50423"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Arial;-inkscape-font-specification:Arial;stroke-width:2.6914711" /></flowRegion><flowPara
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0;font-family:Arial;-inkscape-font-specification:Arial;text-align:center;letter-spacing:0px;text-anchor:middle;stroke-width:3.79738355"
id="flowPara24734-0-3-6-8">measuring</flowPara></flowRoot> <flowRoot
xml:space="preserve"
id="flowRoot24698-5-2-8-9-1"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:40px;line-height:1.25;font-family:Arial;-inkscape-font-specification:Arial;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:2.6914711"
transform="matrix(0.09830435,0,0,0.09830435,60.534626,134.15952)"><flowRegion
id="flowRegion24700-3-8-6-5-3"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Arial;-inkscape-font-specification:Arial;stroke-width:3.79738355"><rect
id="rect24702-3-5-9-7-8"
width="207.95738"
height="110.4809"
x="244.45691"
y="225.50423"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Arial;-inkscape-font-specification:Arial;stroke-width:2.6914711" /></flowRegion><flowPara
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0;font-family:Arial;-inkscape-font-specification:Arial;text-align:center;letter-spacing:0px;text-anchor:middle;stroke-width:3.79738355"
id="flowPara24734-0-3-4-9">10 sec</flowPara></flowRoot> <flowRoot
xml:space="preserve"
id="flowRoot24698-5-2-7-6-2"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:40px;line-height:1.25;font-family:Arial;-inkscape-font-specification:Arial;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:2.6914711"
transform="matrix(0.09830435,0,0,0.09830435,80.546592,133.6429)"><flowRegion
id="flowRegion24700-3-8-4-4-4"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Arial;-inkscape-font-specification:Arial;stroke-width:3.79738355"><rect
id="rect24702-3-5-3-9-5"
width="207.95738"
height="110.4809"
x="244.45691"
y="225.50423"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Arial;-inkscape-font-specification:Arial;stroke-width:2.6914711" /></flowRegion><flowPara
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0;font-family:Arial;-inkscape-font-specification:Arial;text-align:center;letter-spacing:0px;text-anchor:middle;stroke-width:3.79738355"
id="flowPara25034">lost</flowPara></flowRoot> <flowRoot
xml:space="preserve"
id="flowRoot24698-5-2-8-9-3"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:40px;line-height:1.25;font-family:Arial;-inkscape-font-specification:Arial;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:2.6914711"
transform="matrix(0.09830435,0,0,0.09830435,79.625403,129.56174)"><flowRegion
id="flowRegion24700-3-8-6-5-0"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Arial;-inkscape-font-specification:Arial;stroke-width:3.79738355"><rect
id="rect24702-3-5-9-7-0"
width="207.95738"
height="110.4809"
x="244.45691"
y="225.50423"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Arial;-inkscape-font-specification:Arial;stroke-width:2.6914711" /></flowRegion><flowPara
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0;font-family:Arial;-inkscape-font-specification:Arial;text-align:center;letter-spacing:0px;text-anchor:middle;stroke-width:3.79738355"
id="flowPara24734-0-3-4-0">proximity</flowPara></flowRoot> </g>
</svg>

Before

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

View File

@ -1,208 +0,0 @@
%
% Microprocessors and peripherals 3nd assignement.
%
% author:
% Χρήστος Χουτουρίδης ΑΕΜ 8997
% cchoutou@ece.auth.gr
% Document configuration
\newcommand{\ClassName}{Μικροεπεξεργαστές και Περιφερειακά}
\newcommand{\DocTitle}{3η Εργασία}
\newcommand{\InstructorName}{Παπαευσταθίου Ιωάννης}
\newcommand{\InstructorMail}{ygp@ece.auth.gr}
\newcommand{\CurrentDate}{\today}
\input{config/AuthReportConfig.tex}
%\renewcommand{\AuthorName}{Χρήστος Χουτουρίδης}
%\renewcommand{\AuthorMail}{cchoutou@ece.auth.gr}
%\renewcommand{\AuthorAEM}{8997}
\setFancyHeadLR{\ClassName}{\DocTitle}
%\setFancyHeadLERO{\ClassName}{\DocTitle}
% Document
% =================
\begin{document}
\FirstPage
%\TitleHeader
%\tableofcontents
%\listoffigures
%\listoftables
\section{Εισαγωγή}
Στην παρούσα εργασία το ζητούμενο ήταν η υλοποίηση ενός “έξυπνου θερμοστάτη” χρησιμοποιώντας αναπτυξιακό \eng{Nucleo-F401RE} της εταιρίας \eng{ST Microelectronics.}
Η τελική εφαρμογή θα πρέπει να έχει οθόνη, \eng{leds} αισθητήρα θερμοκρασίας και αισθητήρα εγγύτητας, υλικά που δεν είναι διαθέσιμα από το αναπτυξιακό.
Για το σκοπό αυτό αποφασίσαμε να προχωρήσουμε την εργασία λιγάκι παραπάνω και να κατασκευάσουμε ένα \eng{shield} για το \eng{Nucleo,} το οποίο ενσωματώνει σε ένα τυπωμένο κύκλωμα όλα τα απαραίτητα στοιχεία.
Τέλος, λόγο του ότι η διεπαφή χρήστη της εκφώνησης ήταν λιγάκι “φτωχή”, πήραμε την πρωτοβουλία και υλοποιήσαμε ένα μικρό \eng{serial interface} το οποίο μπορεί να χρησιμοποιηθεί και για να ρυθμίσει τον θερμοστάτη.
Η ανάπτυξη έγινε σε γλώσσα \eng{C} και χρησιμοποιήθηκε το εργαλείο \eng{Keil uVision.}
Ο κώδικας της εργασίας, της παρούσας αναφοράς, αλλά και τα σχέδια της κατασκευής υπάρχουν και στον προσωπικό \eng{server}του συντάκτη, στο \href{https://git.hoo2.net/hoo2/Micro2020/src/branch/master/assignment_3}{αποθετήριο} για την εργασία.
\section{Παραδοτέα}
Στο παραδοτέο \eng{.zip} αρχείο μπορείτε να βρείτε:
\begin{itemize}
\item Τον κατάλογο \textbf{\eng{/src}} που περιέχει τον κώδικα της εφαρμογής.
\item Τον κατάλογο \textbf{\eng{/Libraries}} που περιέχει τον κώδικα των βιβλιοθηκών που χρησιμοποιήσαμε, όπως το \eng{CMSIS} και το \eng{ST HAL,} αλλά και τους \eng{drivers} για τα περιφερειακά.
\item Το αρχείο \textbf{\eng{report.pdf}} που είναι η παρούσα αναφορά.
\item Τον κατάλογο \textbf{\eng{/Keil}} που περιέχει το \eng{project} που χρησιμοποιήθηκε στο \eng{Keil.}\\
Στο \eng{project} αυτό περιέχονται επιπλέων οι ρυθμίσεις καθώς και τα αρχεία από τις βιβλιοθήκες που χρησιμοποιήθηκαν.
\end{itemize}
\par
Για την παρούσα εργασία χρησιμοποιήσαμε το \eng{CMSIS} και το \eng{STM32F4xx\_HAL} που παρέχει η εταιρία \eng{ST} στο επίσημο αποθετήριό της.
Η επιλογή αυτού έναντι των αρχείων από το \eng{STM32F4xx Std\_Peripheral} που περιεχόταν στο \eng{e-learning} του μαθήματος έγινε για να συμβαδίσουμε με τις βιβλιοθήκες που προτείνει η κατασκευάστρια εταιρία.
Επίσης η χρήση τους έγινε στο ίδιο χαμηλό επίπεδο της \eng{STM32F4xx\_Std\_Peripheral} κάτι το οποίο προτείνεται και από τον διδάσκοντα.
\emph{\textbf{Εξάλλου μια υψηλότερου επιπέδου χρήση δεν θα είχε νόημα καθώς θα ξέφευγε από τον μαθησιακό χαρακτήρα της εργασίας}}.
\section{Υλοποίηση}
\subsection{Κατασκευή του\eng{shiled}}
\InsertFigure{0.8}{fig:shield_pcb}{shield_pcb.png}{
\eng{3D} απεικόνιση του \eng{PCB.}
}
Η υλοποίηση της εφαρμογής έγινε σε δύο φάσεις.
Η πρώτη ήταν η ανάπτυξη και κατασκευή του \eng{shiled.}
Αυτό το κομμάτι δεν ήταν στα απαιτούμενα και γιαυτό δεν θα ασχοληθούμε πολύ παρουσιάζοντάς το.
Θα πρέπει όμως να αναφέρουμε κάποια βασικά στοιχεία.
Έτσι εν συντομία η κατασκευή απαρτίζεται από:
\begin{itemize}
\item Μια \textbf{οθόνη} υγρών κρυστάλλων \eng{2 x 16,} σε \eng{4bit} παράλληλη επικοινωνία με τον επεξεργαστή.\\
Εκτός από την επικοινωνία ο επεξεργαστής ελέγχει και το \eng{back light} μέσω ενός μικρού \eng{MOSFET,} του \eng{MMBF170.}
Η οθόνη είναι σε μόνιμο \eng{write mode,} μιας και ο ακροδέκτης \eng{RW} είναι συνδεδεμένος μόνιμα στην γείωση.
\item Ένα \eng{\textbf{relay}} τύπου \eng{latching,} το\eng{\textbf{G2SU-2}} συνδεδεμένο μέσω Η-γέφυρας.\\
Η επιλογή \eng{latching relay} έγινε με γνώμονα την πιθανή κατανάλωση της κατασκευής σε περίπτωση μελλοντικής χρήσης της.
Σε μια τέτοια περίπτωση ενώ τα υπόλοιπα υλικά της κατασκευής λίγο πολύ θα μπορούσαν να περιορίσουν την κατανάλωση τους, το \eng{relay} θα έπρεπε να καταναλώνει συνέχεια ρεύμα για να παραμένει οπλισμένο.
\item Ένα αισθητήριο θερμοκρασίας τύπου\eng{\textbf{DS18B20}.}\\
Το αισθητήριο αυτό κάνει χρήση του πρωτοκόλλου επικοινωνίας \eng{1-wire} της \eng{Dallas semiconductors.}
Παρόλα αυτά στην κατασκευή είναι συνδεδεμένο στη σειριακή επικοινωνία του \eng{shield,} επιτρέποντας έτσι τη χρήση του \eng{\href{https://www.maximintegrated.com/en/design/technical-documents/tutorials/2/214.html}{application note 214}} της \eng{maxim,} όπου περιγράφεται ένας τρόπος δημιουργίας του χρονισμού του \eng{1-wire bus} χρησιμοποιώντας τη σειριακή θύρα.
Με τον τρόπο αυτό ο επεξεργαστής αποδεσμεύεται από τον φόρτο να δημιουργεί ακριβείς χρονοκαθυστερήσεις, πιθανότατα απενεργοποιώντας τα \eng{interrupts} και αφήνει ένα περιφερειακό του να εκτελέσει αυτή τη δουλειά.
\item Ένα αισθητήριο εγγύτητας \eng{\textbf{HC-SR04}} που λειτουργεί με υπερήχους.
\item Διάφορα “\textbf{μικρούτσικα}” υλικά, όπως τρανζιστορ-άκια, αντιστάσεις, πυκνωτές, \eng{leds} κ.α.
\end{itemize}
\subsection{Οδηγός του \eng{Nucleo} και του \eng{shiled}}
Η δεύτερη φάση της ανάπτυξης ήταν ο προγραμματισμός.
Ο επεξεργαστής που φέρει το εν λόγο αναπτυξιακό είναι πολύ μεγαλύτερος από τις ανάγκες της παρούσας εργασίας.
Έτσι τα υποσυστήματα που χρησιμοποιήσαμε ήταν ελάχιστα.
Για την ακρίβεια έγινε χρήση:
\begin{itemize}
\item Του \eng{\textbf{SysTick timer}} ώς βάση μέτρησης χρόνου.\\
Η συχνότητα που επιλέξαμε είναι το \eng{1Khz,} το οποίο μας οδηγεί σε επαρκές βήμα \eng{1msec}.
\item Του \eng{\textbf{GPIO}} για την ανάγνωση του κουμπιού και την οδήγηση του \eng{LED} της πλακέτας, αλλά και την οδήγηση όλων των ψηφιακών σημάτων του \eng{shield.}
\item Του \eng{\textbf{RCC}} για τον έλεγχο και των σημάτων ρολογιού εσωτερικά του επεξεργαστή στα διάφορα υποσυστήματα.
\item Του \eng{\textbf{Cycle count}} μηχανισμού στον \eng{debugger.}\\
Ο εν λόγο μηχανισμός χρησιμοποιήθηκε για την μέτρηση του χρόνου απόκρισης του αισθητηρίου εγγύτητας.
\end{itemize}
\par
Αξίζει ίσως σε αυτό το σημείο να αναφέρουμε πως για την μέτρηση χρόνου χρησιμοποιήσαμε μεταβλητές για απαρίθμηση των διακοπών του \eng{SysTick.}
Η εφαρμογή έτσι μπορούσε βλέποντας την τιμή τους να έχει εικόνα του χρόνου που έχει περάσει από το \eng{power up.}
\par
Για την οδήγηση των περιφερειακών του \eng{shield} χρησιμοποιήσαμε επιπλέον:
\begin{itemize}
\item Τη σειριακή \eng{\textbf{USART2}} για την επικοινωνία με το υπολογιστή.\\
Τη θύρα αυτή τη χρησιμοποιήσαμε για την δημιουργία ενός \eng{command interface,} μέσω του οποίου μπορούμε να δούμε την κατάσταση του θερμοστάτη, αλλά και να του αλλάξουμε τις ρυθμίσεις.
\item Τη σειριακή \eng{\textbf{USART6}} για το \eng{1-wire.}\\
Η χρήση αυτής της θύρας έγινε όπως αναφέρθηκε και παραπάνω σύμφωνα με τις οδηγίες της \eng{maxim-ic (Dallas semiconductors).}
\end{itemize}
\par
Εδώ θα πρέπει να αναφέρουμε πως στο \eng{nucleo} οι ακροδέκτες της σειριακής επικοινωνίας\eng{(D0-D1)} είναι συνδεμένοι στην σειριακή του \eng{”USB to serial”} του \eng{ST-LINK2.}
Για να συνδέαμε μέσω αυτών των ακροδεκτών τη σειριακή για το \eng{1-wire} του \eng{shield} στον επεξεργαστή, θα έπρεπε να τοποθετούσαμε τα \eng{jumpers SB62, SB63.}
Έτσι η κατασκευή μας θα πληρούσε τις προδιαγραφές της εκφώνησης, αλλά δεν θα είχε την έξτρα δυνατότητα του \eng{serial console.}
Ανταυτού λοιπόν “αφήσαμε” το \eng{nucleo} απείραχτο και συνδέσαμε τη σειριακή του \eng{shield} στη θύρα \eng{USART6,} μέσω των \eng{morpho headers.}
Αυτό μας αφήνει με το \eng{configuration} που περιγράψαμε παραπάνω, ενώ η κατασκευή μας είναι η ίδια είτε υλοποιήσουμε μόνο τις προδιαγραφές της εκφώνησης είτε υλοποιήσουμε και το έξτρα \eng{command interface.}
\subsection{Οδηγός περιφερειακών}
Στον κατάλογο \eng{Libraries/drivers/} εκτός από τους οδηγούς του \eng{nucleo} και του \eng{shield,} υπάρχουν οι οδηγοί των περιφερειακών πάνω στο \eng{shield,} αλλά και οι επιπλέων λειτουργίες που χρειαστήκαμε για την ορθή λειτουργία τους.
Οι οδηγοί είναι σε ζεύγη αρχείων κώδικα-κεφαλίδας(\eng{.c/.h}) και ο καθένας αποτελεί ένα \eng{module.}
Η αναλυτική παρουσίαση του κώδικα εδώ θα πλάτιαζε χωρίς να προσφέρει τίποτε χρήσιμο.
Θα αναφέρουμε όμως συνοπτικά το κάθε \eng{modul-}άκι και τον τρόπο λειτουργίας του γενικά.
\begin{itemize}
\item \textbf{\eng{jiffies:}}\\
Στο \eng{module} αυτό ρυθμίζουμε ένα \eng{timer} του επεξεργαστή ώστε να μετράει αδιάκοπα μέχρι μία τιμή με \eng{auto-reload.}
Κάνοντας χρήση αυτού του \eng{timer} μπορούμε στη συνέχεια να δημιουργήσουμε χρονοκαθυστερήσεις μικρότερες από το \eng{time base} της εφαρμογής.
\item \textbf{\eng{deque08:}}\\
Το \eng{module} αυτό υλοποιεί μια \eng{double-ended queue.}
Την ουρά αυτή τη χρησιμοποιούμε στη σειριακή επικοινωνία με τον υπολογιστή για το \eng{serial console.}
Η υλοποίηση είναι “όσο \eng{object oriented} γίνεται”.
Οι συναρτήσεις δηλαδή του \eng{module} έχουν όλες ένα δείκτη σ' ένα “αντικείμενο” τύπου ουράς που παίζει το ρόλο του \eng{this pointer} άλλων γλωσσών.
Έτσι μπορούμε να χρησιμοποιήσουμε περισσότερες από μία ουρές στο ίδιο \eng{project} με τον ίδιο κώδικα.
\item \textbf{\eng{onewire\_uart:}}\\
Το \eng{module} αυτό υλοποιεί το πρωτόκολλο επικοινωνίας \eng{1-wire} κάνοντας χρήση της σειριακής.
Ομοίως και εδώ η υλοποίηση είναι \eng{object oriented like.}
Εδώ όμως \textbf{κάνουμε ένα ακόμη κόλπο}.
Αρχικά το \eng{module} προϋποθέτει πως οι ακροδέκτες \eng{Tx-Rx} της θύρας είναι βραχυκυκλωμένοι.
Το βασικό “αντικείμενο” του \eng{module} εσωτερικά έχει δύο δείκτες σε συναρτήσεις.
Τη μία την καλεί για να γράψει στη σειριακή και ταυτόχρονα να διαβάσει τo αποτέλεσμα της πραγματικής κατάστασης του \eng{bus} κατά την προσπάθεια.
Την άλλη τη χρησιμοποιεί για να αλλάξει το \eng{baudrate} της θύρας.
Σε όλο το σώμα του κώδικα του \eng{module} γίνεται χρήση μόνο αυτών των δύο δεικτών και έτσι \textbf{\textit{δεν υπάρχει καμία εξάρτηση από το \eng{hardware.}}}
Ο χρήστης του \eng{module} μπορεί να το χρησιμοποιήσει σε οποιαδήποτε κατασκευή που πληροί τις προϋποθέσεις, να υλοποιήσει για το δικό του \eng{hardware} τις δύο παραπάνω συναρτήσεις και να τις συνδέσει με το \eng{module.}
Κάτι τέτοιο κάναμε και εμείς εδώ, όπου υλοποιήσαμε τις συναρτήσεις \eng{\textit{SHIELD\_1W\_RW()}} και \eng{\textit{SHIELD\_1W\_UART\_BR()}} και τις συνδέσαμε με το \eng{module.}
\item \textbf{\eng{alcd:}}\\
Το \eng{module} αυτό υλοποιεί ένα οδηγό για την οθόνη.
Ομοίως και εδώ η υλοποίηση είναι \eng{object oriented like,} αλλά και απεξαρτημένη από το \eng{hardware} μέσω δεικτών σε συναρτήσεις για τα \eng{pins DB[4..7], RS, EN, Back-light.}
Για τον χρονισμό των σημάτων εδώ κάνουμε χρήση των \eng{jiffies,} καθώς οι χρόνοι που χρειαζόμαστε είναι πολύ μικρότεροι από το \eng{time base.}
\item Τέλος το \eng{\textbf{hal:}}\\
Το \eng{module} αυτό είναι ο συνδετικός κρίκος της εφαρμογής με τους οδηγούς.
Σε αυτό το αρχείο επίσης είναι υλοποιημένες και οι λειτουργίες για την αναγνώριση της εγγύτητας και η ανάγνωση της θερμοκρασίας.
\textit{Αυτές \textbf{οι τελευταίες λειτουργίες είναι οι πιο “ριγμένες”} της εργασίας, καθώς ο συντάκτης από καθαρή τεμπελιά δεν αξιώθηκε να τις κάνει ξεχωριστά \eng{modules.}}
Εξάλλου φαίνεται και με μια ματιά πως οι λειτουργίες που είναι υλοποιημένες είναι οι άκρως απαραίτητες για την εφαρμογή μας.
\end{itemize}
\subsection{Εφαρμογή}
\WrapFigure{0.45}{r}{fig:uistates}{ui_states.png}{
Μηχανή καταστάσεων της διεπαφής χρήστη.
}
Έχοντας υλοποιήσει όλα τα παραπάνω η δουλειά μας για την εφαρμογή ήταν πολύ εύκολη.
Έτσι στην βασική λειτουργία της εκφώνησης προσθέσαμε ορισμένα πράγματα.
Για παράδειγμα η εφαρμογή έχει μια δομή \eng{\textbf{settings}} στην οποία υπάρχουν οι ρυθμίσεις του θερμοστάτη.
Πιο συγκεκριμένα αποθηκεύουμε τον τρόπο λειτουργίας, αν δηλαδή ο θερμοστάτης δουλεύει για \textbf{ψύξη ή θέρμανση}.
Την θερμοκρασία λειτουργίας και μια υστέρηση για αυτήν.
Την απόσταση κάτω από την οποία θεωρεί ο θερμοστάτης ότι έχει εγγύτητα και ομοίως μια απόσταση υστέρησης.
\par
Ο κώδικας της εφαρμογής μας χωρίζεται σε τέσσερεις \eng{non-blocking} συναρτήσεις που καλούνται σε βρόχο επανάληψης από την \eng{main.}
\\
1. \textbf{\eng{control():}}\\
Η συνάρτηση αυτή αναλαμβάνει να διαβάσει τα αισθητήρια εγγύτητας και θερμοκρασίας και να υπολογίσει τη μέση τιμή τις θερμοκρασίας στο τέλος του κάθε παράθυρου.
Η επικοινωνία με τις άλλες συναρτήσεις για την εγγύτητα και την ολοκλήρωση του κύκλου μετρήσεων γίνεται μέσω των σημαιών \eng{flag\_proximity}και\eng{signal\_cycle}αντίστοιχα.
Ακόμα με βάση τις ρυθμίσεις και την τρέχουσα μέση θερμοκρασία, ορίζει τη σημαία της κατάστασης εξόδου \eng{flag\_output.}
\\
2. \textbf{\eng{display():}}\\
Η συνάρτηση αυτή υλοποιεί μια μηχανή καταστάσεων και αναλαμβάνει να εμφανίζει τα μηνύματα της οθόνης.
Στο διάγραμμα \ref{fig:uistates} φαίνονται οι καταστάσεις και ο τρόπος με τον οποίο γίνεται η εναλλαγή.
Σε κάθε κατάσταση η συνάρτηση διαμορφώνει ανάλογα το κείμενο στην οθόνη ώστε να πληρούνται οι προδιαγραφές της εργασίας.
\\
3. \textbf{\eng{outputs():}}\\
Η συνάρτηση αυτή ενεργοποιεί ή απενεργοποιεί τις εξόδους της κατασκευής μας, δηλαδή τα δύο \eng{led} και το \eng{relay.}
Το πράσινο \eng{led} ενεργοποιείται όταν ο θερμοστάτης είναι ρυθμισμένος για ψύξη και η μέση θερμοκρασία είναι πάνω από τη ρύθμιση.
Το κόκκινο αντίστοιχα όταν ο θερμοστάτης είναι ρυθμισμένος για θέρμανση και η μέση θερμοκρασία είναι κάτω από τη ρύθμιση.
Το \eng{relay} ενεργοποιείται όταν θέλουμε ψύξη ή θέρμανση.
\\
4. \textbf{\eng{console():}}\\
Η συνάρτηση αυτή υλοποιεί ένα πολύ απλό \eng{command interface} μέσω του οποίου μπορούμε από την σειριακή του υπολογιστή να δούμε όλες τις θερμοκρασίες και ρυθμίσεις της συσκευής.
Ακόμα μπορούμε να αλλάξουμε όλες τις ρυθμίσεις.
\InsertFigure{0.8}{fig:console}{console.png}{
Στιγμιότυπο από την σειριακή επικοινωνία με τον θερμοστάτη.
}
\par
Στο σημείο αυτό θα πρέπει να αναφέρουμε πως η λειτουργία των \eng{led} είναι λιγάκι αλλαγμένη από την εκφώνηση.
Ο λόγος είναι ότι ο εν λόγο θερμοστάτης πλέον έχει λειτουργία και ψύξης και θέρμανσης και θέλαμε να δώσουμε στο \eng{user interface} ένα πιο “δεμένο” ύφος.
\section{Συμπεράσματα - Παρατηρήσεις}
Συνοψίζοντας την εμπειρία μας με την παρούσα εργασία δεν έχουμε να αναφέρουμε κάποιο ιδιαίτερο πρόβλημα ή δυσκολία.
Η κατασκευή του τυπωμένου ευτυχώς δεν δημιούργησε εκπλήξεις με αποτέλεσμα η συγγραφή του κώδικα να γίνει απρόσκοπτα, αν και ομολογούμε ότι την κάναμε τελευταία στιγμή.
Παρατηρώντας την υλοποίηση βέβαια δεν μπορούμε παρά να τονίσουμε και μια παράβλεψη.
Ο θερμοστάτης δεν έχει κάποιο τρόπο να αποθηκεύει τις ρυθμίσεις στη \eng{flash.}
Αυτή η λειτουργία θα μπορούσε να είναι αιτία για να ξανασχοληθούμε στο μέλλον με την εργασία και ελπίζουμε αυτή μας η παράβλεψη να πέσει στην κατηγορία \textit{“για το μάτι”}.
% References
% ============================
%\begin{thebibliography}{100}
%\bibitem{item}item...
%\end{thebibliography}
\end{document}

View File

@ -1,11 +1,10 @@
/*! /*
* \file console.c * console.c
* \brief
* A simple serial console implementation for out thermostat
* *
* Author: Christos Choutouridis AEM: 8997 * Created on: Jun 28, 2020
* email : <cchoutou@ece.auth.gr> * Author: hoo2
*/ */
#include "console.h" #include "console.h"
static char _buffer[COM_BUFFER_SIZE]; static char _buffer[COM_BUFFER_SIZE];
@ -13,10 +12,6 @@ static int _cursor;
static char _ans[512]; static char _ans[512];
/*!
* Parse and respond funcionality for serial console
* \param buffer Pointer to buffer
*/
void parse (char* buffer) { void parse (char* buffer) {
int i; int i;
float_t s; float_t s;
@ -107,9 +102,6 @@ void parse (char* buffer) {
COM_Transmit((uint8_t*)_ans, i); COM_Transmit((uint8_t*)_ans, i);
} }
/*!
* A simple terminal with echo
*/
void console (void) { void console (void) {
int ch; int ch;

View File

@ -1,11 +1,10 @@
/*! /*
* \file console.h * console.h
* \brief
* A simple serial console implementation for out thermostat
* *
* Author: Christos Choutouridis AEM: 8997 * Created on: Jun 28, 2020
* email : <cchoutou@ece.auth.gr> * Author: hoo2
*/ */
#ifndef CONSOLE_H_ #ifndef CONSOLE_H_
#define CONSOLE_H_ #define CONSOLE_H_

View File

@ -27,14 +27,6 @@ float_t temp_get_current (void) {
return (app_data.cur) ? app_data.T[app_data.cur-1] : app_data.T[MEASUREMENTS-1]; return (app_data.cur) ? app_data.T[app_data.cur-1] : app_data.T[MEASUREMENTS-1];
} }
/*!
* Control functionality
* Handles:
* * Sensor reading
* * Temp averaging
* * Output calculation
* \note Non-blocking
*/
void control (void) { void control (void) {
static time_t sample =0; static time_t sample =0;
time_t now = time(0); // get time time_t now = time(0); // get time
@ -89,11 +81,6 @@ void control (void) {
} }
} }
/*!
* Display functionality
* Implement a state machine for lcd display
* \note Non-blocking
*/
void display (void) { void display (void) {
static time_t mark =0; static time_t mark =0;
@ -164,10 +151,6 @@ void display (void) {
lcd_puts(line2); lcd_puts(line2);
} }
/*!
* Set outputs
* \note Non-blocking
*/
void outputs (void) { void outputs (void) {
static uint8_t pr_output =0; static uint8_t pr_output =0;
@ -183,9 +166,7 @@ void outputs (void) {
} }
/*
* Main loop
*/
int main(void) { int main(void) {
hal_hw_init (); hal_hw_init ();

View File

@ -1,67 +1,51 @@
/*! /*
* \file thermostat.h * thermostat.h
* \brief
* Application wide data type declarations
* *
* Author: Christos Choutouridis AEM: 8997 * Created on: Jun 27, 2020
* email : <cchoutou@ece.auth.gr> * Author: hoo2
*/ */
#ifndef THERMOSTAT_H_ #ifndef THERMOSTAT_H_
#define THERMOSTAT_H_ #define THERMOSTAT_H_
/*
* Hard coded user settings
*/
#define MEAS_WINDOW (120) // [sec] #define MEAS_WINDOW (120) // [sec]
#define MEAS_INTERVAL (5) // [sec] #define MEAS_INTERVAL (5) // [sec]
#define MEASUREMENTS (MEAS_WINDOW / MEAS_INTERVAL) // keep this integer #define MEASUREMENTS (MEAS_WINDOW / MEAS_INTERVAL) // keep this integer
#define UI_AVERAGE_TIME (10) // [sec] #define UI_AVERAGE_TIME (10) // [sec]
//#define UI_USER_TIME (10) //#define UI_USER_TIME (10)
typedef float float_t;
typedef int int_t;
typedef float float_t; //!< Select the floating point type for application
typedef int int_t; //!< Select the integer type for application
/*!
* Thermostat mode enumerator
*/
typedef enum { typedef enum {
HEATING =0, //!< HEATING HEATING =0,
COOLING //!< COOLING COOLING
} mode_en; } mode_en;
/*!
* Application common data type
*/
typedef struct { typedef struct {
float_t T[MEASUREMENTS]; //!< Temperature samples float_t T[MEASUREMENTS];
float_t Tav; //!< Average temperature float_t Tav;
uint32_t cur; //!< Cursor on sample array uint32_t cur;
uint8_t flag_output; //!< Momentary flag to indicate the relay state uint8_t flag_output;
uint8_t flag_init; //!< Momentary flag to indicate the end of initialization state uint8_t flag_init;
uint8_t flag_proximity; //!< Momentary flag to indicate that the user is near uint8_t flag_proximity;
uint8_t signal_cycle; //!< Acknolegable flag to indicate the end of measurement cycle uint8_t signal_cycle;
} app_data_t; } app_data_t;
/*!
* Settings struct
*/
typedef struct { typedef struct {
mode_en mode; //!< Operational mode mode_en mode;
float_t Tset; //!< Target temperature float_t Tset;
float_t Thyst; //!< Target temperature hysteresis float_t Thyst;
float_t Pset; //!< Proximity distance float_t Pset;
float_t Physt; //!< Proximity distance hysteresis float_t Physt;
} settings_t; } settings_t;
/*!
* User interface states
*/
typedef enum { typedef enum {
ST_INIT =0, //!< ST_INIT: Still initializing ST_INIT =0,
ST_COUNT, //!< ST_COUNT: Measurement cycle ST_COUNT,
ST_AVERAGE, //!< ST_AVERAGE: Display average ST_AVERAGE,
ST_USER //!< ST_USER: Display when a user is near ST_USER
} state_en; } state_en;
/* /*
@ -71,9 +55,6 @@ extern app_data_t app_data;
extern state_en state; extern state_en state;
extern settings_t settings; extern settings_t settings;
/*!
* Factory defaults
*/
#define _Init_settings(s) s = { \ #define _Init_settings(s) s = { \
.mode = HEATING, \ .mode = HEATING, \
.Tset = 21.0, \ .Tset = 21.0, \