How to receive more data through the serial port after entering a function called by the shell.

This forum is dedicated to feedback, discussions about ongoing or future developments, ideas and suggestions regarding the ChibiOS projects are welcome. This forum is NOT for support.
ivanbraga
Posts: 6
Joined: Mon Jan 18, 2016 1:17 am
Has thanked: 1 time

How to receive more data through the serial port after entering a function called by the shell.

Postby ivanbraga » Fri Dec 30, 2016 9:38 am

Sorry if this is not the right place for this question.

I am having doubts about getting more data through the serial port after entering a function called by the shell.

Ex:

Code: Select all

static const ShellCommand commands[] =
  {
    { "read", cmd_read  },
    { NULL, NULL } };
   
Static void cmd_read (BaseSequentialStream * chp, int argc, char * argv [])
{
   Static uint8_t buf [16];

   (Void) argc;
   (Void) argv;
 
   Do something ...

   Wait while number of bytes smaller than buffer size
   Read_serial (& SD2, buf, sizeof buf);

   Chprintf (chp, "% s \ r \ n", buf);
}


In other words, I enter the function and wait for a given number of bytes.

User avatar
Giovanni
Site Admin
Posts: 14444
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1074 times
Been thanked: 921 times
Contact:

Re: How to receive more data through the serial port after entering a function called by the shell.

Postby Giovanni » Fri Dec 30, 2016 11:36 am

Hi,

The parameter "chp" is the pointer to the IO stream associated to the shell, you can use any stream function on it.

http://chibios.sourceforge.net/docs3/ha ... a_m_s.html

Giovanni


Return to “Development and Feedback”

Who is online

Users browsing this forum: No registered users and 35 guests