Function control method, circuit, chip and electronic device for sensor pin
By receiving control signals time-sharing control of sensor pins, data input and interrupt output are realized, which solves the problem of low sensor pin utilization and improves pin utilization and product iteration flexibility.
Patent Information
- Application Number
- CN202210315649.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-28
- Publication Date
- 2025-02-07
- Estimated Expiration
- 2042-03-28
AI Technical Summary
The sensor has low pin utilization, especially when it comes to product iterations, the number of pins of the sensor is not enough to meet the increased functionality requirements, resulting in increased cost of replacing the sensor.
By receiving control signals, the functions of sensor pins are controlled in time, and the functions of data input and interrupt output are realized, thereby improving the efficiency of pin utilization.
It realizes the multifunctional use of the same sensor pin, improves pin utilization, meets the needs of increased functions in product iteration, and reduces the cost of replacing sensors.
Smart Images

Figure CN114755951B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present disclosure relate to the technical field of function control of sensor pins, and more specifically, to a method, circuit, chip and electronic device for function control of sensor pins. Background Art
[0002] Sensor pins are mostly used to collect analog signals and output signals. For example, the SDO (Service Data Objects) pin of the pressure sensor is mainly used as the serial data output of the 4-wire SPI. When the pressure sensor does not use SPI but uses I2C as the transmission path, this SDO pin will be used as the least significant bit (LSB) of the I2C device ID, that is, it is used as an input.
[0003] Therefore, under one communication mode, one pin of the pressure sensor can only have one function. It is understandable that after the pressure sensor is manufactured, the number of its pins is limited, but the product is updated and iterated. When the function of a product is increased, the pins of a pressure sensor may not be enough. At this time, replacing the pressure sensor will increase the cost.
[0004] From this we can see that the pin utilization rate of the sensor is low. When the number of sensor pins is insufficient, the existing sensor pins cannot meet the product iteration requirements. Summary of the invention
[0005] One objective of the present disclosure is to provide a new technical solution for a sensor pin function control method circuit, chip and electronic device.
[0006] In a first aspect, a method for controlling a function of a sensor pin is provided, the method comprising:
[0007] receiving a control signal for the same sensor pin;
[0008] controlling the operating state of the sensor pin according to the control signal;
[0009] The control signal includes a first signal and a second signal. When the control signal is the first signal, the sensor pin is configured to be in a first operating state. When the control signal is the second signal, the sensor pin is configured to be in a second operating state.
[0010] Optionally, the first signal is a high level signal, the second signal is a low level signal, and controlling the operating state of the sensor pin according to the control signal includes:
[0011] In the case where the control signal is a first signal, the first operating state is that the sensor pin is configured as a data input state;
[0012] When the control signal is the second signal, the second operating state is that the sensor pin is configured as an interrupt output state.
[0013] Optionally, the sensor pin is connected to an I2C bus, and the method further includes:
[0014] Obtaining the transmission status of the data line and the control line of the I2C bus;
[0015] Determining the data transmission time of the I2C bus according to the transmission status of the data line and the control line;
[0016] During the data transmission time of the I2C bus, the sensor pin is controlled to be in a first operating state.
[0017] Optionally, the sensor pin is connected to a four-wire serial peripheral interface, and the method includes:
[0018] Receiving serial data transmitted by the four-wire serial peripheral interface;
[0019] According to the serial data, it is determined that the operating state of the sensor pin is serial data output.
[0020] In a second aspect, a function control circuit of a sensor pin is provided, the circuit comprising:
[0021] Sensors and control modules;
[0022] The sensor is provided with a sensor pin, and the sensor pin is used to receive a control signal;
[0023] The control module is used to control the operating state of the sensor pin according to the control signal;
[0024] The control signal includes a first signal and a second signal. When the control signal is the first signal, the sensor pin is configured to be in a first operating state. When the control signal is the second signal, the sensor pin is configured to be in a second operating state.
[0025] Optionally, the sensor pin is an open drain pin.
[0026] Optionally, the circuit includes an I2C data detection circuit, an input end of the I2C data detection circuit is connected to the I2C bus, an output end of the I2C data detection circuit is connected to the control module, and the I2C data detection circuit is used to determine the data transmission time of the I2C bus according to the transmission status of the I2C bus, and during the data transmission time of the I2C bus, control the sensor pin to be in the first operating state.
[0027] Optionally, the I2C data detection circuit includes: a first pulse signal detection circuit, a second pulse signal detection circuit and a periodic signal trigger, and the input end of the first pulse signal detection circuit and the input end of the second pulse signal detection circuit are the input ends of the I2C data detection circuit;
[0028] The output end of the first pulse signal detection circuit is connected to the first input end of the periodic signal trigger, the output end of the second pulse signal detection circuit is connected to the second input end of the periodic signal trigger, and the output end of the periodic signal trigger is the output end of the I2C data detection circuit;
[0029] Among them, the first pulse signal detection circuit is used to receive the data transmission start signal of the I2C bus, the second pulse signal detection circuit is used to receive the data transmission end signal of the I2C bus, and the periodic signal trigger is used to generate a periodic signal about the data transmission time according to the data transmission start signal and the data transmission end signal.
[0030] In a third aspect, a chip is provided, the chip comprising:
[0031] Circuit boards;
[0032] A function control circuit of a sensor pin, wherein the function control circuit of the sensor pin is arranged on the circuit board, and the function control circuit of the sensor pin is the function control circuit of the sensor pin according to any one of the second aspects.
[0033] According to a fourth aspect, an electronic device is provided, comprising a memory and a processor, wherein the memory is used to store a computer program; and the processor is used to execute the computer program to implement the method described in any one of the first aspects.
[0034] One beneficial effect of the disclosed embodiment is that, by adopting a time-sharing control method for the same sensor pin, the same sensor pin can have the functions of data input and interrupt output when the control signals received by the sensor pin are different, thereby increasing the utilization efficiency of the pin.
[0035] Other features and advantages of the present specification will become apparent from the following detailed description of exemplary embodiments of the present specification with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] The accompanying drawings, which are incorporated in and constitute a part of the specification, illustrate embodiments of the specification and, together with the description, serve to explain the principles of the specification.
[0037] Figure 1 is a flow chart of the function control method of the sensor pin of this embodiment;
[0038] Figure 2 is another flow chart of the method for controlling the function of the sensor pin of this embodiment;
[0039] Figure 3 is a circuit structure diagram of an I2C data detection circuit according to an embodiment of the present disclosure;
[0040] Figure 4 is a schematic structural diagram of a function control circuit of a sensor pin according to an embodiment;
[0041] Figure 5 is a schematic structural diagram of a chip according to an embodiment;
[0042] Figure 6 is a schematic diagram of the hardware structure of an electronic device according to an embodiment. DETAILED DESCRIPTION
[0043] Various exemplary embodiments of the present disclosure will now be described in detail with reference to the accompanying drawings. It should be noted that the relative arrangement of components and steps, numerical expressions and numerical values set forth in these embodiments do not limit the scope of the present invention unless otherwise specifically stated.
[0044] The following description of at least one exemplary embodiment is merely illustrative in nature and is in no way intended to limit the invention, its application, or uses.
[0045] Technologies, methods, and equipment known to ordinary technicians in the relevant art may not be discussed in detail, but where appropriate, the technologies, methods, and equipment should be considered as part of the specification.
[0046] In all examples shown and discussed herein, any specific values should be interpreted as merely exemplary and not limiting. Therefore, other examples of the exemplary embodiments may have different values.
[0047] It should be noted that like reference numerals and letters refer to similar items in the following figures, and therefore, once an item is defined in one figure, it need not be further discussed in subsequent figures.
[0048] The embodiments of the present disclosure relate to an application scenario of functional multiplexing of a single pin of a sensor, and different control logics and control circuits are designed to enable the same sensor pin to have the functions of both data input and interrupt output.
[0049] Hereinafter, various embodiments and examples according to the present invention are described with reference to the accompanying drawings.
[0050] <Example 1>
[0051] Figure 1 It is a flow chart of a method for controlling the function of a sensor pin according to an embodiment. This embodiment can be implemented by a sensor. When a controller is provided in the sensor, it can be implemented by the controller, which can be a single-chip microcomputer.
[0052] like Figure 1 As shown, the function control method of the sensor pin of this embodiment may include the following steps:
[0053] S110 , receiving a control signal for the same sensor pin.
[0054] In this embodiment, the same sensor pin may be any one of the sensor pins.
[0055] In this embodiment, the control signal includes a first signal and a second signal. When the control signal is the first signal, the sensor pin is configured to the first operating state. When the control signal is the second signal, the sensor pin is configured to the second operating state.
[0056] It can be understood that the first signal and the second signal are different signals. For example, the first signal is a high-level signal, and the second signal is a low-level signal; the first signal is an input signal, and the second signal is an output signal.
[0057] The first operating state and the second operating state are different states. For example, the first operating state is an input state, and the second operating state is an output state; the first operating state is a data transmission state, and the second operating state is an interruption state.
[0058] That is to say, the same sensor pin can receive different control signals, thereby realizing different functions according to different control signals, so that a sensor pin has multiple functions. When the sensor pins are insufficient, the utilization rate of the sensor pins is improved, thereby meeting the pin quantity requirement.
[0059] S120, controlling the operating state of the sensor pin according to the control signal.
[0060] The control signal of this embodiment is based on the signal of the sensor when using the I2C bus to transmit data. When the pin of the sensor is used for the I2C bus to transmit data, the pin will be used as the least significant bit (LSB) of I2C. When the pin is connected to the power level, the input of the sensor pin is "1", and the LSB of I2C is "1". When the pin is connected to the ground level, the input of the sensor pin is "0", and the LSB of I2C is "0". That is, during the period when the input of the pin changes from "1" to "0", the function of the sensor pin is used as the data input of I2C.
[0061] In order to improve the utilization rate of a sensor pin and enable the sensor to have an interrupt output function when using the I2C bus for transmission, the present embodiment realizes the interrupt output by pulling down the potential of the sensor pin.
[0062] Specifically, the first signal of the present embodiment is a high-level signal, and the second signal is a low-level signal. When the control signal is the first signal, that is, when the input of the sensor pin is a high-level signal, the first operating state is that the sensor pin is configured as a data input state; when the control signal is the second signal, that is, when the input of the sensor pin is a low-level signal, the second operating state is that the sensor pin is configured as an interrupt output state.
[0063] For example, in one embodiment, a sensor pin is set as an open drain pin, and the drain of the open drain pin is connected to a potential adjustment circuit to pull up the target pin through the potential adjustment circuit. For example, the potential adjustment circuit is a pull-up resistor, and the target pin uses a transistor, and the pull-up resistor is connected to the drain of the transistor. When the sensor is working, the sensor pin will maintain the input state, thereby avoiding the pin from having an unexpected input-output switch to input I2C bus data.
[0064] It should be noted that if a sensor pin is implemented with input and interrupt output functions, when the sensor pin is in the interrupt output function, the sensor pin will be matched to a low potential state, which will affect the data transmission of I2C. Therefore, in order to avoid the influence of the interrupt output on the input, this embodiment controls the operation state of the sensor pin by monitoring the data transmission state of the I2C bus during the interrupt output process. When it is detected that the I2C bus is in the data transmission state, the interrupt output function of the sensor pin is shielded. At this time, the potential adjustment circuit connected to the sensor pin will pull up the resistor input high level, and the LSB of I2C is still "1", and I2C can still communicate. When the I2C communication ends, the sensor pin returns to the interrupt output state, and the sensor output is interrupted to the master control that controls the sensor.
[0065] Specifically, in order to control the function of the sensor pin according to the data transmission status of the I2C bus, refer to Figure 2 , this embodiment also includes:
[0066] S1201, obtaining the transmission status of the data line and the control line of the I2C bus.
[0067] For example, the I2C bus includes a control line SCL and a data line SDA. The data transmission status of the I2C bus can be obtained by detecting the level of the control line SCL and the data line SDA. For example, when SCL is "1", SDA changes from "1" to "0", indicating that I2C is about to start transmitting data. When SCL is "1", SDA changes from "0" to "1", indicating that I2C has finished transmitting data.
[0068] S1202: Determine the data transmission time of the I2C bus according to the transmission status of the data line and the control line.
[0069] In this embodiment, the detection can be performed by the I2C data detection circuit of the function control circuit of the sensor pin. The specific circuit structure of the I2C data detection circuit can be found in Figure 3 ,like Figure 3 As shown, the I2C data detection circuit includes: a first pulse signal detection circuit 301, a second pulse signal detection circuit 302 and a periodic signal trigger 303, wherein the input end of the first pulse signal detection circuit and the input end of the second pulse signal detection circuit are the input end of the I2C data detection circuit; the output end of the first pulse signal detection circuit is connected to the first input end of the periodic signal trigger, the output end of the second pulse signal detection circuit is connected to the second input end of the periodic signal trigger, and the output end of the periodic signal trigger is the output end of the I2C data detection circuit; wherein, the first pulse signal detection circuit is used to receive the data transmission start signal of the I2C bus, the second pulse signal detection circuit is used to receive the data transmission end signal of the I2C bus, and the periodic signal trigger is used to generate a periodic signal about the data transmission time according to the data transmission start signal and the data transmission end signal.
[0070] like Figure 3As shown, when data is transmitted through the I2C bus, when SCL is "1", SDA changes from "1" to "0", the first pulse signal detection circuit and the second pulse signal detection circuit each include two triggers U1 and U2, the trigger U1 is connected to the control line SCL and the data line SDA, the control line SCL is input to the receiving end of the trigger U1, U1 is triggered after receiving the stable signal D=1, and obtains a positive pulse synchronized with SCL, this positive pulse is also the first pulse signal (Start pulse), the Q end of the trigger U1 is output to the receiving end of U2, and U2 outputs a reverse pulse signal from the Q end to U1 via an inverter.
[0071] When the data transmission of the I2C bus is about to end, SCL is "1" but SDA changes from "0" to "1". At this time, the trigger U1 of the second pulse signal detection circuit has a maintaining blocking effect, that is, the pulse signal output by U1 of the second pulse signal detection circuit is a delayed signal, and this delayed signal is used as the second pulse signal (Stop pulse).
[0072] The output ends of the first pulse signal detection circuit and the second pulse signal detection circuit are connected to the periodic signal trigger U3, wherein an inverter is provided between the second pulse signal detection circuit and the periodic signal trigger U3, and the periodic signal I2C on period is obtained by using the Start pulse and the Stop pulse, and the periodic signal is used to control the potential of the sensor pin. The time within a periodic signal I2C on period is the data transmission time of the I2C bus.
[0073] S1203 . During the data transmission time of the I2C bus, control the sensor pin to be in a first operating state.
[0074] It can be known from S1202 that within a period signal I2C on period, the I2C bus is in the input state and no interrupt output is required. Therefore, during the data transmission time, the interrupt output function of the sensor pin should be turned off to keep the sensor pin in the input state for data communication with I2C.
[0075] It should be noted that in the above embodiments, the sensor pin is connected to the I2C bus. When the sensor pin is connected to a four-wire serial peripheral interface, that is, when the sensor pin outputs serial data through a 4-wire SPI, the method of this embodiment includes: receiving serial data transmitted by the four-wire serial peripheral interface; and determining, based on the serial data, that the operating state of the sensor pin is serial data output.
[0076] That is to say, when the sensor pin is connected to the 4-wire SPI, the sensor pin can be used as the serial data output interface of the 4-wire SPI. When the sensor pin is connected to the I2C bus, the sensor pin has both the I2C data input function and the interrupt output function.
[0077] This embodiment uses a time-sharing control method for the same sensor pin, so that the same sensor pin can have the functions of data input and interrupt output when the sensor pin receives different control signals, thereby increasing the utilization efficiency of the pin.
[0078] <Example 2>
[0079] refer to Figure 4 , This embodiment also provides a function control circuit of a sensor pin, the circuit comprising: a sensor 400 and a control module 403;
[0080] In this embodiment, the sensor may be a pressure sensor, an air flow sensor, a temperature sensor, etc. The sensor is provided with a sensor pin 11, which is used to receive a control signal and implement data input and output. In one example, the sensor pin is used to implement serial data output, I2C bus data input, and interrupt data output.
[0081] In this embodiment, the control module is used to control the operating state of the sensor pin according to the control signal; wherein the control signal includes a first signal and a second signal, and when the control signal is the first signal, the sensor pin is configured to be in the first operating state, and when the control signal is the second signal, the sensor pin is configured to be in the second operating state. Specifically, the function and working principle of the control module are described in the first embodiment, and will not be repeated here.
[0082] In this embodiment, the circuit includes an I2C data detection circuit 402, the input end of the I2C data detection circuit is connected to the I2C bus, the output end of the I2C data detection circuit is connected to the control module, and the I2C data detection circuit is used to determine the data transmission time of the I2C bus according to the transmission status of the I2C bus. During the data transmission time, the sensor pin is controlled to be in the first operating state.
[0083] Among them, reference Figure 3The I2C data detection circuit includes: a first pulse signal detection circuit, a second pulse signal detection circuit and a periodic signal trigger. The input end of the first pulse signal detection circuit and the input end of the second pulse signal detection circuit are the input end of the I2C data detection circuit; the output end of the first pulse signal detection circuit is connected to the first input end of the periodic signal trigger, the output end of the second pulse signal detection circuit is connected to the second input end of the periodic signal trigger, and the output end of the periodic signal trigger is the output end of the I2C data detection circuit.
[0084] In this embodiment, the first pulse signal detection circuit is used to receive the data transmission start signal of the I2C bus, the second pulse signal detection circuit is used to receive the data transmission end signal of the I2C bus, and the periodic signal trigger is used to generate a periodic signal about the data transmission time based on the data transmission start signal and the data transmission end signal.
[0085] like Figure 3 As shown, when data is transmitted through the I2C bus, when SCL is "1", SDA changes from "1" to "0", the first pulse signal detection circuit and the second pulse signal detection circuit each include two triggers U1 and U2, the trigger U1 is connected to the control line SCL and the data line SDA, the control line SCL is input to the receiving end of the trigger U1, U1 is triggered after receiving the stable signal D=1, and obtains a positive pulse synchronized with SCL, this positive pulse is also the first pulse signal (Start pulse), the Q end of the trigger U1 is output to the receiving end of U2, and U2 outputs a reverse pulse signal from the Q end to U1 via an inverter.
[0086] When the data transmission of the I2C bus is about to end, SCL is "1" but SDA changes from "0" to "1". At this time, the trigger U1 of the second pulse signal detection circuit has a maintaining blocking effect, that is, the pulse signal output by U1 of the second pulse signal detection circuit is a delayed signal, and this delayed signal is used as the second pulse signal (Stop pulse).
[0087] The output ends of the first pulse signal detection circuit and the second pulse signal detection circuit are connected to the periodic signal trigger U3, wherein an inverter is provided between the second pulse signal detection circuit and the periodic signal trigger U3, and the periodic signal I2C on period is obtained by using the Start pulse and the Stop pulse, and the periodic signal is used to control the potential of the sensor pin. The time within a periodic signal I2C on period is the data transmission time of the I2C bus.
[0088] It should be noted that the sensor pin of the present embodiment is an open drain pin, and the open drain of the sensor pin is connected to a potential adjustment circuit to pull up the potential of the sensor pin through the potential adjustment circuit. For example, the potential adjustment circuit is a pull-up resistor, and the sensor pin uses a transistor, and the pull-up resistor is connected to the drain of the transistor.
[0089] This embodiment uses a time-sharing control method for the same sensor pin, so that the same sensor pin can have the functions of data input and interrupt output when the sensor pin receives different control signals, thereby increasing the utilization efficiency of the pin.
[0090] <Example 3>
[0091] Figure 5 It is a schematic diagram of the hardware structure of a chip according to another embodiment.
[0092] refer to Figure 5 , the chip 500 comprises:
[0093] Circuit board 501;
[0094] The function control circuit 502 of the sensor pin is arranged on the circuit board. The function control circuit of the sensor pin is the function control circuit of the sensor pin in the second embodiment.
[0095] This embodiment uses a time-sharing control method for the same sensor pin, so that the same sensor pin can have the functions of data input and interrupt output when the sensor pin receives different control signals, thereby increasing the utilization efficiency of the pin.
[0096] <Example 4>
[0097] Figure 6 is a schematic diagram of the hardware structure of an electronic device according to another embodiment.
[0098] like Figure 6 As shown, the electronic device 600 includes a processor 610 and a memory 620, wherein the memory 620 is used to store an executable computer program, and the processor 610 is used to execute a method such as any of the above method embodiments under the control of the computer program.
[0099] The electronic device 600 may be a master in the sensor.
[0100] This embodiment uses a time-sharing control method for the same sensor pin, so that the same sensor pin can have the functions of data input and interrupt output when the sensor pin receives different control signals, thereby increasing the utilization efficiency of the pin.
[0101] This embodiment further provides a computer-readable storage medium, in which executable commands are stored. When the executable commands are executed by a processor, the method described in any method embodiment of this specification is executed.
[0102] One or more embodiments of the present specification may be a system, method and / or computer program product. The computer program product may include a computer-readable storage medium carrying computer-readable program instructions for causing a processor to implement various aspects of the present specification.
[0103] A computer-readable storage medium may be a tangible device that can hold and store instructions used by an instruction execution device. A computer-readable storage medium may be, for example, but not limited to, an electrical storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination of the foregoing. More specific examples of computer-readable storage media (a non-exhaustive list) include: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a static random access memory (SRAM), a portable compact disk read-only memory (CD-ROM), a digital versatile disk (DVD), a memory stick, a floppy disk, a mechanical encoding device, such as a punch card or a raised structure in a groove on which instructions are stored, and any suitable combination of the foregoing. As used herein, a computer-readable storage medium is not to be interpreted as a transient signal per se, such as a radio wave or other freely propagating electromagnetic wave, an electromagnetic wave propagating through a waveguide or other transmission medium (e.g., a light pulse through a fiber optic cable), or an electrical signal transmitted through a wire.
[0104] The computer-readable program instructions described herein can be downloaded from a computer-readable storage medium to each computing / processing device, or downloaded to an external computer or external storage device via a network, such as the Internet, a local area network, a wide area network, and / or a wireless network. The network can include copper transmission cables, optical fiber transmissions, wireless transmissions, routers, firewalls, switches, gateway computers, and / or edge servers. The network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards the computer-readable program instructions for storage in the computer-readable storage medium in each computing / processing device.
[0105] The computer program instructions for performing the operation of the embodiments of this specification may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-related instructions, microcode, firmware instructions, state setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages such as Smalltalk, C++, etc., and conventional procedural programming languages such as "C" language or similar programming languages. Computer-readable program instructions may be executed completely on a user's computer, partially on a user's computer, executed as an independent software package, partially on a user's computer, partially on a remote computer, or completely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer via any type of network including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., using an Internet service provider to connect via the Internet). In certain embodiments, by utilizing the state information of a computer-readable program instruction to customize an electronic circuit, such as a programmable logic circuit, a field programmable gate array (FPGA) or a programmable logic array (PLA), the electronic circuit may execute a computer-readable program instruction, thereby realizing various aspects of this specification.
[0106] Various aspects of this specification are described herein with reference to flowcharts and / or block diagrams of methods, devices (systems) and computer program products according to embodiments of this specification. It should be understood that each box in the flowchart and / or block diagram and the combination of boxes in the flowchart and / or block diagram can be implemented by computer-readable program instructions.
[0107] These computer-readable program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, thereby producing a machine, so that when these instructions are executed by the processor of the computer or other programmable data processing device, a device that implements the functions / actions specified in one or more boxes in the flowchart and / or block diagram is generated. These computer-readable program instructions can also be stored in a computer-readable storage medium, and these instructions cause the computer, programmable data processing device, and / or other equipment to work in a specific manner, so that the computer-readable medium storing the instructions includes a manufactured product, which includes instructions for implementing various aspects of the functions / actions specified in one or more boxes in the flowchart and / or block diagram.
[0108] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device so that a series of operating steps are performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions executed on the computer, other programmable data processing apparatus, or other device to implement the functions / actions specified in one or more boxes in the flowchart and / or block diagram.
[0109] The flowcharts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the systems, methods and computer program products according to the multiple embodiments of this specification. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of an instruction, and a part of a module, a program segment or an instruction contains one or more executable instructions for realizing the specified logical function. In some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or the flowchart, and the combination of the boxes in the block diagram and / or the flowchart can be implemented by a dedicated hardware-based system that performs the specified function or action, or can be implemented by a combination of dedicated hardware and computer instructions. It is well known to those skilled in the art that it is equivalent to implement it by hardware, implement it by software, and implement it by combining software and hardware.
[0110] The embodiments of the present specification have been described above, and the above description is exemplary, not exhaustive, and is not limited to the disclosed embodiments. Many modifications and changes will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The choice of terms used herein is intended to best explain the principles of the embodiments, practical applications, or technical improvements in the marketplace, or to enable other persons of ordinary skill in the art to understand the embodiments disclosed herein. The scope of this application is defined by the appended claims.
Claims
1. A method for controlling the function of a sensor pin, characterized in that: The method comprises: receiving a control signal for the same sensor pin; controlling the operating state of the sensor pin according to the control signal; The control signal includes a first signal and a second signal. When the control signal is the first signal, the sensor pin is configured to be in a first operating state. When the control signal is the second signal, the sensor pin is configured to be in a second operating state. Wherein, the first signal is a high level signal, the second signal is a low level signal, and the controlling the operating state of the sensor pin according to the control signal includes: In the case where the control signal is a first signal, the first operating state is that the sensor pin is configured as a data input state; In the case where the control signal is the second signal, the second operating state is that the sensor pin is configured as an interrupt output state, The sensor pin is connected to an I2C bus, and the method further comprises: Obtaining the transmission status of the data line and the control line of the I2C bus; Determining the data transmission time of the I2C bus according to the transmission status of the data line and the control line; During the data transmission time of the I2C bus, the sensor pin is controlled to be in a first operating state.
2. The method according to claim 1, characterized in that The sensor pin is connected to a four-wire serial peripheral interface, and the method includes: Receiving serial data transmitted by the four-wire serial peripheral interface; According to the serial data, it is determined that the operating state of the sensor pin is serial data output.
3. A function control circuit for a sensor pin, characterized in that: The circuit comprises: a sensor and a control module; The sensor is provided with a sensor pin, and the sensor pin is used to receive a control signal; The control module is used to control the operating state of the sensor pin according to the control signal; Wherein, the control signal includes a first signal and a second signal, the first signal is a high level signal, and the second signal is a low level signal. When the control signal is the first signal, the sensor pin is configured to a first operating state, and the first operating state is that the sensor pin is configured to a data input state. When the control signal is the second signal, the sensor pin is configured to a second operating state, and the second operating state is that the sensor pin is configured to an interrupt output state. The circuit includes an I2C data detection circuit, an input end of the I2C data detection circuit is connected to the I2C bus, an output end of the I2C data detection circuit is connected to the control module, and the I2C data detection circuit is used to determine the data transmission time of the I2C bus according to the transmission status of the data line and the control line of the I2C bus, and control the sensor pin to be in the first operating state during the data transmission time of the I2C bus.
4. The circuit according to claim 3, characterized in that The sensor pins are open drain type pins.
5. The circuit according to claim 3, characterized in that The I2C data detection circuit comprises: a first pulse signal detection circuit, a second pulse signal detection circuit and a periodic signal trigger, the input end of the first pulse signal detection circuit and the input end of the second pulse signal detection circuit are the input ends of the I2C data detection circuit; The output end of the first pulse signal detection circuit is connected to the first input end of the periodic signal trigger, the output end of the second pulse signal detection circuit is connected to the second input end of the periodic signal trigger, and the output end of the periodic signal trigger is the output end of the I2C data detection circuit; Among them, the first pulse signal detection circuit is used to receive the data transmission start signal of the I2C bus, the second pulse signal detection circuit is used to receive the data transmission end signal of the I2C bus, and the periodic signal trigger is used to generate a periodic signal about the data transmission time according to the data transmission start signal and the data transmission end signal.
6. A chip, characterized in that: The chip comprises: Circuit boards; A function control circuit of a sensor pin, wherein the function control circuit of the sensor pin is arranged on the circuit board, and the function control circuit of the sensor pin is the function control circuit of the sensor pin according to any one of claims 3-5.
7. An electronic device, characterized in that: The method comprises a memory and a processor, wherein the memory is used to store a computer program; and the processor is used to execute the computer program to implement the method according to claim 1 or 2.
Citation Information
Patent Citations
Pressure sensor, switching circuit of pressure sensor, clock control method and clock control device
CN110971219A
Digital signal interface circuit, chip and electronic equipment
CN210986071U