#include "io.h" #include "fb.h" #include "bt.h" enum { OGF_HOST_CONTROL = 0x03, OGF_LE_CONTROL = 0x08, OGF_VENDOR = 0x3f, COMMAND_RESET_CHIP = 0x03, VENDOR_LOAD_FIRMWARE = 0x2e, HCI_COMMAND_PKT = 0x01, HCI_EVENT_PKT = 0x04, LL_SCAN_ACTIVE = 0x01, EVENT_TYPE_COMMAND_STATUS = 0x0e }; unsigned char lo(unsigned int val) { return (unsigned char)(val & 0xff); } unsigned char hi(unsigned int val) { return (unsigned char)((val & 0xff00) >> 8); } unsigned char empty[] = {}; int hciCommandBytes(unsigned char *opcodebytes, unsigned char *data, unsigned char length) { unsigned char c=0; bt_writeByte(HCI_COMMAND_PKT); bt_writeByte(opcodebytes[0]); bt_writeByte(opcodebytes[1]); bt_writeByte(length); while (c++