Fuck it, this might work
This commit is contained in:
parent
b2de1920dd
commit
e1a3c8d6af
2 changed files with 17 additions and 2 deletions
|
@ -1,10 +1,9 @@
|
||||||
#ifndef _HEXAGRAM_CLUSTER_H
|
#ifndef _HEXAGRAM_CLUSTER_H
|
||||||
#define _HEXAGRAM_CLUSTER_H
|
#define _HEXAGRAM_CLUSTER_H
|
||||||
|
|
||||||
#include <linux/can.h>
|
|
||||||
|
|
||||||
#include <cairo.h>
|
#include <cairo.h>
|
||||||
|
|
||||||
|
#include <hexagram/can.h>
|
||||||
#include <hexagram/tacho.h>
|
#include <hexagram/tacho.h>
|
||||||
#include <hexagram/speedo.h>
|
#include <hexagram/speedo.h>
|
||||||
#include <hexagram/thermo.h>
|
#include <hexagram/thermo.h>
|
||||||
|
@ -37,6 +36,8 @@ void hexagram_cluster_init(hexagram_cluster *cluster,
|
||||||
hexagram_cluster *hexagram_cluster_new(double width,
|
hexagram_cluster *hexagram_cluster_new(double width,
|
||||||
double height);
|
double height);
|
||||||
|
|
||||||
|
int hexagram_cluster_filter_can_if(hexagram_can_if *can_if);
|
||||||
|
|
||||||
int hexagram_cluster_update(hexagram_cluster *cluster,
|
int hexagram_cluster_update(hexagram_cluster *cluster,
|
||||||
struct can_frame *frame);
|
struct can_frame *frame);
|
||||||
|
|
||||||
|
|
|
@ -72,6 +72,20 @@ error_malloc_cluster:
|
||||||
return NULL;
|
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,
|
int hexagram_cluster_update(hexagram_cluster *cluster,
|
||||||
struct can_frame *frame) {
|
struct can_frame *frame) {
|
||||||
switch (frame->can_id) {
|
switch (frame->can_id) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue