-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.h
47 lines (39 loc) · 1.57 KB
/
main.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/* mbed Microcontroller Library
* Copyright (c) 2019 ARM Limited
* SPDX-License-Identifier: Apache-2.0
*/
#include "mbed.h"
#include <stdio.h>
#include <string>
#include <array>
#include <cstring>
#include <cmath>
#include "stm32l475e_iot01.h"
#include "stm32l475e_iot01_tsensor.h"
#include "stm32l475e_iot01_hsensor.h"
#include "stm32l475e_iot01_accelero.h"
#include "stm32l475e_iot01_gyro.h"
#define LAST_N_SAMPLES 10
template<typename T> std::array<T, LAST_N_SAMPLES> ppush(std::array<T, LAST_N_SAMPLES> arr, T new_item);
template<typename T> int mmax(std::array<T, LAST_N_SAMPLES> arr);
template<typename T> int mmin(std::array<T, LAST_N_SAMPLES> arr);
std::array<uint8_t, 2> AccelConfidence(
std::array<std::array<int16_t, LAST_N_SAMPLES>, 3> old_values,
int16_t* current,
std::array<int16_t, LAST_N_SAMPLES> samp_rate,
std::array<uint8_t, LAST_N_SAMPLES> mov_conf,
std::array<uint8_t, LAST_N_SAMPLES> mov_res);
std::array<uint8_t, 2> GyroConfidence(
std::array<std::array<float, LAST_N_SAMPLES>, 3> old_values,
float* current,
std::array<int16_t, LAST_N_SAMPLES> samp_rate,
std::array<uint8_t, LAST_N_SAMPLES> mov_conf,
std::array<uint8_t, LAST_N_SAMPLES> mov_res);
std::array<uint8_t, 2> MovementRecognition(
std::array<std::array<int16_t, LAST_N_SAMPLES>, 3> old_acc_values,
std::array<std::array<float, LAST_N_SAMPLES>, 3> old_gyro_values,
int16_t* current_acc,
float* current_gyro,
std::array<int16_t, LAST_N_SAMPLES> samp_rate,
std::array<uint8_t, LAST_N_SAMPLES> mov_conf,
std::array<uint8_t, LAST_N_SAMPLES> mov_res);