void bt_step() { if (bt_module_state == BT_MOD_STATE_OFF) return; if (bt_reset_counter) { if (bt_reset_counter > task_get_ms_tick()) return; DEBUG("BT RESET STEP: %d\n", bt_reset_counter_step); switch(bt_reset_counter_step) { case(0): GpioWrite(BT_EN, HIGH); bt_reset_counter = task_get_ms_tick() + 500; bt_reset_counter_step = 1; break; case(1): //enable bt uart BT_UART_PWR_ON; bt_uart.Init(BT_UART, 115200); bt_uart.SetInterruptPriority(MEDIUM); // while(1) // { // _delay_ms(100); // bt_uart.Write(0x00); // _delay_ms(1); // bt_uart.Write(0xAA); // ewdt_reset(); // } bt_reset_counter = task_get_ms_tick() + 10; bt_reset_counter_step = 2; break; case(2): GpioWrite(BT_RESET, HIGH); bt_reset_counter_step = 0; bt_reset_counter = 0; break; } return; } if (bt_module_type == BT_PAN1322) bt_pan1322.Step(); if (bt_module_type == BT_PAN1026) bt_pan1026.Step(); if (bt_module_type == BT_UNKNOWN) bt_unknown_parser(); }
void bt_send(char * str) { if (!bt_device_connected) return; if (bt_module_type == BT_PAN1322) bt_pan1322.SendString(str); if (bt_module_type == BT_PAN1026) bt_pan1026.SendString(str); }
void bt_step() { if (bt_module_state == BT_MOD_STATE_OFF) return; if (bt_module_type == BT_PAN1322) bt_pan1322.Step(); if (bt_module_type == BT_PAN1026) bt_pan1026.Step(); if (bt_module_type == BT_UNKNOWN) bt_unknown_parser(); }
void bt_pan1026_init() { DEBUG("bt_pan1026_init\n"); bt_pan1026.Init(&bt_uart); }