diff options
| author | dmlunar <root@lunar.sh> | 2025-01-22 16:47:21 +0200 |
|---|---|---|
| committer | dmlunar <root@lunar.sh> | 2025-10-15 23:42:50 +0200 |
| commit | 729f2a2c3ebfb2612d873caf453a1d7ca02180d9 (patch) | |
| tree | 7bab2fcc0c7f50eab3013348697bc06ddd71d551 /firmware/inc/module | |
| download | varpa-729f2a2c3ebfb2612d873caf453a1d7ca02180d9.tar.gz varpa-729f2a2c3ebfb2612d873caf453a1d7ca02180d9.zip | |
varpa: initial public commit
Diffstat (limited to 'firmware/inc/module')
| -rw-r--r-- | firmware/inc/module/drain.h | 37 | ||||
| -rw-r--r-- | firmware/inc/module/gate.h | 32 |
2 files changed, 69 insertions, 0 deletions
diff --git a/firmware/inc/module/drain.h b/firmware/inc/module/drain.h new file mode 100644 index 0000000..7b9d66d --- /dev/null +++ b/firmware/inc/module/drain.h @@ -0,0 +1,37 @@ +/** + * + * Author: Dylan Muller + * Copyright (c) 2025 + * All rights reserved. + * + * - Commercial/IP use prohibited. + * - Attribution required. + * See License.txt + * + */ + +#ifndef DRAIN_H_ +#define DRAIN_H_ + +#include <stdint.h> + +#define DRAIN_PROBE_START 0 // mV +#define DRAIN_PROBE_LIMIT 3000 +#define DRAIN_PROBE_INC_FINE 1 +#define DRAIN_PROBE_INC_COARSE 5 +#define DRAIN_PROBE_INC_THRESHOLD 100 +#define DRAIN_Q_AMP 100 // mA +#define DRAIN_TEST_COUNT 10 +#define DRAIN_TEST_BOUNDARY 10 +#define DRAIN_POWER_SAMPLES 10 +#define DRAIN_LOOP_DELAY_US 1000 +#define DRAIN_SETPOINT_TIMEOUT_MS 1500 +#define DRAIN_POWER_LOW_LIM 0 +#define DRAIN_POWER_HIGH_LIM 3000 +#define DRAIN_POWER_MODULUS 50 + +uint16_t drain_sweep_pwr( + int16_t target_fw_pwr +); + +#endif diff --git a/firmware/inc/module/gate.h b/firmware/inc/module/gate.h new file mode 100644 index 0000000..9f399c4 --- /dev/null +++ b/firmware/inc/module/gate.h @@ -0,0 +1,32 @@ +/** + * + * Author: Dylan Muller + * Copyright (c) 2025 + * All rights reserved. + * + * - Commercial/IP use prohibited. + * - Attribution required. + * See License.txt + * + */ + +#ifndef GATE_H_ +#define GATE_H_ + +#include <stdint.h> +#include <stdbool.h> +#include <util/delay.h> + +#define GATE_PROBE_START 2800 // mV +#define GATE_PROBE_LIMIT 3300 // mV +#define GATE_PROBE_DRAIN 1000 // mV +#define GATE_PROBE_INC 1 // COUNTS +#define GATE_PA_POWER_DOWN 1 +#define GATE_LOOP_DELAY_US 1000 + +uint16_t gate_probe( + uint16_t target_amp, // mA + uint16_t* probe_result +); + +#endif |
