Спойлер

Спойлер

Спойлер

Спойлер





Код: Выделить всё
Info: gpm.M1102: Pairing request received from peer device, F4:84:4C:4D:D5:13.
CyDesigner.Common.Base.CyStsMsgDisp+CyDialogResult
[19:56:47:627] : 'Initiate Pairing' request sent
[19:56:47:643] : 'Command Status' event received
[19:56:47:643] : Status: BLE_ERROR_INVALID_OPERATION
Error: gpm.M0101: Invalid operationКод: Выделить всё
stack version: 2.13.2
local BT device address: 08:6b:d7:fe:15:2e
Scanning started
f4:84:4c:4d:d5:13 (0)
f4:84:4c:4d:d5:13 (4) HMSoft
Scanning stopped
Connected
bonding failed, reason 0x303
Connection closed, reason: 0x208
Advertising started
Код: Выделить всё
case gecko_evt_system_boot_id:
bootMessage(&(evt->data.evt_system_boot));
gecko_cmd_sm_configure(0x07,sm_io_capability_keyboarddisplay); // allow all connections
gecko_cmd_sm_set_bondable_mode(1); // enable new bondings
gecko_cmd_le_gap_set_discovery_timing(le_gap_phy_1m, 160, 160); // set scanning period 10ms
gecko_cmd_le_gap_set_discovery_type(le_gap_phy_1m, 1); // do active scanning
gecko_cmd_le_gap_set_conn_timing_parameters(80, 100, 0, 1000, 0, 0xffff); // set connection interval 100ms
gecko_cmd_le_gap_start_discovery(le_gap_phy_1m, le_gap_discover_observation); // start discovering all devices
printLog("Scanning started\r\n");
break; Код: Выделить всё
case gecko_evt_le_connection_opened_id:
GPIO_PinOutSet(BSP_LED0_PORT, BSP_LED0_PIN); // turn on LED
printLog("Connected\r\n");
conn_handle = evt->data.evt_le_connection_opened.connection;
gecko_cmd_sm_increase_security(conn_handle);
break;
Код: Выделить всё
case gecko_evt_sm_passkey_request_id:
case gecko_evt_sm_confirm_passkey_id:
case gecko_evt_sm_bonded_id:
case gecko_evt_sm_bonding_failed_id:
Код: Выделить всё
case gecko_evt_le_connection_parameters_id:
printLog("Connection parameters - security mode: 0x%2.2x\r\n", evt->data.evt_le_connection_parameters.security_mode);
break;
Код: Выделить всё
stack version: 2.13.2
local BT device address: 08:6b:d7:fe:15:2e
Scanning started
f4:84:4c:4d:d5:13 (0)
f4:84:4c:4d:d5:13 (4) NonamePRK
Scanning stopped
Connected
Increase security result 0x00
Connection parameters - security mode: 0x00
bonding failed, reason 0x303
Connection closed, reason: 0x208
Advertising started
Код: Выделить всё
gecko_cmd_sm_configure(0x07,sm_io_capability_keyboarddisplay);Код: Выделить всё
Capability: 0x03
Scanning started
f4:84:4c:4d:d5:13 (0)
f4:84:4c:4d:d5:13 (4) NonamePRK
Scanning stopped
Connected
Increase security result 0x00
Connection parameters - security mode: 0x00
bonding failed, reason 0x206
Connection parameters - security mode: 0x00
Connection closed, reason: 0x216
Advertising started
Код: Выделить всё
gecko_cmd_gatt_write_characteristic_value(conn_handle, 0x0012, 1, (uint8*) &serial_symbol);Код: Выделить всё
gecko_cmd_sm_configure(0x03,sm_io_capability_keyboarddisplay);Код: Выделить всё
local BT device address: 08:6b:d7:fe:15:2e
Scanning started
f4:84:4c:4d:d5:13 (0)
f4:84:4c:4d:d5:13 (4) NonamePRK
Scanning stopped
Connected
Connection Bonding status: 0xff
Connection parameters - security mode: 0x00
Enter passkey: 012345
Connection parameters - security mode: 0x00
Connection parameters - security mode: 0x02
bond successКод: Выделить всё
gecko_cmd_sm_configure(0x03,sm_io_capability_keyboarddisplay); Код: Выделить всё
/* Set this value to 1 if you want to disable deep sleep completely */
#define DISABLE_SLEEP 1 Код: Выделить всё
case gecko_evt_system_external_signal_id:Код: Выделить всё
#define GREEN_LED_PORT gpioPortA
#define GREEN_LED_PIN 4
#define RED_LED_PORT gpioPortA
#define RED_LED_PIN 5Код: Выделить всё
GPIO_PinModeSet(GREEN_LED_PORT, GREEN_LED_PIN, gpioModeInput, 0);
GPIO_PinModeSet(RED_LED_PORT, RED_LED_PIN, gpioModeInput, 0);
GPIO_ExtIntConfig(GREEN_LED_PORT, GREEN_LED_PIN, GREEN_LED_PIN, true, true, true);
GPIO_ExtIntConfig(RED_LED_PORT, RED_LED_PIN, RED_LED_PIN, true, true, true);
GPIOINT_Init(); // init GPIOINT driver
GPIOINT_CallbackRegister(GREEN_LED_PIN, MOTOR_ON_Event); // register callback function
GPIOINT_CallbackRegister(RED_LED_PIN, LED_ON_Event); // register callback function
Код: Выделить всё
static void MOTOR_ON_Event(const uint8_t pin) {
gecko_external_signal(1ul << 0);
}
static void LED_ON_Event(const uint8_t pin) {
gecko_external_signal(1ul << 1);
}
void RETARGET_callback(void) {
gecko_external_signal(1ul << 2);
}
Код: Выделить всё
case gecko_evt_system_external_signal_id: // button event
event = evt->data.evt_system_external_signal.extsignals;
if (event & (1ul << 0)) {
switch_value = GPIO_PinInGet(GREEN_LED_PORT, GREEN_LED_PIN);
gecko_cmd_gatt_server_send_characteristic_notification(0xFF, gattdb_motor_id, 1, (const uint8*)&switch_value);
}
if (event & (1ul << 1)) {
switch_value = GPIO_PinInGet(RED_LED_PORT, RED_LED_PIN);
gecko_cmd_gatt_server_send_characteristic_notification(0xFF, gattdb_user_led_id, 1, (const uint8*) &switch_value);
}
if (event & (1ul << 2)) {
int i, serial_symbol;
// послать принятое из UART
....
Код: Выделить всё
if (event & (1ul << 0)) {
....
}
ELSE if (event & (1ul << 1)) {
....
}
Код: Выделить всё
gecko_cmd_gatt_server_send_characteristic_notification(0xFF, gattdb_serial, i, message);We would like to inform you that your shipping address has been validated.
Your Thunderboard kit for the hands-on, virtual Bluetooth Workshop: BG22 Project Series will be shipped shortly. You will receive mailing tracking information in a separate email.