added initialized flag in splitflap.c prepared RTOS (disabled temporarily)main
parent
ce074fcd38
commit
b7128dcf08
@ -0,0 +1,46 @@ |
||||
/*
|
||||
* multi-splitflap.c |
||||
* |
||||
* Created on: 07.10.2022 |
||||
* Author: jonas |
||||
*/ |
||||
|
||||
#include "multi-splitflap.h" |
||||
#include "fsl_debug_console.h" |
||||
|
||||
static dict_t **flapDict; |
||||
static uint8_t amountOfFlaps = 0; |
||||
|
||||
void MultiSplitFlap_Init(void){ |
||||
amountOfFlaps = 0; |
||||
flapDict = dictAlloc(); |
||||
((dict_t*)flapDict)->key=NULL; |
||||
((dict_t*)flapDict)->value=NULL; |
||||
((dict_t*)flapDict)->next=NULL; |
||||
} |
||||
|
||||
void MultiSplitFlap_Deinit(void){ |
||||
dictDealoc(flapDict); |
||||
amountOfFlaps = 0; |
||||
} |
||||
|
||||
uint8_t MultiSplitFlap_GetAmountOfSplitFlaps(void){ |
||||
return amountOfFlaps; |
||||
} |
||||
|
||||
void MultiSplitFlap_AddFlap(SF_Handle_t splitflap){ |
||||
PRINTF("Adding split flap to multi splitflap combination:\n"); |
||||
addItem(flapDict, (char*)&amountOfFlaps, (SF_Handle_t*)splitflap); |
||||
//TODO probably starting with 0 does not work since its a pointer to the number 0
|
||||
PRINTF("Added flap nr. %i. There are now %i flaps.\n", amountOfFlaps, ++amountOfFlaps); |
||||
} |
||||
|
||||
void MultiSplitFlap_Display(char* sentence[]){ |
||||
SF_Handle_t* sfHandle0 = (SF_Handle_t*)(getItem(*flapDict, (char*)0)); |
||||
SF_Handle_t* sfHandle1 = (SF_Handle_t*)(getItem(*flapDict, (char*)1)); |
||||
SF_t* sf0 = (SF_t*)sfHandle0; |
||||
SF_t* sf1 = (SF_t*)sfHandle1; |
||||
int32_t test = McuULN2003_GetPos(sf1->motor); |
||||
} |
||||
|
||||
|
||||
@ -0,0 +1,30 @@ |
||||
/*
|
||||
* multi-splitflap.h |
||||
* |
||||
* Created on: 07.10.2022 |
||||
* Author: jonas |
||||
*/ |
||||
|
||||
#ifndef MULTI_SPLITFLAP_H_ |
||||
#define MULTI_SPLITFLAP_H_ |
||||
|
||||
#include "splitflap.h" |
||||
|
||||
/* initialize dictionary */ |
||||
void MultiSplitFlap_Init(void); |
||||
|
||||
/* de-initialize: deallocate memory etc. */ |
||||
void MultiSplitFlap_Deinit(void); |
||||
|
||||
|
||||
/* add a splitflap to the combination */ |
||||
void MultiSplitFlap_AddFlap(SF_Handle_t splitflap); |
||||
|
||||
/* display a sentence on the splitflap combination
|
||||
* splitflaps must be initialized to be able to display something!*/ |
||||
void MultiSplitFlap_Display(char* sentence[]); |
||||
|
||||
/* returns the amount of registered split flap displays in the combination */ |
||||
uint8_t MultiSplitFlap_GetAmountOfSplitFlaps(void); |
||||
|
||||
#endif /* MULTI_SPLITFLAP_H_ */ |
||||
Loading…
Reference in new issue