Begin mapping out CAN bus transmit scheduler

This commit is contained in:
XANTRONIX Development 2023-12-23 23:59:13 -05:00
parent 607ef27b0f
commit 95adfdffb7
2 changed files with 42 additions and 0 deletions

View file

@ -0,0 +1,27 @@
#ifndef _HEXAGRAM_SCHEDULE_H
#define _HEXAGRAM_SCHEDULE_H
#include <time.h>
#include <sys/types.h>
#include <sys/time.h>
#include <hexagram/table.h>
typedef struct _hexagram_schedule_slot {
time_t interval_us;
hexagram_table_entry *entry;
} hexagram_schedule_slot;
typedef struct _hexagram_schedule {
size_t current;
timer_t timer;
} hexagram_schedule;
hexagram_schedule *hexagram_schedule_create(hexagram_table_entry *table,
size_t count);
int hexagram_schedule_run(hexagram_schedule *schedule);
int hexagram_schedule_stop(hexagram_schedule *schedule);
#endif /* _HEXAGRAM_SCHEDULE_H */

15
include/hexagram/table.h Normal file
View file

@ -0,0 +1,15 @@
#ifndef _HEXAGRAM_TABLE_H
#define _HEXAGRAM_TABLE_H
#include <sys/time.h>
#include <hexagram/can.h>
typedef struct _hexagram_table_entry {
time_t freq_us;
hexagram_can_if *iface;
struct can_frame frame;
} hexagram_table_entry;
int hexagram_table_entry_send(hexagram_table_entry *entry);
#endif /* _HEXAGRAM_TABLE_H */