From 68c9e7fd5da45cb76e94bd0a48df35dec5f25267 Mon Sep 17 00:00:00 2001 From: Bdale Garbee Date: Sat, 10 Dec 2022 02:10:54 -0700 Subject: [PATCH] first pass at creating firmware for lpc on QuantiMotor v1 --- src/lpc/ao_adc_lpc.c | 2 +- src/quantimotor-v1/ao_pins.h | 80 +++++++++++++++++++++++ src/quantimotor-v1/ao_quantimotor.c | 25 +++++++ src/quantimotor-v1/flash-loader/Makefile | 8 +++ src/quantimotor-v1/flash-loader/ao_pins.h | 21 ++++++ 5 files changed, 135 insertions(+), 1 deletion(-) create mode 100644 src/quantimotor-v1/ao_pins.h create mode 100644 src/quantimotor-v1/ao_quantimotor.c create mode 100644 src/quantimotor-v1/flash-loader/Makefile create mode 100644 src/quantimotor-v1/flash-loader/ao_pins.h diff --git a/src/lpc/ao_adc_lpc.c b/src/lpc/ao_adc_lpc.c index 1fbf1366..aeb4db67 100644 --- a/src/lpc/ao_adc_lpc.c +++ b/src/lpc/ao_adc_lpc.c @@ -146,7 +146,7 @@ ao_adc_dump(void) #ifdef AO_ADC_DUMP AO_ADC_DUMP(&packet); #else - printf("tick: %5u", packet.tick); + printf("tick: %5lu", packet.tick); d = (int16_t *) (&packet.adc); for (i = 0; i < AO_ADC_NUM; i++) printf (" %2d: %5d", i, d[i]); diff --git a/src/quantimotor-v1/ao_pins.h b/src/quantimotor-v1/ao_pins.h new file mode 100644 index 00000000..fbd77c11 --- /dev/null +++ b/src/quantimotor-v1/ao_pins.h @@ -0,0 +1,80 @@ +/* + * Copyright © 2022 Bdale Garbee + * GPLv3 + */ + +#include +#include + +int +main(void) +{ + ao_clock_init(); + ao_task_init(); + ao_timer_init(); + ao_exti_init(); + + ao_adc_init(); + + ao_usb_init(); + + ao_cmd_init(); + ao_config_init(); + + ao_start_scheduler(); +} diff --git a/src/quantimotor-v1/flash-loader/Makefile b/src/quantimotor-v1/flash-loader/Makefile new file mode 100644 index 00000000..9927e810 --- /dev/null +++ b/src/quantimotor-v1/flash-loader/Makefile @@ -0,0 +1,8 @@ +# +# AltOS flash loader build +# +# + +TOPDIR=../.. +HARDWARE=quantimotor-v1 +include $(TOPDIR)/lpc/Makefile-flash.defs diff --git a/src/quantimotor-v1/flash-loader/ao_pins.h b/src/quantimotor-v1/flash-loader/ao_pins.h new file mode 100644 index 00000000..3a69cd6c --- /dev/null +++ b/src/quantimotor-v1/flash-loader/ao_pins.h @@ -0,0 +1,21 @@ +/* + * Copyright © 2022 Bdale Garbee + * GPLv3 + */ + +#ifndef _AO_PINS_H_ +#define _AO_PINS_H_ + +#include + +#define AO_BOOT_PIN 1 +#define AO_BOOT_APPLICATION_GPIO 0 +#define AO_BOOT_APPLICATION_PIN 7 +#define AO_BOOT_APPLICATION_VALUE 1 +#define AO_BOOT_APPLICATION_MODE AO_EXTI_MODE_PULL_UP + +#define HAS_USB_PULLUP 1 +#define AO_USB_PULLUP_PORT 0 +#define AO_USB_PULLUP_PIN 20 + +#endif /* _AO_PINS_H_ */ -- 2.47.2