You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
729 B
32 lines
729 B
/*
|
|
* splitflap.c
|
|
*
|
|
* Created on: 29.09.2022
|
|
* Author: jonas
|
|
*/
|
|
|
|
#include "splitflap.h"
|
|
#include "McuULN2003.h"
|
|
|
|
SF_Handle_t SF_Init(SF_Config_t* instance, int id){
|
|
SF_t* splitflap;
|
|
|
|
#if SPLITFLAP_CONFIG_USE_FREERTOS_HEAP
|
|
splitflap = (SF_t*)pvPortMalloc(sizeof(SF_t)); /* get a new device descriptor */
|
|
#else
|
|
splitflap = (SF_t*)malloc(sizeof(SF_t)); /* get a new device descriptor */
|
|
#endif
|
|
|
|
splitflap->magSensor = McuGPIO_InitGPIO(&instance->magSensorConfig);
|
|
splitflap->motor = McuULN2003_InitMotor(&instance->motorConfig);
|
|
splitflap->id = id;
|
|
|
|
return splitflap;
|
|
}
|
|
|
|
|
|
|
|
void SF_Deinit(SF_Handle_t instance){
|
|
McuULN2003_DeinitMotor(((SF_t*)instance)->motor);
|
|
McuGPIO_DeinitGPIO(((SF_t*)instance)->magSensor);
|
|
}
|
|
|