Begin mapping out CAN bus transmit scheduler
This commit is contained in:
parent
607ef27b0f
commit
95adfdffb7
2 changed files with 42 additions and 0 deletions
27
include/hexagram/schedule.h
Normal file
27
include/hexagram/schedule.h
Normal 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
15
include/hexagram/table.h
Normal 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 */
|
Loading…
Add table
Reference in a new issue