Changeset 10910 for firmware/FSC/src
- Timestamp:
- 06/05/11 17:40:00 (14 years ago)
- Location:
- firmware/FSC/src
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
firmware/FSC/src/FSC_eth_with_user_interface.c
r10705 r10910 34 34 bool once_told_you = true; 35 35 bool debug_mode = false; 36 37 // ETHERNET VARS 38 U08 downloaded_bytes; 39 36 37 40 38 //----------------------------------------------------------------------------- 41 39 // M A I N --- M A I N --- M A I N --- M A I N --- M A I N … … 43 41 int main(void) 44 42 { 43 U08 highbyte; 44 U08 lowbyte; 45 45 46 app_init(); // Setup: Watchdog and I/Os 46 47 usart_init(); … … 59 60 60 61 for ( U08 i=0; i < (RESISTANCE_CHANNELS/8); ++i ) { 61 ad7719_enables[i]=0x FF;62 ad7719_enables[i]=0x00; 62 63 ad7719_channels_ready[i]=0; 63 64 } 64 for ( U08 i=0; i < (VOLTAGE_CHANNELS/8); ++i ) { 65 adc_enables[i]=0x00; 65 for ( U08 i=0; i < (VOLTAGE_REGS); ++i ) { 66 if (i < (VOLTAGE_REGS)-1) 67 adc_enables[i]=0xFF; 68 else 69 adc_enables[i]=0x0F; 66 70 adc_channels_ready[i]=0; 67 71 } 68 72 69 static U08 welcome[]=" welcome to:\n FSC command interface 0.1 \n build: ??.05.2010\n";73 static U08 welcome[]="FSC 0.2 \n build: 05.06.2010 - 12:57\n"; 70 74 usart_write_str(welcome); 71 75 /* … … 94 98 { 95 99 if (get_S0_RX_RSR() != 0) { // we have something to read 96 downloaded_bytes = w5100_get_RX(ETH_READ_BUFFER_SIZE, true);97 parse_w5300_incoming( downloaded_bytes);100 101 parse_w5300_incoming( w5100_get_RX(ETH_READ_BUFFER_SIZE, true) ); 98 102 } 99 103 } … … 107 111 usart_write_U32(sec ,8); 108 112 print_adc_nicely(false,true); 113 //print_adc_stupid(); 114 reset_voltage_done(); 115 reset_voltage_values(); 109 116 telegram_start(); 110 117 w5100_set_TX((U08*) adc_values, ADC_VALUES_LEN_BYTE); … … 115 122 adc_values_printed = true; 116 123 print_adc_nicely(true,true); 124 //print_adc_stupid(); 125 //reset_voltage_done(); 117 126 telegram_start(); 118 127 w5100_set_TX((U08*) adc_values, ADC_VALUES_LEN_BYTE); … … 135 144 ad7719_values_printed = true; 136 145 print_ad7719_nicely(true,true); 146 reset_resistance_done(); 137 147 telegram_start(); 138 148 w5100_set_TX((U08*) ad7719_values, AD7719_VALUES_LEN_BYTE); … … 187 197 // -It is not allowed to send more than one command between two '\n' 188 198 if (usart_rx_ready){ 189 void MSR_parser(); 199 //parse_ascii(); 200 MSR_parser(); 190 201 } 191 202 //---------------------------------------------------------------------------- … … 193 204 //IF ATmega internal ADC did finish a conversion --every 200us 194 205 if ( (ADCSRA & (1<<ADIF)) && !adc_measured_all) { 195 *adc_current_reading = (U16)ADCL; 196 *adc_current_reading += (U16)ADCH<<8; 206 lowbyte = ADCL; 207 highbyte = ADCH; 208 ADCSRA |= 1<<ADIF; 209 *adc_current_reading = ((U16)highbyte<<8) | ((U16)lowbyte); 210 if (debug_mode) { 211 usart_write_U16_hex(*adc_current_reading); 212 usart_write_crlf(); 213 } 214 197 215 if (*adc_readings_since_last_muxing == ADC_READINGS_UNTIL_SETTLED+adc_readings_until_mean-1) { 216 adc_values[*adc_current_channel] += *adc_current_reading; 198 217 adc_channels_ready[*adc_current_channel/8] |= (1<<(*adc_current_channel%8)); 199 218 *adc_current_channel = increase_adc (*adc_current_channel); … … 201 220 Set_V_Muxer(*adc_current_channel); 202 221 *adc_readings_since_last_muxing = 0; 203 _delay_ms(10); 222 _delay_ms(10); // this is a muxer delay 204 223 } 205 224 else if (adc_readings_since_last_muxing >= ADC_READINGS_UNTIL_SETTLED-1) { 206 225 adc_values[*adc_current_channel] += *adc_current_reading; 226 if (debug_mode) { 227 usart_write_str((pU08)"ch:"); 228 usart_write_U08(*adc_current_channel,4); 229 usart_write_str((pU08)" v:"); 230 usart_write_U16_hex(*adc_current_reading); 231 usart_write_str((pU08)" sum:"); 232 usart_write_U16(adc_values[*adc_current_channel],8); 233 usart_write_crlf(); 234 } 235 207 236 ++(*adc_readings_since_last_muxing); 208 237 } … … 212 241 213 242 } 243 214 244 //---------------------------------------------------------------------------- 215 245 -
firmware/FSC/src/FSC_test.c
r10677 r10910 55 55 // ATMEGA ADC global variables 56 56 U08 adc_values[VOLTAGE_CHANNELS]; // stores measured voltage in steps of 16mV 57 U08 adc_enables[VOLTAGE_ CHANNELS/8];58 U08 adc_channels_ready[VOLTAGE_ CHANNELS/8];57 U08 adc_enables[VOLTAGE_REGS]; 58 U08 adc_channels_ready[VOLTAGE_REGS]; 59 59 U08 adc_readings_since_last_muxing = 0; 60 60 U08 adc_current_channel = 0; -
firmware/FSC/src/application.c
r10705 r10910 19 19 20 20 U32 *ad7719_values = (U32*)&FSCregister[68]; 21 U08 *ad7719_enables = &FSCregister[3 2];22 U08 *ad7719_channels_ready = &FSCregister[ 50];21 U08 *ad7719_enables = &FSCregister[30]; 22 U08 *ad7719_channels_ready = &FSCregister[49]; 23 23 U08 *ad7719_readings_since_last_muxing = &FSCregister[14]; 24 24 U08 *ad7719_current_channel = &FSCregister[15]; … … 26 26 27 27 U16 *adc_values = (U16*) &FSCregister[324]; 28 U08 *adc_enables = &FSCregister[ 40];29 U08 *adc_channels_ready = &FSCregister[5 8];28 U08 *adc_enables = &FSCregister[38]; 29 U08 *adc_channels_ready = &FSCregister[57]; 30 30 U08 *adc_readings_since_last_muxing = &FSCregister[20]; 31 31 U08 *adc_current_channel = &FSCregister[21]; … … 178 178 { 179 179 effective_channel = (channel + increase) % (VOLTAGE_CHANNELS); 180 if (adc_enables[effective_channel/8] & (1<<effective_channel%8)) 180 if (adc_enables[effective_channel/8] & (1<<effective_channel%8)) { 181 if (debug_mode) 182 { 183 usart_write_U08(effective_channel,3); 184 usart_write_crlf(); 185 } 181 186 return effective_channel; 187 } 188 } 189 if (debug_mode) 190 { 191 usart_write_U08(channel,3); 192 usart_write_crlf(); 182 193 } 183 194 return channel; … … 197 208 void check_if_measured_all() { 198 209 adc_measured_all = true; 199 for ( U08 i=0; i<(VOLTAGE_ CHANNELS/8); ++i ) {210 for ( U08 i=0; i<(VOLTAGE_REGS); ++i ) { 200 211 if ((adc_enables[i] ^ adc_channels_ready[i]) != 0x00) { 201 212 adc_measured_all = false; … … 214 225 } 215 226 216 227 // an U08 array containts bitmaps, which encode, which channel is enabled and which is not. 228 // a measurement is done, when all (or more) enabled channels were already measured. 229 // a similar U08 array contains a bitmap, encoding which channels are already done. 230 // note: "or more" above is important, if we check to strictly, 231 // we will never finish, in case a disabled channel get measured by any mistake... 232 // 233 // lets assume: 234 // enabled = 1110.0011 1110.0011 235 // done = 1111.0011 0111.0010 236 // 237 // and = 1110.0011 0110.0010 238 // nand = 0001.0011 1001.1101 239 // or = 1111.0011 1111.0011 240 // xor = 0001.0000 1001.0001 241 // 242 // 243 // (en xor done) and enabled = 244 // xor = 0001.0000 1001.0001 245 // enabled = 1110.0011 1110.0011 246 // --------- --------- 247 // 0000.0000 1000.0001 248 // if this statement evaluates to zero, 217 249 bool check_if_adc_measurement_done(){ 218 250 adc_measured_all = true; 219 for ( U08 i=0; i<VOLTAGE_ CHANNELS/8; ++i ) {220 if (( adc_enables[i] ^ adc_channels_ready[i])!= 0x00) {251 for ( U08 i=0; i<VOLTAGE_REGS; ++i ) { 252 if (( (adc_enables[i] ^ adc_channels_ready[i]) & adc_enables[i] ) != 0x00) { 221 253 adc_measured_all = false; 222 254 break; … … 229 261 ad7719_measured_all = true; 230 262 for ( U08 i=0; i<RESISTANCE_CHANNELS/8; ++i ) { 231 if (( ad7719_enables[i] ^ ad7719_channels_ready[i]) != 0x00) {263 if (( (ad7719_enables[i] ^ ad7719_channels_ready[i]) & ad7719_enables[i]) != 0x00) { 232 264 ad7719_measured_all = false; 233 265 break; -
firmware/FSC/src/application.h
r10705 r10910 7 7 // in order to implement the "registers" I work with a quite long 8 8 // char-array like this: 9 # define FSC_REGISTER_LENGTH 2549 # define FSC_REGISTER_LENGTH 492 10 10 extern U08 FSCregister[FSC_REGISTER_LENGTH]; 11 11 // but this register is not only accessible by … … 26 26 27 27 extern U16 *adc_values ; 28 #define ADC_VALUES_LEN_BYTE 1 5228 #define ADC_VALUES_LEN_BYTE 168 29 29 extern U08 *adc_enables ; 30 30 extern U08 *adc_channels_ready ; … … 70 70 71 71 #define VOLTAGE_CHANNELS 84 72 #define VOLTAGE_REGS 11 72 73 #define ADC_READINGS_UNTIL_SETTLED 1 73 74 #endif … … 90 91 91 92 // ATMEGA ADC global variables 92 #define adc_readings_until_mean 25093 #define adc_readings_until_mean 40 93 94 extern bool adc_measured_all; 94 95 extern bool adc_values_printed; -
firmware/FSC/src/atmega_adc.c
r10109 r10910 15 15 ADMUX &= ~(1<<REFS0); 16 16 ADMUX &= ~(1<<REFS1); //REFS = 00 --> use external reference voltage. 17 ADMUX |= 1<<ADLAR; //ADLAR =1 --> left adjust ac result in ADCH register --> 8bit resolution only.17 //ADMUX |= 1<<ADLAR; //ADLAR =1 --> left adjust ac result in ADCH register --> 8bit resolution only. 18 18 ADMUX |= (0x1F & 0x06); //MUX = 0x06 --> Pin ADC6 = PA6 is used as ADC input pin. 19 19 -
firmware/FSC/src/muxer_fsc.c
r10244 r10910 1 1 #include "muxer_fsc.h" 2 2 #include "usart.h" 3 3 // Sets voltage Muxer to current channel 4 4 // this is a Muxing, and therefor the adc might need some time to settle. … … 39 39 break; 40 40 case 2: 41 SB = 0x5 8; //0101.001041 SB = 0x52; //0101.0010 42 42 break; 43 43 case 3: 44 SB = 0x5 8; //0101.001144 SB = 0x53; //0101.0011 45 45 break; 46 46 } // end of switch-case -
firmware/FSC/src/output.c
r10697 r10910 7 7 void print_status() { 8 8 usart_write_str((pU08)"adc status:\n"); 9 for (U08 i=0; i< VOLTAGE_ CHANNELS/8;++i) {9 for (U08 i=0; i< VOLTAGE_REGS;++i) { 10 10 usart_write_U08_bin(adc_enables[i]); 11 11 usart_write_char(' '); 12 12 } 13 usart_write_c har('\n');14 for (U08 i=0; i< VOLTAGE_ CHANNELS/8;++i){13 usart_write_crlf(); 14 for (U08 i=0; i< VOLTAGE_REGS;++i){ 15 15 usart_write_U08_bin(adc_channels_ready[i]); 16 16 usart_write_char(' '); 17 17 } 18 usart_write_c har('\n');18 usart_write_crlf(); 19 19 20 20 usart_write_str((pU08)"ad7719 status:\n"); … … 23 23 usart_write_char(' '); 24 24 } 25 usart_write_c har('\n');25 usart_write_crlf(); 26 26 for (U08 i=0; i< RESISTANCE_CHANNELS/8;++i){ 27 27 usart_write_U08_bin(ad7719_channels_ready[i]); 28 28 usart_write_char(' '); 29 29 } 30 usart_write_c har('\n');30 usart_write_crlf(); 31 31 32 32 usart_write_str((pU08)"time:"); 33 33 usart_write_U32(sec,10); 34 34 usart_write_str((pU08)" sec.\n"); 35 35 /* 36 36 usart_write_str((pU08)"adc measured all: "); 37 37 if (adc_measured_all) … … 48 48 usart_write_str((pU08)"adc current channel:"); 49 49 usart_write_U08(*adc_current_channel,2); 50 usart_write_c har('\n');50 usart_write_crlf(); 51 51 52 52 usart_write_str((pU08)"ad7719 current channel:"); 53 53 usart_write_U08(*ad7719_current_channel,2); 54 usart_write_char('\n'); 55 54 usart_write_crlf(); 55 56 usart_write_str((pU08)"mux SB:"); 57 usart_write_U08_hex(PORTC); 58 usart_write_str((pU08)" SA:"); 59 usart_write_U08_hex(PORTA); 60 usart_write_crlf(); 61 */ 56 62 } 57 63 void print_adc_nicely() { … … 92 98 usart_write_str((pU08)" "); 93 99 } else { 94 usart_write_str((pU08)" 100 usart_write_str((pU08)" "); 95 101 } 96 102 //usart_write_char('\n'); … … 114 120 } 115 121 116 void adc_output(U08 channel, U 08data) {122 void adc_output(U08 channel, U16 data) { 117 123 118 124 // if (channel < 40) … … 167 173 //usart_write_U08(channel,2); // Numbers 1...8 168 174 usart_write_char(':'); 169 usart_write_U16( (U16)data*16, 4); //data175 usart_write_U16(data/(adc_readings_until_mean/4), 7); //data 170 176 } 171 177 … … 182 188 w5100_set_TX(eth_write_buffer, 2); 183 189 } 190 191 void print_help(){ 192 usart_write_str((pU08)"printing help: -not yet- \n"); 193 } 194 195 void print_adc_stupid() { 196 usart_write_str((pU08)"printing voltages in mV - stupid mode:\n"); 197 for (U08 i = 0 ; i < VOLTAGE_CHANNELS ; ++i) { 198 usart_write_str((pU08)"ch:"); 199 usart_write_U08(i,3); 200 usart_write_char(' '); 201 usart_write_U16_hex(adc_values[i]); 202 usart_write_char(' '); 203 usart_write_U16(adc_values[i],7); 204 usart_write_crlf(); 205 } 206 usart_write_char('\n'); 207 } -
firmware/FSC/src/output.h
r10697 r10910 5 5 6 6 void ad7719_output(U08 channel, U32 data); 7 void adc_output(U08 channel, U 08data);7 void adc_output(U08 channel, U16 data); 8 8 void adc_output_all(); 9 9 void print_ad7719_nicely(); 10 10 void print_adc_nicely(); 11 void print_adc_stupid(); 11 12 void print_status() ; 12 13 13 14 void print_help(); 14 15 void telegram_start(); 15 16 -
firmware/FSC/src/parser.c
r10697 r10910 41 41 case 'g': // GET the voltage/current/humidity channels, which are enabled 42 42 once_told_you = false; 43 for ( U08 i=0; i<VOLTAGE_ CHANNELS/8; ++i ) {43 for ( U08 i=0; i<VOLTAGE_REGS; ++i ) { 44 44 adc_channels_ready[i]=0; 45 45 } … … 107 107 } 108 108 */ 109 /* 109 110 110 111 111 // this is the recent MSR parser … … 242 242 case 'G': // GET the Temperature channels, which are enabled 243 243 ad7719_values_printed = false; 244 for ( U08 i=0; i<RESISTANCE_CHANNELS/8; ++i ) {245 ad7719_channels_ready[i]=0;246 }247 break;244 reset_resistance_done(); 245 reset_resistance_values(); 246 break; 247 248 248 case 'g': // GET the voltage/current/humidity channels, which are enabled 249 249 adc_values_printed = false; 250 for ( U08 i=0; i<VOLTAGE_CHANNELS/8; ++i ) { 251 adc_channels_ready[i]=0; 252 } 250 reset_voltage_done(); 251 reset_voltage_values(); 253 252 break; 254 253 … … 264 263 ad7719_print_endless = false; 265 264 break; 265 266 case 's': 267 print_status(); 268 //print_adc_enable_status(true); 269 //usart_write_char('\n'); 270 271 //print_ad7719_enable_status(true); 272 //usart_write_char('\n'); 273 274 //usart_write_str((pU08)"time:"); 275 //usart_write_float((float)local_ms/1000 , 1,7); 276 //usart_write_str((pU08)" sec.\n"); 277 break; 266 278 267 268 case 's': 269 print_adc_enable_status(true); 270 usart_write_char('\n'); 271 272 print_ad7719_enable_status(true); 273 usart_write_char('\n'); 274 275 usart_write_str((pU08)"time:"); 276 usart_write_float((float)local_ms/1000 , 1,7); 277 usart_write_str((pU08)" sec.\n"); 278 break; 279 case 'S': 280 write_status_via_eth(); 281 break; 279 282 280 283 case '!': … … 306 309 } // END of MSR_parser(); 307 310 308 */ 311 309 312 310 313 /////////////////////////////////////////////////////////////////////////////////////// … … 342 345 case 's': // return *s*tatus information 343 346 // this might take a lot of time... about... 25us per byte .. --> less than 25ms 344 w5100_set_TX(FSCregister, FSC_REGISTER_LENGTH); 347 write_status_via_eth(); 348 //w5100_set_TX(FSCregister, FSC_REGISTER_LENGTH); 345 349 break; 346 350 … … 372 376 } 373 377 } 378 void reset_resistance_values(){ 379 for (U08 i=0; i < RESISTANCE_CHANNELS; i++){ 380 ad7719_values[i] = 0; 381 } 382 } 383 384 374 385 void reset_voltage_done(){ 375 for (U08 i=0; i < (VOLTAGE_ CHANNELS/8); i++){386 for (U08 i=0; i < (VOLTAGE_REGS); i++){ 376 387 adc_channels_ready[i] = 0; 377 388 } 378 389 } 390 void reset_voltage_values(){ 391 for (U08 i=0; i < VOLTAGE_CHANNELS; i++){ 392 adc_values[i] = 0; 393 } 394 } 395 379 396 void reset_done(){ 380 397 reset_resistance_done(); … … 387 404 w5100_set_TX(eth_write_buffer, 2); 388 405 } 406 407 void write_status_via_eth() { 408 // take care: ethernet write buffer is just 32 bytes long. 409 eth_write_str("status: "); eth_writeln_str(nc_U32_to_hex(status)); 410 // better switch off interrupts here: 411 // otherwise the numbers in time_sec and time_ms might get corrupt during output. 412 cli(); 413 eth_write_str("time_s: "); eth_writeln_str(nc_U32_to_str(time_sec, 10)); 414 eth_write_str("mili_s: "); eth_writeln_str(nc_U16_to_str(time_ms, 6)); 415 sei(); 416 417 eth_write_str("R_ref : "); eth_writeln_str(nc_U16_to_str(ref_resistor, 6)); 418 419 eth_writeln_str("VOLTAGES\n"); 420 eth_write_str("enable:"); 421 for (U08 i=0; i<4 ; i++){ 422 eth_write_str(nc_U08_to_bin(adc_enables[i])); 423 // need to tweak here in order to get some nice spaces... 424 eth_write_buffer[eth_write_index] = ' '; 425 eth_write_index++; 426 } 427 eth_writeln_str(nc_U08_to_bin(adc_enables[4])); 428 429 eth_write_str(" done:"); 430 for (U08 i=0; i<4 ; i++){ 431 eth_write_str(nc_U08_to_bin(adc_channels_ready[i])); 432 // need to tweak here in order to get some nice spaces... 433 eth_write_buffer[eth_write_index] = ' '; 434 eth_write_index++; 435 } 436 eth_writeln_str(nc_U08_to_bin(adc_channels_ready[4])); 437 438 eth_write_str("values:"); 439 for (U08 i=0; i<73 ; i++){ 440 eth_write_str(nc_U16_to_str(adc_values[i], 6) ); 441 // need to tweak here in order to get some nice spaces... 442 eth_write_buffer[eth_write_index] = ' '; 443 eth_write_index++; 444 } 445 eth_writeln_str(nc_U16_to_str(adc_values[73], 6) ); 446 447 eth_writeln_str("RESISTANCES\n"); 448 eth_write_str("enable:"); 449 for (U08 i=0; i<7 ; i++){ 450 eth_write_str(nc_U08_to_bin(ad7719_enables[i])); 451 // need to tweak here in order to get some nice spaces... 452 eth_write_buffer[eth_write_index] = ' '; 453 eth_write_index++; 454 } 455 eth_writeln_str(nc_U08_to_bin(ad7719_enables[7])); 456 457 eth_write_str(" done:"); 458 for (U08 i=0; i<7 ; i++){ 459 eth_write_str(nc_U08_to_bin(ad7719_channels_ready[i])); 460 // need to tweak here in order to get some nice spaces... 461 eth_write_buffer[eth_write_index] = ' '; 462 eth_write_index++; 463 } 464 eth_writeln_str(nc_U08_to_bin(ad7719_channels_ready[7])); 465 466 eth_write_str("values:"); 467 for (U08 i=0; i<63 ; i++){ 468 eth_write_str(nc_U32_to_str(ad7719_values[i], 10) ); 469 // need to tweak here in order to get some nice spaces... 470 eth_write_buffer[eth_write_index] = ' '; 471 eth_write_index++; 472 } 473 eth_writeln_str(nc_U32_to_str(ad7719_values[63], 10) ); 474 475 476 } -
firmware/FSC/src/parser.h
r10697 r10910 15 15 void read_FSC_register(); 16 16 void reset_resistance_done(); 17 void reset_resistance_values(); 17 18 void reset_voltage_done(); 19 void reset_voltage_values(); 18 20 void reset_done(); 19 21 void simple_acknowledge(); 20 22 23 // this function will loop over the entire FSC register and output it in a human readable form. 24 // I hope this is convenient. 25 void write_status_via_eth(); 21 26 #endif -
firmware/FSC/src/w5100_spi_interface.c
r10698 r10910 8 8 volatile U08 eth_write_buffer[ETH_WRITE_BUFFER_SIZE]; 9 9 10 U08 eth_write_index; 10 11 //----------------------------------------------------------------------------- 11 12 // INTERFACE CONTROL VARS … … 305 306 { 306 307 return 0; 307 } 308 usart_write_str((U08*)"sending via eth: with pointer:"); 309 usart_write_U16_hex(string); 310 usart_write_str((U08*)" #of bytes: "); 311 usart_write_U16(NumBytes,4 ); 312 usart_write_char(' \n'); 313 308 } 314 309 U16 last_TX_write_pointer = get_S0_TX_WR(); 315 310 U16 offset = last_TX_write_pointer & S0_TX_MASK; … … 340 335 upper_size = (S0_RX_MASK + 1) - offset; 341 336 lower_size = NumBytes - upper_size; 342 for (U 08i = 0; i < upper_size; ++i)337 for (U16 i = 0; i < upper_size; ++i) 343 338 { 344 339 w5100_write(start_address + i, string[i]); 345 340 } 346 for (U 08i = 0; i < lower_size; ++i)341 for (U16 i = 0; i < lower_size; ++i) 347 342 { 348 343 w5100_write(S0_RX_BASE + i, string[upper_size+i]); … … 351 346 else // if not data turn over in RX-mem 352 347 { 353 for (U 08i = 0; i < NumBytes; ++i)348 for (U16 i = 0; i < NumBytes; ++i) 354 349 { 355 350 w5100_write(start_address + i, string[i]); … … 366 361 } 367 362 363 void eth_write_str( U08* str ){ 364 365 while (*str) { 366 if (eth_write_index < ETH_WRITE_BUFFER_SIZE) { 367 eth_write_buffer[eth_write_index++] = *str++; 368 } 369 370 } 371 w5100_set_TX(eth_write_buffer, eth_write_index); 372 eth_write_index = 0; 373 } 374 375 void eth_writeln_str( U08* str ){ 376 377 while (*str) 378 { 379 if (eth_write_index < ETH_WRITE_BUFFER_SIZE) { 380 eth_write_buffer[eth_write_index++] = *str++; 381 } 382 } 383 if (eth_write_index < ETH_WRITE_BUFFER_SIZE) { 384 eth_write_buffer[eth_write_index++] = '\n'; 385 } 386 w5100_set_TX(eth_write_buffer, eth_write_index); 387 eth_write_index = 0; 388 } 389 -
firmware/FSC/src/w5100_spi_interface.h
r10697 r10910 11 11 12 12 #define ETH_READ_BUFFER_SIZE 4 13 #define ETH_WRITE_BUFFER_SIZE 413 #define ETH_WRITE_BUFFER_SIZE 32 14 14 extern volatile U08 eth_read_buffer[ETH_READ_BUFFER_SIZE]; 15 15 extern volatile U08 eth_write_buffer[ETH_WRITE_BUFFER_SIZE]; 16 extern U08 eth_write_index; 16 17 //----------------------------------------------------------------------------- 17 18 // Port Definitions … … 227 228 228 229 230 void eth_write_str( U08* str ); 231 void eth_writeln_str( U08* str );
Note:
See TracChangeset
for help on using the changeset viewer.