forked from haraldwolff/avr-fw-modules
Compare commits
2 Commits
Author | SHA1 | Date |
---|---|---|
Harald Wolff | ccdbe3ec0b | |
niclasthobaben | d1c4cff046 |
|
@ -79,16 +79,21 @@ int usart_write (uint8_t _usart,int ch){
|
|||
};
|
||||
|
||||
int usart_tx (uint8_t usart,char *b,int size){
|
||||
int n,r;
|
||||
int n,r, tries;
|
||||
tries = 10;
|
||||
for (n=0;n<size;n++){
|
||||
for (r=0;r<10;r++){
|
||||
if (usart_write( usart, *(b++)) >= 0){
|
||||
return ESUCCESS;
|
||||
for (r=0;r<tries;r++){
|
||||
if (usart_write( usart, *b) >= 0){
|
||||
b++;
|
||||
break;
|
||||
};
|
||||
if(r == tries - 1) {
|
||||
return -EFAIL;
|
||||
}
|
||||
wait_ms(1);
|
||||
};
|
||||
};
|
||||
return -EFAIL;
|
||||
return ESUCCESS;
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue