mirror of
https://github.com/espruino/Espruino.git
synced 2025-12-08 19:06:15 +00:00
microbit working. commands cna be sent over ble now
This commit is contained in:
parent
d99807f97c
commit
fd6495fe65
@ -18,7 +18,7 @@ import pinutils;
|
||||
info = {
|
||||
'name' : "BBC micro:bit",
|
||||
'link' : [ "" ],
|
||||
'variables' : 191,
|
||||
'variables' : 145,
|
||||
'binary_name' : 'espruino_%v_microbit.bin',
|
||||
};
|
||||
chip = {
|
||||
|
||||
@ -68,7 +68,7 @@ static uint16_t m_conn_handle = BLE_CONN_HANDLE_INVALID;
|
||||
|
||||
static ble_uuid_t m_adv_uuids[] = {{BLE_UUID_NUS_SERVICE, NUS_SERVICE_UUID_TYPE}}; /**< Universally unique service identifier. */
|
||||
|
||||
static volatile bool ble_com = false;
|
||||
static volatile bool ble_com;
|
||||
|
||||
/**@brief Function for assert macro callback.
|
||||
*
|
||||
@ -537,6 +537,40 @@ void jswrap_nrf_bluetooth_disable_com(void)
|
||||
ble_com = false;
|
||||
}
|
||||
|
||||
/*JSON{
|
||||
"type" : "staticmethod",
|
||||
"class" : "Bluetooth",
|
||||
"name" : "sleep",
|
||||
"generate" : "jswrap_nrf_bluetooth_sleep"
|
||||
}*/
|
||||
void jswrap_nrf_bluetooth_sleep(void)
|
||||
{
|
||||
uint32_t err_code;
|
||||
|
||||
// If connected, disconnect.
|
||||
if (m_conn_handle != BLE_CONN_HANDLE_INVALID)
|
||||
{
|
||||
err_code = sd_ble_gap_disconnect(m_conn_handle, BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION);
|
||||
}
|
||||
|
||||
// Stop advertising
|
||||
err_code = sd_ble_gap_adv_stop();
|
||||
NRF_RADIO->TASKS_DISABLE = (1UL);
|
||||
}
|
||||
|
||||
/*JSON{
|
||||
"type" : "staticmethod",
|
||||
"class" : "Bluetooth",
|
||||
"name" : "wake",
|
||||
"generate" : "jswrap_nrf_bluetooth_wake"
|
||||
}*/
|
||||
void jswrap_nrf_bluetooth_wake(void)
|
||||
{
|
||||
uint32_t err_code;
|
||||
NRF_RADIO->TASKS_DISABLE = (0UL);
|
||||
err_code = ble_advertising_start(BLE_ADV_MODE_FAST);
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
#include <stdbool.h>
|
||||
#include "jspin.h"
|
||||
|
||||
// public static methods.
|
||||
@ -7,3 +6,6 @@ void jswrap_nrf_bluetooth_send_string(Pin* string_to_send, int length);
|
||||
|
||||
void jswrap_nrf_bluetooth_enable_com(void);
|
||||
void jswrap_nrf_bluetooth_disable_com(void);
|
||||
|
||||
void jswrap_nrf_bluetooth_sleep(void); // maybe these should return err_code?
|
||||
void jswrap_nrf_bluetooth_wake(void);
|
||||
|
||||
@ -6,7 +6,7 @@ GROUP(-lgcc -lc -lnosys)
|
||||
MEMORY
|
||||
{
|
||||
FLASH (rx) : ORIGIN = 0x18000, LENGTH = 0x28000
|
||||
RAM (rwx) : ORIGIN = 0x20002000, LENGTH = 0x6000
|
||||
RAM (rwx) : ORIGIN = 0x20002000, LENGTH = 0x2000
|
||||
}
|
||||
|
||||
/* Linker script for Nordic Semiconductor nRF5 devices
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user