BeRTOS
Data Structures | Defines | Typedefs | Functions
dc_motor.h File Reference

DC motor driver. More...

#include "hw/hw_dc_motor.h"
#include "cfg/cfg_dc_motor.h"
#include "cfg/cfg_pwm.h"
#include <cfg/macros.h>
#include <algo/pid_control.h>
#include <drv/pwm.h>
#include <drv/timer.h>
#include <drv/adc.h>

Go to the source code of this file.

Data Structures

struct  DCMotorConfig
 DC motor configuration stucture. More...
struct  DCMotor
 Context structure for DC motor. More...

Defines

#define DC_MOTOR_NO_EXPIRE   -1
 The DC motor runs do not expire, so it runs forever.
#define DC_MOTOR_NO_DEV_SPEED   -1
 Disable the speed acquire from device (like trimmer, etc.).

Typedefs

typedef uint16_t dc_speed_t
 Type for DC motor.

Functions

void dc_motor_setDir (int index, bool dir)
 Set spin direction of DC motor.
void dc_motor_enable (int index, bool state)
 Enable or disable dc motor.
void dc_motor_setSpeed (int index, dc_speed_t speed)
 Set DC motor speed.
void dc_motor_startTimer (int index, mtime_t on_time)
 Set among of time that dc motor should run.
void dc_motor_setup (int index, DCMotorConfig *dcm_conf)
 Apply a confinguration to select DC motor.
dc_speed_t dc_motor_readTargetSpeed (int index)
 Read the target speed from select device.
void dc_motor_setPriority (int priority)
 If we had enabled the priority scheduling, we can adjust the DC motor poll process priority.
void dc_motor_init (void)
 Init DC motor.
int dc_motor_testSetUp (void)
 Test function prototypes.

Detailed Description

DC motor driver.

Author:
Daniele Basile <asterix@develer.com>

Definition in file dc_motor.h.


Function Documentation

void dc_motor_init ( void  )

Init DC motor.

priority: sets the dc motor process priority.

Definition at line 490 of file dc_motor.c.

void dc_motor_setDir ( int  index,
bool  dir 
)

Set spin direction of DC motor.

index number of DC motor dir direction of DC motor

Definition at line 347 of file dc_motor.c.

int dc_motor_testSetUp ( void  )

Test function prototypes.

See dc_motor_hwtest.c file.

Definition at line 118 of file dc_motor_hwtest.c.