ADS_BP
Macros | Functions | Variables
main.c File Reference
#include <stdint.h>
#include <stdbool.h>
#include "inc/hw_memmap.h"
#include "inc/hw_types.h"
#include "inc/hw_gpio.h"
#include "inc/hw_ssi.h"
#include "inc/hw_ints.h"
#include "inc/hw_timer.h"
#include "driverlib/gpio.h"
#include "driverlib/pin_map.h"
#include "driverlib/sysctl.h"
#include "driverlib/uart.h"
#include "driverlib/ssi.h"
#include "driverlib/interrupt.h"
#include "driverlib/timer.h"
#include "ADS1299.h"
#include "process.h"
Include dependency graph for main.c:

Macros

#define IDLE   0
 
#define ACQUIRE_EMG   1
 

Functions

void DeviceInit (void)
 Function in charge of initializing the ALC-D system. More...
 
void COMM_IntHandler (void)
 UART reception ISR for decoding and executing commands given by external master devices. More...
 
void Timer0IntHandler (void)
 Timer ISR for ADS1299 samples acquisition. More...
 
void Timer2IntHandler (void)
 Timer ISR for LED blinking. More...
 
void Timer3IntHandler (void)
 Timer ISR for accessory operation. More...
 
int main (void)
 Main function. More...
 

Variables

unsigned char firmwareV [13] = {'1','.','5','-','1','1','/','1','0','/','1','6','~'}
 
unsigned char serialN [6] = {'A','D','S','B','P','~'}
 
uint32_t clockFreq = 0
 
volatile unsigned char alcdState = IDLE
 
volatile unsigned char timer
 
volatile uint32_t sF = 1000
 
volatile unsigned char nChannels
 
volatile unsigned char filterEnable
 
const float32_t lsbVolt
 
volatile unsigned char btStatus
 
volatile float32_t temperatureMCU
 
volatile float32_t batteryVoltage
 
volatile float32_t batteryTemperature
 
int32_t priorityCOMM = 100
 
int32_t priorityTMR0 = 100
 
int32_t priorityTMR3 = 100
 
int32_t priorityTMR2 = 100
 

Detailed Description

Main file and module of the ADS_BP project.

 ----------------— Function Description ---------------—
This module includes the main function, all ISRs as well
as the initialization of the device.
 ----------------------— Updates ----------------------—
 2016-06-17     /   Enzo Mastinu        / Creation ADS_BP project.

Function Documentation

§ COMM_IntHandler()

void COMM_IntHandler ( void  )

UART reception ISR for decoding and executing commands given by external master devices.

Parameters
[in]none
Returns
none.

§ DeviceInit()

void DeviceInit ( void  )

Function in charge of initializing the ALC-D system.

Parameters
[in]none
Returns
none.

The function initializes the following peripherals and devices:

  • System Clock at 80 Mhz
  • All needed GPIOs
  • LEDs output pins
  • Analog pin for battery voltage/temperature reading
  • UART for external communication
  • SPI for ADS1299
  • ADS1299
  • TIMERs

    Measured Execution Time @80MHz: 14/07/2016 -> 1.26 s

Here is the caller graph for this function:

§ main()

int main ( void  )

Main function.

ISR priorities
 | Timer3IntHandler            -> 000 = 0x00 –> Accessory timer
        | Timer0IntHandler         -> 001 = 0x20 –> Acquisition timer
     | COMM_IntHandler         -> 001 = 0x20 –> UART communication
            | Timer2IntHandler -> 011 = 0x40 –> LED blinking
    <-------------------— higher priority ----------------------—
Here is the call graph for this function:

§ Timer0IntHandler()

void Timer0IntHandler ( void  )

Timer ISR for ADS1299 samples acquisition.

Parameters
[in]none
Returns
none.

Measured Execution Time @80MHz: 13/07/2016 -> 357 us

§ Timer2IntHandler()

void Timer2IntHandler ( void  )

Timer ISR for LED blinking.

Parameters
[in]none
Returns
none.

In the common setup LEDs are driven in this way:

  • LED1 (usually green) blinks at 2 Hz in stand-by, communication and control mode
  • LED1 blinks at 10 Hz during EMG or features recording
  • LED2 (usually blue):
    • is off when Bluetooth module not found
    • blinks at 2 Hz when the Bluetooth module is present but not connected
    • is on when the Bluetooth module is connected

§ Timer3IntHandler()

void Timer3IntHandler ( void  )

Timer ISR for accessory operation.

Parameters
[in]none
Returns
none.

This has been used for UART and SPI timeout of reading.