|
|
|
|
@ -6,6 +6,7 @@ |
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
#include "fsl_debug_console.h" |
|
|
|
|
#include "platform.h" |
|
|
|
|
#include "application.h" |
|
|
|
|
#include "McuWait.h" |
|
|
|
|
#include "McuLED.h" |
|
|
|
|
@ -14,6 +15,7 @@ |
|
|
|
|
#include "splitflap_pins.h" |
|
|
|
|
#include "splitflap.h" |
|
|
|
|
#include "multi-splitflap.h" |
|
|
|
|
#include "McuLog.h" |
|
|
|
|
|
|
|
|
|
#define APP_DEBUG |
|
|
|
|
|
|
|
|
|
@ -51,6 +53,12 @@ void App_Init(void){ |
|
|
|
|
|
|
|
|
|
/* App Task */ |
|
|
|
|
static void App_Task(void* pv){ |
|
|
|
|
McuLog_info("Application Task starting"); |
|
|
|
|
|
|
|
|
|
while(1){ |
|
|
|
|
vTaskDelay(pdMS_TO_TICKS(100)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
PRINTF("Initializing split flap motors.\n"); |
|
|
|
|
bool successfulInit0 = SF_MoveMotorToZeroPosition(splitflap0, 20); |
|
|
|
|
PRINTF("Init of motor 0 done. Success = %s\n\n", successfulInit0 ? "true" : "false"); |
|
|
|
|
@ -74,7 +82,7 @@ static void App_Task(void* pv){ |
|
|
|
|
|
|
|
|
|
/* MULTI SPLIT FLAP TESTING */ |
|
|
|
|
char sentence[] = "JONAS!"; |
|
|
|
|
MultiSplitFlap_Display(sentence); |
|
|
|
|
//MultiSplitFlap_Display(sentence);
|
|
|
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
@ -159,4 +167,39 @@ void configureSplitflaps(void){ |
|
|
|
|
|
|
|
|
|
/* initialize splitflap 0 */ |
|
|
|
|
splitflap0 = SF_Init(&sf0Config, 0); |
|
|
|
|
|
|
|
|
|
/* SPLITFLAP 1 */ |
|
|
|
|
/* configure the motor */ |
|
|
|
|
McuULN2003_Config_t motor1Config; |
|
|
|
|
McuULN2003_GetDefaultConfig(&motor1Config); |
|
|
|
|
motor1Config.hw[0].gpio = STEPPER_MOTOR1_IN1_GPIO; |
|
|
|
|
motor1Config.hw[0].port = STEPPER_MOTOR1_IN1_PORT; |
|
|
|
|
motor1Config.hw[0].pin = STEPPER_MOTOR1_IN1_PIN; |
|
|
|
|
motor1Config.hw[1].gpio = STEPPER_MOTOR1_IN2_GPIO; |
|
|
|
|
motor1Config.hw[1].port = STEPPER_MOTOR1_IN2_PORT; |
|
|
|
|
motor1Config.hw[1].pin = STEPPER_MOTOR1_IN2_PIN; |
|
|
|
|
motor1Config.hw[2].gpio = STEPPER_MOTOR1_IN3_GPIO; |
|
|
|
|
motor1Config.hw[2].port = STEPPER_MOTOR1_IN3_PORT; |
|
|
|
|
motor1Config.hw[2].pin = STEPPER_MOTOR1_IN3_PIN; |
|
|
|
|
motor1Config.hw[3].gpio = STEPPER_MOTOR1_IN4_GPIO; |
|
|
|
|
motor1Config.hw[3].port = STEPPER_MOTOR1_IN4_PORT; |
|
|
|
|
motor1Config.hw[3].pin = STEPPER_MOTOR1_IN4_PIN; |
|
|
|
|
motor1Config.inverted = true; |
|
|
|
|
|
|
|
|
|
/* configure magnetic sensor for motor 0 */ |
|
|
|
|
McuGPIO_Config_t magSensor1Config; |
|
|
|
|
McuGPIO_GetDefaultConfig(&magSensor1Config); |
|
|
|
|
magSensor1Config.hw.gpio = MAG_MOTOR1_GPIO; |
|
|
|
|
magSensor1Config.hw.port = MAG_MOTOR1_PORT; |
|
|
|
|
magSensor1Config.hw.pin = MAG_MOTOR1_PIN; |
|
|
|
|
magSensor1Config.isInput = true; |
|
|
|
|
magSensor1Config.hw.pull = McuGPIO_PULL_UP; |
|
|
|
|
|
|
|
|
|
/* create config instance for splitflap 0 */ |
|
|
|
|
SF_Config_t sf1Config; |
|
|
|
|
sf1Config.magSensorConfig = magSensor1Config; |
|
|
|
|
sf1Config.motorConfig = motor1Config; |
|
|
|
|
|
|
|
|
|
/* initialize splitflap 1 */ |
|
|
|
|
splitflap1 = SF_Init(&sf1Config, 1); |
|
|
|
|
} |
|
|
|
|
|