Skip to content

Instantly share code, notes, and snippets.

@Gadgetoid
Gadgetoid / Makefile
Last active October 21, 2024 00:48
Pi 400 KB
CFLAGS_ALL=-I../libusbgx/build/include -I../bcm2835-1.68/build/include -L../bcm2835-1.68/build/lib -I../lua-5.4.0/src -L../libusbgx/build/lib -L../libserialport/build/lib -L../lua-5.4.0/src -lpng -lz -lpthread -llua -lm -lbcm2835 -ldl
pi400: CFLAGS+=-static $(CFLAGS_ALL) -lusbgx -lconfig -DPI400_USB
pi400: pi400.c gadget-hid.c
$(CC) $^ $(CFLAGS) -o $@
pi400test: CFLAGS+=-static $(CFLAGS_ALL) -lusbgx -lconfig
pi400test: pi400.c gadget-hid.c
$(CC) $^ $(CFLAGS) -o $@
/** @brief RC Mixer
* @detailed Takes 2 RC signals and mixes them to produce tank style steering. The results are scaled to ensure no stick travel is wasted.
*
* Algorithm copied from here: http://electronics.stackexchange.com/questions/19669/algorithm-for-mixing-2-axis-analog-input-to-control-a-differential-motor-drive
*
* @param inThrottle The throttle channel RC value, constrained to -255 and +255
* @param inYaw The steering channel RC value, constrained to -255 and +255
* @param outLeft The left motor output, constrained to -255 and +255
* @param outRight The right motor output, constrained to -255 and +255
*/