391
#define TOTAL_NUMBER_OF_ELEMENTS 1
// If the RAM_FOR_FLASH definition is removed, then the appropriate HEAP size
// must be allocated. 2 bytes * MAXIMUM_NUMBER_OF_ELEMENTS_PER_SENSOR + 2 bytes
// of overhead.
#define RAM_FOR_FLASH
//****** Structure Array Definition ********************************************
// This defines the array size in the sensor strucure. In the event that
// RAM_FOR_FLASH is defined, then this also defines the amount of RAM space
// allocated (global variable) for computations.
#define MAXIMUM_NUMBER_OF_ELEMENTS_PER_SENSOR 1
//****** Choosing a Measurement Method ****************************************
// These variables are references to the definitions found in structure.c and
// must be generated per the application.
// possible values for the method field
// OSCILLATOR DEFINITIONS
//#define RO_COMPAp_TA0_WDTp 64
#define RO_PINOSC_TA0_WDTp 65
. . . .
structure.c
#include "structure.h"
// Middle Element (P2.5)
const struct Element middle_element =
{
.inputPxselRegister = (uint8_t *)&P2SEL,
.inputPxsel2Register = (uint8_t *)&P2SEL2,
.inputBits = BIT4,
// When using an abstracted function to measure the element
// the 100*(maxResponse - threshold) < 0xFFFF
// ie maxResponse - threshold < 655
.maxResponse = (450 + 655),
.threshold = 450
};
// One Button Sensor
const struct Sensor one_button =
{
.halDefinition = RO_PINOSC_TA0_WDTp, // Sensing Method
.numElements = 1, // # of Elements
.baseOffset = 0, // First element index = 0
// Pointer to elements
.arrayPtr[0] = &middle_element, // point to middle element
// Timer Information
.measGateSource= GATE_WDT_ACLK, // 0->SMCLK, 1-> ACLK
.accumulationCycles= WDTp_GATE_64 //64 - Default
};
main.c
#include <msp430.h>
#include "CTS_Layer.h"
#include "CTS_HAL.h"
#include "structure.h"