techmannih/nema34-mounted-stepper-controller
A USB-C PD-powered RP2040 motor controller with protected 48 V power, DRV8262 dual-bridge drive for a NEMA34 motor, regenerative-braking resistor, isolated sensing, hardware interlocks, and telemetry/status interfaces.
- Version
- 0.3.113
- License
- unset
- Stars
- 1
firmware/src/as5600.c
#include "as5600.h"
bool as5600_sample(as5600_read_fn read, void *context, as5600_sample_t *s) {
uint8_t bytes[3]={0};
*s=(as5600_sample_t){0};
if(!read || !read(context,0x0b,bytes,3)) return false;
s->status=bytes[0];
if((bytes[0]&0x38u)!=0x20u || (bytes[1]&0xf0u)) return false;
s->angle=((uint16_t)bytes[1]<<8)|bytes[2]; s->valid=true; return true;
}