Fuck it, this might work

This commit is contained in:
XANTRONIX Development 2019-06-28 18:12:29 -05:00
parent b2de1920dd
commit e1a3c8d6af
2 changed files with 17 additions and 2 deletions

View file

@ -1,10 +1,9 @@
#ifndef _HEXAGRAM_CLUSTER_H
#define _HEXAGRAM_CLUSTER_H
#include <linux/can.h>
#include <cairo.h>
#include <hexagram/can.h>
#include <hexagram/tacho.h>
#include <hexagram/speedo.h>
#include <hexagram/thermo.h>
@ -37,6 +36,8 @@ void hexagram_cluster_init(hexagram_cluster *cluster,
hexagram_cluster *hexagram_cluster_new(double width,
double height);
int hexagram_cluster_filter_can_if(hexagram_can_if *can_if);
int hexagram_cluster_update(hexagram_cluster *cluster,
struct can_frame *frame);

View file

@ -72,6 +72,20 @@ error_malloc_cluster:
return NULL;
}
int hexagram_cluster_filter_can_if(hexagram_can_if *can_if) {
struct can_filter filters[3] = {
{ .can_id = 0x280, .can_mask = 0x3f0 },
{ .can_id = 0x320, .can_mask = 0x320 },
{ .can_id = 0x5a0, .can_mask = 0x5a0 }
};
return setsockopt(hexagram_can_if_fd(can_if),
SOL_CAN_RAW,
CAN_RAW_FILTER,
&filters,
sizeof(filters));
}
int hexagram_cluster_update(hexagram_cluster *cluster,
struct can_frame *frame) {
switch (frame->can_id) {