Hardware UART comms + partial v5 modules support

This commit is contained in:
Filip Ayazi 2022-09-03 22:04:28 +01:00
parent dfd4a99f1f
commit fde7a90480
10 changed files with 296 additions and 120 deletions

View file

@ -0,0 +1,41 @@
#include "config.h"
#ifdef ILLUMINATION
#include "illumination.h"
#ifdef SUPPORT_EEPROM
#include <EEPROM.h>
#else
#include "dummyEEPROM.h"
#endif
#define WIRING_PWM_LED_NUM 1
#define WIRING_PWM_LEDS {25}
//TODO: implement some fancier features of TMC controllers
const uint8_t pwm_led_pins[] = WIRING_PWM_LEDS;
void illumination_pwm(String command)
{
//TODO: make this properly, this is just a test for hacked on/off
char * args[2];
parse_arguments(args, command, 2);
if (atof(args[1]) < 0.001)
{
digitalWrite(pwm_led_pins[0], LOW);//start with motor disabled
}
else
{
digitalWrite(pwm_led_pins[0], HIGH);
}
SERIAL_PORT.println("Illumination set");
free(args[0]);
free(args[1]);
}
void illumination_setup()
{
pinMode(pwm_led_pins[0], OUTPUT);
register_module(illumination_commands, NULL);
}
extern const Command illumination_commands[] = {
{"led_pwm", illumination_pwm},
END_COMMAND};
#endif