]> git.gag.com Git - fw/altos/commitdiff
first pass at creating firmware for lpc on QuantiMotor v1
authorBdale Garbee <bdale@gag.com>
Sat, 10 Dec 2022 09:10:54 +0000 (02:10 -0700)
committerBdale Garbee <bdale@gag.com>
Sat, 10 Dec 2022 09:10:54 +0000 (02:10 -0700)
src/lpc/ao_adc_lpc.c
src/quantimotor-v1/ao_pins.h [new file with mode: 0644]
src/quantimotor-v1/ao_quantimotor.c [new file with mode: 0644]
src/quantimotor-v1/flash-loader/Makefile [new file with mode: 0644]
src/quantimotor-v1/flash-loader/ao_pins.h [new file with mode: 0644]

index 29d3668cedb1fdff4824dfa5ba2494610604ab81..411015d48eec7ac11dbefe5113b9767598dbe391 100644 (file)
@@ -143,7 +143,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 (file)
index 0000000..fbd77c1
--- /dev/null
@@ -0,0 +1,80 @@
+/*
+ * Copyright © 2022 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
+
+#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
+
+/*
+ * 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
new file mode 100644 (file)
index 0000000..226c37a
--- /dev/null
@@ -0,0 +1,25 @@
+/*
+ * Copyright © 2022 Bdale Garbee <bdale@gag.com>
+ * GPLv3
+ */
+
+#include <ao.h>
+#include <ao_exti.h>
+
+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 (file)
index 0000000..9927e81
--- /dev/null
@@ -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 (file)
index 0000000..3a69cd6
--- /dev/null
@@ -0,0 +1,21 @@
+/*
+ * Copyright © 2022 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_ */