Adding mac address and example for bluetooth.
This commit is contained in:
@ -65,6 +65,8 @@
|
|||||||
X("SerialBT.disconnect", SERIALBT_DISCONNECT, tos = ((BluetoothSerial *) tos)->disconnect()) \
|
X("SerialBT.disconnect", SERIALBT_DISCONNECT, tos = ((BluetoothSerial *) tos)->disconnect()) \
|
||||||
X("SerialBT.connected", SERIALBT_CONNECTED, tos = ((BluetoothSerial *) tos)->connected(*sp); --sp) \
|
X("SerialBT.connected", SERIALBT_CONNECTED, tos = ((BluetoothSerial *) tos)->connected(*sp); --sp) \
|
||||||
X("SerialBT.isReady", SERIALBT_IS_READY, tos = ((BluetoothSerial *) tos)->isReady(sp[-1], *sp); sp -= 2) \
|
X("SerialBT.isReady", SERIALBT_IS_READY, tos = ((BluetoothSerial *) tos)->isReady(sp[-1], *sp); sp -= 2) \
|
||||||
|
/* Bluetooth */ \
|
||||||
|
X("esp_bt_dev_get_address", ESP_BT_DEV_GET_ADDRESS, DUP; tos = (cell_t) esp_bt_dev_get_address()) \
|
||||||
/* Pins and PWM */ \
|
/* Pins and PWM */ \
|
||||||
X("pinMode", PIN_MODE, pinMode(*sp, tos); --sp; DROP) \
|
X("pinMode", PIN_MODE, pinMode(*sp, tos); --sp; DROP) \
|
||||||
X("digitalWrite", DIGITAL_WRITE, digitalWrite(*sp, tos); --sp; DROP) \
|
X("digitalWrite", DIGITAL_WRITE, digitalWrite(*sp, tos); --sp; DROP) \
|
||||||
|
|||||||
8
ueforth/examples/serialbt.fs
Normal file
8
ueforth/examples/serialbt.fs
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
SerialBT.new constant bt
|
||||||
|
z" ueforthbt" 0 bt SerialBT.begin .
|
||||||
|
esp_bt_dev_get_address hex 6 dump cr
|
||||||
|
: bt-type bt SerialBT.write drop ;
|
||||||
|
: bt-key
|
||||||
|
begin bt SerialBT.available until 0 >r rp@ 1 bt SerialBT.readBytes drop r> ;
|
||||||
|
: bt-on ['] bt-type is type ['] bt-key is key ;
|
||||||
|
: bt-off ['] arduino-type is type ['] arduino-key is key ;
|
||||||
@ -169,7 +169,7 @@ Serial.begin ( baud -- ) Start serial port
|
|||||||
Serial.end ( -- ) End serial port
|
Serial.end ( -- ) End serial port
|
||||||
Serial.available ( -- f ) Is serial data available
|
Serial.available ( -- f ) Is serial data available
|
||||||
Serial.readBytes ( a n -- n ) Read serial bytes, return number gotten
|
Serial.readBytes ( a n -- n ) Read serial bytes, return number gotten
|
||||||
Serial.write ( a n -- ) Write serial bytes
|
Serial.write ( a n -- n ) Write serial bytes
|
||||||
Serial.flush ( -- ) Flush serial buffer
|
Serial.flush ( -- ) Flush serial buffer
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
@ -181,7 +181,7 @@ SerialBT.begin ( localname ismaster bt -- f )
|
|||||||
SerialBT.end ( bt -- )
|
SerialBT.end ( bt -- )
|
||||||
SerialBT.available ( bt -- f )
|
SerialBT.available ( bt -- f )
|
||||||
SerialBT.readBytes ( a n bt -- n )
|
SerialBT.readBytes ( a n bt -- n )
|
||||||
SerialBT.write ( a n bt -- )
|
SerialBT.write ( a n bt -- n )
|
||||||
SerialBT.flush ( bt -- )
|
SerialBT.flush ( bt -- )
|
||||||
SerialBT.hasClient ( bt -- f )
|
SerialBT.hasClient ( bt -- f )
|
||||||
SerialBT.enableSSP ( bt -- )
|
SerialBT.enableSSP ( bt -- )
|
||||||
@ -194,6 +194,11 @@ SerialBT.connected ( timeout bt -- f )
|
|||||||
SerialBT.isReady ( checkMaster timeout -- f ) Default checkMaster=false, timeout=0
|
SerialBT.isReady ( checkMaster timeout -- f ) Default checkMaster=false, timeout=0
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
|
<h5>Bluetooth</h5>
|
||||||
|
<pre>
|
||||||
|
esp_bt_dev_get_address ( -- a ) addr of 6 byte mac address
|
||||||
|
</pre>
|
||||||
|
|
||||||
<h5>GPIO</h5>
|
<h5>GPIO</h5>
|
||||||
<pre>
|
<pre>
|
||||||
pinMode ( pin mode -- ) Set GPIO pin mode
|
pinMode ( pin mode -- ) Set GPIO pin mode
|
||||||
|
|||||||
Reference in New Issue
Block a user