Functions | |
uns8 | soundout_is_busy () |
void | soundout_play_pause () |
void | soundout_reset () |
void | soundout_send_data (uns16 data) |
void | soundout_set_file_id (uns16 file_id) |
void | soundout_set_volume (uns8 level) |
void | soundout_setup_io () |
void | soundout_standby () |
void | soundout_stop () |
void | soundout_wake () |
uns8 soundout_is_busy | ( | ) |
00123 { 00124 #ifdef soundout_busy_port 00125 return test_pin(soundout_busy_port, soundout_busy_pin); 00126 #else 00127 return 0; 00128 #endif 00129 }
void soundout_play_pause | ( | ) |
00113 { 00114 soundout_send_data(soundout_PLAY_PAUSE_CMD); 00115 }
void soundout_reset | ( | ) |
void soundout_send_data | ( | uns16 | data | ) |
00079 { 00080 00081 // Signal start 00082 clear_pin(soundout_clk_port, soundout_clk_pin); 00083 delay_ms(3); // tSTART = 2ms 00084 00085 for (uns8 count = 0; count < 16; count++) { 00086 if (data.15) { 00087 set_pin(soundout_data_port, soundout_data_pin); 00088 } else { 00089 clear_pin(soundout_data_port, soundout_data_pin); 00090 } 00091 delay_us(2); // tDS = 1us 00092 set_pin(soundout_clk_port, soundout_clk_pin); 00093 delay_us(220); // tCH = 200us 00094 clear_pin(soundout_clk_port, soundout_clk_pin); 00095 delay_us(220); // tCL = 200us 00096 data = data << 1; 00097 } 00098 // Signal end 00099 set_pin(soundout_clk_port, soundout_clk_pin); 00100 delay_ms(3); // tSTOP = 2ms 00101 }
void soundout_set_file_id | ( | uns16 | file_id | ) |
void soundout_set_volume | ( | uns8 | level | ) |
00108 { 00109 level = level & 0x07; 00110 soundout_send_data(soundout_VOLUME_CMD + level); 00111 }
void soundout_setup_io | ( | ) |
00041 { 00042 00043 make_output(soundout_clk_port, soundout_clk_pin); 00044 set_pin(soundout_clk_port, soundout_clk_pin); // idle high 00045 00046 make_output(soundout_data_port, soundout_data_pin); 00047 // don't care about data pin state 00048 #ifdef soundout_reset_port 00049 make_output(soundout_reset_port, soundout_reset_pin); 00050 set_pin(soundout_reset_port, soundout_reset_pin); 00051 #endif 00052 #ifdef soundout_busy_port 00053 make_input(soundout_busy_port, soundout_busy_pin); 00054 #endif 00055 }
void soundout_standby | ( | ) |
00065 { 00066 #ifdef soundout_reset_port 00067 clear_pin(soundout_reset_port, soundout_reset_pin); 00068 // Need to wait for 1 second to go into standby 00069 // seems a shame to hang around here waiting though... 00070 // delay_s(1); 00071 #endif 00072 }
void soundout_stop | ( | ) |
00117 { 00118 00119 soundout_send_data(soundout_STOP_CMD); 00120 00121 }
void soundout_wake | ( | ) |
00073 { 00074 #ifdef soundout_reset_port 00075 set_pin(soundout_reset_port, soundout_reset_pin); 00076 #endif 00077 }