Skip to content
Snippets Groups Projects
Commit 8a6cadae authored by schneider's avatar schneider
Browse files

fix(ecgtest): Minor cleanup

parent cb5dc5cc
Branches
No related tags found
No related merge requests found
/******************************************************************************* /*******************************************************************************
* Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved. * License: TBD
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES
* OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of Maxim Integrated
* Products, Inc. shall not be used except as stated in the Maxim Integrated
* Products, Inc. Branding Policy.
*
* The mere transfer of this software does not imply any licenses
* of trade secrets, proprietary technology, copyrights, patents,
* trademarks, maskwork rights, or any other form of intellectual
* property whatsoever. Maxim Integrated Products, Inc. retains all
* ownership rights.
*
* $Date: 2018-09-04 22:13:32 +0000 (Tue, 04 Sep 2018) $
* $Revision: 37649 $
*
******************************************************************************/ ******************************************************************************/
/**
* @file main.c
* @brief Hello World!
* @details This example uses the UART to print to a terminal and flashes an LED.
*/
/***** Includes *****/ /***** Includes *****/
#include <stdio.h> #include <stdio.h>
#include <stdint.h> #include <stdint.h>
...@@ -104,7 +66,7 @@ static void ecg_write_reg(uint8_t reg, uint32_t data) ...@@ -104,7 +66,7 @@ static void ecg_write_reg(uint8_t reg, uint32_t data)
SPI_MasterTrans(SPI0, &req); SPI_MasterTrans(SPI0, &req);
} }
void ecg_config(void) static void ecg_config(void)
{ {
// Reset ECG to clear registers // Reset ECG to clear registers
ecg_write_reg(SW_RST , 0); ecg_write_reg(SW_RST , 0);
...@@ -169,17 +131,17 @@ void ecg_config(void) ...@@ -169,17 +131,17 @@ void ecg_config(void)
#define SIZE_X 160 #define SIZE_X 160
#define SIZE_Y 80 #define SIZE_Y 80
uint16_t content[SIZE_X*SIZE_Y]; static uint16_t content[SIZE_X*SIZE_Y];
uint8_t prev; static uint8_t prev;
void clear(void) static void clear(void)
{ {
memset(content, 0x00, sizeof(content)); memset(content, 0x00, sizeof(content));
prev = 32; prev = 32;
} }
void set(uint8_t index, int8_t val) static void set(uint8_t index, int8_t val)
{ {
if(val < -31) val = -31; if(val < -31) val = -31;
...@@ -205,7 +167,7 @@ void set(uint8_t index, int8_t val) ...@@ -205,7 +167,7 @@ void set(uint8_t index, int8_t val)
prev = pos; prev = pos;
} }
int16_t samples[SIZE_X*2]; static int16_t samples[SIZE_X*2];
void update(void) void update(void)
{ {
...@@ -226,9 +188,9 @@ void update(void) ...@@ -226,9 +188,9 @@ void update(void)
LCD_Set((uint8_t*)content, sizeof(content)); LCD_Set((uint8_t*)content, sizeof(content));
} }
uint8_t sample_count = 0; static uint8_t sample_count = 0;
void add_sample(int16_t sample) static void add_sample(int16_t sample)
{ {
#if 1 #if 1
memmove(samples, samples + 1, sizeof(*samples) * (SIZE_X*2-1)); memmove(samples, samples + 1, sizeof(*samples) * (SIZE_X*2-1));
...@@ -249,8 +211,8 @@ void add_sample(int16_t sample) ...@@ -249,8 +211,8 @@ void add_sample(int16_t sample)
} }
} }
volatile bool ecgFIFOIntFlag = false; static volatile bool ecgFIFOIntFlag = false;
void ecgFIFO_callback(void *data) { static void ecgFIFO_callback(void *data) {
ecgFIFOIntFlag = true; ecgFIFOIntFlag = true;
} }
...@@ -288,8 +250,6 @@ int main(void) ...@@ -288,8 +250,6 @@ int main(void)
while(1) { while(1) {
#if 1
// Read back ECG samples from the FIFO // Read back ECG samples from the FIFO
if( ecgFIFOIntFlag ) { if( ecgFIFOIntFlag ) {
ecgFIFOIntFlag = false; ecgFIFOIntFlag = false;
...@@ -329,6 +289,5 @@ int main(void) ...@@ -329,6 +289,5 @@ int main(void)
} }
} }
#endif
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment