0
mirror of https://gitlab.com/hyperglitch/jellyfish.git synced 2026-01-02 16:21:55 +00:00

30 lines
751 B
C

/*
* SPDX-FileCopyrightText: 2025 Igor Brkic <igor@hyperglitch.com>
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
#ifndef JF_SOURCE_H
#define JF_SOURCE_H
#include <stdint.h>
#include <stdbool.h>
typedef enum {
JF_CURRENT_LIMIT_POSITIVE,
JF_CURRENT_LIMIT_NEGATIVE,
JF_CURRENT_LIMIT_BOTH,
} jf_current_limit_t;
bool jf_source_enable(bool en);
bool jf_source_is_enabled();
bool jf_source_set_voltage_raw(uint16_t code, bool from_isr);
bool jf_source_set_voltage(int32_t voltage_mv, bool from_isr);
bool jf_source_set_current_limit(int32_t current_ma, jf_current_limit_t direction, bool from_isr);
int32_t jf_source_get_voltage();
void jf_source_get_current_limit(int32_t *limit_plus, int32_t *limit_minus);
#endif //JF_SOURCE_H