Skip to content

Commit

Permalink
bugfixing
Browse files Browse the repository at this point in the history
  • Loading branch information
ni-vpacella committed Apr 7, 2016
1 parent 974079f commit 1a93d70
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
10 changes: 5 additions & 5 deletions Synapse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

namespace
{
static constexpr uint8_t k_writeChannelA = 0b01010000;
static constexpr uint8_t k_writeChannelB = 0b11010000;
static constexpr uint8_t k_writeChannelA = 0b01110000;
static constexpr uint8_t k_writeChannelB = 0b11110000;

static constexpr uint8_t k_pinCVInA = A0;
static constexpr uint8_t k_pinCVInB = A1;
Expand Down Expand Up @@ -69,7 +69,7 @@ unsigned Synapse::readCV(CVChannel channel_)

//--------------------------------------------------------------------------------------------------

void Synapse::writeCV(CVChannel channel_, unsigned value_)
void Synapse::writeCV(CVChannel channel_, uint16_t value_)
{
uint8_t msg1 = (uint8_t)((value_ >> 8) & 0x0F);
uint8_t msg2 = (uint8_t)(value_ & 0xFF);
Expand Down Expand Up @@ -172,12 +172,12 @@ void Synapse::writeGate(GateChannel channel_, bool state_)
{
case GateChannel::A:
{
m_outputGateA = LOW;
m_outputGateA = state_ ? LOW : HIGH;
break;
}
case GateChannel::B:
{
m_outputGateB = LOW;
m_outputGateB = state_ ? LOW : HIGH;
break;
}
default:
Expand Down
16 changes: 9 additions & 7 deletions Synapse.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,30 +36,32 @@ class Synapse
{
A, //!< CV channel A
B, //!< CV channel B
Unknown, //!< Unknown/unspecified
};

enum class GateChannel : uint8_t
{
A, //!< Gate channel A
B, //!< Gate channel A
Unknown, //!< Unknown/unspecified
};

enum class GateInterrupt : uint32_t
{
ValueLow = LOW, //!< Interrupt when the value of the digital input is LOW
ValueLow = HIGH, //!< Interrupt when the value of the digital input is LOW
#ifdef _SAM3XA_
ValueHigh = HIGH, //!< Interrupt when the value of the digital input is HIGH
ValueHigh = LOW, //!< Interrupt when the value of the digital input is HIGH
#endif
ValueChange = CHANGE, //!< Interrupt when the value of the digital input changes
RisingEdge = RISING, //!< Interrupt when the value of the digital input goes from LOW to HIGH
FallingEdge = FALLING, //!< Interrupt when the value of the digital input goes from HIGH to LOW
RisingEdge = FALLING, //!< Interrupt when the value of the digital input goes from LOW to HIGH
FallingEdge = RISING, //!< Interrupt when the value of the digital input goes from HIGH to LOW
};

//! Initialize the board
/*!
\param spiDivider_ The SPI divider (default = 8)
*/
void begin(unsigned spiDivider_ = SPI_CLOCK_DIV8);
void begin(unsigned spiDivider_ = SPI_CLOCK_DIV2);

//! Read from a CV input channel
/*!
Expand All @@ -72,7 +74,7 @@ class Synapse
/*!
\param channel_ The channel to write to
*/
void writeCV(CVChannel channel_, unsigned value_);
void writeCV(CVChannel channel_, uint16_t value_);

//! Get the CV range of the selected channel
/*!
Expand Down Expand Up @@ -137,7 +139,7 @@ class Synapse
Output<k_pinCVOutConfA> m_outputCVOutConfA;
Output<k_pinCVOutConfB> m_outputCVOutConfB;

Range m_channelRange[k_numCVOutputs]{Range::MinusFiveToFiveVolts, Range::MinusFiveToFiveVolts};
Range m_channelRange[k_numCVOutputs]{Range::ZeroToTenVolts, Range::ZeroToTenVolts};
unsigned m_spiDivider;
};

Expand Down

0 comments on commit 1a93d70

Please sign in to comment.