Hello,
I wanted to use the tm4c123gh6pm to send ps/2 keyboard commands. The ps2dev library accomplishes ps2 writes by:
int PS2dev::write(unsigned char data) { delayMicroseconds(BYTEWAIT); unsigned char i; unsigned char parity = 1; if(digitalRead(_ps2clk) == LOW) { return -1; } if(digitalRead(_ps2data) == LOW) { return -2; } golo(_ps2data); delayMicroseconds(CLKHALF); // device sends on falling clock golo(_ps2clk); // start bit delayMicroseconds(CLKFULL); gohi(_ps2clk); delayMicroseconds(CLKHALF); for(i=0; i<8; i++) { if(data & 0x01) { gohi(_ps2data); } else { golo(_ps2data); } delayMicroseconds(CLKHALF); golo(_ps2clk); delayMicroseconds(CLKFULL); gohi(_ps2clk); delayMicroseconds(CLKHALF); parity = parity ^ (data & 0x01); data = data >> 1; } // parity bit if(parity) { gohi(_ps2data); } else { golo(_ps2data); } delayMicroseconds(CLKHALF); golo(_ps2clk); delayMicroseconds(CLKFULL); gohi(_ps2clk); delayMicroseconds(CLKHALF); // stop bit gohi(_ps2data); delayMicroseconds(CLKHALF); golo(_ps2clk); delayMicroseconds(CLKFULL); gohi(_ps2clk); delayMicroseconds(CLKHALF); delayMicroseconds(BYTEWAIT); return 0; }
However, this is a blocking approach. Is there any way I can accomplish this? How slow can I clock spi? basically I need to generate serial data with clock, Can I clock the ssi peripheal as low as 10-16.7 kHz?