AnasSarkiz/usb-c-pd-brushed-motor
USB-C PD-powered motor controller with protected input, selectable 5/9/12 V buck supply, MCU qualification, PWM H-bridge drive, overvoltage sensing, regenerative energy-dump resistors, and safety interlocks.
- Version
- 0.0.1-a48-cloud-pipeline9-unrouted-c41d79a-305b1e7a
- License
- unset
- Stars
- 0
firmware/freestanding_memory.c
#include <stddef.h>
/* Real freestanding memory operations; no heap, OS, constructors or hosted
* libc. -fno-builtin prevents these loops from recursively calling themselves. */
void *memcpy(void *destination, const void *source, size_t count) {
unsigned char *out=destination; const unsigned char *in=source;
for(size_t i=0;i<count;++i) out[i]=in[i];
return destination;
}
void *memset(void *destination, int byte, size_t count) {
unsigned char *out=destination;
for(size_t i=0;i<count;++i) out[i]=(unsigned char)byte;
return destination;
}
void __aeabi_memcpy(void *destination, const void *source, size_t count) {
(void)memcpy(destination,source,count);
}
void __aeabi_memcpy4(void *destination, const void *source, size_t count) {
(void)memcpy(destination,source,count);
}
void __aeabi_memclr(void *destination, size_t count) { (void)memset(destination,0,count); }
void __aeabi_memclr4(void *destination, size_t count) { (void)memset(destination,0,count); }