kscheff / BlueBasic

BASIC interpreter for CC2540 and CC2541 Bluetooth LE chips
11 stars 9 forks source link

Interface docu / code? #16

Closed milkpirate closed 3 years ago

milkpirate commented 3 years ago

Hey,

I now do have a (kinda) working access to the REPL, so I can start programming. My problem is, that most examples are a little bit too brief for me (f.g. spi example what are the parameters? what does 0, 1 and 3 stand for?).

Could you direct me to some docu (I checked the aanon4's wiki but without luck)? Or could you send me the link to the source where the interpreter handles these lines?

Further, which Basic dialect is BlueBasic based on?

Thank you very much!

kscheff commented 3 years ago

The best and most up to date documentation is the source code itself. Mostly you'll find all the explanations in the interpreter code. For the SPI command its here: https://github.com/kscheff/BlueBasic/blob/185773b8b21ac48e47d44ff3ae42f2bd36ca6b92/BLE-CC254x-1.5.0.16/Projects/ble/BlueBasic/Source/BlueBasic_Interpreter.c#L4300

//
// SPI MASTER <port 0|1|2|3>, <mode 0|1|2|3>, LSB|MSB <speed> [, wordsize]
//  or
// SPI TRANSFER Px(y) <array>
//
milkpirate commented 3 years ago

Ok, great! So in the example port 3 is used, which one is it? P0, P1, P2? Does the numberings map to each other in some sensable way? image

Or even more precise, to which Px_y does C SS MO MI map to? image

I am sorry for bothering you with all my silly question, but you must just be the most experienced and most responsive person to ask.

kscheff commented 3 years ago

reading the source code reveals:

port 0: USART 0, Alt 1 port 1: USART 0, Alt 2 port 2: USART 1, Alt 1 port 3: USART 1, Alt 2

I have not used the SPI interface with BlueBasic, so be prepared to go through some debugging... The SPI interface is not enabled in the binaries, since it saves code space and might get in conflict with SERIAL