shibosoftwaredev/f1c100s-linux-nema17-stepper-controller

A four-layer NEMA 17 motor-controller PCB combining an Allwinner F1C100S Linux computer, USB‑PD/buck power system, W5500 Ethernet, STM32 real-time motion control, DRV8825 stepper driver, protection/temperature/current telemetry, USB interfaces, and local LED/buzzer diagnostics.

Version
0.4.56
License
unset
Stars
0

firmware/stm32/current.h

#pragma once
#include <stdbool.h>
#include <stdint.h>

enum { CURRENT_A_VALID=1, CURRENT_B_VALID=2, CURRENT_A_CLIPPED=4, CURRENT_B_CLIPPED=8 };
typedef struct {
  uint16_t raw_a,raw_b,vdda_mv;
  uint32_t now;
  bool adc_ok;
} CurrentSample;
typedef struct {
  int32_t a_ma,b_ma;
  uint16_t raw_a,raw_b,vdda_mv,age_ms;
  uint8_t flags;
  uint32_t updated_at;
} CurrentTelemetry;

void current_update(CurrentTelemetry *, const CurrentSample *);
CurrentTelemetry current_snapshot(const CurrentTelemetry *, uint32_t now);