SmartCradle v1
Baby smart cradle
motor.c File Reference

Motor module implementation. More...

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <linux/types.h>
#include "../inc/motor.h"
Include dependency graph for motor.c:

Go to the source code of this file.

Functions

void initMotor ()
 Load the motor driver device driver. More...
 
void remMotor ()
 Remove the motor driver device driver. More...
 
int startMotor ()
 Start the motor. More...
 
int stopMotor ()
 Stop the motor. More...
 
_Bool getMotorStatus ()
 Get the Motor Status object. More...
 

Variables

const char RUN = '1'
 
const char STOP = '0'
 
static _Bool motorRunning
 

Detailed Description

Motor module implementation.

Author
José Carvalho, João Carneiro
Date
2022-01-13

Definition in file motor.c.

Function Documentation

◆ getMotorStatus()

_Bool getMotorStatus ( )

Get the Motor Status object.

Returns
bool: Returns the status of the motor

Definition at line 79 of file motor.c.

◆ initMotor()

void initMotor ( )

Load the motor driver device driver.

Definition at line 22 of file motor.c.

◆ remMotor()

void remMotor ( )

Remove the motor driver device driver.

Definition at line 27 of file motor.c.

◆ startMotor()

int startMotor ( )

Start the motor.

Writes to the device driver so that the motor is enabled.

Returns
int: Returns 0 on error, or 1 if sucessful

Definition at line 31 of file motor.c.

◆ stopMotor()

int stopMotor ( )

Stop the motor.

Writes to the device driver so that the motor is disabled.

Returns
int: Returns 0 on error, or 1 if sucessful

Definition at line 55 of file motor.c.

Variable Documentation

◆ motorRunning

_Bool motorRunning
static

Definition at line 20 of file motor.c.

◆ RUN

const char RUN = '1'

Definition at line 17 of file motor.c.

◆ STOP

const char STOP = '0'

Definition at line 18 of file motor.c.