int test_main() { serial_putstr("Hello world.\n"); int k; for(k=0; k<10; k++) { serial_putstr("Loop!\n"); } for(k=0; k<int_buffer_size; k++) int_buffer[k] = k; for(k=0; k<(int_buffer_size); k++) { int j = int_buffer[k]; j = j * j; int_buffer[k] = j; } for(k=0; k<(int_buffer_size); k++) { char print = (char)int_buffer[k]; print = print % 10; serial_putchar(print + '0'); } serial_putchar('\n'); serial_putstr("Bye world.\n"); stop(); return 0; }
void serial_put_signal(uint8 *signalName, int32 value) { serial_putc('{'); serial_putstr(signalName); serial_putstr((uint8 *) ",T,"); serial_putnr(value); serial_putc('}'); }
void poll_serial() { uint8_t c; if(USART_GetFlagStatus(USART2, USART_FLAG_RXNE) == RESET) {return;} c=USART_ReceiveData(USART2); if(state<3) { *dlc=0; } if(state<0) { if(c==0xFF) { state=0; } } else if(state>=0 && state<*dlc+3) { can_frame[state]=c; state++; } else if(state>=*dlc+3) { if(c==0xFF) { canout(); serial_putstr("OK\r",3); state=0; } else { state=-1; } } }