Created
May 30, 2016 06:39
-
-
Save monpetit/e6d475bcdb45da5895e3aff4cb90fa0a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void ssd1306_command(uint8_t c) | |
| { | |
| if (use_i2c) { | |
| static uint8_t control = 0x00; | |
| I2C_TransferSeq_TypeDef seq; | |
| seq.addr = (0x3C << 1); | |
| seq.flags = I2C_FLAG_WRITE_WRITE; | |
| seq.buf[0].data = &control; | |
| seq.buf[0].len = 1; | |
| seq.buf[1].data = &c; | |
| seq.buf[1].len = 1; | |
| /* Do a polled transfer */ | |
| I2C_Status = I2C_TransferInit(I2C0, &seq); | |
| while (I2C_Status == i2cTransferInProgress) { | |
| I2C_Status = I2C_Transfer(I2C0); | |
| } | |
| UNUSED_VARIABLE(I2C_Status); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment