/*! * \file * assign2_impl.h * \brief * Assignment 2 application header * * Created on: May 23, 2020 * Author: Christos Choutouridis AEM: 8997 * email : */ #ifndef ASSIGN2_IMPL_H_ #define ASSIGN2_IMPL_H_ #include "NUCLEO_F401RE.h" #include #include /* * ============= User defines =============== */ #define SYSTICK_FREQ (1000) //!< 1000Hz => 1msec accuracy #define MODE_LEADING_EDGE (1) //!< Start counting as soon as the led is switched on #define MODE_TRAILING_EDGE (2) //!< Start counting as soon as the led is switched off (Motor sport style) //! If there is no Pre-define MODE, select one here #ifndef MODE #define MODE MODE_TRAILING_EDGE #endif #define MEASUREMENTS (5) //!< The number of measurements for each experiment //! elect the maximum waiting time before the visual trigger. #define MAX_WAIT_TIME sec2CPUtime(10) //! Select if we need cycle counting also. #define CYCLE_COUNTING (1) /* * ============= Data types =============== */ //! Select the application wide accuracy of the floating point type. typedef float fp_data_t; //!< floating point data alias. /*! * Statistical data structure */ typedef struct { fp_data_t average; //!< The average response time of the experiment fp_data_t median; //!< The median of the times fp_data_t std_dev; //!< Standard deviation } stats_t; fp_data_t average (const clock_t *t, size_t n); fp_data_t median (const clock_t *t, size_t n); fp_data_t std_deviation (const clock_t* t, size_t n); void leading (clock_t *out, size_t n); void trailing (clock_t *out, size_t n); #endif /* ASSIGN2_IMPL_H_ */