109 lines
3.4 KiB
C
109 lines
3.4 KiB
C
|
|
/* USER CODE BEGIN Header */
|
|||
|
|
/**
|
|||
|
|
******************************************************************************
|
|||
|
|
* @file : bs83b12_capacitive_touch.h
|
|||
|
|
* @brief : <EFBFBD><EFBFBD>Ļ<EFBFBD><EFBFBD>ʾ
|
|||
|
|
* @version : 1.0
|
|||
|
|
* @changelog : version 1.0 <EFBFBD><EFBFBD>ʼ<EFBFBD>汾 2025.11.13
|
|||
|
|
******************************************************************************
|
|||
|
|
* @attention
|
|||
|
|
*
|
|||
|
|
* Copyright (c) 2025 Yuwell Software Danyang.Jiangsu.China
|
|||
|
|
* THIS SOFTWARE is licensed under the Mulan PSL v1.
|
|||
|
|
* can use this software according to the terms and conditions of the Mulan PSL v1.
|
|||
|
|
* You may obtain a copy of Mulan PSL v1 at:
|
|||
|
|
* http://license.coscl.org.cn/MulanPSL
|
|||
|
|
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR
|
|||
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR
|
|||
|
|
* PURPOSE.
|
|||
|
|
* See the Mulan PSL v1 for more details.
|
|||
|
|
*
|
|||
|
|
******************************************************************************
|
|||
|
|
*/
|
|||
|
|
/* USER CODE END Header */
|
|||
|
|
|
|||
|
|
/* Define to prevent recursive inclusion -------------------------------------*/
|
|||
|
|
#ifndef __BS83B12_CAPACITIVE_TOUCH_H
|
|||
|
|
#define __BS83B12_CAPACITIVE_TOUCH_H
|
|||
|
|
|
|||
|
|
#ifdef __cplusplus
|
|||
|
|
extern "C" {
|
|||
|
|
#endif
|
|||
|
|
|
|||
|
|
|
|||
|
|
#include <stdint.h>
|
|||
|
|
#include "fm33lg0xx_fl.h"
|
|||
|
|
#include "fm33lg0xx_queue.h"
|
|||
|
|
#include "fm33lg0xx_event.h"
|
|||
|
|
|
|||
|
|
|
|||
|
|
#define ALARM_YELLOW_GPIO_PORT GPIOC
|
|||
|
|
#define ALARM_YELLOW_GPIO_PIN FL_GPIO_PIN_9
|
|||
|
|
|
|||
|
|
|
|||
|
|
#define ALARM_YELLOW_ON FL_GPIO_SetOutputPin(ALARM_YELLOW_GPIO_PORT, ALARM_YELLOW_GPIO_PIN);
|
|||
|
|
#define ALARM_YELLOW_OFF FL_GPIO_ResetOutputPin(ALARM_YELLOW_GPIO_PORT, ALARM_YELLOW_GPIO_PIN);
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
/*********
|
|||
|
|
1<EFBFBD><EFBFBD>iic ͨѶ
|
|||
|
|
2<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ 0xA0
|
|||
|
|
|
|||
|
|
3<EFBFBD><EFBFBD><EFBFBD>ӻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>3<EFBFBD><EFBFBD><EFBFBD>ֽ<EFBFBD>
|
|||
|
|
byte0: <EFBFBD><EFBFBD>ֵ
|
|||
|
|
byte1: <EFBFBD>̶<EFBFBD>0x00
|
|||
|
|
byte2: ~(byte0+byte1) + 1
|
|||
|
|
|
|||
|
|
5<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
byte0: bit0 = 1
|
|||
|
|
bit1/bit2=11/00(<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָʾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>/<EFBFBD><EFBFBD>)
|
|||
|
|
bit4=1/0(<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>/<EFBFBD><EFBFBD>)
|
|||
|
|
bit6=1/0(<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָʾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>/<EFBFBD><EFBFBD>)
|
|||
|
|
bit7(<EFBFBD>̵<EFBFBD>ָʾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
|||
|
|
byte1: ~(byte0)+1
|
|||
|
|
*********/
|
|||
|
|
#define BS83B12_ADDR 0xA0 // ÿ<><C3BF>100ms<6D>Ӹõ<D3B8>ַ<EFBFBD><D6B7>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|
|||
|
|
#define BS83B12_SCL_GPIO_GROUP GPIOC
|
|||
|
|
#define BS83B12_SCL_GPIO_PIN FL_GPIO_PIN_7
|
|||
|
|
#define BS83B12_SDA_GPIO_GROUP GPIOC
|
|||
|
|
#define BS83B12_SDA_GPIO_PIN FL_GPIO_PIN_8
|
|||
|
|
|
|||
|
|
#define BS83B12_SDA_CLEAR() FL_GPIO_ResetOutputPin(BS83B12_SDA_GPIO_GROUP,BS83B12_SDA_GPIO_PIN);
|
|||
|
|
#define BS83B12_SDA_SET() FL_GPIO_SetOutputPin(BS83B12_SDA_GPIO_GROUP,BS83B12_SDA_GPIO_PIN);
|
|||
|
|
|
|||
|
|
#define BS83B12_SCL_CLEAR() FL_GPIO_ResetOutputPin(BS83B12_SCL_GPIO_GROUP,BS83B12_SCL_GPIO_PIN);
|
|||
|
|
#define BS83B12_SCL_SET() FL_GPIO_SetOutputPin(BS83B12_SCL_GPIO_GROUP,BS83B12_SCL_GPIO_PIN);
|
|||
|
|
|
|||
|
|
#define BS83B12_BACK_LIGHT_ON_BYTE0 0x07
|
|||
|
|
#define BS83B12_BACK_LIGHT_ON_BYTE1 0xF9
|
|||
|
|
|
|||
|
|
#define BS83B12_BACK_LIGHT_OFF_BYTE0 0x01
|
|||
|
|
#define BS83B12_BACK_LIGHT_OFF_BYTE1 0xFF
|
|||
|
|
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD>崥<EFBFBD><E5B4A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>ֵ
|
|||
|
|
#define BS83B12_KEY1_CODE 0xFB
|
|||
|
|
#define BS83B12_KEY2_CODE 0xFD
|
|||
|
|
#define BS83B12_KEY3_CODE 0xFE
|
|||
|
|
#define BS83B12_KEY_NONE 0xFF
|
|||
|
|
|
|||
|
|
#define KEY121_TIMEOUT_TICKS (20)
|
|||
|
|
|
|||
|
|
|
|||
|
|
void bs83b12_capacitive_touch_init(void); // <20><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD>
|
|||
|
|
|
|||
|
|
|
|||
|
|
void bs83b12_touch_read_task(void); // ÿ<><C3BF>100msִ<73><D6B4>һ<EFBFBD>Σ<EFBFBD><CEA3><EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>״̬
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
#ifdef __cplusplus
|
|||
|
|
}
|
|||
|
|
#endif
|
|||
|
|
|
|||
|
|
#endif /* __BS83B12_CAPACITIVE_TOUCH_H */
|
|||
|
|
|
|||
|
|
/************************ (C) COPYRIGHT Yuwell *****END OF FILE****/
|