![]() |
ParaCAN 0.0.40-master SHA: 4c1cf74739
|
Hardware-independent parameterinterface implementation via Controller Area Network (CAN) More...
#include <stdbool.h>#include <stdint.h>#include <string.h>#include "CAN_Para.h"#include "../lib/Para/PARA_Lib.h"#include "../lib/Para/PARA_ID_System.h"#include "../lib/Para/PARA_MemoryInfo.h"Macros | |
| #define | CAN_BUFFER_LENGTH 50 |
| Length of Buffer which is used for write operations to parameter values. More... | |
Functions | |
| static void | process_para_data (uint8_t rxdata[8], uint8_t DLC) |
| Process received data. More... | |
| static void | CAN_Para_Ping_Request (void) |
| Response to ping from PC. More... | |
| static void | CAN_Para_Read_one (uint8_t rxdata[8]) |
| Read request from PC to µC. More... | |
| static void | CAN_Para_Read_All (uint8_t rxdata[8]) |
| Read all SubIDs of a parameter. More... | |
| static void | CAN_Para_Read_Memory (uint8_t rxdata[8]) |
| Read Memory Area. More... | |
| static void | CAN_Para_Write (uint8_t rxdata[8]) |
| Write request. More... | |
| void | CAN_Para_Init (void) |
| Initialization of CAN Parameterinterface. More... | |
| uint8_t | CAN_Para_ReceiveIRQ (uint8_t data[8], uint32_t id, uint8_t DLC) |
| Reads Message from CAN-Interface and handles Parameter Request. More... | |
| void | CAN_Para_Cyclic (void) |
| Cyclic procedure to process messages that needs more than one answer message. More... | |
| void | CAN_Para_SendPing (void) |
| Send ping to connected PCs. More... | |
Variables | |
| const uint16_t | cui16_CANBaseAddress |
| Base address of the CAN Parameter-interface. Must be defined in main program. More... | |
| const uint16_t | cui16_CANBroadcastAddress |
| Broadcast Address of the CAN Parameter-interface. Must be defined in main program. With this Identifier the Broadcast Pings are send. More... | |
| static Parameter_InfoHeader | g_CAN_Parameter_info |
| Parameter-information of the actual processed Message. More... | |
| static uint8_t | g_ui8CAN_Para_Packet_id |
| Identifier of the actulal processed Message. Is used for follow-up telegrams. More... | |
| static volatile uint8_t | g_ui8CanAccessInProgress =0 |
| Mutex to prevent access from other PC while follow-up telegrams are processed. More... | |
| static uint32_t | g_ui32CAN_RemainingDataToSend |
| Length of the remaining data in follow-up telegrams. More... | |
| static uint32_t | g_ui32CAN_ActualMemoryAddress |
| Address of the processed memory-area which is transferred in follow-up telegrams. More... | |
| static uint8_t | g_ui8CAN_PacketRunningCounter |
| Running counter of the actual follow-up telegram. More... | |
| static uint32_t | g_ui32CANActualOffset |
| Actual offset of the processed follow-up telegram. More... | |
| static uint8_t | g_ui8CANReceiveLength |
| Length of the received Telegram. More... | |
| static uint8_t | g_pui8CANBuffer [50] |
| Buffer to process write requests. More... | |
Hardware-independent parameterinterface implementation via Controller Area Network (CAN)
© Copyright 2017-2022 Copyright: Torquetronik GmbH Stütingstraße 30 58285 Gevelsberg
| #define CAN_BUFFER_LENGTH 50 |
Length of Buffer which is used for write operations to parameter values.
If the length of the Buffer is not sufficient during a write operation, Error-code 2 is returned.
| void CAN_Para_Cyclic | ( | void | ) |
Cyclic procedure to process messages that needs more than one answer message.
This function must be called regularly, or from CAN transmit interrupt. If the global variable g_ui32CAN_RemainingDataToSend > 0 the remaining data is sent. If further characters in the string or other subIDs are to be transmitted, these are sent.
| void CAN_Para_Init | ( | void | ) |
Initialization of CAN Parameterinterface.
Must be called before using all other functions. Local variables are initialized here.
|
static |
Response to ping from PC.
Process the Connect from PC (command 1) telegram.
|
static |
Read all SubIDs of a parameter.
Process the Read all SubIDs (command 4) telegram. Data direction is from µC to PC. Does not work with string data type! Each sub-ID must be transmitted individually.
| rxdata | Transmitted Data bytes |
|
static |
Read Memory Area.
Process the Read Memory Area (command 5) telegram. Data direction is from µC to PC.
| rxdata | Transmitted Data bytes |
|
static |
Read request from PC to µC.
Process the Read one SubID (command 2) telegram.
| rxdata | Data-Bytes from PC |
| uint8_t CAN_Para_ReceiveIRQ | ( | uint8_t | data[8], |
| uint32_t | id, | ||
| uint8_t | DLC | ||
| ) |
Reads Message from CAN-Interface and handles Parameter Request.
Is normally called from receive-interrupt. After processing the CAN-Message the answer is sent depending on the message type.
| 1 | Data is processed |
| 0 | Data is not processed. |
| data | Data of the received CAN-Telegram. |
| id | Identifier of the received CAN-Telegram. |
| DLC | Number of bytes received in this CAN-Telegram. |
| void CAN_Para_SendPing | ( | void | ) |
Send ping to connected PCs.
Send one Ping from Device for Autoconnect to PC, to announce presence of Device. The Device starts connecting afterwards. Should mot be send faster than in a 500ms cycle.
|
static |
Write request.
Process the Write of one Sub-ID (command 3) telegram. Data direction is from PC to µC. Only the write request is processed here. The data are processed with subsequent telegrams.
| rxdata | Transmitted Data bytes |
|
static |
Process received data.
In the case of write access, the data are transmitted in the 2nd and following CAN telegrams. These telegrams are sent with a different ID and are processed here.
| rxdata | Received Data bytes |
| DLC | number of data bytes |
|
extern |
Base address of the CAN Parameter-interface. Must be defined in main program.
|
extern |
Broadcast Address of the CAN Parameter-interface. Must be defined in main program. With this Identifier the Broadcast Pings are send.
|
static |
Parameter-information of the actual processed Message.
|
static |
Buffer to process write requests.
|
static |
Address of the processed memory-area which is transferred in follow-up telegrams.
|
static |
Length of the remaining data in follow-up telegrams.
|
static |
Actual offset of the processed follow-up telegram.
|
static |
Running counter of the actual follow-up telegram.
|
static |
Identifier of the actulal processed Message. Is used for follow-up telegrams.
|
static |
Mutex to prevent access from other PC while follow-up telegrams are processed.
|
static |
Length of the received Telegram.