File tree Expand file tree Collapse file tree 6 files changed +24
-26
lines changed Expand file tree Collapse file tree 6 files changed +24
-26
lines changed Original file line number Diff line number Diff line change @@ -100,13 +100,8 @@ void harness_init(void) {
100
100
set_gpio_output (current_board -> harness_config -> GPIO_relay_SBU1 , current_board -> harness_config -> pin_relay_SBU1 , 1 );
101
101
set_gpio_output (current_board -> harness_config -> GPIO_relay_SBU2 , current_board -> harness_config -> pin_relay_SBU2 , 1 );
102
102
103
- // try to detect orientation
103
+ // detect initial orientation
104
104
harness .status = harness_detect_orientation ();
105
- if (harness .status != HARNESS_STATUS_NC ) {
106
- print ("detected car harness with orientation " ); puth2 (harness .status ); print ("\n" );
107
- } else {
108
- print ("failed to detect car harness!\n" );
109
- }
110
105
111
106
// keep buses connected by default
112
107
set_intercept_relay (false, false);
Original file line number Diff line number Diff line change @@ -108,7 +108,9 @@ void spi_rx_done(void) {
108
108
response_len = 1U ;
109
109
} else {
110
110
// response: NACK and reset state machine
111
- print ("- incorrect header sync or checksum " ); hexdump (spi_buf_rx , SPI_HEADER_SIZE );
111
+ #ifdef DEBUG_SPI
112
+ print ("- incorrect header sync or checksum " ); hexdump (spi_buf_rx , SPI_HEADER_SIZE );
113
+ #endif
112
114
spi_buf_tx [0 ] = SPI_NACK ;
113
115
next_rx_state = SPI_STATE_HEADER_NACK ;
114
116
response_len = 1U ;
@@ -160,12 +162,14 @@ void spi_rx_done(void) {
160
162
} else {
161
163
// Checksum was incorrect
162
164
response_ack = false;
163
- print ("- incorrect data checksum " );
164
- puth4 (spi_data_len_mosi );
165
- print ("\n" );
166
- hexdump (spi_buf_rx , SPI_HEADER_SIZE );
167
- hexdump (& (spi_buf_rx [SPI_HEADER_SIZE ]), MIN (spi_data_len_mosi , 64 ));
168
- print ("\n" );
165
+ #ifdef DEBUG_SPI
166
+ print ("- incorrect data checksum " );
167
+ puth4 (spi_data_len_mosi );
168
+ print ("\n" );
169
+ hexdump (spi_buf_rx , SPI_HEADER_SIZE );
170
+ hexdump (& (spi_buf_rx [SPI_HEADER_SIZE ]), MIN (spi_data_len_mosi , 64 ));
171
+ print ("\n" );
172
+ #endif
169
173
}
170
174
171
175
if (!response_ack ) {
Original file line number Diff line number Diff line change @@ -145,10 +145,6 @@ void puth(unsigned int i) {
145
145
puthx (i , 8U );
146
146
}
147
147
148
- void puth2 (unsigned int i ) {
149
- puthx (i , 2U );
150
- }
151
-
152
148
#if defined(ENABLE_SPI ) || defined(BOOTSTUB ) || defined(DEBUG )
153
149
void puth4 (unsigned int i ) {
154
150
puthx (i , 4U );
@@ -160,7 +156,7 @@ void hexdump(const void *a, int l) {
160
156
if (a != NULL ) {
161
157
for (int i = 0 ; i < l ; i ++ ) {
162
158
if ((i != 0 ) && ((i & 0xf ) == 0 )) print ("\n" );
163
- puth2 (((const unsigned char * )a )[i ]);
159
+ puthx (((const unsigned char * )a )[i ], 2U );
164
160
print (" " );
165
161
}
166
162
}
Original file line number Diff line number Diff line change @@ -33,7 +33,6 @@ void putch(const char a);
33
33
void print (const char * a );
34
34
void puthx (uint32_t i , uint8_t len );
35
35
void puth (unsigned int i );
36
- void puth2 (unsigned int i );
37
36
#if defined(ENABLE_SPI ) || defined(BOOTSTUB ) || defined(DEBUG )
38
37
void puth4 (unsigned int i );
39
38
#endif
Original file line number Diff line number Diff line change @@ -538,21 +538,26 @@ void usb_irqhandler(void) {
538
538
}
539
539
540
540
if ((gintsts & USB_OTG_GINTSTS_USBRST ) != 0U ) {
541
- print ("USB reset\n" );
541
+ #ifdef DEBUG_USB
542
+ print ("USB reset\n" );
543
+ #endif
542
544
usb_reset ();
543
545
}
544
546
545
547
if ((gintsts & USB_OTG_GINTSTS_ENUMDNE ) != 0U ) {
546
- print ("enumeration done" );
548
+ #ifdef DEBUG_USB
549
+ print ("enumeration done\n" );
550
+ #endif
547
551
// Full speed, ENUMSPD
548
552
//puth(USBx_DEVICE->DSTS);
549
- print ("\n" );
550
553
}
551
554
552
555
if ((gintsts & USB_OTG_GINTSTS_OTGINT ) != 0U ) {
553
- print ("OTG int:" );
554
- puth (USBx -> GOTGINT );
555
- print ("\n" );
556
+ #ifdef DEBUG_USB
557
+ print ("OTG int:" );
558
+ puth (USBx -> GOTGINT );
559
+ print ("\n" );
560
+ #endif
556
561
557
562
// getting ADTOCHG
558
563
//USBx->GOTGINT = USBx->GOTGINT;
Original file line number Diff line number Diff line change 3
3
// ******************** Prototypes ********************
4
4
void print (const char * a );
5
5
void puth (unsigned int i );
6
- void puth2 (unsigned int i );
7
6
void puth4 (unsigned int i );
8
7
void hexdump (const void * a , int l );
9
8
typedef struct board board ;
You can’t perform that action at this time.
0 commit comments