#include "ch.h"
#include "hal.h"
#include "chprintf.h"
Go to the source code of this file.
◆ ENABLE
#define ENABLE GPIOB_EN_MAG |
◆ EXIT_FAILURE
◆ EXIT_SUCCESS
◆ FORWARD
◆ MTQR_PWM_FREQ
#define MTQR_PWM_FREQ 2e3 |
◆ MTQR_PWM_PERIOD
◆ MTQR_PWM_TIMER_FREQ
#define MTQR_PWM_TIMER_FREQ 2e6 |
◆ MTQR_STARTING_DC
#define MTQR_STARTING_DC 5000u |
◆ PH
◆ PWM_CH_MTQR
◆ REVERSE
◆ mtqrExit()
void mtqrExit |
( |
MTQR * |
mtqr | ) |
|
Magnetorquer exit function.
Function to initialize shutdown of driver.
int started
Definition: magnetorquer.h:51
void mtqrStop(MTQR *mtqr)
Magnetorquer stop function.
Definition: magnetorquer.c:43
◆ mtqrInit()
void mtqrInit |
( |
MTQR * |
mtqr | ) |
|
Magnetorquer initialization function.
This function will initialize the driver state to off.
int started
Definition: magnetorquer.h:51
#define ENABLE
Definition: magnetorquer.h:19
◆ mtqrSetDC()
void mtqrSetDC |
( |
uint16_t |
dc | ) |
|
Magnetorquer set duty cycle function.
This function takes a 16 bit value as parameter and sets the duty cycle of the magnetorquer driver using the paramater.
65 PWM_PERCENTAGE_TO_WIDTH(&PWMD1,dc)
#define PWM_CH_MTQR
Definition: magnetorquer.h:16
◆ mtqrSetDir()
void mtqrSetDir |
( |
uint8_t |
dc | ) |
|
Magnetorquer set direction function.
This function sets the phase pin for the STSPIN250 motor driver. The phase is set based on the value of the paramater given to the function.
79 palClearPad(GPIOA,
PH);
#define REVERSE
Definition: magnetorquer.h:12
#define FORWARD
Definition: magnetorquer.h:11
#define PH
Definition: magnetorquer.h:18
◆ mtqrStart()
void mtqrStart |
( |
MTQR * |
mtqr | ) |
|
Magnetorquer start function.
This function will start the PWM driver and enable the STSPIN250 motor driver while providing a starting duty cycle. At this point, the state of the magnetorquer will be set to true to indicate on state.
void mtqrSetDC(uint16_t dc)
Magnetorquer set duty cycle function.
Definition: magnetorquer.c:61
int started
Definition: magnetorquer.h:51
#define ENABLE
Definition: magnetorquer.h:19
#define MTQR_STARTING_DC
Definition: magnetorquer.h:17
static const PWMConfig pwm_MTQRcfg
PWMConfig structure for the magnetorquer.
Definition: magnetorquer.h:28
◆ mtqrStop()
void mtqrStop |
( |
MTQR * |
mtqr | ) |
|
Magnetorquer stop function.
This function will disable the active PWM driver and disable the STSPIN250 motor driver.
int started
Definition: magnetorquer.h:51
#define PWM_CH_MTQR
Definition: magnetorquer.h:16
#define ENABLE
Definition: magnetorquer.h:19
◆ pwm_MTQRcfg
const PWMConfig pwm_MTQRcfg |
|
static |
Initial value:= {
NULL,
{
{PWM_OUTPUT_ACTIVE_HIGH,NULL},
{PWM_OUTPUT_DISABLED,NULL},
{PWM_OUTPUT_DISABLED,NULL},
{PWM_OUTPUT_DISABLED,NULL}
},
0,
0,
0
}
#define MTQR_PWM_TIMER_FREQ
Definition: magnetorquer.h:8
#define MTQR_PWM_PERIOD
Definition: magnetorquer.h:14
PWMConfig structure for the magnetorquer.