Skip to content

File syn_port_comp.h

FileList > port > syn_port_comp.h

Go to the source code of this file

Platform Port Interface for Analog Comparators. More...

  • #include "../common/syn_defs.h"
  • #include <stdbool.h>
  • #include <stdint.h>

Public Types

Type Name
enum SYN_COMP_InvertingInput
Inverting input selection for comparator.

Public Functions

Type Name
SYN_Status syn_port_comp_enable (uint8_t comp_id, bool enable)
Enable or disable hardware analog comparator.
SYN_Status syn_port_comp_init (uint8_t comp_id, SYN_COMP_InvertingInput inv_in)
Initialize hardware analog comparator instance.
bool syn_port_comp_read (uint8_t comp_id)
Read real-time logical output state of the hardware comparator.

Detailed Description

Defines low-level target hardware bindings for internal high-speed analog comparators, threshold selection (internal VREFINT / DAC / external pin), and output state reading.

Public Types Documentation

enum SYN_COMP_InvertingInput

Inverting input selection for comparator.

enum SYN_COMP_InvertingInput {
    SYN_COMP_INV_VREFINT_1_4 = 0,
    SYN_COMP_INV_VREFINT_1_2 = 1,
    SYN_COMP_INV_VREFINT_3_4 = 2,
    SYN_COMP_INV_VREFINT = 3,
    SYN_COMP_INV_DAC1_CH1 = 4,
    SYN_COMP_INV_EXTERNAL = 5
};


Public Functions Documentation

function syn_port_comp_enable

Enable or disable hardware analog comparator.

SYN_Status syn_port_comp_enable (
    uint8_t comp_id,
    bool enable
) 

Parameters:

  • comp_id Comparator hardware index.
  • enable true to enable comparator, false to disable.

Returns:

SYN_OK on success.


function syn_port_comp_init

Initialize hardware analog comparator instance.

SYN_Status syn_port_comp_init (
    uint8_t comp_id,
    SYN_COMP_InvertingInput inv_in
) 

Parameters:

  • comp_id Comparator hardware index (0 = COMP1, 1 = COMP2).
  • inv_in Inverting reference input source.

Returns:

SYN_OK on success, SYN_INVALID_PARAM or SYN_ERROR on hardware error.


function syn_port_comp_read

Read real-time logical output state of the hardware comparator.

bool syn_port_comp_read (
    uint8_t comp_id
) 

Parameters:

  • comp_id Comparator hardware index.

Returns:

true if non-inverting input > inverting reference, false otherwise.



The documentation for this class was generated from the following file src/syntropic/port/syn_port_comp.h