pins for i2c, added missing wiki .pre file

This commit is contained in:
olikraus 2015-12-06 10:53:59 +01:00
parent 357b1c566a
commit fc64bae5fb
4 changed files with 101 additions and 38 deletions

View File

@ -192,7 +192,7 @@ struct u8x8_display_info_struct
#ifdef U8X8_USE_PINS
#define U8X8_PIN_CNT 12
#define U8X8_PIN_CNT 14
#define U8X8_PIN_NONE 255
#endif
@ -215,9 +215,9 @@ struct u8x8_struct
/* list of U8x8 pins */
#define U8X8_PIN_D0 0
#define U8X8_PIN_CLOCK 0
#define U8X8_PIN_SPI_CLOCK 0
#define U8X8_PIN_D1 1
#define U8X8_PIN_DATA 1
#define U8X8_PIN_SPI_DATA 1
#define U8X8_PIN_D2 2
#define U8X8_PIN_D3 3
#define U8X8_PIN_D4 4
@ -230,6 +230,9 @@ struct u8x8_struct
#define U8X8_PIN_DC 10 /* parallel, SPI */
#define U8X8_PIN_RESET 11 /* parallel, SPI, I2C */
#define U8X8_PIN_I2C_CLOCK 12 /* 1 = Input/high impedance, 0 = drive low */
#define U8X8_PIN_I2C_DATA 13 /* 1 = Input/high impedance, 0 = drive low */
#ifdef U8X8_USE_PINS
#define u8x8_SetPin(u8x8,pin,val) (u8x8)->pins[pin] = (val)
#endif
@ -446,20 +449,23 @@ uint8_t u8x8_byte_ssd13xx_sw_i2c(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, voi
#define u8x8_GetPinValue(u8x8, msg) ((u8x8)->pins[(msg)&0x3f])
#endif
#define U8X8_MSG_GPIO_D0 U8X8_MSG_GPIO(U8X8_PIN_D0)
#define U8X8_MSG_GPIO_CLOCK U8X8_MSG_GPIO(U8X8_PIN_CLOCK)
#define U8X8_MSG_GPIO_D1 U8X8_MSG_GPIO(U8X8_PIN_D1)
#define U8X8_MSG_GPIO_DATA U8X8_MSG_GPIO(U8X8_PIN_DATA)
#define U8X8_MSG_GPIO_D2 U8X8_MSG_GPIO(U8X8_PIN_D2)
#define U8X8_MSG_GPIO_D3 U8X8_MSG_GPIO(U8X8_PIN_D3)
#define U8X8_MSG_GPIO_D4 U8X8_MSG_GPIO(U8X8_PIN_D4)
#define U8X8_MSG_GPIO_D5 U8X8_MSG_GPIO(U8X8_PIN_D5)
#define U8X8_MSG_GPIO_D6 U8X8_MSG_GPIO(U8X8_PIN_D6)
#define U8X8_MSG_GPIO_D7 U8X8_MSG_GPIO(U8X8_PIN_D7)
#define U8X8_MSG_GPIO_E U8X8_MSG_GPIO(U8X8_PIN_E)
#define U8X8_MSG_GPIO_CS U8X8_MSG_GPIO(U8X8_PIN_CS)
#define U8X8_MSG_GPIO_DC U8X8_MSG_GPIO(U8X8_PIN_DC)
#define U8X8_MSG_GPIO_RESET U8X8_MSG_GPIO(U8X8_PIN_RESET)
#define U8X8_MSG_GPIO_D0 U8X8_MSG_GPIO(U8X8_PIN_D0)
#define U8X8_MSG_GPIO_SPI_CLOCK U8X8_MSG_GPIO(U8X8_PIN_SPI_CLOCK)
#define U8X8_MSG_GPIO_D1 U8X8_MSG_GPIO(U8X8_PIN_D1)
#define U8X8_MSG_GPIO_SPI_DATA U8X8_MSG_GPIO(U8X8_PIN_SPI_DATA)
#define U8X8_MSG_GPIO_D2 U8X8_MSG_GPIO(U8X8_PIN_D2)
#define U8X8_MSG_GPIO_D3 U8X8_MSG_GPIO(U8X8_PIN_D3)
#define U8X8_MSG_GPIO_D4 U8X8_MSG_GPIO(U8X8_PIN_D4)
#define U8X8_MSG_GPIO_D5 U8X8_MSG_GPIO(U8X8_PIN_D5)
#define U8X8_MSG_GPIO_D6 U8X8_MSG_GPIO(U8X8_PIN_D6)
#define U8X8_MSG_GPIO_D7 U8X8_MSG_GPIO(U8X8_PIN_D7)
#define U8X8_MSG_GPIO_E U8X8_MSG_GPIO(U8X8_PIN_E)
#define U8X8_MSG_GPIO_CS U8X8_MSG_GPIO(U8X8_PIN_CS)
#define U8X8_MSG_GPIO_DC U8X8_MSG_GPIO(U8X8_PIN_DC)
#define U8X8_MSG_GPIO_RESET U8X8_MSG_GPIO(U8X8_PIN_RESET)
#define U8X8_MSG_GPIO_I2C_CLOCK U8X8_MSG_GPIO(U8X8_PIN_I2C_CLOCK)
#define U8X8_MSG_GPIO_I2C_DATA U8X8_MSG_GPIO(U8X8_PIN_I2C_DATA)
#define u8x8_gpio_Init(u8x8) ((u8x8)->gpio_and_delay_cb((u8x8), U8X8_MSG_GPIO_AND_DELAY_INIT, 0, NULL ))
@ -474,8 +480,10 @@ uint8_t u8x8_byte_ssd13xx_sw_i2c(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, voi
#define u8x8_gpio_SetDC(u8x8, v) u8x8_gpio_call(u8x8, U8X8_MSG_GPIO_DC, (v))
#define u8x8_gpio_SetCS(u8x8, v) u8x8_gpio_call(u8x8, U8X8_MSG_GPIO_CS, (v))
#define u8x8_gpio_SetReset(u8x8, v) u8x8_gpio_call(u8x8, U8X8_MSG_GPIO_RESET, (v))
#define u8x8_gpio_SetClock(u8x8, v) u8x8_gpio_call(u8x8, U8X8_MSG_GPIO_CLOCK, (v))
#define u8x8_gpio_SetData(u8x8, v) u8x8_gpio_call(u8x8, U8X8_MSG_GPIO_DATA, (v))
#define u8x8_gpio_SetSPIClock(u8x8, v) u8x8_gpio_call(u8x8, U8X8_MSG_GPIO_SPI_CLOCK, (v))
#define u8x8_gpio_SetSPIData(u8x8, v) u8x8_gpio_call(u8x8, U8X8_MSG_GPIO_SPI_DATA, (v))
#define u8x8_gpio_SetI2CClock(u8x8, v) u8x8_gpio_call(u8x8, U8X8_MSG_GPIO_I2C_CLOCK, (v))
#define u8x8_gpio_SetI2CData(u8x8, v) u8x8_gpio_call(u8x8, U8X8_MSG_GPIO_I2C_DATA, (v))
void u8x8_gpio_call(u8x8_t *u8x8, uint8_t msg, uint8_t arg) U8X8_NOINLINE;

View File

@ -66,14 +66,14 @@ uint8_t u8x8_byte_8bit_sw_spi(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *
for( i = 0; i < 8; i++ )
{
if ( b & 128 )
u8x8_gpio_SetData(u8x8, 1);
u8x8_gpio_SetSPIData(u8x8, 1);
else
u8x8_gpio_SetData(u8x8, 0);
u8x8_gpio_SetSPIData(u8x8, 0);
b <<= 1;
u8x8_gpio_SetClock(u8x8, not_takeover_edge);
u8x8_gpio_SetSPIClock(u8x8, not_takeover_edge);
u8x8_gpio_Delay(u8x8, U8X8_MSG_DELAY_NANO, u8x8->display_info->sda_setup_time_ns);
u8x8_gpio_SetClock(u8x8, takeover_edge);
u8x8_gpio_SetSPIClock(u8x8, takeover_edge);
u8x8_gpio_Delay(u8x8, U8X8_MSG_DELAY_NANO, u8x8->display_info->sck_pulse_width_ns);
}
}
@ -85,7 +85,7 @@ uint8_t u8x8_byte_8bit_sw_spi(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *
/* no wait required here */
/* for SPI: setup correct level of the clock signal */
u8x8_gpio_SetClock(u8x8, u8x8->display_info->sck_takeover_edge);
u8x8_gpio_SetSPIClock(u8x8, u8x8->display_info->sck_takeover_edge);
break;
case U8X8_MSG_BYTE_SET_DC:
u8x8_gpio_SetDC(u8x8, arg_int);
@ -125,8 +125,8 @@ static void i2c_delay(u8x8_t *u8x8)
static void i2c_init(u8x8_t *u8x8)
{
u8x8_gpio_SetClock(u8x8, 1);
u8x8_gpio_SetData(u8x8, 1);
u8x8_gpio_SetI2CClock(u8x8, 1);
u8x8_gpio_SetI2CData(u8x8, 1);
i2c_delay(u8x8);
}
@ -136,26 +136,26 @@ static void i2c_init(u8x8_t *u8x8)
static void i2c_read_scl_and_delay(u8x8_t *u8x8)
{
/* set as input (line will be high) */
u8x8_gpio_SetClock(u8x8, 1);
u8x8_gpio_SetI2CClock(u8x8, 1);
i2c_delay(u8x8);
}
static void i2c_clear_scl(u8x8_t *u8x8)
{
u8x8_gpio_SetClock(u8x8, 0);
u8x8_gpio_SetI2CClock(u8x8, 0);
}
static void i2c_read_sda(u8x8_t *u8x8)
{
/* set as input (line will be high) */
u8x8_gpio_SetData(u8x8, 1);
u8x8_gpio_SetI2CData(u8x8, 1);
}
static void i2c_clear_sda(u8x8_t *u8x8)
{
/* set open collector and drive low */
u8x8_gpio_SetData(u8x8, 0);
u8x8_gpio_SetI2CData(u8x8, 0);
}
static void i2c_start(u8x8_t *u8x8)

View File

@ -115,9 +115,9 @@ u8x8_SetPin(u8x8,pin,val)
values for "pin":
U8X8_PIN_D0
U8X8_PIN_CLOCK
U8X8_PIN_SPI_CLOCK
U8X8_PIN_D1
U8X8_PIN_DATA
U8X8_PIN_SPI_DATA
U8X8_PIN_D2
U8X8_PIN_D3
U8X8_PIN_D4
@ -144,8 +144,8 @@ void u8x8_Setup_SW_4Wire_SPI(u8x8_t *u8x8, u8x8_msg_cb display_cb, uint8_t clock
u8x8_SetupDefaults(u8x8);
/* assign individual pin values (only for ARDUINO, if pin_list is available) */
u8x8_SetPin(u8x8, U8X8_PIN_CLOCK, clock);
u8x8_SetPin(u8x8, U8X8_PIN_DATA, data);
u8x8_SetPin(u8x8, U8X8_PIN_SPI_CLOCK, clock);
u8x8_SetPin(u8x8, U8X8_PIN_SPI_DATA, data);
u8x8_SetPin(u8x8, U8X8_PIN_CS, cs);
u8x8_SetPin(u8x8, U8X8_PIN_DC, dc);
u8x8_SetPin(u8x8, U8X8_PIN_RESET, reset);
@ -190,8 +190,8 @@ void u8x8_Setup_SW_SSD13xx_I2C(u8x8_t *u8x8, u8x8_msg_cb display_cb, uint8_t clo
u8x8_SetupDefaults(u8x8);
/* assign individual pin values (only for ARDUINO, if pin_list is available) */
u8x8_SetPin(u8x8, U8X8_PIN_CLOCK, clock);
u8x8_SetPin(u8x8, U8X8_PIN_DATA, data);
u8x8_SetPin(u8x8, U8X8_PIN_I2C_CLOCK, clock);
u8x8_SetPin(u8x8, U8X8_PIN_I2C_DATA, data);
u8x8_SetPin(u8x8, U8X8_PIN_RESET, reset);
/* setup specific callbacks */
@ -222,8 +222,8 @@ void setup(void)
digitalWrite(10, 0); // default output in I2C mode for the SSD1306 test shield
//u8x8_Setup_SW_4Wire_SPI(&u8x8, u8x8_d_ssd1306_128x64_noname, 13, 11, 10, 9, 8);
u8x8_Setup_HW_4Wire_SPI(&u8x8, u8x8_d_ssd1306_128x64_noname, 10, 9, 8);
//u8x8_Setup_SW_SSD13xx_I2C(&u8x8, u8x8_d_ssd1306_128x64_noname, 13, 11, 8);
//u8x8_Setup_HW_4Wire_SPI(&u8x8, u8x8_d_ssd1306_128x64_noname, 10, 9, 8);
u8x8_Setup_SW_SSD13xx_I2C(&u8x8, u8x8_d_ssd1306_128x64_noname, 13, 11, 8);
//u8x8_Setup_SW_4Wire_SPI(&u8x8, u8x8_d_uc1701_dogs102, 13, 11, 10, 9, 8);
//u8x8_Setup_HW_4Wire_SPI(&u8x8, u8x8_d_uc1701_dogs102, 10, 9, 8);

View File

@ -0,0 +1,55 @@
This page contains fonts from http://zone38.net/font/.
# Press Start 2P
## Reference
http://zone38.net/font/
## Copyright
Copyright (c) 2011, Cody "CodeMan38" Boisclair (cody@zone38.net),
with Reserved Font Name "Press Start".
This Font Software is licensed under the SIL Open Font License, Version 1.1.
http://scripts.sil.org/OFL
# PC Senior
## Reference
http://zone38.net/font/
## Copyright (from zip file)
Thanks for downloading one of codeman38's retro video game fonts, as seen on Memepool, BoingBoing, and all around the blogosphere.
So, you're wondering what the license is for these fonts? Pretty simple; it's based upon that used for Bitstream's Vera font set <http://www.gno
me.org/fonts/>.
Basically, here are the key points summarized, in as little legalese as possible; I hate reading license agreements as much as you probably do:
With one specific exception, you have full permission to bundle these fonts in your own free or commercial projects-- and by projects, I'm refer
ring to not just software but also electronic documents and print publications.
So what's the exception? Simple: you can't re-sell these fonts in a commercial font collection. I've seen too many font CDs for sale in stores t
hat are just a repackaging of thousands of freeware fonts found on the internet, and in my mind, that's quite a bit like highway robbery. Note t
hat this *only* applies to products that are font collections in and of themselves; you may freely bundle these fonts with an operating system,
application program, or the like.
Feel free to modify these fonts and even to release the modified versions, as long as you change the original font names (to ensure consistency
among people with the font installed) and as long as you give credit somewhere in the font file to codeman38 or zone38.net. I may even incorpora
te these changes into a later version of my fonts if you wish to send me the modifed fonts via e-mail.
Also, feel free to mirror these fonts on your own site, as long as you make it reasonably clear that these fonts are not your own work. I'm not
asking for much; linking to zone38.net or even just mentioning the nickname codeman38 should be enough.
Well, that pretty much sums it up... so without further ado, install and enjoy these fonts from the golden age of video games.
# Font Pictures