Wed, 26 Oct 2016 22:41:16 +0200
almost working... before killing the 87C51...
--- a/lib/unigraphic/SSD1322.cpp Tue Oct 11 21:49:43 2016 +0200 +++ b/lib/unigraphic/SSD1322.cpp Wed Oct 26 22:41:16 2016 +0200 @@ -53,7 +53,7 @@ static const uint8_t oledInit[] = { SSD1322_CMD_SET_COMMAND_LOCK, 1, 0x12, /* Unlock OLED driver IC*/ SSD1322_CMD_SET_DISPLAY_OFF, 0, - SSD1322_CMD_SET_CLOCK_DIVIDER, 1, 0x91, + SSD1322_CMD_SET_CLOCK_DIVIDER, 1, 0x91,//0xF0, //max freq, was 0x91, SSD1322_CMD_SET_MULTIPLEX_RATIO, 1, 0x3F, /*duty = 1/64*,64 COMS are enabled*/ SSD1322_CMD_SET_DISPLAY_OFFSET, 1, 0x00, SSD1322_CMD_SET_DISPLAY_START_LINE, 1, 0x00, /*set start line position*/ @@ -364,10 +364,15 @@ DISPLAY_BUFFER_ELEMENTS * sizeof(DISPLAY_BUFFER_TYPE)); wr_cmd8(SSD1322_CMD_WRITE_RAM); +#ifdef DEVICE_SPI_ASYNCH + _CS = 0; + _spi.transfer((uint8_t*) _trBuffer, 64*128, (uint8_t*) NULL, 0, _spiEventCb); +#else i = 0; for(y=0; y<64; y++) for(x=0; x<128; x++) wr_data8(_trBuffer[i++]); +#endif } void SSD1322::copy_to_lcd(unsigned char from_col, unsigned char to_col,
--- a/lib/unigraphic/SSD1322.h Tue Oct 11 21:49:43 2016 +0200 +++ b/lib/unigraphic/SSD1322.h Wed Oct 26 22:41:16 2016 +0200 @@ -232,7 +232,10 @@ int orientation; SSD1322_state_t _state; - +#ifdef DEVICE_SPI_ASYNCH + event_callback_t _spiEventCb; +#endif + }; #endif
--- a/src/main.cpp Tue Oct 11 21:49:43 2016 +0200 +++ b/src/main.cpp Wed Oct 26 22:41:16 2016 +0200 @@ -12,8 +12,7 @@ #include "SSD1322.h" #include "hp34comm.h" - -#if (defined STM32F303x8) || (defined STM32L432xx) +#if (defined STM32L432xx) // display #define DSP_MOSI PA_7 //A6 #define DSP_MISO PA_6 //A5 @@ -26,6 +25,19 @@ // misc #define DBGPIN PA_12 +#elif (defined STM32F303x8) +// display +#define DSP_MOSI PA_7 //A6 +#define DSP_MISO PA_6 //A5 +#define DSP_SCLK PA_5 //A4 +#define DSP_CS PA_4 +#define DSP_RST PB_5 //D11 +#define DSP_DC PB_4 //D12 +// UART for RX (CPU->DP) and TX (DP->CPU) combined +#define HP_RX PA_10 // serial1 RX +// misc +#define DBGPIN PA_12 + #elif defined STM32F446xx // display #define DSP_MOSI PB_15 @@ -497,7 +509,6 @@ for (uint8_t i=0; i<8; i++) err[i] = 0; while(1) { - if (hp != NULL) { if (hp->cmd_available()) { led = 1; @@ -541,12 +552,8 @@ } led = 0; } - } - else { - show(0x00, "hello", 6); - } - - Thread::wait(10); + else + Thread::wait(1); } }