BaseMachine UI Controllerに分離
Dependencies: AverageAnalogIn PinDetect RotaryEncoder Sequence SequencerDisplay mbed-rtos mbed st7567LCD BaseMachineComon
Fork of BaseMachine_Sequencer by
Revision 55:ab24d74eb0e6, committed 2016-10-28
- Comitter:
- ryood
- Date:
- Fri Oct 28 03:53:41 2016 +0000
- Parent:
- 54:38187ac44253
- Commit message:
- Change SPI bits to 8bit
Changed in this revision
BaseMachineComon.lib | Show annotated file Show diff for this revision Revisions of this file |
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/BaseMachineComon.lib Sun Oct 23 05:48:57 2016 +0000 +++ b/BaseMachineComon.lib Fri Oct 28 03:53:41 2016 +0000 @@ -1,1 +1,1 @@ -https://developer.mbed.org/users/ryood/code/BaseMachineComon/#a7a23cc867a6 +https://developer.mbed.org/users/ryood/code/BaseMachineComon/#41422a08bd8e
--- a/main.cpp Sun Oct 23 05:48:57 2016 +0000 +++ b/main.cpp Fri Oct 28 03:53:41 2016 +0000 @@ -14,13 +14,13 @@ #include "RotaryEncoder.h" #include "AverageAnalogIn.h" -#define UART_TRACE (1) +#define UART_TRACE (0) #include "BaseMachineCommon.h" #include "Sequence.h" #include "ST7565_SequencerDisplay.h" #define TITLE_STR1 ("BaseMachine UI Controller") -#define TITLE_STR2 ("20161023") +#define TITLE_STR2 ("20161028") #define SPI2_RATE (1000000) #define POT_RESOLUTION (7) // bit @@ -185,14 +185,13 @@ uint16_t SpiSendParams(uint8_t cmd, uint8_t data) { - uint16_t sendVal = ((uint16_t)cmd << 8) | data; - SpiMasterCs = 0; - uint16_t recievedVal = SpiMaster.write(sendVal); + SpiMaster.write(cmd); + uint8_t rv = SpiMaster.write(data); SpiMasterCs = 1; //Thread::wait(1); - - return recievedVal; + + return rv; } uint16_t SpiSendAllParams() @@ -584,7 +583,7 @@ // Initialize SPI Master // SpiMasterCs = 1; - SpiMaster.format(16, 0); + SpiMaster.format(SPI_UI_TO_SEQUENCER_BITS, SPI_UI_TO_SEQUENCER_MODE); SpiMaster.frequency(SPI_UI_TO_SEQUENCER_RATE); StepChangeInterrupt.fall(&updateStep); @@ -631,8 +630,7 @@ // Recieve playing step from SPI slave if (isStepChanged) { - uint16_t recievedVal = SpiSendParams(CMD_RCV_PLAYING_STEP, 0x55); // Send dummy data - playingStep = (uint8_t)(recievedVal & 0xff); + playingStep = SpiSendParams(CMD_RCV_PLAYING_STEP, 0x55); // Send dummy data isStepChanged = false; isDirty = true; }