Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int main(void){
- ss_init();
- sei();
- bool sendactive = false;
- while(1){
- if(sendactive){
- uart_sendl("T!");
- // Comment out the below and all is well. We never see the T! unless we specifically turn on sending.
- while(ss_queuebyte(count)){
- count++;
- }
- }
- ss_poll();
- ss_check_errors();
- uart_async_send_poll();
- bool a;
- if(UCSR0A & (1<<RXC0)){
- char x = UDR0;
- /*if(x<97 || x > 122) {
- return;
- }*/
- uart_send("rx: ");
- uart_sendl(x);
- if(x == 'r'){
- uart_send("Received bytes: ");
- uart_sendl(rbf_get_bytes_in_use(&ss_inbuf));
- while(rbf_get_bytes_in_use(&ss_inbuf)!=0){
- a = true;
- uart_send(rbf_get_byte(&ss_inbuf)); // Contents are scrambled unless the while statement above is commented out (even when it doesn't run)
- uart_send(",");
- }
- if(a) uart_send("\r\n");
- }
- if(x == 's'){
- //ss_queuebyte(count++);
- if(!sendactive){
- sendactive = true;
- uart_sendl("Send active");
- } else {
- sendactive = false;
- uart_sendl("Send inactive");
- }
- }
- if(x == 'u'){
- ss_clks ++;
- uart_send(ss_clks);
- OCR0A = ss_clks;
- uart_sendl(";");
- }
- if(x == 'd'){
- ss_clks --;
- uart_send(ss_clks);
- OCR0A = ss_clks;
- uart_sendl(";");
- }
- }
- _delay_us(100);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement