本文整理汇总了C++中chSequentialStreamPut函数的典型用法代码示例。如果您正苦于以下问题:C++ chSequentialStreamPut函数的具体用法?C++ chSequentialStreamPut怎么用?C++ chSequentialStreamPut使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了chSequentialStreamPut函数的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: shellGetLine
/**
* @brief Reads a whole line from the input channel.
*
* @param[in] chp pointer to a @p BaseSequentialStream object
* @param[in] line pointer to the line buffer
* @param[in] size buffer maximum length
* @return The operation status.
* @retval true the channel was reset or CTRL-D pressed.
* @retval false operation successful.
*
* @api
*/
bool shellGetLine(BaseSequentialStream *chp, char *line, unsigned size) {
char *p = line;
while (true) {
char c;
if (chSequentialStreamRead(chp, (uint8_t *)&c, 1) == 0)
return true;
if (c == 4) {
chprintf(chp, "^D");
return true;
}
if ((c == 8) || (c == 127)) {
if (p != line) {
chSequentialStreamPut(chp, c);
chSequentialStreamPut(chp, 0x20);
chSequentialStreamPut(chp, c);
p--;
}
continue;
}
if (c == '\r') {
chprintf(chp, "\r\n");
*p = 0;
return false;
}
if (c < 0x20)
continue;
if (p < line + size - 1) {
chSequentialStreamPut(chp, c);
*p++ = (char)c;
}
}
}
开发者ID:MultiCalorNV,项目名称:verventa-web_Int,代码行数:46,代码来源:shell.c
示例2: printn
static void printn(uint32_t n) {
char buf[16], *p;
if (!n)
chSequentialStreamPut(&SD1, '0');
else {
p = buf;
while (n)
*p++ = (n % 10) + '0', n /= 10;
while (p > buf)
chSequentialStreamPut(&SD1, *--p);
}
}
开发者ID:CNCBASHER,项目名称:ChibiOS,代码行数:13,代码来源:main.c
示例3: print_line
static void print_line(void) {
unsigned i;
for (i = 0; i < 76; i++)
chSequentialStreamPut(chp, '-');
chSequentialStreamWrite(chp, (const uint8_t *)"\r\n", 2);
}
开发者ID:Tambralinga,项目名称:ChibiOS,代码行数:7,代码来源:test.c
示例4: THD_FUNCTION
static THD_FUNCTION(thSerEcho, arg)
{
(void)arg;
chRegSetThreadName("SerEcho");
event_listener_t elSerData;
eventflags_t flags;
chEvtRegisterMask((event_source_t *)chnGetEventSource(&SD1), &elSerData, EVENT_MASK(1));
while (!chThdShouldTerminateX())
{
chEvtWaitOneTimeout(EVENT_MASK(1), MS2ST(10));
flags = chEvtGetAndClearFlags(&elSerData);
if (flags & CHN_INPUT_AVAILABLE)
{
msg_t charbuf;
do
{
charbuf = chnGetTimeout(&SD1, TIME_IMMEDIATE);
if ( charbuf != Q_TIMEOUT )
{
chSequentialStreamPut(&SD1, charbuf);
}
}
while (charbuf != Q_TIMEOUT);
}
}
}
开发者ID:dotdash32,项目名称:tmk_keyboard,代码行数:27,代码来源:main.c
示例5: cmd_gps_passthrough
static void cmd_gps_passthrough(BaseSequentialStream *chp, int argc, char *argv[]) {
(void)argc;
(void)argv;
static const SerialConfig sc = {
9600, 0, USART_CR2_STOP1_BITS | USART_CR2_LINEN, 0};
sdStart(&SD1, &sc);
EventListener elSerData;
flagsmask_t flags;
chEvtRegisterMask(chnGetEventSource(&SD1), &elSerData, EVENT_MASK(1));
while (TRUE)
{
chEvtWaitOneTimeout(EVENT_MASK(1), MS2ST(10));
flags = chEvtGetAndClearFlags(&elSerData);
if (flags & CHN_INPUT_AVAILABLE)
{
msg_t charbuf;
do
{
charbuf = chnGetTimeout(&SD1, TIME_IMMEDIATE);
if ( charbuf != Q_TIMEOUT )
{
chSequentialStreamPut(chp, charbuf);
}
}
while (charbuf != Q_TIMEOUT);
}
}
}
开发者ID:ac942,项目名称:avionics14,代码行数:29,代码来源:b3_shell.c
示例6: println
static void println(char *p) {
while (*p) {
chSequentialStreamPut(&SD1, *p++);
}
chSequentialStreamWrite(&SD1, (uint8_t *)"\r\n", 2);
}
开发者ID:CNCBASHER,项目名称:ChibiOS,代码行数:7,代码来源:main.c
示例7: chvprintf
/**
* @brief System formatted output function.
* @details This function implements a minimal @p vprintf()-like functionality
* with output on a @p BaseSequentialStream.
* The general parameters format is: %[-][width|*][.precision|*][l|L]p.
* The following parameter types (p) are supported:
* - <b>x</b> hexadecimal integer.
* - <b>X</b> hexadecimal long.
* - <b>o</b> octal integer.
* - <b>O</b> octal long.
* - <b>d</b> decimal signed integer.
* - <b>D</b> decimal signed long.
* - <b>u</b> decimal unsigned integer.
* - <b>U</b> decimal unsigned long.
* - <b>c</b> character.
* - <b>s</b> string.
* .
*
* @param[in] chp pointer to a @p BaseSequentialStream implementing object
* @param[in] fmt formatting string
* @param[in] ap list of parameters
* @return The number of bytes that would have been
* written to @p chp if no stream error occurs
*
* @api
*/
int chvprintf(BaseSequentialStream *chp, const char *fmt, va_list ap) {
char *p, *s, c, filler;
int i, precision, width;
int n = 0;
bool is_long, left_align;
long l;
#if CHPRINTF_USE_FLOAT
float f;
char tmpbuf[2*MAX_FILLER + 1];
#else
char tmpbuf[MAX_FILLER + 1];
#endif
while (TRUE) {
c = *fmt++;
if (c == 0)
return n;
if (c != '%') {
chSequentialStreamPut(chp, (uint8_t)c);
n++;
continue;
}
p = tmpbuf;
s = tmpbuf;
left_align = FALSE;
if (*fmt == '-') {
fmt++;
left_align = TRUE;
}
filler = ' ';
if (*fmt == '0') {
fmt++;
filler = '0';
}
width = 0;
while (TRUE) {
c = *fmt++;
if (c >= '0' && c <= '9')
c -= '0';
else if (c == '*')
c = va_arg(ap, int);
else
break;
width = width * 10 + c;
}
precision = 0;
if (c == '.') {
while (TRUE) {
c = *fmt++;
if (c >= '0' && c <= '9')
c -= '0';
else if (c == '*')
c = va_arg(ap, int);
else
break;
precision *= 10;
precision += c;
}
}
开发者ID:vedderb,项目名称:bldc,代码行数:85,代码来源:chprintf.c
示例8: chstream_write
static size_t chstream_write(void *ip, const void *data, size_t size) {
BaseSequentialStream *chp = (BaseSequentialStream *) ip;
int cr_send = 0;
int counter = 0;
while (counter < size) {
char *ptr = (char*) data;
#if 1
if (ptr[counter] == '\r')
cr_send = 1;
else if (ptr[counter] == '\n' && !cr_send)
chSequentialStreamPut(chp, '\r');
else
cr_send = 0;
#endif
if (chSequentialStreamPut(chp, ptr[counter]) != Q_OK)
return counter;
counter++;
}
return counter;
}
开发者ID:martinribelotta,项目名称:ChibiOS-JS,代码行数:20,代码来源:posix_chstream.c
示例9: _write_r
int _write_r(struct _reent *r, int file, char * ptr, int len)
{
(void)r;
(void)file;
(void)ptr;
while(len) {
chSequentialStreamPut(&SDU2, *ptr);
ptr++;
len--;
}
return len;
}
开发者ID:Tecnologic,项目名称:ThunderCryer,代码行数:12,代码来源:LibraryHacks.cpp
示例10: LogTextMessage
void LogTextMessage(const char* format, ...) {
if ((usbGetDriverStateI(BDU1.config->usbp) == USB_ACTIVE) && (connected)) {
int h = 0x546F7841; // "AxoT"
chSequentialStreamWrite((BaseSequentialStream * )&BDU1,
(const unsigned char* )&h, 4);
va_list ap;
va_start(ap, format);
chvprintf((BaseSequentialStream *)&BDU1, format, ap);
va_end(ap);
chSequentialStreamPut((BaseSequentialStream * )&BDU1, 0);
}
}
开发者ID:Buerk,项目名称:axoloti,代码行数:13,代码来源:pconnection.c
示例11: print
static void print(char *p) {
while (*p) {
chSequentialStreamPut(&SD1, *p++);
}
}
开发者ID:CNCBASHER,项目名称:ChibiOS,代码行数:6,代码来源:main.c
示例12: print_tokens
static void print_tokens(void) {
char *cp = tokens_buffer;
while (cp < tokp)
chSequentialStreamPut(chp, *cp++);
}
开发者ID:Tambralinga,项目名称:ChibiOS,代码行数:6,代码来源:test.c
示例13: test_print
/**
* @brief Prints a line without final end-of-line.
*
* @param[in] msgp the message
*/
void test_print(const char *msgp) {
while (*msgp)
chSequentialStreamPut(chp, *msgp++);
}
开发者ID:Tambralinga,项目名称:ChibiOS,代码行数:10,代码来源:test.c
示例14: fm_putchar
/**
* @brief Function required to properly using format library
* @param c char
* @return
*/
int fm_putchar(int c)
{
chThdSleepMilliseconds(2);
chSequentialStreamPut(&SDU1, (uint8_t)c);
return 1;
}
开发者ID:kl-cruz,项目名称:cecc,代码行数:11,代码来源:platform_utils.c
示例15: chvprintf
void chvprintf(BaseSequentialStream *chp, const char *fmt, va_list ap) {
char *p, *s, c, filler;
int i, precision, width;
bool is_long, left_align;
long l;
#if CHPRINTF_USE_FLOAT
double d;
char tmpbuf[2*MAX_FILLER + 1];
int fprec=0;
#else
char tmpbuf[MAX_FILLER + 1];
#endif
while (TRUE) {
c = *fmt++;
if (c == 0) {
return;
}
if (c != '%') {
chSequentialStreamPut(chp, (uint8_t)c);
continue;
}
p = tmpbuf;
s = tmpbuf;
left_align = false;
if (*fmt == '-') {
fmt++;
left_align = true;
}
filler = ' ';
if (*fmt == '.') {
fmt++;
filler = '0';
#if CHPRINTF_USE_FLOAT
fprec = intPow (10, (*fmt)-'0');
#endif
}
width = 0;
while (TRUE) {
c = *fmt++;
if (c >= '0' && c <= '9')
c -= '0';
else if (c == '*')
c = va_arg(ap, int);
else
break;
width = width * 10 + c;
}
precision = 0;
if (c == '.') {
while (TRUE) {
c = *fmt++;
if (c >= '0' && c <= '9') {
c -= '0';
#if CHPRINTF_USE_FLOAT
fprec = intPow (10, c);
#endif
}
else if (c == '*')
c = va_arg(ap, int);
else
break;
precision *= 10;
precision += c;
}
}
开发者ID:2seasuav,项目名称:paparuzzi,代码行数:66,代码来源:printf.c
示例16: send_command
void send_command( char *p )
{
while (*p) chSequentialStreamPut( &SD6, *p++ );
}
开发者ID:JeremySavonet,项目名称:Eurobot-2016_The-beach-bots,代码行数:4,代码来源:esp8266_manager.c
示例17: spicallback
void spicallback(SPIDriver *spip){
chSequentialStreamPut(&SD1, '.');
spip->txbuf = 0; // terminating null
}
开发者ID:0x00f,项目名称:ChibiOS,代码行数:4,代码来源:slave.c
示例18: consolePutChar
void consolePutChar(int x) {
chSequentialStreamPut(getConsoleChannel(), (uint8_t )(x));
}
开发者ID:ioerror88,项目名称:rusefi,代码行数:3,代码来源:console_io.cpp
注:本文中的chSequentialStreamPut函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论