]> git.gag.com Git - fw/altos/commitdiff
fix quantimotor version/naming, make ready led blink rate twice as fast
authorBdale Garbee <bdale@gag.com>
Mon, 6 Jan 2025 10:23:12 +0000 (03:23 -0700)
committerBdale Garbee <bdale@gag.com>
Tue, 6 May 2025 18:37:26 +0000 (12:37 -0600)
src/quantimotor-v1/Makefile [deleted file]
src/quantimotor-v1/ao_pins.h [deleted file]
src/quantimotor-v1/ao_quantimotor.c [deleted file]
src/quantimotor-v1/flash-loader/Makefile [deleted file]
src/quantimotor-v1/flash-loader/ao_pins.h [deleted file]
src/quantimotor-v2/Makefile [new file with mode: 0644]
src/quantimotor-v2/ao_pins.h [new file with mode: 0644]
src/quantimotor-v2/ao_quantimotor.c [new file with mode: 0644]
src/quantimotor-v2/flash-loader/Makefile [new file with mode: 0644]
src/quantimotor-v2/flash-loader/ao_pins.h [new file with mode: 0644]

diff --git a/src/quantimotor-v1/Makefile b/src/quantimotor-v1/Makefile
deleted file mode 100644 (file)
index aa6bf9c..0000000
+++ /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 (file)
index 5b4a611..0000000
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Copyright © 2024 Bdale Garbee <bdale@gag.com
- * GPLv3
- */
-
-#ifndef _AO_PINS_H_
-#define _AO_PINS_H_
-
-#define AO_STACK_SIZE  320
-
-#define IS_FLASH_LOADER        0
-
-/* Crystal on the board */
-#define AO_LPC_CLKIN   12000000
-
-/* Main clock frequency. 48MHz for USB so we don't use the USB PLL */
-#define AO_LPC_CLKOUT  48000000
-
-/* System clock frequency */
-#define AO_LPC_SYSCLK  24000000
-
-#define HAS_EEPROM             0
-#define USE_INTERNAL_FLASH     0
-#define USE_STORAGE_CONFIG     0
-#define USE_EEPROM_CONFIG      0
-
-#define HAS_USB                        1
-#define HAS_USB_CONNECT                0
-#define HAS_USB_VBUS           0
-#define HAS_USB_PULLUP         1
-#define AO_USB_PULLUP_PORT     0
-#define AO_USB_PULLUP_PIN      20 
-
-/* USART */
-
-#define HAS_SERIAL_0            1
-#define USE_SERIAL_0_STDIN      0
-#define SERIAL_0_18_19          1
-
-#define HAS_BEEP               0
-#define HAS_RADIO              0
-#define HAS_TELEMETRY          0
-#define HAS_RSSI               0
-
-#define HAS_SPI_0              0
-#define SPI_SCK0_P0_6          0
-
-#define PACKET_HAS_SLAVE       0
-#define PACKET_HAS_MASTER      0
-
-#define LOW_LEVEL_DEBUG                0
-
-#define HAS_GPS                        0
-#define HAS_FLIGHT             0
-#define HAS_LOG                        0
-
-#define AO_DATA_RING           16
-
-/* SOM sets "health" high when system is ready */
-#define HEALTH_PORT            1
-#define HEALTH_PIN             19
-
-/* LED */
-
-#define HAS_LED                        1
-#define LED_0_PORT              0
-#define LED_0_PIN              8
-#define AO_LED_HEALTH           (1 << 0)
-#define AO_LED_PANIC           AO_LED_HEALTH
-
-/*
- * ADC
- */
-
-#define HAS_ADC                 1
-
-#define AO_NUM_ADC              7
-
-#define AO_ADC_0                1
-#define AO_ADC_1                1
-#define AO_ADC_2                1
-#define AO_ADC_3                1
-#define AO_ADC_4                0
-#define AO_ADC_5                1
-#define AO_ADC_6                1
-#define AO_ADC_7                1
-
-struct ao_adc {
-        int16_t         v_batt;
-        int16_t         v_pyro;
-        int16_t         sense_1;
-        int16_t         adc3;
-        int16_t         adc5;
-        int16_t         adc6;
-        int16_t         adc7;
-};
-
-#endif /* _AO_PINS_H_ */
diff --git a/src/quantimotor-v1/ao_quantimotor.c b/src/quantimotor-v1/ao_quantimotor.c
deleted file mode 100644 (file)
index 2badefe..0000000
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Copyright © 2024 Bdale Garbee <bdale@gag.com>
- * GPLv3
- */
-
-#include <ao.h>
-#include <ao_serial.h>
-#include <ao_exti.h>
-
-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 (file)
index 9927e81..0000000
+++ /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 (file)
index 092b720..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Copyright © 2024 Bdale Garbee <bdale@gag.com>
- * GPLv3
- */
-
-#ifndef _AO_PINS_H_
-#define _AO_PINS_H_
-
-#include <ao_flash_lpc_pins.h>
-
-#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 (file)
index 0000000..c4fd6cb
--- /dev/null
@@ -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 (file)
index 0000000..5b4a611
--- /dev/null
@@ -0,0 +1,98 @@
+/*
+ * Copyright © 2024 Bdale Garbee <bdale@gag.com
+ * GPLv3
+ */
+
+#ifndef _AO_PINS_H_
+#define _AO_PINS_H_
+
+#define AO_STACK_SIZE  320
+
+#define IS_FLASH_LOADER        0
+
+/* Crystal on the board */
+#define AO_LPC_CLKIN   12000000
+
+/* Main clock frequency. 48MHz for USB so we don't use the USB PLL */
+#define AO_LPC_CLKOUT  48000000
+
+/* System clock frequency */
+#define AO_LPC_SYSCLK  24000000
+
+#define HAS_EEPROM             0
+#define USE_INTERNAL_FLASH     0
+#define USE_STORAGE_CONFIG     0
+#define USE_EEPROM_CONFIG      0
+
+#define HAS_USB                        1
+#define HAS_USB_CONNECT                0
+#define HAS_USB_VBUS           0
+#define HAS_USB_PULLUP         1
+#define AO_USB_PULLUP_PORT     0
+#define AO_USB_PULLUP_PIN      20 
+
+/* USART */
+
+#define HAS_SERIAL_0            1
+#define USE_SERIAL_0_STDIN      0
+#define SERIAL_0_18_19          1
+
+#define HAS_BEEP               0
+#define HAS_RADIO              0
+#define HAS_TELEMETRY          0
+#define HAS_RSSI               0
+
+#define HAS_SPI_0              0
+#define SPI_SCK0_P0_6          0
+
+#define PACKET_HAS_SLAVE       0
+#define PACKET_HAS_MASTER      0
+
+#define LOW_LEVEL_DEBUG                0
+
+#define HAS_GPS                        0
+#define HAS_FLIGHT             0
+#define HAS_LOG                        0
+
+#define AO_DATA_RING           16
+
+/* SOM sets "health" high when system is ready */
+#define HEALTH_PORT            1
+#define HEALTH_PIN             19
+
+/* LED */
+
+#define HAS_LED                        1
+#define LED_0_PORT              0
+#define LED_0_PIN              8
+#define AO_LED_HEALTH           (1 << 0)
+#define AO_LED_PANIC           AO_LED_HEALTH
+
+/*
+ * ADC
+ */
+
+#define HAS_ADC                 1
+
+#define AO_NUM_ADC              7
+
+#define AO_ADC_0                1
+#define AO_ADC_1                1
+#define AO_ADC_2                1
+#define AO_ADC_3                1
+#define AO_ADC_4                0
+#define AO_ADC_5                1
+#define AO_ADC_6                1
+#define AO_ADC_7                1
+
+struct ao_adc {
+        int16_t         v_batt;
+        int16_t         v_pyro;
+        int16_t         sense_1;
+        int16_t         adc3;
+        int16_t         adc5;
+        int16_t         adc6;
+        int16_t         adc7;
+};
+
+#endif /* _AO_PINS_H_ */
diff --git a/src/quantimotor-v2/ao_quantimotor.c b/src/quantimotor-v2/ao_quantimotor.c
new file mode 100644 (file)
index 0000000..8fdd839
--- /dev/null
@@ -0,0 +1,90 @@
+/*
+ * Copyright © 2024 Bdale Garbee <bdale@gag.com>
+ * GPLv3
+ */
+
+#include <ao.h>
+#include <ao_serial.h>
+#include <ao_exti.h>
+
+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 (file)
index 0000000..3234e0c
--- /dev/null
@@ -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 (file)
index 0000000..092b720
--- /dev/null
@@ -0,0 +1,21 @@
+/*
+ * Copyright © 2024 Bdale Garbee <bdale@gag.com>
+ * GPLv3
+ */
+
+#ifndef _AO_PINS_H_
+#define _AO_PINS_H_
+
+#include <ao_flash_lpc_pins.h>
+
+#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_ */