@@ -26,12 +26,14 @@ extern __IO uint32_t Receive_length ;
extern __IO uint32_t length ;
uint8_t Send_Buffer[64];
uint32_t packet_sent=1;
uint32_t packet_receive=1;
static __IO uint32_t TimingDelay;
// Move to header file
void init_gpio();
void init_spi();
void process();
@@ -65,14 +67,16 @@ int main(void)
GPIO_ResetBits(LED_POWER);
init_spi();
ssd1306_Init();
ssd1306_block_write();
ssd1306_DrawString("Hello World!", 0, 10);
ssd1306_DrawString("therm 0.1", 0, 40);
ssd1306_DrawString("Status: Idle", 2, 40);
// ssd1306_block_write();
ssd1306_test();
uint8_t toggle = 0;
while(1)
{
//ssd1306_block_write();
@@ -90,17 +94,17 @@ int main(void)
uint8_t sw_left = GPIO_ReadInputDataBit(SW_LEFT);
uint8_t sw_right = GPIO_ReadInputDataBit(SW_RIGHT);
if(!sw_btn) {
GPIO_ToggleBits(LED_STAT);
if(!toggle) {
ssd1306_DrawString("I freaking work!", 2, 10);
ssd1306_DrawString("________________", 3, 32);
toggle = ! toggle;
}
else {
ssd1306_DrawString("----------------", 3, 32);
GPIO_SetBits(LED_POWER);
Delay(50);
@@ -632,12 +632,66 @@ void setStartColumn(unsigned char d)
WriteCommand(0x00+d%16); // Set Lower Column Start Address for Page Addressing Mode
WriteCommand(0x10+d/16); // Set Higher Column Start Address for Page Addressing Mode
// Default => 0x10
const uint8_t row[4][32] = {
{0x00,0x00,0x01,0x03,0x07,0x0F,0x1E,0x3C,0x3C,0x7C,0x7C,0x7C,0xFC,0xFF,0xFF,0xFC,0xFC,0xFC,0xFC,0xFF,0x7F,0x7F,0x7F,0x3C,0x3C,0x1C,0x0C,0x06,0x03,0x01,0x00,0x00},
{0x0F,0x7F,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x3F,0x3F,0x7F,0xFF,0xFF,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0x7F,0x0F},
{0xF0,0xFE,0xFF,0xFF,0xFF,0xC7,0x00,0x00,0x00,0x00,0x87,0xC7,0xC7,0xFF,0xFF,0x00,0x00,0x00,0x00,0x87,0x87,0xC7,0xC3,0x03,0x07,0x07,0x0F,0x7F,0xFF,0xFF,0xFE,0xF0},
{0x00,0x00,0x80,0xC0,0xE0,0xF0,0xF8,0xFC,0xFC,0xFE,0xFE,0xFE,0xFF,0xFF,0xFF,0x1F,0x1F,0x1F,0x1F,0xFF,0xFE,0xFE,0xFE,0xFC,0xFC,0xF8,0xF0,0xE0,0xC0,0x80,0x00,0x00},
};
void ssd1306_test()
uint8_t i = 0;
setStartPage(3);
setStartColumn(0);
for(i = 0; i<32; i++)
WriteData(row[0][i]);
WriteData(0x00);
setStartPage(2);
WriteData(row[1][i]);
setStartPage(1);
WriteData(row[2][i]);
setStartPage(0);
WriteData(row[3][i]);
/* Print a single character from font.cpp */
void ssd1306_DrawChar(char ascii, unsigned char row, unsigned char xPos)
char *srcPointer = 0;
unsigned char i;
@@ -47,8 +47,9 @@ unsigned char ssd1306_SetContrast(unsign
unsigned char ssd1306_GetContrast();
unsigned char* ssd1306_GetBuffer();
unsigned long ssd1306_DrawPoint(Pos_t x, Pos_t y, Color_t color);
void ssd1306_block_write(void);
void ssd1306_DrawChar(char ascii, unsigned char row, unsigned char xPos);
void ssd1306_DrawString(const char *dataPtr, unsigned char row, unsigned char xPos);
void ssd1306_test();
#endif
Status change: