Skip to content
Snippets Groups Projects
Unverified Commit 2c26e370 authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

msp430fr5969 stdin: increase buffer size; move initialization to stdin

parent b452e3f5
No related branches found
No related tags found
No related merge requests found
......@@ -4,17 +4,18 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
class DMX {
class DMX1 {
private:
DMX(const DMX &copy);
DMX1(const DMX1 &copy);
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;
......@@ -9,7 +9,7 @@
class StandardInput {
private:
StandardInput(const StandardInput &copy);
static unsigned char const bufsize = 16;
static unsigned char const bufsize = 32;
char buffer[bufsize];
volatile unsigned char write_pos;
unsigned char read_pos;
......
......@@ -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
......
......@@ -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;
......@@ -8,6 +8,10 @@
void StandardInput::setup()
{
UCA0CTLW0 |= UCSWRST;
P2SEL0 &= ~BIT1;
P2SEL1 |= BIT1;
UCA0CTLW0 &= ~UCSWRST;
UCA0IE |= UCRXIE;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment