Commit 7205332a authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

add DMX driver for MSP430FR5969 and MSP430FR5994 launchpads

parent 8b5d14c7
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -46,6 +46,7 @@ Peripheral communication:
* I²C (master only, interrupt-driven)
* SPI (master only, polling)
* UART (output polling, input interrupt-driven)
* DMX (polling, via UART, overrides regular serial output)
* NeoPixel/WS2812B (Adafruit driver)

Hardware features:
@@ -56,9 +57,10 @@ Hardware features:

Peripheral communication:

* I²C on eUSCI\_B0 (master only, interrupt-driven)
* SPI on eUSCI\_B0 (master only, polling)
* UART on eUSCI\_A1 (output polling, input interrupt-driven)
* I²C on eUSCI\_B0 (FR5969) / eUSCI\_B1 (FR5994) (master only, interrupt-driven)
* SPI on eUSCI\_B0 (FR5969) / eUSCI\_B1 (FR5994) (master only, polling)
* UART on eUSCI\_A0 (FR5969) / eUSCI\_A1 (FR5994) (output polling, input interrupt-driven)
* DMX on eUSCI\_A1 (FR5969) / eUSCI\_A3 (FR5994) (polling)

Hardware features:

+20 −0
Original line number Diff line number Diff line
/*
 * Copyright 2022 Daniel Friesel
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */

class DMX {
	private:
		DMX(const DMX &copy);

	public:
		unsigned char frames[16];

		DMX() {}

		void setup();
		void write();
};

extern DMX dmx;
+20 −0
Original line number Diff line number Diff line
/*
 * Copyright 2022 Daniel Friesel
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */

class DMX {
	private:
		DMX(const DMX &copy);

	public:
		unsigned char frames[16];

		DMX() {}

		void setup();
		void write();
};

extern DMX dmx;
+3 −3
Original line number Diff line number Diff line
@@ -23,7 +23,7 @@ void DMX::setup()
#endif

	UCSR0B |= _BV(TXEN0);
	UCSR0C = _BV(USBS0) | _BV(UCSZ01) | _BV(UCSZ00); // 8 bits
	UCSR0C = _BV(USBS0) | _BV(UCSZ01) | _BV(UCSZ00); // MSB first, 8 data bits, 2 stop bits, no parity
}

void DMX::write()
@@ -31,9 +31,9 @@ void DMX::write()
	// Disable UART for reset and mark signals
	UCSR0B &= ~_BV(TXEN0);
	gpio.output(GPIO::pd1, 0);
	arch.delay_us(88); // break
	arch.delay_us(88); // break / reset
	gpio.output(GPIO::pd1, 1);
	arch.delay_us(8);
	arch.delay_us(8); // mark
	UCSR0B |= _BV(TXEN0); // causes line to go high
	for (uint8_t i = 0; i < 16; i++) {
		while (!(UCSR0A & _BV(UDRE0)));
+4 −0
Original line number Diff line number Diff line
@@ -9,6 +9,10 @@ config arch_msp430fr5969lp_driver_counter
bool "Cycle Counter"
select meta_driver_counter

config arch_msp430fr5969lp_driver_dmx
bool "DMX"
select meta_driver_dmx

config arch_msp430fr5969lp_driver_i2c
bool "I2C on eUSCI_B0"
select meta_driver_hardware_i2c
Loading