示例#1
0
文件: usart.c 项目: genba/micropython
void usart_tx_strn_cooked(pyb_usart_t usart_id, const char *str, int len) {
    for (const char *top = str + len; str < top; str++) {
        if (*str == '\n') {
            usart_tx_char(usart_id, '\r');
        }
        usart_tx_char(usart_id, *str);
    }
}
示例#2
0
static mp_obj_t usart_obj_tx_char(mp_obj_t self_in, mp_obj_t c) {
    pyb_usart_obj_t *self = self_in;
    if (self->is_enabled) {
        usart_tx_char(self->usart_id, mp_obj_get_int(c));
    }
    return mp_const_none;
}
示例#3
0
文件: usart.c 项目: genba/micropython
static mp_obj_t usart_obj_tx_char(mp_obj_t self_in, mp_obj_t c) {
    pyb_usart_obj_t *self = self_in;
    uint len;
    const char *str = mp_obj_str_get_data(c, &len);
    if (len == 1 && self->is_enabled) {
        usart_tx_char(self->usart_id, str[0]);
    }
    return mp_const_none;
}
示例#4
0
文件: usart.c 项目: genba/micropython
void usart_tx_bytes(pyb_usart_t usart_id, const char *data, uint len) {
    for (; len > 0; data++, len--) {
        usart_tx_char(usart_id, *data);
    }
}
示例#5
0
文件: usart.c 项目: genba/micropython
void usart_tx_str(pyb_usart_t usart_id, const char *str) {
    for (; *str; str++) {
        usart_tx_char(usart_id, *str);
    }
}
示例#6
0
void usart_tx_strn(pyb_usart_obj_t *usart_obj, const char *str, uint len) {
    for (; len > 0; str++, len--) {
        usart_tx_char(usart_obj, *str);
    }
}
示例#7
0
void usart_tx_str(pyb_usart_obj_t *usart_obj, const char *str) {
    for (; *str; str++) {
        usart_tx_char(usart_obj, *str);
    }
}