Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "my_List.h"
- // Do not initialize inputs!
- void Init(void)
- {
- count = 0;
- v->Out = 0;
- }
- void Exec(void)
- {
- if(*v->Enable == 1){
- struct item *newItem = (struct item*) malloc(sizeof(struct item));
- newItem->value = *v->In;
- newItem->index = count;
- if(count == 0){
- myListHeader = newItem;
- myListTail = newItem;
- }else{
- myListTail->next = newItem;
- myListTail = myListTail->next;
- }
- if(count < v->Interval){
- v->Out = 0;
- }else{
- myListHeader = myListHeader->next;
- free(myListHeader->prev);
- myListHeader->prev = NULL;
- }
- count++;
- }
- if(count != 0)
- v->Out = myListTail->value - myListHeader->value;
- else
- v->Out = 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement