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

📄 structure.c

📁 launchpad msp430官方示例
💻 C
字号:
//******************************************************************************
// structure.c
//
//RO_COMPB_TA1_WDTA example
//                                                         MSP430F5529
//                                                        +---------------+
//                                                        | 
//c-+--------------------------------------------------R--+--<P1.6/TA1CLK/CBOUT  
//  |                                                     |
//  |  c-+---------------------------------------------R--+  
//  |    |                                                |
//  |    |  c-+----------------------------------------R--+  
//  |    |    |                                           |
//  |    |    | c-+------------------------------------R--+  
//  |    |    |   |                                       |
//                  c-+--------------------------------R--+  
//                    |                                   |
//                    |  c-+---------------------------R--+  
//                    |    |                              |
//                    |    |  c-+----------------------R--+  
//                    |    |    |                         |
//                    |    |    | c-+------------------R--+  
//                    |    |    |   |                     |
//                    |    |    |   |  c-+-------------R--+  
//                    |    |    |   |    |                |
//                    |    |    |   |    | c-+---------R--+  
//                    |    |    |   |    |   |            |
//                    |    |    |   |    |   | c-+-----R--+  
//                    |    |    |   |    |   |   |        |
//                    |    |    |   |    |   |   | c-+-R--+                               
//                    |    |    |   |    |   |   |   |
//                    |    |    |   |    |   |   |   +------->CB0
//                    |    |    |   |    |   |   +----------->CB1
//                    |    |    |   |    |   +--------------->CB2
//                    |    |    |   |    +------------------->CB3
//                    |    |    |   +------------------------>CB4
//                    |    |    +---------------------------->CB5
//                    |    +--------------------------------->CB6
//  |    |    |   |   +-------------------------------------->CB7
//  |    |    |   +------------------------------------------>CB8
//  |    |    +---------------------------------------------->CB9
//  |    +--------------------------------------------------->CB10
//  +-------------------------------------------------------->CB11
//
//
//******************************************************************************

#include "structure.h"

// Actual demo structures
const struct Element element0 = {   //CB0
              .inputBits = CBIMSEL_0,
              .maxResponse = 250,
              .threshold = 125
};
const struct Element element1 = {   //CB1
              .inputBits = CBIMSEL_1,
              .maxResponse = 390,
              .threshold = 195
};
const struct Element element2 = {   //CB2
              .inputBits = CBIMSEL_2,
              .maxResponse = 340,
              .threshold = 170
};
const struct Element element3 = {   //CB3
              .inputBits = CBIMSEL_3,
              .maxResponse = 500,
              .threshold = 230
};
const struct Element element4 = {   //CB4
              .inputBits = CBIMSEL_4,
              .maxResponse = 400,
              .threshold = 200
};
const struct Element element5 = {   //CB5
              .inputBits = CBIMSEL_5,
              .maxResponse = 250,
              .threshold = 125
};
const struct Element element6 = {   //CB6
              .inputBits = CBIMSEL_6,
              .maxResponse = 390,
              .threshold = 195
};
const struct Element element7 = {   //CB7
              .inputBits = CBIMSEL_7,
              .maxResponse = 340,
              .threshold = 170
};
const struct Element element8 = {   //CB8
              .inputBits = CBIMSEL_8,
              .maxResponse = 500,
              .threshold = 230
};
const struct Element element9 = {   //CB9
              .inputBits = CBIMSEL_9,
              .maxResponse = 400,
              .threshold = 200
};
const struct Element elementA = {   //CB10
              .inputBits = CBIMSEL_10,
              .maxResponse = 340,
              .threshold = 170
};
const struct Element elementB = {   //CB11
              .inputBits = CBIMSEL_11,
              .maxResponse = 500,
              .threshold = 230
};


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

const struct Sensor keypad =
               { 
                  .halDefinition = RO_COMPB_TA1_WDTA,
                  .numElements = 5,
                  .baseOffset = 0,
                  .cbpdBits = 0x0FFF, //CB0,CB1,...CB11
                  // Pointer to elements
                  .arrayPtr[0] = &element0,  // point to first element 
                  .arrayPtr[1] = &element1,    
                  .arrayPtr[2] = &element2,  
                  .arrayPtr[3] = &element3, 
                  .arrayPtr[4] = &element4,  
                  .arrayPtr[5] = &element5,  // point to first element 
                  .arrayPtr[6] = &element6,    
                  .arrayPtr[7] = &element7,  
                  .arrayPtr[8] = &element8, 
                  .arrayPtr[9] = &element9,    
				  .arrayPtr[10] = &elementA, 
                  .arrayPtr[11] = &elementB,    
 
                  .cboutTAxDirRegister = (uint8_t *)&P1DIR,  // PxDIR
                  .cboutTAxSelRegister = (uint8_t *)&P1SEL,  // PxSEL
                  .cboutTAxBits = BIT6, // P1.6
                  // Timer Information
                  .measGateSource= GATE_WDTA_ACLK,     //  0->SMCLK, 1-> ACLK
                  .accumulationCycles= WDTA_GATE_512  //
               };

⌨️ 快捷键说明

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