On my best understanding there is one major location to call USARTKick, which is jshTransmit
jshTransmit is called with one char in jsdevices.c and in jswrap_serial.c
In jsdevices its called from jshTransmitPrintfCallback which loops through a string
In jswrap_serial its called from _jswrap_serial_print_cb which iterates through an arg (jsVar)
Both cases a string is send with lot of calls to USARTKick. For Bluetooth it would be a better idea, to send strings, to avoid overhead.
If I would now replace many calls to USARTKick by a function that sends a string, what would be the best way ?
Adding an #ifdef USE_BLUEOOTH in jsdevices and jswrap_serial is doable, but would be ugly.
We could add a call in bluetooth.h for strings
Or add a call to jshardware.h like USART_SendString
There are pros and cons for all solutions. Looks to me, like we have to change core sources in each case.
What would be best, or is there another way to solve the problem.
© Espruino, powered by microcosm.
Report a problem