summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrett Weiland <brett_weiland@bpcspace.com>2023-10-27 07:35:48 -0500
committerBrett Weiland <brett_weiland@bpcspace.com>2023-10-27 07:35:48 -0500
commit03a3acd11bce3ab11e225574ac6d3e0f93669056 (patch)
treebdac7e7a72faca071b00cd386404d212a67e51b0
parente811d778ea51ac1e25588a9cc957fca4f532ea5a (diff)
I will never be able to sleep before an exam
-rw-r--r--software_pwm.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/software_pwm.c b/software_pwm.c
index 561edfd..73c40c8 100644
--- a/software_pwm.c
+++ b/software_pwm.c
@@ -24,11 +24,15 @@ static struct pwm_event {
} events[SOFTPWM_PIN_COUNT + 1];
-#define LIST_INSERT(new, former, member) (\
- list_insert(&(new.member), &(former.member), offsetof(struct pwm_event, time)))
-
-static void list_insert(struct link_pair *new_links, struct link_pair *former_links, size_t parent_offset) {
-
+#define LIST_INSERT(new, prev, member) (\
+ list_insert(&(new.member), &(prev.member), offsetof(struct pwm_event, member)))
+
+//TODO GYAAAAAAAGH!!!
+static void list_insert(struct link_pair *new_links, struct link_pair *prev_links, size_t parent_offset) {
+ new_links->next = prev_links->next;
+ new_links->prev = (struct pwm_event *)(char *)prev_links - parent_offset;
+ ((struct link_pair *)(char *)prev_links->next + parent_offset)->prev = (struct pwm_event *)(char *)new_links - parent_offset; //GYAAAAGH
+ prev_links->next = (struct pwm_event *)(char *)new_links - parent_offset;
}
static void list_remove(struct link_pair *event) {