//***********************************************************************************************
//***********************************************************************************************
//
// -- takes two ADC clock cycles to start up the data pipe line
// -- HG and LG ADC clocks are 180 deg out of phase to make sampling as fast as poosible
// -- ADC samples analog value on negative clock edge, data valid 25ns after negative edge
// -- Low Gain ADC is on Port D, High Gain ADC is on Port C
//
//***********************************************************************************************
//***********************************************************************************************
FASTRUN void Get_Pulse(void)
{
while(digitalReadFast(TRIGGER_PULSE) == HIGH) {} // wait for any old pulse to finish befor looking for new pulse
while(digitalReadFast(TRIGGER_PULSE) == LOW) {} // wait for new pulse
cli(); // disable interrupts
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[0] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[0] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[1] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[1] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[2] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[2] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[3] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[3] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[4] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[4] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[5] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[5] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[6] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[6] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[7] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[7] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[8] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[8] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[9] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[9] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[10] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[10] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[11] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[11] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[12] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[12] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[13] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[13] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[14] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[14] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[15] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[15] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[16] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[16] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[17] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[17] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[18] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[18] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[19] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[19] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[20] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[20] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[21] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[21] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[22] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[22] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[23] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[23] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[24] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[24] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[25] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[25] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[26] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[26] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[27] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[27] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[28] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[28] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[29] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[29] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[30] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[30] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[31] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[31] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[32] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[32] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[33] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[33] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[34] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[34] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[35] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[35] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[36] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[36] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[37] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[37] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[38] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[38] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[39] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[39] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[40] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[40] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[41] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[41] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[42] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[42] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[43] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[43] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[44] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[44] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[45] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[45] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[46] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[46] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[47] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[47] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[48] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[48] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[49] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[49] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[50] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[50] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[51] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[51] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[52] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[52] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[53] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[53] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[54] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[54] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[55] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[55] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[56] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[56] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[57] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[57] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[58] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[58] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[59] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[59] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[60] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[60] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[61] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[61] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[62] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[62] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[63] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[63] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[64] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[64] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[65] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[65] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[66] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[66] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[67] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[67] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[68] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[68] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[69] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[69] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[70] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[70] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[71] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[71] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[72] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[72] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[73] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[73] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[74] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[74] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[75] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[75] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[76] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[76] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[77] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[77] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[78] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[78] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[79] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[79] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[80] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[80] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[81] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[81] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[82] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[82] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[83] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[83] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[84] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[84] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[85] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[85] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[86] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[86] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[87] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[87] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[88] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[88] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[89] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[89] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[90] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[90] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[91] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[91] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[92] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[92] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[93] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[93] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[94] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[94] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[95] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[95] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[96] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[96] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[97] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[97] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[98] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[98] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[99] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[99] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[100] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[100] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[101] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[101] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[102] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[102] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[103] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[103] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[104] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[104] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[105] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[105] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[106] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[106] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[107] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[107] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[108] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[108] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[109] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[109] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[110] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[110] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[111] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[111] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[112] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[112] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[113] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[113] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[114] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[114] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[115] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[115] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[116] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[116] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[117] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[117] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[118] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[118] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[119] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[119] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[120] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[120] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[121] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[121] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[122] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[122] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[123] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[123] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[124] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[124] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[125] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[125] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[126] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[126] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[127] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[127] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[128] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[128] = GPIOD_PDIR;
digitalWriteFast(HG_ADC_CLK, LOW); digitalWriteFast(LG_ADC_CLK, HIGH); HG_buff[129] = GPIOC_PDIR;
digitalWriteFast(HG_ADC_CLK, HIGH); digitalWriteFast(LG_ADC_CLK, LOW); LG_buff[129] = GPIOD_PDIR;
digitalWriteFast(LG_ADC_CLK, HIGH);
sei(); // enable interrupts
}