⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 structure.c

📁 launchpad msp430官方示例
💻 C
字号:
//******************************************************************************
//  RC_PAIR_TA0 example
//
// 4 elements configured as a 64 point slider.  
//
// This file contains the structure names and the variable assingments.
//
//******************************************************************************


#include "structure.h"
//#pragma location="INFOB"

// P1.0 input, P1.1 reference 
const struct Element element0 = {
              .inputPxoutRegister = (uint8_t *)&P1OUT,    
              .inputPxinRegister = (uint8_t *)&P1IN,     
              .inputPxdirRegister = (uint8_t *)&P1DIR,
              .referencePxoutRegister= (uint8_t *)&P1OUT,
              .referencePxdirRegister = (uint8_t *)&P1DIR,     	     
              .referenceBits = BIT1,
              .inputBits =  BIT0,
              .maxResponse = 250,
              .threshold = 80
};
// P1.1 input, P1.0 reference 
const struct Element element1 = {
	      .inputPxoutRegister = (uint8_t *)&P1OUT,    
              .inputPxinRegister = (uint8_t *)&P1IN,     
              .inputPxdirRegister = (uint8_t *)&P1DIR,
              .referencePxoutRegister= (uint8_t *)&P1OUT,
              .referencePxdirRegister = (uint8_t *)&P1DIR,     	     
              .referenceBits = BIT0,
              .inputBits =  BIT1,
              .maxResponse = 250,
              .threshold = 80
};
// P1.2 input, P1.3 reference 
const struct Element element2 = {
              .inputPxoutRegister = (uint8_t *)&P1OUT,    
              .inputPxinRegister = (uint8_t *)&P1IN,     
              .inputPxdirRegister = (uint8_t *)&P1DIR,
              .referencePxoutRegister= (uint8_t *)&P1OUT,
              .referencePxdirRegister = (uint8_t *)&P1DIR,     	     
              .referenceBits = BIT3,
              .inputBits =  BIT2,
              .maxResponse = 250,
              .threshold = 80
};
// P1.3 input, P1.2 reference 
const struct Element element3 = {
              .inputPxoutRegister = (uint8_t *)&P1OUT,    
              .inputPxinRegister = (uint8_t *)&P1IN,     
              .inputPxdirRegister = (uint8_t *)&P1DIR,
              .referencePxoutRegister= (uint8_t *)&P1OUT,
              .referencePxdirRegister = (uint8_t *)&P1DIR,     	     
              .referenceBits = BIT2,
              .inputBits =  BIT3,
              .maxResponse = 250,
              .threshold = 80
};

//*** Sensor *******************************************************/
// This defines the grouping of sensors, the method to measure change in
// capacitance, and the function of the group

const struct Sensor slider = 
{ 
                  .halDefinition = RC_PAIR_TA0,
                  .numElements = 4,
                  .baseOffset = 0,
                  .points = 80,
		  .sensorThreshold = 75,
                  // Pointer to elements
                  .arrayPtr[0] = &element0,  // point to first element 
                  .arrayPtr[1] = &element1,    
                  .arrayPtr[2] = &element2,    
                  .arrayPtr[3] = &element3,    
                  // Timer Information
		  //.measGateSource= TIMER_TxCLK,   // TxCLK
                  //.measGateSource= TIMER_ACLK,    // ACLK
                  .measGateSource= TIMER_SMCLK,     // SMCLK
		  .sourceScale = TIMER_SOURCE_DIV_0,
		  //.sourceScale = TIMER_SOURCE_DIV_1,				  
		  //.sourceScale = TIMER_SOURCE_DIV_2,
		  //.sourceScale = TIMER_SOURCE_DIV_3,
		  .accumulationCycles = 10
};

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -