Project

General

Profile

Revision 798

Minor style change - elseif's changed to a case :P

View differences:

encoders.c
211 211
		
212 212
		//Parse the encoder data, comes in over 5 bytes 16 bits per encoder,
213 213
		// second is offset by 1 bit.
214
		if(buf_index == 0)
215
		  right_data_buf |= ((short)data)<<8 & 0xff00;
216

  
217
		else if (buf_index == 1)
218
		  right_data_buf |= ((short)data) & 0xff;
219
		
220
		else if (buf_index == 2)
214
		switch(buf_index){	
215
		case 0: 
216
			right_data_buf |= ((short)data)<<8 & 0xff00;
217
			break;
218
		case 1:
219
		  	right_data_buf |= ((short)data) & 0xff;
220
			break;
221
		case 2:
221 222
			left_data_buf |= (((short)data) << 9) & (0x7F << 9);
222
		
223
		else if (buf_index == 3)
223
			break;
224
		case 3:
224 225
			left_data_buf |= (((short)data) << 1) & (0xFF<<1);
225
		
226
		else if (buf_index == 4)
227
			left_data_buf |= (((short)data)>>7) & 0x1;
228

  
229
		
226
			break;
227
		case 4: left_data_buf |= (((short)data)>>7) & 0x1;
228
			
230 229
		buf_index = (buf_index + 1) % 5;
231 230

  
232 231
		if(buf_index==0) {

Also available in: Unified diff