From: Bdale Garbee Date: Mon, 6 Jan 2025 10:23:12 +0000 (-0700) Subject: fix quantimotor version/naming, make ready led blink rate twice as fast X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=3f9763fedbbf0abde6f130359b64d3487b899163;p=fw%2Faltos fix quantimotor version/naming, make ready led blink rate twice as fast --- diff --git a/src/quantimotor-v1/Makefile b/src/quantimotor-v1/Makefile deleted file mode 100644 index aa6bf9c0..00000000 --- a/src/quantimotor-v1/Makefile +++ /dev/null @@ -1,67 +0,0 @@ -# -# AltOS build -# -# - -include ../lpc/Makefile.defs - -INC = \ - ao.h \ - ao_arch.h \ - ao_arch_funcs.h \ - ao_pins.h \ - ao_product.h \ - lpc.h - -# -# Common AltOS sources -# - -ALTOS_SRC = \ - ao_interrupt.c \ - ao_boot_chain.c \ - ao_product.c \ - ao_mutex.c \ - ao_panic.c \ - ao_stdio.c \ - ao_storage.c \ - ao_data.c \ - ao_convert_volt.c \ - ao_task.c \ - ao_cmd.c \ - ao_timer_lpc.c \ - ao_romconfig.c \ - ao_adc_lpc.c \ - ao_serial_lpc.c \ - ao_usb_lpc.c \ - ao_led.c - -PRODUCT=QuantiMotor-v1 -PRODUCT_DEF=-DQUANTIMOTOR_V_1 -IDPRODUCT=0x002d - -CFLAGS = $(PRODUCT_DEF) $(LPC_CFLAGS) - -PROGNAME=quantimotor-v3 -PROG=$(PROGNAME)-$(VERSION).elf -HEX=$(PROGNAME)-$(VERSION).ihx - -SRC=$(ALTOS_SRC) ao_quantimotor.c -OBJ=$(SRC:.c=.o) - -all: $(PROG) $(HEX) - -$(PROG): Makefile $(OBJ) - $(call quiet,CC) $(LDFLAGS) -o $(PROG) $(OBJ) $(LIBS) - -$(OBJ): $(INC) - -distclean: clean - -clean: - rm -f *.o $(PROGNAME)-*.elf $(PROGNAME)-*.ihx $(PROGNAME)-*.map - rm -f ao_product.h ao_serial_lpc.h - -install: - -uninstall: diff --git a/src/quantimotor-v1/ao_pins.h b/src/quantimotor-v1/ao_pins.h deleted file mode 100644 index 5b4a6111..00000000 --- a/src/quantimotor-v1/ao_pins.h +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright © 2024 Bdale Garbee - * GPLv3 - */ - -#include -#include -#include - -static struct ao_task ao_console_read_task; -static struct ao_task ao_console_write_task; -static struct ao_task ao_health_indicator_task; - -static void -ao_console_read(void) -{ - int c; - for (;;) { - ao_arch_block_interrupts(); - c = _ao_serial0_pollchar(); - ao_arch_release_interrupts(); - if (c == AO_READ_AGAIN) { - flush(); - c = ao_serial0_getchar(); - } - ao_usb_putchar((char) c); - } -} - -static void -ao_console_write(void) -{ - char c; - for (;;) { - c = ao_usb_getchar(); - ao_serial0_putchar(c); - } -} - -static void -ao_health_indicator(void) -{ - int ledstate = 0; - - for (;;) { - if (ao_gpio_get(HEALTH_PORT, HEALTH_PIN)) { - ao_led_on(AO_LED_HEALTH); - } else { - if (ledstate) { - ledstate = 0; - ao_led_off(AO_LED_HEALTH); - } else { - ledstate = 1; - ao_led_on(AO_LED_HEALTH); - } - } - ao_delay(AO_MS_TO_TICKS(1000)); - } -} - -int -main(void) -{ - ao_clock_init(); - ao_task_init(); - ao_timer_init(); - - ao_led_init(); - - /* set up the input we watch to sense SOM "health" */ - /* choosing pull down so SOM has to actually assert readiness */ - ao_enable_input(HEALTH_PORT, HEALTH_PIN, 0); - - ao_adc_init(); - - ao_usb_init(); - - ao_serial_init(); - ao_serial0_set_speed(AO_SERIAL_SPEED_115200); - - /* the command interpreter could interfere with usb -> serial */ - /* ao_cmd_init(); */ - - ao_add_task(&ao_console_read_task, ao_console_read, "console_read"); - ao_add_task(&ao_console_write_task, ao_console_write, "console_write"); - ao_add_task(&ao_health_indicator_task, ao_health_indicator, "health_indicator"); - - ao_start_scheduler(); - return 0; -} diff --git a/src/quantimotor-v1/flash-loader/Makefile b/src/quantimotor-v1/flash-loader/Makefile deleted file mode 100644 index 9927e810..00000000 --- a/src/quantimotor-v1/flash-loader/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -# -# 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 deleted file mode 100644 index 092b7201..00000000 --- a/src/quantimotor-v1/flash-loader/ao_pins.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright © 2024 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_ */ diff --git a/src/quantimotor-v2/Makefile b/src/quantimotor-v2/Makefile new file mode 100644 index 00000000..c4fd6cba --- /dev/null +++ b/src/quantimotor-v2/Makefile @@ -0,0 +1,67 @@ +# +# AltOS build +# +# + +include ../lpc/Makefile.defs + +INC = \ + ao.h \ + ao_arch.h \ + ao_arch_funcs.h \ + ao_pins.h \ + ao_product.h \ + lpc.h + +# +# Common AltOS sources +# + +ALTOS_SRC = \ + ao_interrupt.c \ + ao_boot_chain.c \ + ao_product.c \ + ao_mutex.c \ + ao_panic.c \ + ao_stdio.c \ + ao_storage.c \ + ao_data.c \ + ao_convert_volt.c \ + ao_task.c \ + ao_cmd.c \ + ao_timer_lpc.c \ + ao_romconfig.c \ + ao_adc_lpc.c \ + ao_serial_lpc.c \ + ao_usb_lpc.c \ + ao_led.c + +PRODUCT=QuantiMotor-v2 +PRODUCT_DEF=-DQUANTIMOTOR_V_2 +IDPRODUCT=0x002d + +CFLAGS = $(PRODUCT_DEF) $(LPC_CFLAGS) + +PROGNAME=quantimotor-v2 +PROG=$(PROGNAME)-$(VERSION).elf +HEX=$(PROGNAME)-$(VERSION).ihx + +SRC=$(ALTOS_SRC) ao_quantimotor.c +OBJ=$(SRC:.c=.o) + +all: $(PROG) $(HEX) + +$(PROG): Makefile $(OBJ) + $(call quiet,CC) $(LDFLAGS) -o $(PROG) $(OBJ) $(LIBS) + +$(OBJ): $(INC) + +distclean: clean + +clean: + rm -f *.o $(PROGNAME)-*.elf $(PROGNAME)-*.ihx $(PROGNAME)-*.map + rm -f ao_product.h ao_serial_lpc.h + +install: + +uninstall: diff --git a/src/quantimotor-v2/ao_pins.h b/src/quantimotor-v2/ao_pins.h new file mode 100644 index 00000000..5b4a6111 --- /dev/null +++ b/src/quantimotor-v2/ao_pins.h @@ -0,0 +1,98 @@ +/* + * Copyright © 2024 Bdale Garbee + * GPLv3 + */ + +#include +#include +#include + +static struct ao_task ao_console_read_task; +static struct ao_task ao_console_write_task; +static struct ao_task ao_health_indicator_task; + +static void +ao_console_read(void) +{ + int c; + for (;;) { + ao_arch_block_interrupts(); + c = _ao_serial0_pollchar(); + ao_arch_release_interrupts(); + if (c == AO_READ_AGAIN) { + flush(); + c = ao_serial0_getchar(); + } + ao_usb_putchar((char) c); + } +} + +static void +ao_console_write(void) +{ + char c; + for (;;) { + c = ao_usb_getchar(); + ao_serial0_putchar(c); + } +} + +static void +ao_health_indicator(void) +{ + int ledstate = 0; + + for (;;) { + if (ao_gpio_get(HEALTH_PORT, HEALTH_PIN)) { + ao_led_on(AO_LED_HEALTH); + } else { + if (ledstate) { + ledstate = 0; + ao_led_off(AO_LED_HEALTH); + } else { + ledstate = 1; + ao_led_on(AO_LED_HEALTH); + } + } + ao_delay(AO_MS_TO_TICKS(500)); + } +} + +int +main(void) +{ + ao_clock_init(); + ao_task_init(); + ao_timer_init(); + + ao_led_init(); + + /* set up the input we watch to sense SOM "health" */ + /* choosing pull down so SOM has to actually assert readiness */ + ao_enable_input(HEALTH_PORT, HEALTH_PIN, 0); + + ao_adc_init(); + + ao_usb_init(); + + ao_serial_init(); + ao_serial0_set_speed(AO_SERIAL_SPEED_115200); + + /* the command interpreter could interfere with usb -> serial */ + /* ao_cmd_init(); */ + + ao_add_task(&ao_console_read_task, ao_console_read, "console_read"); + ao_add_task(&ao_console_write_task, ao_console_write, "console_write"); + ao_add_task(&ao_health_indicator_task, ao_health_indicator, "health_indicator"); + + ao_start_scheduler(); + return 0; +} diff --git a/src/quantimotor-v2/flash-loader/Makefile b/src/quantimotor-v2/flash-loader/Makefile new file mode 100644 index 00000000..3234e0cd --- /dev/null +++ b/src/quantimotor-v2/flash-loader/Makefile @@ -0,0 +1,8 @@ +# +# AltOS flash loader build +# +# + +TOPDIR=../.. +HARDWARE=quantimotor-v2 +include $(TOPDIR)/lpc/Makefile-flash.defs diff --git a/src/quantimotor-v2/flash-loader/ao_pins.h b/src/quantimotor-v2/flash-loader/ao_pins.h new file mode 100644 index 00000000..092b7201 --- /dev/null +++ b/src/quantimotor-v2/flash-loader/ao_pins.h @@ -0,0 +1,21 @@ +/* + * Copyright © 2024 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_ */