![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
Modularizando o src
Dependencies: EALib EthernetInterface_vz mbed-rtos mbed
Fork of header_main_colinas_V0-20-09-14 by
vz_protocol.cpp@132:05cd37f7e007, 2015-09-01 (annotated)
- Committer:
- klauss
- Date:
- Tue Sep 01 17:21:11 2015 +0000
- Revision:
- 132:05cd37f7e007
- Parent:
- 126:1f90756250fb
- Child:
- 135:2f4290590e51
Substitui??o de; send_msg -> vz_printf; debug_msg -> vz_debug
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
klauss | 0:4d17cd9c8f9d | 1 | #include "vz_protocol.h" |
klauss | 72:895ca792c647 | 2 | |
klauss | 78:1353744f01e1 | 3 | uint32_t pkg_ckserr = 0; |
klauss | 78:1353744f01e1 | 4 | uint32_t pkg_zero = 0; |
klauss | 78:1353744f01e1 | 5 | uint32_t pkg_cksok = 0; |
klauss | 81:3656f00ab3db | 6 | int begin = 0; |
klauss | 81:3656f00ab3db | 7 | int end = 0; |
klauss | 81:3656f00ab3db | 8 | |
klauss | 126:1f90756250fb | 9 | int init_ranges ( void ) |
klauss | 126:1f90756250fb | 10 | { |
klauss | 132:05cd37f7e007 | 11 | begin = cm -> get_min_ext (); |
klauss | 132:05cd37f7e007 | 12 | end = cm -> get_max_ext (); |
klauss | 119:ee6a53069455 | 13 | |
klauss | 119:ee6a53069455 | 14 | return ( 0 ); |
klauss | 81:3656f00ab3db | 15 | } |
Cola | 20:2d6ab23956e5 | 16 | |
klauss | 126:1f90756250fb | 17 | uint8_t * parse_vz_pkg ( int * ext, int * port, volatile uint8_t * type, uint8_t * cb_buffer ) |
klauss | 126:1f90756250fb | 18 | { |
klauss | 0:4d17cd9c8f9d | 19 | uint8_t e_lsb, e_msb; |
klauss | 126:1f90756250fb | 20 | uint8_t p_lsb, p_msb; |
klauss | 0:4d17cd9c8f9d | 21 | |
klauss | 126:1f90756250fb | 22 | if ( ( ext and port and type and cb_buffer ) == NULL ) return ( NULL ); |
klauss | 114:472502b31a12 | 23 | |
klauss | 119:ee6a53069455 | 24 | //tratamento dos pacotes do tipo flood logo na chegada |
klauss | 119:ee6a53069455 | 25 | { |
klauss | 126:1f90756250fb | 26 | if ( cb_buffer [ TYPE_PLACE ] == FLOOD ) |
klauss | 126:1f90756250fb | 27 | { |
klauss | 119:ee6a53069455 | 28 | flood_counter++; |
klauss | 119:ee6a53069455 | 29 | static uint8_t flood_cnt = 0; |
klauss | 119:ee6a53069455 | 30 | static uint8_t first_run_flag = 0; |
klauss | 119:ee6a53069455 | 31 | static Timer t; |
klauss | 119:ee6a53069455 | 32 | if (first_run_flag == 0) { |
klauss | 119:ee6a53069455 | 33 | flood_cnt = cb_buffer[0]; |
klauss | 119:ee6a53069455 | 34 | first_run_flag++; |
klauss | 119:ee6a53069455 | 35 | t.start(); |
klauss | 119:ee6a53069455 | 36 | } else { |
klauss | 119:ee6a53069455 | 37 | if (cb_buffer[0] == 0x00){ |
klauss | 119:ee6a53069455 | 38 | if( debug_uart3 ) pc.printf("%d", t.read_us()); |
klauss | 126:1f90756250fb | 39 | if( tcp_session and !udp_query ){ |
klauss | 48:195c97f12e8e | 40 | char tmp[ 16 ]; |
klauss | 119:ee6a53069455 | 41 | sprintf( tmp, "%d", t.read_us() ); |
klauss | 48:195c97f12e8e | 42 | tcp_client.send_all( tmp, strlen( tmp ) ); |
klauss | 48:195c97f12e8e | 43 | } |
klauss | 48:195c97f12e8e | 44 | } |
klauss | 119:ee6a53069455 | 45 | flood_cnt++; |
klauss | 119:ee6a53069455 | 46 | while (flood_cnt != cb_buffer[0]) { |
klauss | 119:ee6a53069455 | 47 | if( debug_uart3 ) pc.printf("0"); |
klauss | 119:ee6a53069455 | 48 | flood_cnt++; |
klauss | 126:1f90756250fb | 49 | if( tcp_session and !udp_query ){ |
klauss | 119:ee6a53069455 | 50 | tcp_client.send_all( "0", strlen( "0" ) ); |
klauss | 119:ee6a53069455 | 51 | } |
klauss | 119:ee6a53069455 | 52 | } |
klauss | 119:ee6a53069455 | 53 | int i; |
klauss | 119:ee6a53069455 | 54 | int ok = 1; |
klauss | 119:ee6a53069455 | 55 | uint8_t cmp; |
klauss | 126:1f90756250fb | 56 | for (i=0, cmp=cb_buffer[0]; (i<300) and (ok==1); i++, cmp++) { |
klauss | 119:ee6a53069455 | 57 | if (i != 6) { |
klauss | 119:ee6a53069455 | 58 | if (cb_buffer[i] != cmp) ok = 0; |
klauss | 119:ee6a53069455 | 59 | } |
klauss | 119:ee6a53069455 | 60 | } |
klauss | 119:ee6a53069455 | 61 | if( ok ){ |
klauss | 119:ee6a53069455 | 62 | if( debug_uart3 ) pc.printf("+"); |
klauss | 126:1f90756250fb | 63 | if( tcp_session and !udp_query ){ |
klauss | 119:ee6a53069455 | 64 | tcp_client.send_all( "+", strlen( "+" ) ); |
klauss | 119:ee6a53069455 | 65 | } |
klauss | 119:ee6a53069455 | 66 | }else{ |
klauss | 119:ee6a53069455 | 67 | if( debug_uart3 ) pc.printf("%02x",cb_buffer[0] ); |
klauss | 119:ee6a53069455 | 68 | if( debug_uart3 ) pc.printf("#"); |
klauss | 119:ee6a53069455 | 69 | if( debug_uart3 ) pc.printf("\n\r"); |
klauss | 126:1f90756250fb | 70 | if( tcp_session and !udp_query ){ |
klauss | 119:ee6a53069455 | 71 | char tmp[ 16 ]; |
klauss | 119:ee6a53069455 | 72 | sprintf( tmp, "%02x#\n\r", cb_buffer[ 0 ] ); |
klauss | 119:ee6a53069455 | 73 | tcp_client.send_all( tmp, strlen( tmp ) ); |
klauss | 119:ee6a53069455 | 74 | } |
klauss | 119:ee6a53069455 | 75 | for( int i = 0; i < 300 ; i++ ){ |
klauss | 119:ee6a53069455 | 76 | if( debug_uart3 ) pc.printf("%x", cb_buffer[ i ]); |
klauss | 126:1f90756250fb | 77 | if( tcp_session and !udp_query ){ |
klauss | 119:ee6a53069455 | 78 | char tmp[ 16 ]; |
klauss | 119:ee6a53069455 | 79 | sprintf( tmp, "%x", cb_buffer[ i ] ); |
klauss | 119:ee6a53069455 | 80 | tcp_client.send_all( tmp, strlen( tmp ) ); |
klauss | 119:ee6a53069455 | 81 | } |
klauss | 119:ee6a53069455 | 82 | } |
klauss | 119:ee6a53069455 | 83 | } |
Cola | 21:0bd688722e81 | 84 | } |
klauss | 119:ee6a53069455 | 85 | return( NULL ); |
Cola | 21:0bd688722e81 | 86 | } |
klauss | 119:ee6a53069455 | 87 | }//fim tratamento do flood |
Cola | 21:0bd688722e81 | 88 | |
klauss | 126:1f90756250fb | 89 | uint16_t cc = ( uint16_t )cb_buffer[ 4 ] << 8 bitor cb_buffer[ 5 ]; |
klauss | 0:4d17cd9c8f9d | 90 | |
klauss | 126:1f90756250fb | 91 | uint16_t cc_calculated = vz_checksum ( cb_buffer, CB_BUFFER_SIZE ); |
klauss | 78:1353744f01e1 | 92 | |
klauss | 126:1f90756250fb | 93 | if ( cc != cc_calculated ) |
klauss | 124:c1b6c893e1c3 | 94 | { |
klauss | 132:05cd37f7e007 | 95 | if ( debug_cks_err ) vz_printf ( "Received PKG, but -- CKS ERROR: %d ( %d )", cc_calculated, cc ); |
klauss | 78:1353744f01e1 | 96 | |
klauss | 126:1f90756250fb | 97 | if ( cc_calculated == 30975 and cc == 0 ){ |
klauss | 78:1353744f01e1 | 98 | pkg_zero++; |
klauss | 78:1353744f01e1 | 99 | }else{ |
Cola | 20:2d6ab23956e5 | 100 | pkg_ckserr++; |
klauss | 78:1353744f01e1 | 101 | } |
klauss | 78:1353744f01e1 | 102 | return( NULL ); |
klauss | 124:c1b6c893e1c3 | 103 | } |
klauss | 124:c1b6c893e1c3 | 104 | else |
klauss | 124:c1b6c893e1c3 | 105 | { |
klauss | 132:05cd37f7e007 | 106 | pkg_cksok ++; |
klauss | 132:05cd37f7e007 | 107 | e_msb = cb_buffer [ 0 ]; |
klauss | 132:05cd37f7e007 | 108 | e_lsb = cb_buffer [ 1 ]; |
klauss | 126:1f90756250fb | 109 | *ext = ( (uint16_t )e_msb ) << 8 bitor e_lsb; |
klauss | 79:9bc12aa305a9 | 110 | |
klauss | 81:3656f00ab3db | 111 | //restriçao de controle para cbx malucos |
klauss | 126:1f90756250fb | 112 | if ( *ext < begin or *ext > end ) |
klauss | 126:1f90756250fb | 113 | { |
klauss | 132:05cd37f7e007 | 114 | if ( debug_out_of_range ) vz_printf ("Trying from %d", *ext ); |
klauss | 132:05cd37f7e007 | 115 | out_of_range ++; |
klauss | 126:1f90756250fb | 116 | return ( NULL ); |
klauss | 79:9bc12aa305a9 | 117 | } |
klauss | 81:3656f00ab3db | 118 | |
klauss | 0:4d17cd9c8f9d | 119 | p_msb = cb_buffer[ 2 ]; |
klauss | 0:4d17cd9c8f9d | 120 | p_lsb = cb_buffer[ 3 ]; |
klauss | 126:1f90756250fb | 121 | *port = ( (uint16_t )p_msb ) << 8 bitor p_lsb; |
klauss | 98:43b45f26b430 | 122 | |
klauss | 126:1f90756250fb | 123 | *type = cb_buffer [ TYPE_PLACE ]; |
klauss | 119:ee6a53069455 | 124 | |
klauss | 132:05cd37f7e007 | 125 | return ( cb_buffer + VZ_HEADER_OFFSET ); |
klauss | 0:4d17cd9c8f9d | 126 | } |
klauss | 0:4d17cd9c8f9d | 127 | } |
klauss | 126:1f90756250fb | 128 | |
klauss | 126:1f90756250fb | 129 | uint8_t * build_cb_package ( const int ext, const int port, const uint8_t type, const char * cb_buffer, const uint8_t seq_num, const int length, uint8_t * pkg ) |
klauss | 121:ee02790d00b7 | 130 | { |
klauss | 119:ee6a53069455 | 131 | //checa se o fuffer de src e dst dos dados estao alocados |
klauss | 126:1f90756250fb | 132 | if( ( cb_buffer == NULL ) or ( pkg == NULL ) ) return NULL; |
klauss | 119:ee6a53069455 | 133 | |
klauss | 119:ee6a53069455 | 134 | //apaga as posicoes de memoria onde serah montado o pacote |
klauss | 119:ee6a53069455 | 135 | for( register int i = 0; i < CB_BUFFER_SIZE; i++ ) pkg[ i ] = 0; |
klauss | 119:ee6a53069455 | 136 | |
klauss | 119:ee6a53069455 | 137 | //coloca ramal ( MSB ), ramal ( LSB ), porta ( MSB ), porta ( LSB ) e tipo nas posicoes destino |
klauss | 126:1f90756250fb | 138 | pkg[ 0 ] = ( uint8_t )( ( ext bitand 0xFF00 ) >> 8 ); |
klauss | 126:1f90756250fb | 139 | pkg[ 1 ] = ( uint8_t )( ext bitand 0x00FF ); |
klauss | 126:1f90756250fb | 140 | pkg[ 2 ] = ( uint8_t )( ( port bitand 0xFF00 ) >> 8 ); |
klauss | 126:1f90756250fb | 141 | pkg[ 3 ] = ( uint8_t )( port bitand 0x00FF ); |
klauss | 0:4d17cd9c8f9d | 142 | |
klauss | 125:8ff4dc96ad58 | 143 | pkg[ TYPE_PLACE ] = type; |
klauss | 0:4d17cd9c8f9d | 144 | |
klauss | 119:ee6a53069455 | 145 | //preenche os dados de acordo com o tipo do pacote transmitido |
klauss | 119:ee6a53069455 | 146 | size_t fill = VZ_HEADER_OFFSET; |
klauss | 119:ee6a53069455 | 147 | switch( type ) |
klauss | 119:ee6a53069455 | 148 | { |
klauss | 119:ee6a53069455 | 149 | case AUDIO :{ |
klauss | 119:ee6a53069455 | 150 | for( register int i = VZ_HEADER_OFFSET; i < length + VZ_HEADER_OFFSET; i++ ) |
klauss | 119:ee6a53069455 | 151 | pkg[ i ] = ( uint8_t )cb_buffer[ i - VZ_HEADER_OFFSET ]; |
klauss | 119:ee6a53069455 | 152 | |
klauss | 119:ee6a53069455 | 153 | fill = length + VZ_HEADER_OFFSET; |
klauss | 119:ee6a53069455 | 154 | break; |
klauss | 119:ee6a53069455 | 155 | } |
klauss | 119:ee6a53069455 | 156 | case INVITE :{ |
klauss | 119:ee6a53069455 | 157 | pkg[ 7 ] = seq_num; |
klauss | 119:ee6a53069455 | 158 | print_clock( pkg + 8 ); |
klauss | 119:ee6a53069455 | 159 | pkg[ TIMESLICE_PLACE ] = cb_buffer[ TIMESLICE_PLACE ]; |
klauss | 119:ee6a53069455 | 160 | fill = TIMESLICE_PLACE + 1; |
klauss | 119:ee6a53069455 | 161 | break; |
klauss | 119:ee6a53069455 | 162 | } |
klauss | 92:92df17f538a8 | 163 | |
klauss | 119:ee6a53069455 | 164 | case REGISTRY :{ |
klauss | 119:ee6a53069455 | 165 | pkg[ 7 ] = seq_num; |
klauss | 119:ee6a53069455 | 166 | print_clock( pkg + 8 ); |
klauss | 119:ee6a53069455 | 167 | fill = VZ_HEADER_OFFSET + CLOCK_SYNC_SIZE + SEQ_NUM_SIZE; |
klauss | 119:ee6a53069455 | 168 | break; |
klauss | 119:ee6a53069455 | 169 | } |
klauss | 119:ee6a53069455 | 170 | case BOOT :{ |
klauss | 119:ee6a53069455 | 171 | pkg[ 7 ] = seq_num; |
klauss | 119:ee6a53069455 | 172 | print_clock( pkg + 8 ); |
klauss | 119:ee6a53069455 | 173 | fill = VZ_HEADER_OFFSET + CLOCK_SYNC_SIZE + SEQ_NUM_SIZE; |
klauss | 119:ee6a53069455 | 174 | break; |
klauss | 119:ee6a53069455 | 175 | } |
klauss | 119:ee6a53069455 | 176 | case CB_BYE :{ |
klauss | 119:ee6a53069455 | 177 | pkg[ 7 ] = seq_num; |
klauss | 119:ee6a53069455 | 178 | print_clock( pkg + 8 ); |
klauss | 119:ee6a53069455 | 179 | pkg[ TIMESLICE_PLACE ] = cb_buffer[ TIMESLICE_PLACE ]; |
klauss | 119:ee6a53069455 | 180 | fill = TIMESLICE_PLACE + 1; |
klauss | 119:ee6a53069455 | 181 | break; |
klauss | 119:ee6a53069455 | 182 | } |
klauss | 119:ee6a53069455 | 183 | case PROMPT :{ |
klauss | 119:ee6a53069455 | 184 | strcpy( ( char * )( pkg + VZ_HEADER_OFFSET ), cb_buffer ); |
klauss | 119:ee6a53069455 | 185 | fill = strlen( cb_buffer ) + VZ_HEADER_OFFSET; |
klauss | 119:ee6a53069455 | 186 | break; |
klauss | 119:ee6a53069455 | 187 | } |
klauss | 119:ee6a53069455 | 188 | case TELEMETRY :{ |
klauss | 119:ee6a53069455 | 189 | pkg[ 7 ] = seq_num; |
klauss | 119:ee6a53069455 | 190 | print_clock( pkg + 8 ); |
klauss | 119:ee6a53069455 | 191 | //FIXME a header manda pacotes de tele pro cbx ? |
klauss | 119:ee6a53069455 | 192 | pkg[ TIMESLICE_PLACE ] = cb_buffer[ TIMESLICE_PLACE ]; |
klauss | 119:ee6a53069455 | 193 | fill = TIMESLICE_PLACE + 1; |
klauss | 119:ee6a53069455 | 194 | break; |
klauss | 119:ee6a53069455 | 195 | } |
klauss | 119:ee6a53069455 | 196 | case BOOTLOADER_CBX :{ |
klauss | 119:ee6a53069455 | 197 | xmemcpy((pkg + 7),(uint8_t *)cb_buffer,length); |
klauss | 119:ee6a53069455 | 198 | fill = VZ_HEADER_OFFSET + length; |
klauss | 119:ee6a53069455 | 199 | break; |
klauss | 119:ee6a53069455 | 200 | } |
klauss | 119:ee6a53069455 | 201 | }//fim switch |
klauss | 0:4d17cd9c8f9d | 202 | |
klauss | 119:ee6a53069455 | 203 | //preenche o final do pacote com 0 |
klauss | 119:ee6a53069455 | 204 | for( register uint16_t i = fill; i < CB_BUFFER_SIZE; i++ ) pkg[ i ] = 0x00; |
klauss | 0:4d17cd9c8f9d | 205 | |
klauss | 119:ee6a53069455 | 206 | //colocando o terminador de pacotes estabelecido pelo protocolo |
klauss | 119:ee6a53069455 | 207 | pkg[ CB_BUFFER_SIZE - 4 ] = 0x5a; |
klauss | 119:ee6a53069455 | 208 | pkg[ CB_BUFFER_SIZE - 3 ] = 0x56; |
klauss | 119:ee6a53069455 | 209 | pkg[ CB_BUFFER_SIZE - 2 ] = 0x5a; |
klauss | 119:ee6a53069455 | 210 | pkg[ CB_BUFFER_SIZE - 1 ] = 0xe1; |
klauss | 100:09a23fcd3bdf | 211 | |
klauss | 119:ee6a53069455 | 212 | //calcula e preenche o checksum |
klauss | 119:ee6a53069455 | 213 | uint16_t cc = vz_checksum( pkg, CB_BUFFER_SIZE ); |
klauss | 126:1f90756250fb | 214 | pkg[ 4 ] =( uint8_t )( ( cc bitand 0xFF00 ) >> 8) ; |
klauss | 126:1f90756250fb | 215 | pkg[ 5 ] =( uint8_t )( cc bitand 0x00FF ); |
klauss | 0:4d17cd9c8f9d | 216 | |
klauss | 119:ee6a53069455 | 217 | //retorna o ultimo paramentro recebido com o pacote montado. |
klauss | 0:4d17cd9c8f9d | 218 | return pkg; |
klauss | 0:4d17cd9c8f9d | 219 | } |
klauss | 0:4d17cd9c8f9d | 220 | |
klauss | 119:ee6a53069455 | 221 | uint16_t vz_checksum ( uint8_t * buffer, size_t length ) |
klauss | 119:ee6a53069455 | 222 | { |
klauss | 70:714c33487aae | 223 | if( !buffer ) return( 0 ); |
klauss | 0:4d17cd9c8f9d | 224 | uint16_t cc = 0x00; |
klauss | 0:4d17cd9c8f9d | 225 | buffer[ 4 ] = buffer[ 5 ] = 0x5a; |
klauss | 0:4d17cd9c8f9d | 226 | for( register int i = 0; i < length; i++ ){ |
klauss | 0:4d17cd9c8f9d | 227 | cc += buffer[ i ]; |
klauss | 126:1f90756250fb | 228 | if( cc bitand BIT15 ){ |
klauss | 0:4d17cd9c8f9d | 229 | cc <<= 1; |
klauss | 126:1f90756250fb | 230 | cc or_eq BIT0; |
klauss | 0:4d17cd9c8f9d | 231 | }else{ cc <<= BIT0; } |
klauss | 0:4d17cd9c8f9d | 232 | } |
klauss | 0:4d17cd9c8f9d | 233 | cc ^= 0xffff; |
klauss | 0:4d17cd9c8f9d | 234 | return cc; |
klauss | 122:480c44b0e205 | 235 | } |
klauss | 122:480c44b0e205 | 236 | |
klauss | 122:480c44b0e205 | 237 | void print_clock ( uint8_t * buffer ) |
klauss | 122:480c44b0e205 | 238 | { |
klauss | 122:480c44b0e205 | 239 | if( buffer != NULL ) |
klauss | 122:480c44b0e205 | 240 | { |
klauss | 122:480c44b0e205 | 241 | struct tm * result_tm; |
klauss | 122:480c44b0e205 | 242 | if( sizeof( time_t ) != sizeof( long ) ) |
klauss | 122:480c44b0e205 | 243 | { |
klauss | 132:05cd37f7e007 | 244 | if ( debug_print_clock ) vz_debug ("sizeof( time_t ) : %lu -- sizeof( long int ) : %lu\n", sizeof( time_t ), sizeof( long ) ); |
klauss | 122:480c44b0e205 | 245 | } |
klauss | 122:480c44b0e205 | 246 | |
klauss | 132:05cd37f7e007 | 247 | if ( debug_print_clock ) vz_debug ("current_time : %lu\t", current_time ); |
klauss | 122:480c44b0e205 | 248 | |
klauss | 122:480c44b0e205 | 249 | if( current_time != 0 ) |
klauss | 122:480c44b0e205 | 250 | { |
klauss | 122:480c44b0e205 | 251 | result_tm = localtime( ( const time_t *)¤t_time ); |
klauss | 122:480c44b0e205 | 252 | if ( result_tm ) |
klauss | 122:480c44b0e205 | 253 | { |
klauss | 122:480c44b0e205 | 254 | char formated_time[ 16 ]; |
klauss | 122:480c44b0e205 | 255 | |
klauss | 122:480c44b0e205 | 256 | /* Correcao "manual" do (GMT -3:00) */ |
klauss | 122:480c44b0e205 | 257 | result_tm->tm_hour -= 3; |
klauss | 122:480c44b0e205 | 258 | if ( result_tm->tm_hour < 0 ) result_tm->tm_hour = 24 + result_tm->tm_hour; |
klauss | 122:480c44b0e205 | 259 | |
klauss | 122:480c44b0e205 | 260 | size_t formated_nbytes = strftime( formated_time, sizeof( formated_time ), "%Y%m%d%H%M%S", result_tm ); |
klauss | 122:480c44b0e205 | 261 | |
klauss | 132:05cd37f7e007 | 262 | if ( debug_print_clock ) vz_debug ("clock() : %s\n", formated_time ); |
klauss | 122:480c44b0e205 | 263 | |
klauss | 132:05cd37f7e007 | 264 | if( formated_nbytes != CLOCK_SYNC_SIZE ) vz_debug ("( %lu )\n", formated_nbytes ); |
klauss | 122:480c44b0e205 | 265 | |
klauss | 122:480c44b0e205 | 266 | for( register int i = 0; i < CLOCK_SYNC_SIZE; i++ ) buffer[ i ] = formated_time[ i ]; |
klauss | 122:480c44b0e205 | 267 | } |
klauss | 122:480c44b0e205 | 268 | else |
klauss | 122:480c44b0e205 | 269 | { |
klauss | 122:480c44b0e205 | 270 | for( register int i = 0; i < CLOCK_SYNC_SIZE; i++ ) buffer[ i ] = 0xfa; |
klauss | 122:480c44b0e205 | 271 | } |
klauss | 122:480c44b0e205 | 272 | } |
klauss | 122:480c44b0e205 | 273 | else |
klauss | 122:480c44b0e205 | 274 | { |
klauss | 122:480c44b0e205 | 275 | for( register int i = 0; i < CLOCK_SYNC_SIZE; i++ ) buffer[ i ] = 0xab; |
klauss | 122:480c44b0e205 | 276 | } |
klauss | 122:480c44b0e205 | 277 | } |
klauss | 0:4d17cd9c8f9d | 278 | } |