# HG changeset patch # User David Douard # Date 1477514476 -7200 # Node ID 162fe523c37d7fc9d21d2f1688f7a84cf7bad0c9 # Parent c5e5bdc5ef496fe0f5bc51eb92a1dfe43f2e7c5a almost working... before killing the 87C51... diff -r c5e5bdc5ef49 -r 162fe523c37d lib/unigraphic/SSD1322.cpp --- 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, diff -r c5e5bdc5ef49 -r 162fe523c37d lib/unigraphic/SSD1322.h --- 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 diff -r c5e5bdc5ef49 -r 162fe523c37d src/main.cpp --- 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); } }