drivers/can_peak_win32/can_peak_win32.c
changeset 365 9b76e0881beb
parent 341 7ff01f109bbc
child 384 83793fc7ce48
equal deleted inserted replaced
364:17edd8a028fa 365:9b76e0881beb
   123 				// If status, return status if 29bit, return overrun
   123 				// If status, return status if 29bit, return overrun
   124 				//pthread_mutex_unlock (&PeakCan_mutex);
   124 				//pthread_mutex_unlock (&PeakCan_mutex);
   125 				return peakMsg.MSGTYPE ==
   125 				return peakMsg.MSGTYPE ==
   126 					MSGTYPE_STATUS ? peakMsg.DATA[2] : CAN_ERR_OVERRUN;
   126 					MSGTYPE_STATUS ? peakMsg.DATA[2] : CAN_ERR_OVERRUN;
   127 			}
   127 			}
   128 			m->cob_id.w = peakMsg.ID;
   128 			m->cob_id = peakMsg.ID;
   129 			
   129 			
   130 			if (peakMsg.MSGTYPE == CAN_INIT_TYPE_ST)	/* bits of MSGTYPE_ */
   130 			if (peakMsg.MSGTYPE == CAN_INIT_TYPE_ST)	/* bits of MSGTYPE_ */
   131 				m->rtr = 0;
   131 				m->rtr = 0;
   132 			else
   132 			else
   133 				m->rtr = 1;
   133 				m->rtr = 1;
   159 UNS8
   159 UNS8
   160 canSend_driver (CAN_HANDLE fd0, Message * m)
   160 canSend_driver (CAN_HANDLE fd0, Message * m)
   161 {
   161 {
   162 	UNS8 data;
   162 	UNS8 data;
   163 	TPCANMsg peakMsg;
   163 	TPCANMsg peakMsg;
   164 	peakMsg.ID = m->cob_id.w;	/* 11/29 bit code */
   164 	peakMsg.ID = m->cob_id;	/* 11/29 bit code */
   165 	if (m->rtr == 0)
   165 	if (m->rtr == 0)
   166 		peakMsg.MSGTYPE = CAN_INIT_TYPE_ST;	/* bits of MSGTYPE_ */
   166 		peakMsg.MSGTYPE = CAN_INIT_TYPE_ST;	/* bits of MSGTYPE_ */
   167 	else
   167 	else
   168 	{
   168 	{
   169 		peakMsg.MSGTYPE = CAN_INIT_TYPE_ST_RTR;	/* bits of MSGTYPE_ */
   169 		peakMsg.MSGTYPE = CAN_INIT_TYPE_ST_RTR;	/* bits of MSGTYPE_ */