parent
42f3753b2b
commit
525ae31d3e
@ -0,0 +1,22 @@
|
||||
#ifndef io_h
|
||||
#define io_h
|
||||
|
||||
// Many of the ESP-IDF functions require pins from the gpio_num_t enum
|
||||
#define GPIO_ROLLER1_SPEED GPIO_NUM_5
|
||||
#define GPIO_ROLLER2_SPEED GPIO_NUM_18
|
||||
#define GPIO_ROLLER3_SPEED GPIO_NUM_19
|
||||
#define GPIO_ROLLER1_EN GPIO_NUM_4
|
||||
#define GPIO_ROLLER2_EN GPIO_NUM_16
|
||||
#define GPIO_ROLLER3_EN GPIO_NUM_17
|
||||
#define GPIO_ROLLER1_PWM GPIO_NUM_26
|
||||
#define GPIO_ROLLER2_PWM GPIO_NUM_27
|
||||
#define GPIO_ROLLER3_PWM GPIO_NUM_14
|
||||
#define GPIO_ROLLER1_IS GPIO_NUM_36
|
||||
#define GPIO_ROLLER2_IS GPIO_NUM_39
|
||||
#define GPIO_ROLLER3_IS GPIO_NUM_34
|
||||
#define GPIO_SYS_VOLTAGE GPIO_NUM_35
|
||||
|
||||
#define GPIO_SDA GPIO_NUM_21
|
||||
#define GPIO_SCL GPIO_NUM_22
|
||||
|
||||
#endif
|
||||
@ -0,0 +1,21 @@
|
||||
#ifndef roller_speed_h
|
||||
#define roller_speed_h
|
||||
|
||||
#include "freertos/FreeRTOS.h"
|
||||
|
||||
static const float REV_OVERFLOW = 10000; // Number at which rev counts overflow back to 0
|
||||
|
||||
typedef struct {
|
||||
uint32_t speed;
|
||||
uint32_t timestamp;
|
||||
} speed_measurement;
|
||||
|
||||
void roller_speed_setup(void);
|
||||
|
||||
// Returns the last calculated speed for Roller 1 in revs/second
|
||||
float getRoller1Speed(void);
|
||||
|
||||
// Returns the total rev count for Roller 1. Overflows back to 0 at REV_OVERFLOW
|
||||
float getRoller1Revs(void);
|
||||
|
||||
#endif
|
||||
Loading…
Reference in new issue