#include "mw_bt.h"
#include "mw_adc.h"
#include "mw_bt.h"
+#include "mw_acc.h"
#include "bt_hci.h"
#include "bt_l2cap.h"
#include "bluetooth_init_cc256x.h"
-unsigned int _event_src = 0;
+uint16_t _event_src = 0;
static void set16mhz(void)
DISABLE_LCD_LED(); // frontlight
CONFIG_DEBUG_PINS();
CONFIG_ACCELEROMETER_PINS();
- // DISABLE_ACCELEROMETER_POWER(); // there is no accel. power switching!
+ DISABLE_ACCELEROMETER_POWER(); // starts from config 5 and later
HARDWARE_CFG_SENSE_INIT();
if (debug_uart_rx_char(&c)) {
debug_uart_tx_char(c);
- if (c == 'b') {
+ if (c == 'a') {
+ debug_uart_tx("\nenabling ACC\n");
+ mw_acc_enable();
+ } else if (c == 'A') {
+ debug_uart_tx("\ndisabling ACC\n");
+ mw_acc_disable();
+ } else if (c == 'r') {
+ int16_t x,y,z;
+ debug_uart_tx("\nread ACC: ");
+ mw_acc_read(&x, &y, &z);
+ snprintf(tstr, 64, "x:%d y:%d z:%d\n", x,y,z);
+ debug_uart_tx(tstr);
+ } else if (c == 'b') {
debug_uart_tx("\nenabling BT\n");
mw_enable_bt();
} else if (c == 'B') {
} else if (_event_src & TIMER_100MS_EVENT) {
_event_src &= ~TIMER_100MS_EVENT;
oswald_centisecond_tick();
+ } else if (_event_src & ACCEL_EVENT) {
+ _event_src &= ~ACCEL_EVENT;
+ mw_acc_handle_irq();
} else {
#if defined MW_DEVBOARD_V2
snprintf(tstr, 64, "unhandled event in 0x%04x\n", _event_src);
LPM3_EXIT;
}
+#pragma vector=PORT1_VECTOR
+__interrupt void PORT1_GPIO_ISR (void)
+{
+ if (P1IFG & BT_IO_CTS) {
+ P1IFG &= ~BT_IO_CTS;
+
+ debug_uart_tx("BT CTS irq\n");
+ bt_hci_ehcill_wake();
+
+ LPM3_EXIT;
+ };
+ if (P1IFG & ACCELEROMETER_INT_PIN) {
+ P1IFG &= ~ACCELEROMETER_INT_PIN;
+ // debug_uart_tx("ACC irq\n");
+ _event_src |= ACCEL_EVENT;
+ LPM3_EXIT;
+ }
+}
+
+
#if 0
#pragma vector=NOVECTOR
__interrupt void UNEXP_ISR (void)