diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/avr/ao_pwmin.c | 90 | ||||
-rw-r--r-- | src/avr/ao_pwmin.h | 18 | ||||
-rw-r--r-- | src/core/ao.h | 5 | ||||
-rw-r--r-- | src/core/ao_panic.c | 10 | ||||
-rw-r--r-- | src/drivers/ao_cc1120.c | 4 | ||||
-rw-r--r-- | src/drivers/ao_mma655x.c | 134 | ||||
-rw-r--r-- | src/drivers/ao_mpu6000.c | 2 | ||||
-rw-r--r-- | src/drivers/ao_ms5607.c | 35 | ||||
-rw-r--r-- | src/drivers/ao_radio_slave.c | 10 | ||||
-rw-r--r-- | src/megametrum-v0.1/ao_pins.h | 24 | ||||
-rw-r--r-- | src/product/ao_telescience.c | 2 | ||||
-rw-r--r-- | src/telescience-v0.1/Makefile | 1 |
12 files changed, 147 insertions, 188 deletions
diff --git a/src/avr/ao_pwmin.c b/src/avr/ao_pwmin.c deleted file mode 100644 index 84397357..00000000 --- a/src/avr/ao_pwmin.c +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright © 2012 Robert D. Garbee <robert@gag.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - */ - -#include "ao.h" -#include "ao_pwmin.h" - -/* - * This code implements a PWM input using ICP3. - * - * The initial use is to measure wind speed in the ULA/Ball summer intern - * project payload developed at Challenger Middle School. - */ - -volatile __data uint16_t ao_icp3_count = 0; -volatile __data uint16_t ao_icp3_last = 0; - -uint16_t ao_icp3(void) -{ - uint16_t v; - ao_arch_critical( - v = ao_icp3_count; - ); - return v; -} - -static void -ao_pwmin_display(void) __reentrant -{ - /* display the most recent value */ - printf("icp 3: %5u\n", ao_icp3()); - -} - - -ISR(TIMER3_CAPT_vect) -{ - - uint8_t lo = ICR3L; - uint8_t hi = ICR3H; - uint16_t ao_icp3_this = (hi <<8) | lo; - - /* handling counter rollovers */ - if (ao_icp3_this >= ao_icp3_last) - ao_icp3_count = ao_icp3_this - ao_icp3_last; - else - ao_icp3_count = ao_icp3_this + (65536 - ao_icp3_last); - ao_icp3_last = ao_icp3_this; -} - -__code struct ao_cmds ao_pwmin_cmds[] = { - { ao_pwmin_display, "p\0PWM input" }, - { 0, NULL }, -}; - -void -ao_pwmin_init(void) -{ - /* do hardware setup here */ - TCCR3A = ((0 << WGM31) | /* normal mode, OCR3A */ - (0 << WGM30)); /* normal mode, OCR3A */ - TCCR3B = ((1 << ICNC3) | /* input capture noise canceler on */ - (0 << ICES3) | /* input capture on falling edge (don't care) */ - (0 << WGM33) | /* normal mode, OCR3A */ - (0 << WGM32) | /* normal mode, OCR3A */ - (3 << CS30)); /* clk/64 from prescaler */ - - - - TIMSK3 = (1 << ICIE3); /* Interrupt on input compare */ - - /* set the spike filter bit in the TCCR3B register */ - - ao_cmd_register(&ao_pwmin_cmds[0]); -} - - diff --git a/src/avr/ao_pwmin.h b/src/avr/ao_pwmin.h deleted file mode 100644 index bbab4ddc..00000000 --- a/src/avr/ao_pwmin.h +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Copyright © 2012 Robert D. Garbee <robert@gag.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - */ - -void ao_pwmin_init(void); diff --git a/src/core/ao.h b/src/core/ao.h index 66c0881f..4f4779ec 100644 --- a/src/core/ao.h +++ b/src/core/ao.h @@ -115,7 +115,10 @@ ao_start_scheduler(void); #define AO_PANIC_BT 11 /* Communications with bluetooth device failed */ #define AO_PANIC_STACK 12 /* Stack overflow */ #define AO_PANIC_SPI 13 /* SPI communication failure */ -#define AO_PANIC_SELF_TEST 14 /* Self test failure */ +#define AO_PANIC_SELF_TEST_CC1120 0x40 | 1 /* Self test failure */ +#define AO_PANIC_SELF_TEST_HMC5883 0x40 | 2 /* Self test failure */ +#define AO_PANIC_SELF_TEST_MPU6000 0x40 | 3 /* Self test failure */ +#define AO_PANIC_SELF_TEST_MS5607 0x40 | 4 /* Self test failure */ /* Stop the operating system, beeping and blinking the reason */ void diff --git a/src/core/ao_panic.c b/src/core/ao_panic.c index 25dc145e..52433044 100644 --- a/src/core/ao_panic.c +++ b/src/core/ao_panic.c @@ -65,7 +65,15 @@ ao_panic(uint8_t reason) #ifdef SDCC #pragma disable_warning 126 #endif - for (n = 0; n < reason; n++) { + if (reason & 0x40) { + ao_led_on(AO_LED_RED); + ao_beep(AO_BEEP_HIGH); + ao_panic_delay(40); + ao_led_off(AO_LED_RED); + ao_beep(AO_BEEP_OFF); + ao_panic_delay(10); + } + for (n = 0; n < (reason & 0x3f); n++) { ao_led_on(AO_LED_RED); ao_beep(AO_BEEP_MID); ao_panic_delay(10); diff --git a/src/drivers/ao_cc1120.c b/src/drivers/ao_cc1120.c index 4df931b5..2f9c296f 100644 --- a/src/drivers/ao_cc1120.c +++ b/src/drivers/ao_cc1120.c @@ -1028,12 +1028,12 @@ ao_radio_init(void) AO_CC1120_SPI_CS_PORT->bsrr = ((uint32_t) (1 << AO_CC1120_SPI_CS_PIN)); for (i = 0; i < 10000; i++) { - if ((SPI_2_GPIO->idr & (1 << SPI_2_MISO)) == 0) + if ((SPI_2_PORT->idr & (1 << SPI_2_MISO_PIN)) == 0) break; } AO_CC1120_SPI_CS_PORT->bsrr = (1 << AO_CC1120_SPI_CS_PIN); if (i == 10000) - ao_panic(AO_PANIC_SELF_TEST); + ao_panic(AO_PANIC_SELF_TEST_CC1120); /* Enable the EXTI interrupt for the appropriate pin */ ao_enable_port(AO_CC1120_INT_PORT); diff --git a/src/drivers/ao_mma655x.c b/src/drivers/ao_mma655x.c index cd304d80..06422206 100644 --- a/src/drivers/ao_mma655x.c +++ b/src/drivers/ao_mma655x.c @@ -20,67 +20,101 @@ #if HAS_MMA655X +#if 1 +#define PRINTD(...) do { printf ("\r%5u %s: ", ao_tick_count, __func__); printf(__VA_ARGS__); } while(0) +#else +#define PRINTD(...) +#endif + static uint8_t mma655x_configured; +uint8_t ao_mma655x_spi_index = AO_MMA655X_SPI_INDEX; + static void ao_mma655x_start(void) { - ao_spi_get_bit(AO_MMA655X_CS_GPIO, - AO_MMA655X_CS, + ao_spi_get_bit(AO_MMA655X_CS_PORT, AO_MMA655X_CS_PIN, + AO_MMA655X_CS, AO_MMA655X_SPI_INDEX, AO_SPI_SPEED_FAST); } static void ao_mma655x_stop(void) { - ao_spi_put_bit(AO_MMA655X_CS_GPIO, - AO_MMA655X_CS, + ao_spi_put_bit(AO_MMA655X_CS_PORT, AO_MMA655X_CS_PIN, + AO_MMA655X_CS, AO_MMA655X_SPI_INDEX); } +static void +ao_mma655x_restart(void) { + uint8_t i; + ao_gpio_set(AO_MMA655X_CS_PORT, AO_MMA655X_CS_PIN, AO_MMA655X_CS, 1); + + /* Emperical testing on STM32L151 at 32MHz for this delay amount */ + for (i = 0; i < 9; i++) + ao_arch_nop(); + ao_gpio_set(AO_MMA655X_CS_PORT, AO_MMA655X_CS_PIN, AO_MMA655X_CS, 0); +} + static uint8_t ao_parity(uint8_t v) { + uint8_t p; /* down to four bits */ - v = (v ^ (v >> 4)) & 0xf; + p = (v ^ (v >> 4)) & 0xf; /* Cute lookup hack -- 0x6996 encodes the sixteen * even parity values in order. */ - return (~0x6996 >> v) & 1; + p = (~0x6996 >> p) & 1; + return p; } static void ao_mma655x_cmd(uint8_t d[2]) { ao_mma655x_start(); - ao_spi_send(d, 2, AO_MMA655X_SPI_INDEX); - ao_spi_recv(d, 2, AO_MMA655X_SPI_INDEX); + PRINTD("\tSEND %02x %02x\n", d[0], d[1]); + ao_spi_duplex(d, d, 2, AO_MMA655X_SPI_INDEX); + PRINTD("\t\tRECV %02x %02x\n", d[0], d[1]); ao_mma655x_stop(); } static uint8_t -ao_mma655x_reg_write(uint8_t addr, uint8_t value) +ao_mma655x_reg_read(uint8_t addr) { uint8_t d[2]; + ao_mma655x_start(); + d[0] = addr | (ao_parity(addr) << 7); + d[1] = 0; + ao_spi_send(&d, 2, AO_MMA655X_SPI_INDEX); + ao_mma655x_restart(); - addr |= (1 << 6); /* write mode */ - d[0] = addr | (ao_parity(addr^value) << 7); - d[1] = value; - ao_mma655x_cmd(d); + /* Send a dummy read of 00 to clock out the SPI data */ + d[0] = 0x80; + d[1] = 0x00; + ao_spi_duplex(&d, &d, 2, AO_MMA655X_SPI_INDEX); + ao_mma655x_stop(); return d[1]; } -static uint8_t -ao_mma655x_reg_read(uint8_t addr) +static void +ao_mma655x_reg_write(uint8_t addr, uint8_t value) { uint8_t d[2]; - d[0] = addr | (ao_parity(addr) << 7); - d[1] = 0; - ao_mma655x_cmd(d); - return d[1]; + addr |= (1 << 6); /* write mode */ + d[0] = addr | (ao_parity(addr^value) << 7); + d[1] = value; + ao_mma655x_start(); + ao_spi_send(d, 2, AO_MMA655X_SPI_INDEX); + ao_mma655x_stop(); + + addr &= ~(1 << 6); + PRINTD("write %x %x = %x\n", + addr, value, ao_mma655x_reg_read(addr)); } static uint16_t @@ -89,14 +123,23 @@ ao_mma655x_value(void) uint8_t d[2]; uint16_t v; - d[0] = ((0 << 7) | /* Axis selection (X) */ - (1 << 6) | /* Acceleration operation */ - (1 << 5)); /* Raw data */ + d[0] = ((0 << 6) | /* Axis selection (X) */ + (1 << 5) | /* Acceleration operation */ + (1 << 4)); /* Raw data */ d[1] = ((1 << 3) | /* must be one */ (1 << 2) | /* Unsigned data */ (0 << 1) | /* Arm disabled */ (1 << 0)); /* Odd parity */ - ao_mma655x_cmd(d); + ao_mma655x_start(); + PRINTD("value SEND %02x %02x\n", d[0], d[1]); + ao_spi_send(d, 2, AO_MMA655X_SPI_INDEX); + ao_mma655x_restart(); + d[0] = 0x80; + d[1] = 0x00; + ao_spi_duplex(d, d, 2, AO_MMA655X_SPI_INDEX); + ao_mma655x_stop(); + PRINTD("value RECV %02x %02x\n", d[0], d[1]); + v = (uint16_t) d[1] << 2; v |= d[0] >> 6; v |= (uint16_t) (d[0] & 3) << 10; @@ -132,6 +175,12 @@ ao_mma655x_setup(void) uint8_t v; uint16_t a, a_st; uint8_t stdefl; + uint8_t i; + uint8_t s0, s1, s2, s3; + uint8_t pn; + uint32_t lot; + uint16_t serial; + if (mma655x_configured) return; @@ -157,7 +206,10 @@ ao_mma655x_setup(void) ao_mma655x_reg_write(AO_MMA655X_AXISCFG, AXISCFG_VALUE | (1 << AO_MMA655X_AXISCFG_ST)); - a_st = ao_mma655x_value(); + for (i = 0; i < 10; i++) { + a_st = ao_mma655x_value(); + printf ("SELF-TEST %2d = %6d\n", i, a_st); + } stdefl = ao_mma655x_reg_read(AO_MMA655X_STDEFL); @@ -165,22 +217,14 @@ ao_mma655x_setup(void) AXISCFG_VALUE | (0 << AO_MMA655X_AXISCFG_ST)); a = ao_mma655x_value(); - printf ("normal: %u self_test: %u stdefl: %u\n", - a, a_st, stdefl); + + for (i = 0; i < 10; i++) { + a = ao_mma655x_value(); + printf("NORMAL %2d = %6d\n", i, a); + } ao_mma655x_reg_write(AO_MMA655X_DEVCFG, DEVCFG_VALUE | (1 << AO_MMA655X_DEVCFG_ENDINIT)); -} - -static void -ao_mma655x_dump(void) -{ - uint8_t s0, s1, s2, s3; - uint32_t lot; - uint16_t serial; - - ao_mma655x_setup(); - s0 = ao_mma655x_reg_read(AO_MMA655X_SN0); s1 = ao_mma655x_reg_read(AO_MMA655X_SN1); s2 = ao_mma655x_reg_read(AO_MMA655X_SN2); @@ -189,8 +233,16 @@ ao_mma655x_dump(void) ((uint32_t) s1 << 8) | ((uint32_t) s0); serial = lot & 0x1fff; lot >>= 12; - printf ("MMA655X lot %d serial %d\n", lot, serial); - mma655x_configured = 0; + pn = ao_mma655x_reg_read(AO_MMA655X_PN); + printf ("MMA655X lot %d serial %d number %d\n", lot, serial, pn); + +} + +static void +ao_mma655x_dump(void) +{ + ao_mma655x_setup(); + printf ("MMA655X value %d\n", ao_mma655x_value()); } __code struct ao_cmds ao_mma655x_cmds[] = { @@ -219,9 +271,9 @@ ao_mma655x_init(void) mma655x_configured = 0; ao_cmd_register(&ao_mma655x_cmds[0]); - ao_spi_init_cs(AO_MMA655X_CS_GPIO, (1 << AO_MMA655X_CS)); + ao_spi_init_cs(AO_MMA655X_CS_PORT, (1 << AO_MMA655X_CS_PIN)); - ao_add_task(&ao_mma655x_task, ao_mma655x, "mma655x"); +// ao_add_task(&ao_mma655x_task, ao_mma655x, "mma655x"); } #endif diff --git a/src/drivers/ao_mpu6000.c b/src/drivers/ao_mpu6000.c index e8c80f12..b3e284e0 100644 --- a/src/drivers/ao_mpu6000.c +++ b/src/drivers/ao_mpu6000.c @@ -225,7 +225,7 @@ ao_mpu6000_setup(void) errors += ao_mpu6000_gyro_check(normal_mode.gyro_z, test_mode.gyro_z, "z"); if (errors) - ao_panic(AO_PANIC_SELF_TEST); + ao_panic(AO_PANIC_SELF_TEST_MPU6000); /* Filter to about 100Hz, which also sets the gyro rate to 1000Hz */ ao_mpu6000_reg_write(MPU6000_CONFIG, diff --git a/src/drivers/ao_ms5607.c b/src/drivers/ao_ms5607.c index ec0d2202..704b4583 100644 --- a/src/drivers/ao_ms5607.c +++ b/src/drivers/ao_ms5607.c @@ -27,12 +27,12 @@ static uint8_t ms5607_configured; static void ao_ms5607_start(void) { ao_spi_get(AO_MS5607_SPI_INDEX,AO_SPI_SPEED_FAST); - stm_gpio_set(AO_MS5607_CS_GPIO, AO_MS5607_CS, 0); + stm_gpio_set(AO_MS5607_CS_PORT, AO_MS5607_CS_PIN, 0); } static void ao_ms5607_stop(void) { - stm_gpio_set(AO_MS5607_CS_GPIO, AO_MS5607_CS, 1); + stm_gpio_set(AO_MS5607_CS_PORT, AO_MS5607_CS_PIN, 1); ao_spi_put(AO_MS5607_SPI_INDEX); } @@ -92,7 +92,7 @@ ao_ms5607_prom_read(struct ao_ms5607_prom *prom) printf ("MS5607 PROM CRC error (computed %x actual %x)\n", crc, (((uint8_t *) prom)[15] & 0xf)); flush(); - ao_panic(AO_PANIC_SELF_TEST); +// ao_panic(AO_PANIC_SELF_TEST_MS5607); } #if __BYTE_ORDER == __LITTLE_ENDIAN @@ -120,7 +120,7 @@ static uint8_t ao_ms5607_done; static void ao_ms5607_isr(void) { - ao_exti_disable(AO_MS5607_MISO_GPIO, AO_MS5607_MISO); + ao_exti_disable(AO_MS5607_MISO_PORT, AO_MS5607_MISO_PIN); ao_ms5607_done = 1; ao_wakeup(&ao_ms5607_done); } @@ -135,7 +135,7 @@ ao_ms5607_get_sample(uint8_t cmd) { ao_ms5607_start(); ao_spi_send(&cmd, 1, AO_MS5607_SPI_INDEX); - ao_exti_enable(AO_MS5607_MISO_GPIO, AO_MS5607_MISO); + ao_exti_enable(AO_MS5607_MISO_PORT, AO_MS5607_MISO_PIN); #if AO_MS5607_PRIVATE_PINS ao_spi_put(AO_MS5607_SPI_INDEX); #endif @@ -144,7 +144,7 @@ ao_ms5607_get_sample(uint8_t cmd) { ao_sleep(&ao_ms5607_done); sei(); #if AO_MS5607_PRIVATE_PINS - stm_gpio_set(AO_MS5607_CS_GPIO, AO_MS5607_CS, 1); + stm_gpio_set(AO_MS5607_CS_PORT, AO_MS5607_CS_PIN, 1); #else ao_ms5607_stop(); #endif @@ -235,13 +235,14 @@ ao_ms5607_info(void) static void ao_ms5607_dump(void) { - struct ao_data sample; + struct ao_ms5607_sample sample; struct ao_ms5607_value value; - ao_data_get(&sample); - ao_ms5607_convert(&sample.ms5607_raw, &value); - printf ("Pressure: %8u %8d\n", sample.ms5607_raw.pres, value.pres); - printf ("Temperature: %8u %8d\n", sample.ms5607_raw.temp, value.temp); + ao_ms5607_setup(); + ao_ms5607_sample(&sample); + ao_ms5607_convert(&sample, &value); + printf ("Pressure: %8u %8d\n", sample.pres, value.pres); + printf ("Temperature: %8u %8d\n", sample.temp, value.temp); printf ("Altitude: %ld\n", ao_pa_to_altitude(value.pres)); } @@ -255,24 +256,24 @@ ao_ms5607_init(void) { ms5607_configured = 0; ao_cmd_register(&ao_ms5607_cmds[0]); - ao_spi_init_cs(AO_MS5607_CS_GPIO, (1 << AO_MS5607_CS)); + ao_spi_init_cs(AO_MS5607_CS_PORT, (1 << AO_MS5607_CS_PIN)); - ao_add_task(&ao_ms5607_task, ao_ms5607, "ms5607"); +// ao_add_task(&ao_ms5607_task, ao_ms5607, "ms5607"); /* Configure the MISO pin as an interrupt; when the * conversion is complete, the MS5607 will raise this * pin as a signal */ - ao_exti_setup(AO_MS5607_MISO_GPIO, - AO_MS5607_MISO, + ao_exti_setup(AO_MS5607_MISO_PORT, + AO_MS5607_MISO_PIN, AO_EXTI_MODE_RISING, ao_ms5607_isr); /* Reset the pin from INPUT to ALTERNATE so that SPI works * This needs an abstraction at some point... */ - stm_moder_set(AO_MS5607_MISO_GPIO, - AO_MS5607_MISO, + stm_moder_set(AO_MS5607_MISO_PORT, + AO_MS5607_MISO_PIN, STM_MODER_ALTERNATE); } diff --git a/src/drivers/ao_radio_slave.c b/src/drivers/ao_radio_slave.c index 9a01bbfa..1d1f16fe 100644 --- a/src/drivers/ao_radio_slave.c +++ b/src/drivers/ao_radio_slave.c @@ -32,7 +32,6 @@ ao_radio_slave_low(void) if (slave_state != 1) ao_panic(1); - ao_led_toggle(AO_LED_GREEN); ao_gpio_set(AO_RADIO_SLAVE_INT_PORT, AO_RADIO_SLAVE_INT_BIT, AO_RADIO_SLAVE_INT_PIN, 0); for (i = 0; i < 1000; i++) ao_arch_nop(); @@ -44,7 +43,6 @@ ao_radio_slave_high(void) { if (slave_state != 0) ao_panic(2); - ao_led_toggle(AO_LED_RED); ao_gpio_set(AO_RADIO_SLAVE_INT_PORT, AO_RADIO_SLAVE_INT_BIT, AO_RADIO_SLAVE_INT_PIN, 1); slave_state = 1; } @@ -65,8 +63,10 @@ ao_radio_slave_spi(void) /* XXX monitor CS to interrupt the receive */ ao_config.radio_setting = ao_radio_spi_request.setting; + ao_led_on(AO_LED_RX); ao_radio_spi_reply.status = ao_radio_recv(&ao_radio_spi_reply.payload, ao_radio_spi_request.recv_len); + ao_led_off(AO_LED_RX); ao_radio_spi_reply.rssi = 0; ao_spi_send(&ao_radio_spi_reply, AO_RADIO_SPI_REPLY_HEADER_LEN + ao_radio_spi_request.recv_len, @@ -76,9 +76,11 @@ ao_radio_slave_spi(void) continue; case AO_RADIO_SPI_CMAC_RECV: ao_config.radio_setting = ao_radio_spi_request.setting; + ao_led_on(AO_LED_RX); ao_radio_spi_reply.status = ao_radio_cmac_recv(&ao_radio_spi_reply.payload, ao_radio_spi_request.recv_len, ao_radio_spi_request.timeout); + ao_led_off(AO_LED_RX); ao_radio_spi_reply.rssi = ao_radio_cmac_rssi; ao_spi_send(&ao_radio_spi_reply, AO_RADIO_SPI_REPLY_HEADER_LEN + ao_radio_spi_request.recv_len, @@ -88,14 +90,18 @@ ao_radio_slave_spi(void) continue; case AO_RADIO_SPI_SEND: ao_config.radio_setting = ao_radio_spi_request.setting; + ao_led_on(AO_LED_TX); ao_radio_send(&ao_radio_spi_request.payload, ao_radio_spi_request.len - AO_RADIO_SPI_REQUEST_HEADER_LEN); + ao_led_off(AO_LED_TX); break; case AO_RADIO_SPI_CMAC_SEND: ao_config.radio_setting = ao_radio_spi_request.setting; + ao_led_on(AO_LED_TX); ao_radio_cmac_send(&ao_radio_spi_request.payload, ao_radio_spi_request.len - AO_RADIO_SPI_REQUEST_HEADER_LEN); + ao_led_off(AO_LED_TX); break; case AO_RADIO_SPI_CMAC_KEY: diff --git a/src/megametrum-v0.1/ao_pins.h b/src/megametrum-v0.1/ao_pins.h index 8b631ae9..af8eebae 100644 --- a/src/megametrum-v0.1/ao_pins.h +++ b/src/megametrum-v0.1/ao_pins.h @@ -77,10 +77,10 @@ #define SPI_2_PB13_PB14_PB15 1 /* Flash, Companion */ #define SPI_2_PD1_PD3_PD4 0 -#define SPI_2_GPIO (&stm_gpiob) -#define SPI_2_SCK 13 -#define SPI_2_MISO 14 -#define SPI_2_MOSI 15 +#define SPI_2_PORT (&stm_gpiob) +#define SPI_2_SCK_PIN 13 +#define SPI_2_MISO_PIN 14 +#define SPI_2_MOSI_PIN 15 #define HAS_I2C_1 1 #define I2C_1_PB8_PB9 1 @@ -249,11 +249,11 @@ struct ao_adc { */ #define HAS_MS5607 1 #define AO_MS5607_PRIVATE_PINS 1 -#define AO_MS5607_CS_GPIO (&stm_gpioc) -#define AO_MS5607_CS 4 +#define AO_MS5607_CS_PORT (&stm_gpioc) +#define AO_MS5607_CS_PIN 4 #define AO_MS5607_CS_MASK (1 << AO_MS5607_CS) -#define AO_MS5607_MISO_GPIO (&stm_gpioa) -#define AO_MS5607_MISO 6 +#define AO_MS5607_MISO_PORT (&stm_gpioa) +#define AO_MS5607_MISO_PIN 6 #define AO_MS5607_MISO_MASK (1 << AO_MS5607_MISO) #define AO_MS5607_SPI_INDEX AO_SPI_1_PA5_PA6_PA7 @@ -309,10 +309,10 @@ struct ao_adc { * mma655x */ -#define HAS_MMA655X 0 -#define AO_MMA655X_SPI_INDEX AO_SPI_1_PA5_PA6_PA7 -#define AO_MMA655X_CS_GPIO (&stm_gpiod) -#define AO_MMA655X_CS 4 +#define HAS_MMA655X 1 +#define AO_MMA655X_SPI_INDEX AO_SPI_1_PE13_PE14_PE15 +#define AO_MMA655X_CS_PORT (&stm_gpiod) +#define AO_MMA655X_CS_PIN 4 #define NUM_CMDS 16 diff --git a/src/product/ao_telescience.c b/src/product/ao_telescience.c index 2d594d7f..45b6d40e 100644 --- a/src/product/ao_telescience.c +++ b/src/product/ao_telescience.c @@ -16,7 +16,6 @@ */ #include "ao.h" -#include "ao_pwmin.h" int main(void) @@ -35,7 +34,6 @@ main(void) ao_usb_init(); ao_adc_init(); ao_log_single_init(); - ao_pwmin_init(); ao_start_scheduler(); return 0; } diff --git a/src/telescience-v0.1/Makefile b/src/telescience-v0.1/Makefile index 5542913d..d24128ef 100644 --- a/src/telescience-v0.1/Makefile +++ b/src/telescience-v0.1/Makefile @@ -53,7 +53,6 @@ ALTOS_SRC = \ ao_adc_avr.c \ ao_science_slave.c \ ao_spi_slave.c \ - ao_pwmin.c \ $(TELESCIENCE_STORAGE)\ $(TELESCIENCE_LOG) |