parent
a92e1c0fc9
commit
92f99dfb58
@ -0,0 +1,30 @@ |
||||
/*
|
||||
* platform.c |
||||
* |
||||
* Created on: 29.09.2022 |
||||
* Author: jonas |
||||
*/ |
||||
|
||||
#include "platform.h" |
||||
#include "McuLib.h" |
||||
#include "McuWait.h" |
||||
#include "McuLED.h" |
||||
#include "McuGPIO.h" |
||||
#include "McuULN2003.h" |
||||
|
||||
void PL_Init(void){ |
||||
McuLib_Init(); |
||||
McuWait_Init(); |
||||
McuGPIO_Init(); |
||||
McuLED_Init(); |
||||
McuULN2003_Init(); |
||||
} |
||||
|
||||
|
||||
void PL_Deinit(void){ |
||||
McuULN2003_Deinit(); |
||||
McuLED_Deinit(); |
||||
McuGPIO_Deinit(); |
||||
McuWait_Deinit(); |
||||
McuLib_Deinit(); |
||||
} |
||||
@ -0,0 +1,18 @@ |
||||
/*
|
||||
* platform.h |
||||
* |
||||
* Created on: 29.09.2022 |
||||
* Author: jonas |
||||
*/ |
||||
|
||||
#ifndef PLATFORM_H_ |
||||
#define PLATFORM_H_ |
||||
|
||||
/* Platform initialization */ |
||||
void PL_Init(void); |
||||
|
||||
/* Platform de-initialization */ |
||||
void PL_Deinit(void); |
||||
|
||||
|
||||
#endif /* PLATFORM_H_ */ |
||||
@ -0,0 +1,26 @@ |
||||
/*
|
||||
* 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; |
||||
|
||||
splitflap.magSensor = McuGPIO_InitGPIO(&instance->magSensorConfig); |
||||
splitflap.motor = McuULN2003_InitMotor(&instance->motorConfig); |
||||
splitflap.id = id; |
||||
|
||||
return &splitflap; |
||||
} |
||||
|
||||
|
||||
|
||||
void SF_Deinit(SF_t* instance){ |
||||
McuULN2003_DeinitMotor(&instance->motorConfig); |
||||
McuGPIO_DeinitGPIO(&instance->magSensorConfig); |
||||
} |
||||
@ -0,0 +1,34 @@ |
||||
/*
|
||||
* splitflap.h |
||||
* |
||||
* Created on: 29.09.2022 |
||||
* Author: jonas |
||||
*/ |
||||
|
||||
#ifndef SPLITFLAP_H_ |
||||
#define SPLITFLAP_H_ |
||||
|
||||
#include "McuULN2003.h" |
||||
#include "McuGPIO.h" |
||||
|
||||
/* define splitflap handle type. SF_Handle_t points to SF_t */ |
||||
typedef void* SF_Handle_t; |
||||
|
||||
typedef struct { |
||||
McuULN2003_Handle_t motor; |
||||
McuGPIO_Handle_t magSensor; |
||||
int id; |
||||
} SF_t; |
||||
|
||||
typedef struct { |
||||
McuULN2003_Config_t motorConfig; |
||||
McuGPIO_Config_t magSensorConfig; |
||||
} SF_Config_t; |
||||
|
||||
/* split flap initialization */ |
||||
SF_Handle_t SF_Init(SF_Config_t* instance, int id); |
||||
|
||||
/* split flap deinitialization */ |
||||
void SF_Deinit(SF_Handle_t* instance); |
||||
|
||||
#endif /* SPLITFLAP_H_ */ |
||||
@ -0,0 +1,64 @@ |
||||
/*
|
||||
* splitflap_pins.h |
||||
* |
||||
* Created on: 29.09.2022 |
||||
* Author: jonas |
||||
*/ |
||||
|
||||
#ifndef SPLITFLAP_PINS_H_ |
||||
#define SPLITFLAP_PINS_H_ |
||||
|
||||
/* Magnet sensor */ |
||||
#define MAG_MOTOR0_GPIO GPIOB |
||||
#define MAG_MOTOR0_PORT PORTB |
||||
#define MAG_MOTOR0_PIN 19U |
||||
|
||||
#define MAG_MOTOR1_GPIO GPIOB |
||||
#define MAG_MOTOR1_PORT PORTB |
||||
#define MAG_MOTOR1_PIN 18U |
||||
|
||||
#define MAG_MOTOR2_GPIO GPIOA |
||||
#define MAG_MOTOR2_PORT PORTA |
||||
#define MAG_MOTOR2_PIN 13U |
||||
|
||||
#define MAG_MOTOR3_GPIO GPIOB |
||||
#define MAG_MOTOR3_PORT PORTB |
||||
#define MAG_MOTOR3_PIN 3U |
||||
|
||||
/* motor 0 */ |
||||
#define STEPPER_MOTOR0_IN1_GPIO GPIOC |
||||
#define STEPPER_MOTOR0_IN1_PORT PORTC |
||||
#define STEPPER_MOTOR0_IN1_PIN 11U |
||||
|
||||
#define STEPPER_MOTOR0_IN2_GPIO GPIOC |
||||
#define STEPPER_MOTOR0_IN2_PORT PORTC |
||||
#define STEPPER_MOTOR0_IN2_PIN 10U |
||||
|
||||
#define STEPPER_MOTOR0_IN3_GPIO GPIOC |
||||
#define STEPPER_MOTOR0_IN3_PORT PORTC |
||||
#define STEPPER_MOTOR0_IN3_PIN 9U |
||||
|
||||
#define STEPPER_MOTOR0_IN4_GPIO GPIOC |
||||
#define STEPPER_MOTOR0_IN4_PORT PORTC |
||||
#define STEPPER_MOTOR0_IN4_PIN 8U |
||||
|
||||
/* motor 1 */ |
||||
#define STEPPER_MOTOR1_IN1_GPIO GPIOA |
||||
#define STEPPER_MOTOR1_IN1_PORT PORTA |
||||
#define STEPPER_MOTOR1_IN1_PIN 1U |
||||
|
||||
#define STEPPER_MOTOR1_IN2_GPIO GPIOA |
||||
#define STEPPER_MOTOR1_IN2_PORT PORTA |
||||
#define STEPPER_MOTOR1_IN2_PIN 2U |
||||
|
||||
#define STEPPER_MOTOR1_IN3_GPIO GPIOA |
||||
#define STEPPER_MOTOR1_IN3_PORT PORTA |
||||
#define STEPPER_MOTOR1_IN3_PIN 5U |
||||
|
||||
#define STEPPER_MOTOR1_IN4_GPIO GPIOA |
||||
#define STEPPER_MOTOR1_IN4_PORT PORTA |
||||
#define STEPPER_MOTOR1_IN4_PIN 12U |
||||
|
||||
/* TODO define motors 2 and 3 */ |
||||
|
||||
#endif /* SPLITFLAP_PINS_H_ */ |
||||
Loading…
Reference in new issue