Skip to content
Snippets Groups Projects
CanConnector.c 1.41 KiB

#include "inc/CanConnector.h"

// constants
const char* CAN_DEVICE_NAME = "can0";

// variables
struct can_socket* can_sock;

// send and receive
void can_send() {
    // TODO send and empty buffer
}

void can_send_clock(CAN_CLK_T counter) {
    // TODO send clock message with clock counter
}

void can_receive() {
    // TODO fill buffer
}

CAN_CLK_T can_receive_clock() {
    // TODO receive clock message and return clock counter
}

// init, terminate
void can_init() {
    printf("initializing CAN\n");

    can_sock = can_socket_open(CAN_DEVICE_NAME);

    // TODO init buffers
}

void can_term() {
    printf("terminating CAN\n");

    can_socket_close(can_sock);
}

void prepare_input_CanConnector() {}

void finish_input_CanConnector() {}

void prepare_output_CanConnector() {}

void finish_output_CanConnector() {}

// noval
GEN_TYPE_boolean can_is_noval(CAN_MSG_T msg) {
    return false;
}

GEN_TYPE_boolean can_set_noval(CAN_MSG_T msg) {
    return false;
}

// readers
GEN_TYPE_boolean can_read_bool(CAN_MSG_T msg) {
    return false; // TODO
}

GEN_TYPE_double can_read_double(CAN_MSG_T msg) {
    return 0.0; // TODO
}

GEN_TYPE_int can_read_int(CAN_MSG_T msg) {
    return 0; // TODO
}

// writers
void can_write_bool(CAN_MSG_T msg, GEN_TYPE_boolean value) {
    // TODO
}

void can_write_double(CAN_MSG_T msg, GEN_TYPE_double value) {
    // TODO
}

void can_write_int(CAN_MSG_T msg, GEN_TYPE_int value) {
    // TODO
}