BASIC UART CLI.

I am looking to set up a basic UART CLI, I want to be able to write commands such as "scan ", "Connect 'MAC' " or "Set LED on" etc. I have been working off the lesson exercise for UART, and have set up a termination for the command "\r\n". the RX buffer is not resetting and so all the commands are merging together. My plan was to then search the receive buffer for the command i.e. "scan" and then act on that.

How can I clear the buffer, length and offset? i had set to 0 and "" but on next callback the values are back.

Am I maybe going in the wrong direction for this? i want to keep this quite simple.

My end goal is to setup a basic version of the ble_app_interactive.

Thanks for your help.

William

Parents
  • Hi,

    How can I clear the buffer, length and offset? i had set to 0 and "" but on next callback the values are back.

    This is how how the event structs work. The struct will be filled with the correct information for the event each time the event is generated.

    You should rather focus only on the part of the rx.buf where you expect the string to be (if you are able to receive the full string each time, it should be between the offset and len parameters). You should enable some more logging in your application to see what parameters you are sending, which part of the buffer you are using, etc.

    Best regards,
    Jørgen

  • Hi Jorgen,

    Thanks i see what you mean, my problem with this is that once the end of the buffer is reached the offset and length wont match the command correctly. Im maybe just being picky and setting a large buffer length will sort that issue for me.

    Regards,

    William

Reply Children
No Data
Related