56 lines
1.0 KiB
C
56 lines
1.0 KiB
C
#include "hal_motor.h"
|
|
|
|
bool stub_motor_enabled;
|
|
int stub_stop_count;
|
|
int stub_agitate_start_count;
|
|
int stub_agitate_stop_count;
|
|
int stub_enable_count;
|
|
float stub_last_cw;
|
|
float stub_last_ccw;
|
|
uint32_t stub_last_rpm;
|
|
|
|
void hal_motor_init(void)
|
|
{
|
|
stub_motor_enabled = false;
|
|
stub_stop_count = 0;
|
|
stub_agitate_start_count = 0;
|
|
stub_agitate_stop_count = 0;
|
|
stub_enable_count = 0;
|
|
stub_last_cw = 0.f;
|
|
stub_last_ccw = 0.f;
|
|
stub_last_rpm = 0;
|
|
}
|
|
|
|
void hal_motor_enable(bool on)
|
|
{
|
|
stub_enable_count++;
|
|
stub_motor_enabled = on;
|
|
}
|
|
|
|
void hal_motor_request_stop(void)
|
|
{
|
|
stub_stop_count++;
|
|
stub_motor_enabled = false;
|
|
}
|
|
|
|
esp_err_t hal_motor_agitate_start(float cw_revs, float ccw_revs, uint32_t rpm)
|
|
{
|
|
stub_agitate_start_count++;
|
|
stub_last_cw = cw_revs;
|
|
stub_last_ccw = ccw_revs;
|
|
stub_last_rpm = rpm;
|
|
stub_motor_enabled = true;
|
|
return ESP_OK;
|
|
}
|
|
|
|
void hal_motor_agitate_stop(void)
|
|
{
|
|
stub_agitate_stop_count++;
|
|
stub_motor_enabled = false;
|
|
}
|
|
|
|
bool hal_motor_is_enabled(void)
|
|
{
|
|
return stub_motor_enabled;
|
|
}
|