fixed uart issues
This commit is contained in:
parent
ae5d5c74a7
commit
6ad59e04a6
@ -1,4 +1,4 @@
|
|||||||
# UART Write Number
|
# UART Write String
|
||||||
|
|
||||||
### ~hint
|
### ~hint
|
||||||
![](/static/bluetooth/Bluetooth_SIG.png)
|
![](/static/bluetooth/Bluetooth_SIG.png)
|
||||||
|
@ -6,7 +6,7 @@ namespace bluetooth {
|
|||||||
/**
|
/**
|
||||||
* Writes to the Bluetooth UART service buffer. From there the data is transmitted over Bluetooth to a connected device.
|
* Writes to the Bluetooth UART service buffer. From there the data is transmitted over Bluetooth to a connected device.
|
||||||
*/
|
*/
|
||||||
//% help=bluetooth/uart-write weight=80
|
//% help=bluetooth/uart-write-string weight=80
|
||||||
//% blockId=bluetooth_uart_write block="bluetooth uart|write string %data" blockGap=8
|
//% blockId=bluetooth_uart_write block="bluetooth uart|write string %data" blockGap=8
|
||||||
//% parts="bluetooth" shim=bluetooth::uartWriteString advanced=true
|
//% parts="bluetooth" shim=bluetooth::uartWriteString advanced=true
|
||||||
export function uartWriteString(data: string): void {
|
export function uartWriteString(data: string): void {
|
||||||
@ -17,7 +17,7 @@ namespace bluetooth {
|
|||||||
/**
|
/**
|
||||||
* Prints a numeric value to the serial
|
* Prints a numeric value to the serial
|
||||||
*/
|
*/
|
||||||
//% help=serial/write-number weight=79
|
//% help=bluetooth/uart-write-number weight=79
|
||||||
//% weight=89 blockGap=8 advanced=true
|
//% weight=89 blockGap=8 advanced=true
|
||||||
//% blockId=bluetooth_uart_writenumber block="bluetooth uart|write number %value"
|
//% blockId=bluetooth_uart_writenumber block="bluetooth uart|write number %value"
|
||||||
export function uartWriteNumber(value: number): void {
|
export function uartWriteNumber(value: number): void {
|
||||||
|
@ -43,6 +43,10 @@ namespace pxsim.serial {
|
|||||||
return board().serialState.readSerial();
|
return board().serialState.readSerial();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function readUntil(del: string): string {
|
||||||
|
return readLine();
|
||||||
|
}
|
||||||
|
|
||||||
export function onDataReceived(delimiters: string, handler: RefAction) {
|
export function onDataReceived(delimiters: string, handler: RefAction) {
|
||||||
let b = board();
|
let b = board();
|
||||||
b.bus.listen(DAL.MICROBIT_ID_SERIAL, DAL.MICROBIT_SERIAL_EVT_DELIM_MATCH, handler);
|
b.bus.listen(DAL.MICROBIT_ID_SERIAL, DAL.MICROBIT_SERIAL_EVT_DELIM_MATCH, handler);
|
||||||
|
Loading…
Reference in New Issue
Block a user