Commit f2b786c6 authored by smartinezs's avatar smartinezs
Browse files

minor changes

parent e2bcc8f4
......@@ -90,7 +90,7 @@ void can_config(TComm *comm_dev,CAN_InitTypeDef *conf);
void can_set_priorities(TComm *comm_dev,TCAN_IRQ_Priorities *priorities);
void can_set_bitrate(TComm *comm_dev,CAN_SPEED bitrate);
void can_set_filter(TComm *comm_dev,CAN_FilterConfTypeDef *filter);
void can_set_can_id(TComm *comm_dev,unsigned char id);
void can_set_can_id(TComm *comm_dev,unsigned int id);
/* IRQ functions */
unsigned char can_send_irq(unsigned char first_byte);
unsigned char can_enable_tx_irq(void);
......
......@@ -126,8 +126,6 @@ void can_init(TComm *comm_dev,CAN_InitTypeDef *conf,TCAN_IRQ_Priorities *priorit
CANHandle.pTxMsg->RTR = CAN_RTR_DATA;
CANHandle.pTxMsg->IDE = CAN_ID_STD;
//HAL_CAN_Receive_IT(&CANHandle,CAN_FIFO0);
}
void can_config(TComm *comm_dev,CAN_InitTypeDef *conf)
......@@ -216,10 +214,9 @@ void can_set_bitrate(TComm *comm_dev,CAN_SPEED bitrate)
void can_set_filter(TComm *comm_dev,CAN_FilterConfTypeDef *filter)
{
HAL_CAN_ConfigFilter(&CANHandle, filter);
//HAL_CAN_Receive_IT(&CANHandle,CAN_FIFO0);
}
void can_set_can_id(TComm *comm_dev,unsigned char id)
void can_set_can_id(TComm *comm_dev,unsigned int id)
{
CANHandle.pTxMsg->StdId = id;
}
......@@ -238,16 +235,11 @@ void HAL_CAN_ErrorCallback(CAN_HandleTypeDef* CANHandle)
void HAL_CAN_TxCpltCallback(CAN_HandleTypeDef* CANHandle)
{
// HAL_CAN_StateTypeDef status = HAL_CAN_GetState(CANHandle);
// while(HAL_CAN_STATE_READY != status)
// {
// status = HAL_CAN_GetState(CANHandle);
// }
if (can_send_lenght != 0)
{
if (can_send_lenght > 8)
{
CANHandle->pTxMsg->DLC = 8;
for (uint8_t i=0;i<8;i++)
{
CANHandle->pTxMsg->Data[i] = can_send_data[i+(8*can_send_iterations)];
......@@ -258,6 +250,7 @@ void HAL_CAN_TxCpltCallback(CAN_HandleTypeDef* CANHandle)
}
else
{
CANHandle->pTxMsg->DLC = can_send_lenght;
for (uint8_t i=0;i<can_send_lenght;i++)
{
CANHandle->pTxMsg->Data[i] = can_send_data[i+(8*can_send_iterations)];
......@@ -388,35 +381,6 @@ unsigned char can_cancel_receive_irq(void)
/* DMA functions */
unsigned char can_send_dma(unsigned char *data,unsigned short int length)
{
// if (length <= 8)
// {
// CANHandle.pTxMsg->DLC = length;
// for (uint8_t i=0;i<length;i++)
// {
// CANHandle.pTxMsg->Data[i] = data[i];
// }
// HAL_CAN_Transmit_IT(&CANHandle);
// }
// else
// {
// unsigned char iterations = 0x00;
// while (length > 0)
// {
// if(length > 8)
// CANHandle.pTxMsg->DLC = 8;
// else
// CANHandle.pTxMsg->DLC = length;
// for (uint8_t i=0;i<CANHandle.pTxMsg->DLC;i++)
// {
// CANHandle.pTxMsg->Data[i] = data[i+iterations];
// }
// HAL_CAN_Transmit_IT(&CANHandle);
// HAL_Delay(5);
// iterations = iterations + 8;
// length = length - CANHandle.pTxMsg->DLC;
// }
// }
if(length > 8){
CANHandle.pTxMsg->DLC = 8;
for (uint8_t i=0;i<length;i++)
......@@ -464,6 +428,8 @@ unsigned char can_cancel_receive_dma(void)
can_dma_phase_data=0x00;
can_dma_phase_length=0;
can_dma_phase_write_ptr=0;
//can_missing_bytes_length=0;
//can_missing_bytes_write_ptr=0;
return 0x00;
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment