主题中讨论的其他器件:BOOSTXL-ULPSENSE
工具与软件:
您好!
我将以 CC1354的电容式触控为例、在"采用 CC13x2/CC26x2的超低功耗感应应用"文档中、它提到了不采用触控的8.1uA 电流和采用触控的128uA 电流、
我用 Sensor Controller Studio 中的示例尝试了这种情况,并使用 CCS Theia 在一个空的专业喷射中非常简单地实现它:
/* * Copyright (c) 2015-2019, Texas Instruments Incorporated * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of Texas Instruments Incorporated nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* * ======== empty.c ======== */ /* For usleep() */ #include <unistd.h> #include <stdint.h> #include <stddef.h> /* Driver Header files */ #include <ti/drivers/GPIO.h> #include <ti/drivers/apps/LED.h> #include "ti_drivers_config.h" #include "C:\Users\ValentinKUNTI\Documents\Texas Instruments\Sensor Controller Studio\examples\cap_touch_ulpsense\source\scif.h" // SCIF driver callbacks void scCtrlReadyCallback(void) { // Empty callback for task control interface ready } void scTaskAlertCallback(void) { // Handle alert interrupt from Sensor Controller scifClearAlertIntSource(); scifAckAlertEvents(); } void *mainThread(void *arg0) { // Array to store touch detection state for each pin uint16_t touchState[SCIF_CAPACITIVE_TOUCH_PIN_COUNT] = {0}; LED_Handle led0Handle = LED_open(CONFIG_LED_0, NULL); // Initialize drivers GPIO_init(); // Initialize SCIF scifOsalInit(); scifOsalRegisterCtrlReadyCallback(scCtrlReadyCallback); scifOsalRegisterTaskAlertCallback(scTaskAlertCallback); scifInit(&scifDriverSetup); // Configure capacitive touch parameters scifTaskData.capacitiveTouch.cfg.isrcCurrent = 0x0011; // Set current for touch sensing scifTaskData.capacitiveTouch.cfg.maxSmplPeriod = 100; // Maximum sampling period scifTaskData.capacitiveTouch.cfg.minSmplPeriod = 30; // Minimum sampling period // Reset task structures (except configuration) scifResetTaskStructs(1 << SCIF_CAPACITIVE_TOUCH_TASK_ID, (1 << SCIF_STRUCT_INPUT) | (1 << SCIF_STRUCT_OUTPUT)); // Start the Capacitive Touch task if (scifWaitOnNbl(20000) != SCIF_SUCCESS) { // Handle timeout error return NULL; } if (scifStartTasksNbl(1 << SCIF_CAPACITIVE_TOUCH_TASK_ID) != SCIF_SUCCESS) { // Handle start error return NULL; } // Main loop while (1) { // Check for available output data while (scifGetTaskIoStructAvailCount(SCIF_CAPACITIVE_TOUCH_TASK_ID, SCIF_STRUCT_OUTPUT) > 0) { // Get pointer to output structure SCIF_CAPACITIVE_TOUCH_OUTPUT_T* output = scifGetTaskStruct(SCIF_CAPACITIVE_TOUCH_TASK_ID, SCIF_STRUCT_OUTPUT); // Read touch detection state for (int i = 0; i < SCIF_CAPACITIVE_TOUCH_PIN_COUNT; i++) { touchState[i] = output->pTouchDet[i]; } // Return the buffer to the Sensor Controller scifHandoffTaskStruct(SCIF_CAPACITIVE_TOUCH_TASK_ID, SCIF_STRUCT_OUTPUT); } // Toggle LED based on touch state of first pin if (touchState[0]) { LED_toggle(led0Handle); } // Small delay sleep(1); } return NULL; }
我将 XDS110与 MSP CapTIvate MCU 板一起用于电容测试、不幸的是、我无法实现8或120 uA 的功效:
我在配置中缺少什么吗?
此致、
Valentin Künti ć