From 0dc66c91776f9e248380d858e706146f364ebe0f Mon Sep 17 00:00:00 2001 From: Aapo Torkkeli <aamato@utu.fi> Date: Thu, 17 Oct 2019 10:27:16 +0300 Subject: [PATCH] Basic untested version of ex6. --- ex_6/main.c | 75 ++++- ex_6/pca10040/blank/config/sdk_config.h | 4 +- ex_6/pca10040/blank/ses/ex6_Release.jlink | 39 +++ ex_6/pca10040/blank/ses/fdacoefs.h | 42 +++ .../blank/ses/template_pca10040.emProject | 9 +- ex_6/pca10040/blank/ses/tmwtypes.h | 265 ++++++++++++++++++ 6 files changed, 430 insertions(+), 4 deletions(-) create mode 100644 ex_6/pca10040/blank/ses/ex6_Release.jlink create mode 100644 ex_6/pca10040/blank/ses/fdacoefs.h create mode 100644 ex_6/pca10040/blank/ses/tmwtypes.h diff --git a/ex_6/main.c b/ex_6/main.c index adcd7b6..eb247ae 100644 --- a/ex_6/main.c +++ b/ex_6/main.c @@ -50,6 +50,8 @@ #include "bmi160.h" #include "nrf_delay.h" #include "nrf_drv_gpiote.h" +#include "fdacoefs.h" +#include "arm_math.h" #define SPI_INSTANCE 0 // SPI instance index. We use SPI master 0 #define SPI_SS_PIN 26 @@ -58,6 +60,26 @@ #define SPI_SCK_PIN 22 #define INT_PIN 27 +#define NUM_TAPS 58 +#define BLOCK_SIZE 28 + +// Declare a state array +static float32_t firStateF32[BLOCK_SIZE + NUM_TAPS - 1]; +// Declare an instance for the low-pass FIR filter +arm_fir_instance_f32 fir_lpf; + +float32_t acc_x_in_buf[140]; +float32_t acc_y_in_buf[140]; +float32_t acc_z_in_buf[140]; +float32_t acc_x_out_buf[140]; +float32_t acc_y_out_buf[140]; +float32_t acc_z_out_buf[140]; + +int in_array[16]; +int out_array[16]; + +int block_cnt = 0; + //SPI instance static const nrf_drv_spi_t spi = NRF_DRV_SPI_INSTANCE(SPI_INSTANCE); //Flag used to indicate that SPI instance completed the transfer @@ -74,6 +96,39 @@ struct bmi160_fifo_frame fifo_frame; // 200 bytes -> ~7bytes per frame -> ~28 data frames struct bmi160_sensor_data acc_data[28]; +/** +* Function for initializing the FIR filter instance +*/ +void dsp_config() { + // Note that the init function requires the address of the coefficient table B as an input + arm_fir_init_f32(&fir_lpf, NUM_TAPS, (float32_t *)&B[0], &firStateF32[0], BLOCK_SIZE); +} + +/** +* Function for computing the filter response +*/ +void compute_fir(){ + + // Each axis is processed on its own in 5 blocks of data + + // x-axis + for (uint8_t i = 0; i < 5; i++) { + arm_fir_f32(&fir_lpf, &acc_x_in_buf[0] + i * BLOCK_SIZE, &acc_x_out_buf[0] + i * BLOCK_SIZE, BLOCK_SIZE); + } + + // y-axis + for (uint8_t i = 0; i < 5; i++) { + arm_fir_f32(&fir_lpf, &acc_y_in_buf[0] + i * BLOCK_SIZE, &acc_y_out_buf[0] + i * BLOCK_SIZE, BLOCK_SIZE); + } + + // z-axis + for (uint8_t i = 0; i < 5; i++) { + arm_fir_f32(&fir_lpf, &acc_z_in_buf[0] + i * BLOCK_SIZE, &acc_z_out_buf[0] + i * BLOCK_SIZE, BLOCK_SIZE); + } + + block_cnt = 0; // Reset block counting +} + /** * Function for reading FIFO data */ @@ -85,6 +140,22 @@ int8_t get_bmi160_fifo_data() rslt = bmi160_get_fifo_data(&sensor); // Parse the data and extract 28 accelerometer frames rslt = bmi160_extract_accel(acc_data, &acc_frames_req, &sensor); + + // Copy the contents of each axis to a FIR input buffer + for (uint8_t i = 0; i < acc_frames_req; i++) { + acc_x_in_buf[acc_frames_req*block_cnt + i] = acc_data[i].x; + acc_y_in_buf[acc_frames_req*block_cnt + i] = acc_data[i].y; + acc_z_in_buf[acc_frames_req*block_cnt + i] = acc_data[i].z; + } + + // Increase block count after each sensor read + block_cnt++; + + // After 5 reads the buffer is almost full and the data is ready to be processed + if (block_cnt == 5) { + compute_fir(); + } + return rslt; } @@ -193,7 +264,7 @@ int8_t sensor_config() { rslt = bmi160_init(&sensor); // Configure the accelerometer's sampling freq, range and modes - sensor.accel_cfg.odr = BMI160_ACCEL_ODR_25HZ; + sensor.accel_cfg.odr = BMI160_ACCEL_ODR_100HZ; sensor.accel_cfg.range = BMI160_ACCEL_RANGE_8G; sensor.accel_cfg.bw = BMI160_ACCEL_BW_NORMAL_AVG4; sensor.accel_cfg.power = BMI160_ACCEL_NORMAL_MODE; @@ -263,6 +334,8 @@ uint32_t config_gpio() { int main(void) { + dsp_config(); + uint32_t err_code = spi_config(); if (err_code != NRF_SUCCESS) { diff --git a/ex_6/pca10040/blank/config/sdk_config.h b/ex_6/pca10040/blank/config/sdk_config.h index 080eca9..c227e28 100644 --- a/ex_6/pca10040/blank/config/sdk_config.h +++ b/ex_6/pca10040/blank/config/sdk_config.h @@ -943,7 +943,7 @@ // <7=> 7 #ifndef GPIOTE_CONFIG_IRQ_PRIORITY -#define GPIOTE_CONFIG_IRQ_PRIORITY 6 +#define GPIOTE_CONFIG_IRQ_PRIORITY 7 #endif // </e> @@ -4762,7 +4762,7 @@ // <7=> 7 #ifndef SPI_DEFAULT_CONFIG_IRQ_PRIORITY -#define SPI_DEFAULT_CONFIG_IRQ_PRIORITY 6 +#define SPI_DEFAULT_CONFIG_IRQ_PRIORITY 5 #endif // <o> NRF_SPI_DRV_MISO_PULLUP_CFG - MISO PIN pull-up configuration. diff --git a/ex_6/pca10040/blank/ses/ex6_Release.jlink b/ex_6/pca10040/blank/ses/ex6_Release.jlink new file mode 100644 index 0000000..292d9a0 --- /dev/null +++ b/ex_6/pca10040/blank/ses/ex6_Release.jlink @@ -0,0 +1,39 @@ +[BREAKPOINTS] +ForceImpTypeAny = 0 +ShowInfoWin = 1 +EnableFlashBP = 2 +BPDuringExecution = 0 +[CFI] +CFISize = 0x00 +CFIAddr = 0x00 +[CPU] +MonModeVTableAddr = 0xFFFFFFFF +MonModeDebug = 0 +MaxNumAPs = 0 +LowPowerHandlingMode = 0 +OverrideMemMap = 0 +AllowSimulation = 1 +ScriptFile="" +[FLASH] +CacheExcludeSize = 0x00 +CacheExcludeAddr = 0x00 +MinNumBytesFlashDL = 0 +SkipProgOnCRCMatch = 1 +VerifyDownload = 1 +AllowCaching = 1 +EnableFlashDL = 2 +Override = 0 +Device="ARM7" +[GENERAL] +WorkRAMSize = 0x00 +WorkRAMAddr = 0x00 +RAMUsageLimit = 0x00 +[SWO] +SWOLogFile="" +[MEM] +RdOverrideOrMask = 0x00 +RdOverrideAndMask = 0xFFFFFFFF +RdOverrideAddr = 0xFFFFFFFF +WrOverrideOrMask = 0x00 +WrOverrideAndMask = 0xFFFFFFFF +WrOverrideAddr = 0xFFFFFFFF diff --git a/ex_6/pca10040/blank/ses/fdacoefs.h b/ex_6/pca10040/blank/ses/fdacoefs.h new file mode 100644 index 0000000..ad92268 --- /dev/null +++ b/ex_6/pca10040/blank/ses/fdacoefs.h @@ -0,0 +1,42 @@ +/* + * Filter Coefficients (C Source) generated by the Filter Design and Analysis Tool + * Generated by MATLAB(R) 8.6 and the Signal Processing Toolbox 7.1. + * Generated on: 11-Oct-2017 16:49:27 + */ + +/* + * Discrete-Time FIR Filter (real) + * ------------------------------- + * Filter Structure : Direct-Form FIR + * Filter Length : 58 + * Stable : Yes + * Linear Phase : Yes (Type 2) + */ + +/* General type conversion for MATLAB generated C-code */ +#include "tmwtypes.h" +/* + * Expected path to tmwtypes.h + * C:\Program Files\MATLAB\R2015b\extern\include\tmwtypes.h + */ +/* + * Warning - Filter coefficients were truncated to fit specified data type. + * The resulting response may not match generated theoretical response. + * Use the Filter Design & Analysis Tool to design accurate + * single-precision filter coefficients. + */ +const int BL = 58; +const real32_T B[58] = { + -0.006835767534,-0.0001287975028, 0.001011819462, 0.002859717235, 0.005234236829, + 0.007840729319, 0.01028612256, 0.01211740635, 0.01288195327, 0.0122014191, + 0.009848706424, 0.005815302487,0.0003548534878,-0.006007892545, -0.01250642445, + -0.01819767803, -0.02205833979, -0.02310673892, -0.0205419641, -0.01388948597, + -0.003023079131, 0.01167452801, 0.02940613776, 0.04895731807, 0.06882610172, + 0.08737079054, 0.1029818207, 0.1142592356, 0.1201712489, 0.1201712489, + 0.1142592356, 0.1029818207, 0.08737079054, 0.06882610172, 0.04895731807, + 0.02940613776, 0.01167452801,-0.003023079131, -0.01388948597, -0.0205419641, + -0.02310673892, -0.02205833979, -0.01819767803, -0.01250642445,-0.006007892545, + 0.0003548534878, 0.005815302487, 0.009848706424, 0.0122014191, 0.01288195327, + 0.01211740635, 0.01028612256, 0.007840729319, 0.005234236829, 0.002859717235, + 0.001011819462,-0.0001287975028,-0.006835767534 +}; \ No newline at end of file diff --git a/ex_6/pca10040/blank/ses/template_pca10040.emProject b/ex_6/pca10040/blank/ses/template_pca10040.emProject index 42c49c1..03f401a 100644 --- a/ex_6/pca10040/blank/ses/template_pca10040.emProject +++ b/ex_6/pca10040/blank/ses/template_pca10040.emProject @@ -16,7 +16,7 @@ arm_target_device_name="nRF52832_xxAA" arm_target_interface_type="SWD" c_preprocessor_definitions="BOARD_PCA10040;CONFIG_GPIO_AS_PINRESET;FLOAT_ABI_HARD;INITIALIZE_USER_SECTIONS;MBEDTLS_CONFIG_FILE="nrf_crypto_mbedtls_config.h";NO_VTOR_CONFIG;NRF52;NRF52832_XXAA;NRF52_PAN_74;NRF_CRYPTO_MAX_INSTANCE_COUNT=1;SWI_DISABLE0;uECC_ENABLE_VLI_API=0;uECC_OPTIMIZATION_LEVEL=3;uECC_SQUARE_FUNC=0;uECC_SUPPORT_COMPRESSED_POINT=0;uECC_VLI_NATIVE_LITTLE_ENDIAN=1;" - c_user_include_directories="../../../config;../../../../../nRF5_SDK_15.3.0_59ac345/components;../../../../../nRF5_SDK_15.3.0_59ac345/components/boards;../../../../../nRF5_SDK_15.3.0_59ac345/components/drivers_nrf/nrf_soc_nosd;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/atomic;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/atomic_fifo;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/balloc;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/bsp;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/button;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/cli;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/cli/uart;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/crc16;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/crc32;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/crypto;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/crypto/backend/cc310;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/crypto/backend/cc310_bl;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/crypto/backend/cifra;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/crypto/backend/mbedtls;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/crypto/backend/micro_ecc;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/crypto/backend/nrf_hw;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/crypto/backend/nrf_sw;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/crypto/backend/oberon;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/crypto/backend/optiga;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/csense;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/csense_drv;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/delay;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/ecc;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/experimental_section_vars;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/experimental_task_manager;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/fds;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/fifo;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/fstorage;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/gfx;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/gpiote;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/hardfault;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/hardfault/nrf52;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/hci;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/led_softblink;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/log;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/log/src;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/low_power_pwm;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/mem_manager;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/memobj;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/mpu;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/mutex;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/pwm;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/pwr_mgmt;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/queue;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/ringbuf;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/scheduler;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/sdcard;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/slip;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/sortlist;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/spi_mngr;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/stack_guard;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/stack_info;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/strerror;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/timer;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/twi_mngr;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/twi_sensor;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/uart;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/util;../../../../../nRF5_SDK_15.3.0_59ac345/components/toolchain/cmsis/include;../../..;../../../../../nRF5_SDK_15.3.0_59ac345/external/cifra_AES128-EAX;../../../../../nRF5_SDK_15.3.0_59ac345/external/fnmatch;../../../../../nRF5_SDK_15.3.0_59ac345/external/fprintf;../../../../../nRF5_SDK_15.3.0_59ac345/external/mbedtls/include;../../../../../nRF5_SDK_15.3.0_59ac345/external/micro-ecc/micro-ecc;../../../../../nRF5_SDK_15.3.0_59ac345/external/nrf_cc310/include;../../../../../nRF5_SDK_15.3.0_59ac345/external/nrf_oberon;../../../../../nRF5_SDK_15.3.0_59ac345/external/nrf_oberon/include;../../../../../nRF5_SDK_15.3.0_59ac345/external/nrf_tls/mbedtls/nrf_crypto/config;../../../../../nRF5_SDK_15.3.0_59ac345/external/protothreads;../../../../../nRF5_SDK_15.3.0_59ac345/external/protothreads/pt-1.4;../../../../../nRF5_SDK_15.3.0_59ac345/external/thedotfactory_fonts;../../../../../nRF5_SDK_15.3.0_59ac345/integration/nrfx;../../../../../nRF5_SDK_15.3.0_59ac345/integration/nrfx/legacy;../../../../../nRF5_SDK_15.3.0_59ac345/modules/nrfx;../../../../../nRF5_SDK_15.3.0_59ac345/modules/nrfx/drivers/include;../../../../../nRF5_SDK_15.3.0_59ac345/modules/nrfx/hal;../../../../../nRF5_SDK_15.3.0_59ac345/modules/nrfx/mdk;../config;/home/aapo/EmbeddedStudio/nRF5_SDK_15.3.0_59ac345/integration/nrfx/legacy;/home/aapo/Documents/nRF5_SDK_15.3.0_59ac345/components/drivers_ext/BMI160_driver-master" + c_user_include_directories="../../../config;../../../../../nRF5_SDK_15.3.0_59ac345/components;../../../../../nRF5_SDK_15.3.0_59ac345/components/boards;../../../../../nRF5_SDK_15.3.0_59ac345/components/drivers_nrf/nrf_soc_nosd;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/atomic;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/atomic_fifo;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/balloc;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/bsp;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/button;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/cli;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/cli/uart;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/crc16;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/crc32;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/crypto;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/crypto/backend/cc310;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/crypto/backend/cc310_bl;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/crypto/backend/cifra;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/crypto/backend/mbedtls;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/crypto/backend/micro_ecc;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/crypto/backend/nrf_hw;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/crypto/backend/nrf_sw;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/crypto/backend/oberon;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/crypto/backend/optiga;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/csense;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/csense_drv;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/delay;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/ecc;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/experimental_section_vars;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/experimental_task_manager;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/fds;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/fifo;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/fstorage;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/gfx;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/gpiote;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/hardfault;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/hardfault/nrf52;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/hci;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/led_softblink;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/log;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/log/src;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/low_power_pwm;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/mem_manager;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/memobj;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/mpu;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/mutex;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/pwm;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/pwr_mgmt;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/queue;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/ringbuf;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/scheduler;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/sdcard;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/slip;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/sortlist;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/spi_mngr;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/stack_guard;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/stack_info;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/strerror;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/timer;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/twi_mngr;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/twi_sensor;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/uart;../../../../../nRF5_SDK_15.3.0_59ac345/components/libraries/util;../../../../../nRF5_SDK_15.3.0_59ac345/components/toolchain/cmsis/include;../../..;../../../../../nRF5_SDK_15.3.0_59ac345/external/cifra_AES128-EAX;../../../../../nRF5_SDK_15.3.0_59ac345/external/fnmatch;../../../../../nRF5_SDK_15.3.0_59ac345/external/fprintf;../../../../../nRF5_SDK_15.3.0_59ac345/external/mbedtls/include;../../../../../nRF5_SDK_15.3.0_59ac345/external/micro-ecc/micro-ecc;../../../../../nRF5_SDK_15.3.0_59ac345/external/nrf_cc310/include;../../../../../nRF5_SDK_15.3.0_59ac345/external/nrf_oberon;../../../../../nRF5_SDK_15.3.0_59ac345/external/nrf_oberon/include;../../../../../nRF5_SDK_15.3.0_59ac345/external/nrf_tls/mbedtls/nrf_crypto/config;../../../../../nRF5_SDK_15.3.0_59ac345/external/protothreads;../../../../../nRF5_SDK_15.3.0_59ac345/external/protothreads/pt-1.4;../../../../../nRF5_SDK_15.3.0_59ac345/external/thedotfactory_fonts;../../../../../nRF5_SDK_15.3.0_59ac345/integration/nrfx;../../../../../nRF5_SDK_15.3.0_59ac345/integration/nrfx/legacy;../../../../../nRF5_SDK_15.3.0_59ac345/modules/nrfx;../../../../../nRF5_SDK_15.3.0_59ac345/modules/nrfx/drivers/include;../../../../../nRF5_SDK_15.3.0_59ac345/modules/nrfx/hal;../../../../../nRF5_SDK_15.3.0_59ac345/modules/nrfx/mdk;../config;/home/aapo/EmbeddedStudio/nRF5_SDK_15.3.0_59ac345/integration/nrfx/legacy;/home/aapo/Documents/nRF5_SDK_15.3.0_59ac345/components/drivers_ext/BMI160_driver-master;/home/aapo/Documents/embeddediotprogramming/ex_6/pca10040/blank/ses/" debug_register_definition_file="../../../../../nRF5_SDK_15.3.0_59ac345/modules/nrfx/mdk/nrf52.svd" debug_start_from_entry_point_symbol="No" debug_target_connection="J-Link" @@ -293,6 +293,13 @@ <folder Name="bmi160"> <file file_name="../../../../../nRF5_SDK_15.3.0_59ac345/components/drivers_ext/BMI160_driver-master/bmi160.c" /> </folder> + <folder Name="DSP"> + <file file_name="fdacoefs.h" /> + <file file_name="tmwtypes.h" /> + </folder> + <configuration + CMSIS_DSP="Cortex-M4 Little Endian With FPU" + Name="Release" /> </project> <configuration Name="Release" diff --git a/ex_6/pca10040/blank/ses/tmwtypes.h b/ex_6/pca10040/blank/ses/tmwtypes.h new file mode 100644 index 0000000..64aea2f --- /dev/null +++ b/ex_6/pca10040/blank/ses/tmwtypes.h @@ -0,0 +1,265 @@ +#ifndef __TMWTYPES__ +#define __TMWTYPES__ + +/* Copyright (C) 1994,1995, The MathWorks, Inc. + * All Rights Reserved. + * + * File : tmwtypes.h + * Abstract: + * Data types for use with MATLAB/SIMULINK and the Real-Time Workshop. + * + * When compiling stand-alone model code, data types can be overridden + * via compiler switches. + * + */ + +/* $Revision: 1.9 $ */ + +#include <limits.h> + +#ifndef __MWERKS__ +# ifdef __STDC__ +# include <float.h> +# else +# define FLT_MANT_DIG 24 +# define DBL_MANT_DIG 53 +# endif +#endif + + +/* + * The following data types cannot be overridden when building MEX files. + */ +#ifdef MATLAB_MEX_FILE +# undef CHAR_T +# undef INT_T +# undef BOOLEAN_T +# undef REAL_T +# undef TIME_T +#endif + + +/* + * The uchar_T, ushort_T and ulong_T types are needed for compilers which do + * not allow defines to be specified, at the command line, with spaces in them. + */ + +typedef unsigned char uchar_T; +typedef unsigned short ushort_T; +typedef unsigned long ulong_T; + + + +/*=======================================================================* + * Fixed width word size data types: * + * int8_T, int16_T, int32_T - signed 8, 16, or 32 bit integers * + * uint8_T, uint16_T, uint32_T - unsigned 8, 16, or 32 bit integers * + * real32_T, real64_T - 32 and 64 bit floating point numbers * + *=======================================================================*/ + +#ifndef INT8_T +# if CHAR_MIN == -128 +# define INT8_T char +# elif SCHAR_MIN == -128 +# define INT8_T signed char +# endif +#endif +#ifdef INT8_T + typedef INT8_T int8_T; +# ifndef UINT8_T +# define UINT8_T unsigned char +# endif + typedef UINT8_T uint8_T; +#endif + + +#ifndef INT16_T +# if SHRT_MAX == 0x7FFF +# define INT16_T short +# elif INT_MAX == 0x7FFF +# define INT16_T int +# endif +#endif +#ifdef INT16_T + typedef INT16_T int16_T; +#endif + + +#ifndef UINT16_T +# if SHRT_MAX == 0x7FFF /* can't compare with USHRT_MAX on some platforms */ +# define UINT16_T unsigned short +# elif INT_MAX == 0x7FFF +# define UINT16_T unsigned int +# endif +#endif +#ifdef UINT16_T + typedef UINT16_T uint16_T; +#endif + + +#ifndef INT32_T +# if INT_MAX == 0x7FFFFFFF +# define INT32_T int +# elif LONG_MAX == 0x7FFFFFFF +# define INT32_T long +# endif +#endif +#ifdef INT32_T + typedef INT32_T int32_T; +#endif + + +#ifndef UINT32_T +# if INT_MAX == 0x7FFFFFFF +# define UINT32_T unsigned int +# elif LONG_MAX == 0x7FFFFFFF +# define UINT32_T unsigned long +# endif +#endif +#ifdef UINT32_T + typedef UINT32_T uint32_T; +#endif + + +#ifndef REAL32_T +# ifndef __MWERKS__ +# if FLT_MANT_DIG >= 23 +# define REAL32_T float +# endif +# else +# define REAL32_T float +# endif +#endif +#ifdef REAL32_T +typedef REAL32_T real32_T; +#endif + +#ifndef REAL64_T +# ifndef __MWERKS__ +# if DBL_MANT_DIG >= 52 +# define REAL64_T double +# endif +# else +# define REAL64_T double +# endif +#endif +#ifdef REAL64_T + typedef REAL64_T real64_T; +#endif + +/*=======================================================================* + * Fixed width word size data types: (alpha & sgi64) * + * int64_T - signed 64 bit integers * + * uint64_T - unsigned 64 bit integers * + *=======================================================================*/ + +#if defined(__alpha) || (defined(_MIPS_SZLONG) && (_MIPS_SZLONG == 64)) +#ifndef INT64_T +# define INT64_T long +#endif +#ifdef INT64_T + typedef INT64_T int64_T; +#endif + +#ifndef UINT64_T +# define UINT64_T unsigned long +#endif +#ifdef UINT64_T + typedef UINT64_T uint64_T; +#endif +#endif + +/*================================================================* + * Fixed-point data types: * + * fixpoint_T - 16 or 32-bit unsigned integers * + * sgn_fixpoint_T - 16 or 32-bit signed integers * + * Note, when building fixed-point applications, real_T is equal * + * to fixpoint_T and time_T is a 32-bit unsigned integer. * + *================================================================*/ + +#ifndef FIXPTWS +# define FIXPTWS 32 +#endif +#if FIXPTWS != 16 && FIXPTWS != 32 + "--> fixed-point word size (FIXPTWS) must be 16 or 32 bits" +#endif + +#if FIXPTWS == 16 + typedef uint16_T fixpoint_T; + typedef int16_T sgn_fixpoint_T; +#else + typedef uint32_T fixpoint_T; + typedef int32_T sgn_fixpoint_T; +#endif + +#ifdef FIXPT +# define REAL_T fixpoint_T +# define TIME_T uint32_T +#endif + + + +/*===========================================================================* + * General or logical data types where the word size is not guaranteed. * + * real_T - possible settings include real32_T, real64_T, or fixpoint_T * + * time_T - possible settings include real64_T or uint32_T * + * boolean_T * + * char_T * + * int_T * + * uint_T * + * byte_T * + *===========================================================================*/ + +#ifndef REAL_T +# ifdef REAL64_T +# define REAL_T real64_T +# else +# ifdef REAL32_T +# define REAL_T real32_T +# endif +# endif +#endif +#ifdef REAL_T + typedef REAL_T real_T; +#endif + +#ifndef TIME_T +# ifdef REAL_T +# define TIME_T real_T +# endif +#endif +#ifdef TIME_T + typedef TIME_T time_T; +#endif + +#ifndef BOOLEAN_T +#define BOOLEAN_T int +#endif +typedef BOOLEAN_T boolean_T; + + +#ifndef CHAR_T +#define CHAR_T char +#endif +typedef CHAR_T char_T; + + +#ifndef INT_T +#define INT_T int +#endif +typedef INT_T int_T; + + +#ifndef UINT_T +#define UINT_T unsigned +#endif +typedef UINT_T uint_T; + + +#ifndef BYTE_T +#define BYTE_T unsigned char +#endif +typedef BYTE_T byte_T; + + +#endif /* __TMWTYPES__ */ \ No newline at end of file -- GitLab