ESP Line Following Buggy
2nd Year Embedded System Project (Group 48 - 2023/24)
Loading...
Searching...
No Matches
motor_driver_board.cpp
Go to the documentation of this file.
1#include "mbed.h"
3#include "constants.h"
4#include "pin_assignments.h"
5
6#include "ds2781.h"
7#include "OneWire_Methods.h"
8
9
11
12
13MotorDriverBoard::MotorDriverBoard(PinName enable_pin, PinName monitor_pin): board_enable(enable_pin)
14{
15 disable();
16}
17
18
20{
21 enable_state = true;
22 board_enable.write(true);
23}
24
25
27{
28 enable_state = false;
29 board_enable.write(false);
30}
31
32
40
41void MotorDriverBoard::set_enable(bool expression)
42{
43 enable_state = expression;
44 board_enable.write(expression);
45}
46
48{
49 return Voltage;
50}
51
53{
54 return Current;
55}
56
57
DigitalInOut one_wire_pin
int CurrentReading
gets the value of voltage and current as integers per unit value referred to in the ds2781....
float get_voltage(void)
returns the actual voltage value
void update_measurements(void)
updates the measurements of voltage and current values
bool get_enable_state(void)
returns the state of the enable pin
void disable(void)
causes the enable pin to be set to LOW
void set_enable(bool expression)
enable pin will be set to the boolean value in the paremeter
void enable(void)
causes the enable pin to be set to HIGH
MotorDriverBoard(PinName enable_pin, PinName monitor_pin)
Construct a new MotorDriverBoard object.
float get_current(void)
returns the actual curent value
float Current
actual value of the voltage and current
bool enable_state
state of the enable pin
DigitalOut board_enable
pin responsible for enabling the board
contains all the constant variables for easy access from one file
int ReadVoltage(void)
Definition ds2781.cpp:27
uint16_t ReadCurrent(void)
Definition ds2781.cpp:50
ESP Motor Driver Board Interface library
MCU pin assigments in one file for easy modification.
#define DRIVER_MONITOR_PIN