diff options
-rw-r--r-- | include/arch/msp430fr5969lp/driver/dmx1.h (renamed from include/arch/msp430fr5969lp/driver/dmx.h) | 11 | ||||
-rw-r--r-- | include/arch/msp430fr5969lp/driver/stdin.h | 2 | ||||
-rw-r--r-- | src/arch/msp430fr5969lp/Kconfig | 16 | ||||
-rw-r--r-- | src/arch/msp430fr5969lp/driver/dmx1.cc (renamed from src/arch/msp430fr5969lp/driver/dmx.cc) | 16 | ||||
-rw-r--r-- | src/arch/msp430fr5969lp/driver/stdin.cc | 4 |
5 files changed, 25 insertions, 24 deletions
diff --git a/include/arch/msp430fr5969lp/driver/dmx.h b/include/arch/msp430fr5969lp/driver/dmx1.h index d3fff46..2f738b8 100644 --- a/include/arch/msp430fr5969lp/driver/dmx.h +++ b/include/arch/msp430fr5969lp/driver/dmx1.h @@ -4,17 +4,18 @@ * SPDX-License-Identifier: BSD-2-Clause */ -class DMX { +class DMX1 { private: - DMX(const DMX ©); + DMX1(const DMX1 ©); public: - unsigned char frames[16]; + static unsigned char const num_frames = 32; + unsigned char frames[num_frames]; - DMX() {} + DMX1() {} void setup(); void write(); }; -extern DMX dmx; +extern DMX1 dmx1; diff --git a/include/arch/msp430fr5969lp/driver/stdin.h b/include/arch/msp430fr5969lp/driver/stdin.h index 34d0551..9076baa 100644 --- a/include/arch/msp430fr5969lp/driver/stdin.h +++ b/include/arch/msp430fr5969lp/driver/stdin.h @@ -9,7 +9,7 @@ class StandardInput { private: StandardInput(const StandardInput ©); - static unsigned char const bufsize = 16; + static unsigned char const bufsize = 32; char buffer[bufsize]; volatile unsigned char write_pos; unsigned char read_pos; diff --git a/src/arch/msp430fr5969lp/Kconfig b/src/arch/msp430fr5969lp/Kconfig index b96a032..0e7052d 100644 --- a/src/arch/msp430fr5969lp/Kconfig +++ b/src/arch/msp430fr5969lp/Kconfig @@ -9,20 +9,20 @@ config arch_msp430fr5969lp_driver_counter bool "Cycle Counter" select meta_driver_counter -config arch_msp430fr5969lp_driver_dmx -bool "DMX" +config arch_msp430fr5969lp_driver_dmx1 +bool "DMX Output on eUSCI_A1 / P2.5" +depends on !meta_driver_stdout1 select meta_driver_dmx +select meta_driver_dmx1 config arch_msp430fr5969lp_driver_i2c -bool "I2C on eUSCI_B0" +bool "I²C on eUSCI_B0 / P1.[67]" +help + SDA: P1.6 + SCL: P1.7 select meta_driver_hardware_i2c select meta_driver_i2c -## broken -#config arch_msp430fr5969lp_driver_spi_a1 -#bool "SPI on eUSCI_A1" -#select meta_driver_spi - config arch_msp430fr5969lp_driver_spi bool "SPI on eUSCI_B0" select meta_driver_spi diff --git a/src/arch/msp430fr5969lp/driver/dmx.cc b/src/arch/msp430fr5969lp/driver/dmx1.cc index 78c7e19..cad965b 100644 --- a/src/arch/msp430fr5969lp/driver/dmx.cc +++ b/src/arch/msp430fr5969lp/driver/dmx1.cc @@ -5,7 +5,7 @@ */ #include <msp430.h> #include "arch.h" -#include "driver/dmx.h" +#include "driver/dmx1.h" #include "driver/gpio.h" /* @@ -16,7 +16,7 @@ * Set UCBRS0 according to table 21-4 */ -void DMX::setup() +void DMX1::setup() { UCA1CTLW0 |= UCSWRST; #if F_CPU == 16000000UL @@ -38,7 +38,7 @@ void DMX::setup() UCA1CTLW0 &= ~UCSWRST; } -void DMX::write() +void DMX1::write() { // Disable UART for reset and mark signals UCA1CTLW0 |= UCSWRST; @@ -49,18 +49,14 @@ void DMX::write() arch.delay_us(8); // mark P2SEL1 |= BIT5; UCA1CTLW0 &= ~UCSWRST; // causes line to go high - for (unsigned char i = 0; i < 16; i++) { + for (unsigned short i = 0; i < num_frames; i++) { while (!(UCA1IFG & UCTXIFG)); UCA1TXBUF = frames[i]; } - for (unsigned char i = 0; i < 241; i++) { - while (!(UCA1IFG & UCTXIFG)); - UCA1TXBUF = 0; - } - for (unsigned char i = 0; i < 255; i++) { + for (unsigned short i = 0; i < 258 - num_frames; i++) { while (!(UCA1IFG & UCTXIFG)); UCA1TXBUF = 0; } } -DMX dmx; +DMX1 dmx1; diff --git a/src/arch/msp430fr5969lp/driver/stdin.cc b/src/arch/msp430fr5969lp/driver/stdin.cc index 0850dab..92b7157 100644 --- a/src/arch/msp430fr5969lp/driver/stdin.cc +++ b/src/arch/msp430fr5969lp/driver/stdin.cc @@ -8,6 +8,10 @@ void StandardInput::setup() { + UCA0CTLW0 |= UCSWRST; + P2SEL0 &= ~BIT1; + P2SEL1 |= BIT1; + UCA0CTLW0 &= ~UCSWRST; UCA0IE |= UCRXIE; } |