From f60fcd1bb7b1044a7da5f6ecff89289f091a2773 Mon Sep 17 00:00:00 2001 From: Clyne Sullivan Date: Thu, 22 Oct 2015 14:47:59 -0400 Subject: hey --- src/5106z.c | 105 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 105 insertions(+) create mode 100644 src/5106z.c (limited to 'src/5106z.c') diff --git a/src/5106z.c b/src/5106z.c new file mode 100644 index 0000000..83462ce --- /dev/null +++ b/src/5106z.c @@ -0,0 +1,105 @@ +#include <5106z.h> +#include + +typedef struct { + int8_t *speedP; + int8_t speed; + uint8_t thresh; + uint8_t polarity :1; + uint8_t enable :1; + uint8_t useptr :1; + uint8_t imeable :3; +} __attribute__ ((packed)) motor_t; + +static motor_t motor[11]; + +void motor_init(uint8_t count,...){ + va_list m; + uint8_t i; + memset(motor,0,11*sizeof(motor_t)); + va_start(m,count); + for(i=0;imotor[port].thresh?speed:0); +} + +int motor_setSpeedSum(uint8_t port,uint8_t args,...){ + va_list s; + uint8_t i; + int8_t speed=0; + if(!motor[port].enable)return -1; + va_start(s,args); + for(i=0;i