Advertisement
Guest User

Untitled

a guest
Sep 8th, 2023
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 54.49 KB | None | 0 0
  1. /* ************************************************************************
  2. *
  3. * ATmega 328 specific global configuration, setup and settings
  4. *
  5. * (c) 2012-2023 by Markus Reschke
  6. * based on code from Markus Frejek and Karl-Heinz Kübbeler
  7. *
  8. * ************************************************************************ */
  9.  
  10.  
  11. /* source management */
  12. #define CONFIG_328_H
  13.  
  14.  
  15.  
  16. /* ************************************************************************
  17. * display module
  18. * ************************************************************************ */
  19.  
  20.  
  21. /*
  22. * display module / controller
  23. *
  24. * Please uncomment the package matching your LCD/OLED module and adjust
  25. * settings. And comment out the default package (ST7565R, bit-bang SPI)
  26. * if not used.
  27. *
  28. * To uncomment, remove the enclosing "#if 0" and "#endif" or put
  29. * a "//" in front of both. To comment out, remove the "//" in front
  30. * of the "#if 0" and "#endif".
  31. *
  32. * Individual settings can be enabled by removing the leading "//", or
  33. * disabled by placing a "//" in front of the setting.
  34. */
  35.  
  36.  
  37. /*
  38. * HD44780
  39. * - 4 bit parallel interface
  40. * - if you change LCD_DB4/5/6/7 comment out LCD_DB_STD!
  41. */
  42.  
  43. #if 0
  44. #define LCD_HD44780 /* display controller HD44780 */
  45. #define LCD_TEXT /* character display */
  46. #define LCD_PAR_4 /* 4 bit parallel interface */
  47. /* control and data lines */
  48. #define LCD_PORT PORTD /* port data register */
  49. #define LCD_DDR DDRD /* port data direction register */
  50. #define LCD_DB_STD /* use standard pins 0-3 for DB4-7 */
  51. #define LCD_DB4 PD0 /* port pin used for DB4 */
  52. #define LCD_DB5 PD1 /* port pin used for DB5 */
  53. #define LCD_DB6 PD2 /* port pin used for DB6 */
  54. #define LCD_DB7 PD3 /* port pin used for DB7 */
  55. #define LCD_RS PD4 /* port pin used for RS */
  56. #define LCD_EN1 PD5 /* port pin used for E */
  57. /* display settings */
  58. #define LCD_CHAR_X 16 /* characters per line */
  59. #define LCD_CHAR_Y 2 /* number of lines */
  60. /* HD44780 has an internal 5x7 font */
  61. #define FONT_HD44780_INT /* International font (English) */
  62. //#define FONT_HD44780_WIN1251 /* Cyrillic font (European) */
  63. #endif
  64.  
  65.  
  66.  
  67. /*
  68. * HD44780 plus PCF8574 based backpack
  69. * - I2C interface using bit-bang I2C
  70. * - if you change LCD_DB4/5/6/7 comment out LCD_DB_STD!
  71. * - PCF8574T is 0x27, PCF8574AT is 0x3f
  72. */
  73.  
  74. #if 0
  75. #define LCD_HD44780 /* display controller HD44780 */
  76. #define LCD_TEXT /* character display */
  77. #define LCD_PCF8574 /* PCF8574 backpack */
  78. #define LCD_I2C_ADDR 0x3f /* PCF8574's I2C address */
  79. /* control and data lines */
  80. #define LCD_DB_STD /* use standard pins 4-7 for DB4-7 */
  81. #define LCD_DB4 PCF8574_P4 /* port pin used for DB4 */
  82. #define LCD_DB5 PCF8574_P5 /* port pin used for DB5 */
  83. #define LCD_DB6 PCF8574_P6 /* port pin used for DB6 */
  84. #define LCD_DB7 PCF8574_P7 /* port pin used for DB7 */
  85. #define LCD_RS PCF8574_P0 /* port pin used for RS */
  86. #define LCD_RW PCF8574_P1 /* port pin used for RW */
  87. #define LCD_EN1 PCF8574_P2 /* port pin used for E */
  88. #define LCD_LED PCF8574_P3 /* port pin used for backlight */
  89. /* display settings */
  90. #define LCD_CHAR_X 16 /* characters per line */
  91. #define LCD_CHAR_Y 2 /* number of lines */
  92. //#define LCD_BACKLIGHT_LOW /* backlight is low active */
  93. /* HD44780 has an internal 5x7 font */
  94. #define FONT_HD44780_INT /* International font (English) */
  95. //#define FONT_HD44780_WIN1251 /* Cyrillic font (European) */
  96. /* I2C bus */
  97. #define I2C_BITBANG /* bit-bang I2C */
  98. #define I2C_STANDARD_MODE /* 100kHz bus speed */
  99. #define I2C_PORT PORTD /* I2C port data register */
  100. #define I2C_DDR DDRD /* I2C port data direction register */
  101. #define I2C_PIN PIND /* I2C port input pins register */
  102. #define I2C_SDA PD0 /* port pin used for SDA */
  103. #define I2C_SCL PD1 /* port pin used for SCL */
  104. #endif
  105.  
  106.  
  107.  
  108. /*
  109. * ILI9163
  110. * - 4 wire SPI interface using bit-bang SPI
  111. */
  112.  
  113. #if 0
  114. #define LCD_ILI9163 /* display controller ILI9163 */
  115. #define LCD_GRAPHIC /* graphic display */
  116. #define LCD_COLOR /* color display */
  117. #define LCD_SPI /* SPI interface */
  118. /* control and data lines */
  119. #define LCD_PORT PORTD /* port data register */
  120. #define LCD_DDR DDRD /* port data direction register */
  121. #define LCD_RES PD4 /* port pin used for /RESX (optional) */
  122. #define LCD_CS PD5 /* port pin used for /CSX (optional) */
  123. #define LCD_DC PD3 /* port pin used for D/CX */
  124. #define LCD_SCL PD2 /* port pin used for SCL */
  125. #define LCD_SDA PD1 /* port pin used for SDA/SDIO */
  126. /* display settings */
  127. #define LCD_DOTS_X 128 /* number of horizontal dots */
  128. #define LCD_DOTS_Y 128 /* number of vertical dots */
  129. #define LCD_OFFSET_X 32 /* x offset of 32 dots (160-128) */
  130. //#define LCD_FLIP_X /* enable horizontal flip */
  131. #define LCD_FLIP_Y /* enable vertical flip */
  132. #define LCD_ROTATE /* switch X and Y (rotate by 90°) */
  133. #define LCD_BGR /* reverse red and blue color channels */
  134. //#define LCD_LATE_ON /* turn on LCD after clearing it */
  135. /* font and symbols: horizonally aligned & flipped */
  136. #define FONT_8X8_HF /* 8x8 font */
  137. //#define FONT_10X16_HF /* 10x16 font */
  138. //#define FONT_8X8_ISO8859_2_HF /* 8x8 Central European font */
  139. //#define FONT_8X12T_ISO8859_2_HF /* thin 8x12 Central European font */
  140. //#define FONT_8X16_ISO8859_2_HF /* 8x16 Central European font */
  141. //#define FONT_10X16_ISO8859_2_HF /* 10x16 Central European font */
  142. //#define FONT_8X16_WIN1251_HF /* 8x16 cyrillic font */
  143. //#define FONT_8X16ALT_WIN1251_HF /* 8x16 alternative cyrillic font */
  144. #define SYMBOLS_30X32_HF /* 30x32 symbols */
  145. //#define SYMBOLS_30X32_ALT1_HF /* 30x32 alternative symbols #1 */
  146. //#define SYMBOLS_30X32_ALT2_HF /* 30x32 alternative symbols #2 */
  147. //#define SYMBOLS_32X32_HF /* 32x32 symbols */
  148. //#define SYMBOLS_32X32_ALT1_HF /* 32x32 alternative symbols #1 */
  149. //#define SYMBOLS_32X32_ALT2_HF /* 32x32 alternative symbols #2 */
  150. /* SPI bus */
  151. #define SPI_BITBANG /* bit-bang SPI */
  152. #define SPI_PORT LCD_PORT /* SPI port data register */
  153. #define SPI_DDR LCD_DDR /* SPI port data direction register */
  154. #define SPI_SCK LCD_SCL /* port pin used for SCK */
  155. #define SPI_MOSI LCD_SDA /* port pin used for MOSI */
  156. #endif
  157.  
  158.  
  159.  
  160. /*
  161. * ILI9342
  162. * - SPI interface using bit-bang SPI
  163. */
  164.  
  165. #if 0
  166. #define LCD_ILI9341 /* display controller ILI9341/ILI9342 */
  167. #define LCD_GRAPHIC /* graphic display */
  168. #define LCD_COLOR /* color display */
  169. #define LCD_SPI /* SPI interface */
  170. /* control and data lines */
  171. #define LCD_PORT PORTD /* port data register */
  172. #define LCD_DDR DDRD /* port data direction register */
  173. #define LCD_RES PD4 /* port pin used for /RES (optional) */
  174. #define LCD_CS PD5 /* port pin used for /CS (optional) */
  175. #define LCD_DC PD3 /* port pin used for D/C */
  176. #define LCD_SCK PD2 /* port pin used for SCK */
  177. #define LCD_SDI PD1 /* port pin used for SDI (data input) */
  178. //#define LCD_SDO PD0 /* port pin used for SDO (data output) */
  179. /* display settings */
  180. #define LCD_DOTS_X 320 /* number of horizontal dots */
  181. #define LCD_DOTS_Y 240 /* number of vertical dots */
  182. //#define LCD_FLIP_X /* enable horizontal flip */
  183. //#define LCD_FLIP_Y /* enable vertical flip */
  184. //#define LCD_ROTATE /* switch X and Y (rotate by 90°) */
  185. //#define LCD_BGR /* reverse red and blue color channels */
  186. //#define LCD_EXT_CMD_OFF /* extended commands disabled */
  187. /* font and symbols: horizontally aligned & flipped */
  188. #define FONT_16X26_HF /* 16x26 font */
  189. //#define FONT_16X26_ISO8859_2_HF /* 16x26 Central European font */
  190. //#define FONT_16X26_WIN1251_HF /* 16x26 cyrillic font */
  191. //#define SYMBOLS_32X32_HF /* 32x32 symbols */
  192. //#define SYMBOLS_32X32_ALT1_HF /* 32x32 alternative symbols #1 */
  193. //#define SYMBOLS_32X32_ALT2_HF /* 32x32 alternative symbols #2 */
  194. #define SYMBOLS_32X39_HF /* 32x39 symbols */
  195. /* SPI bus */
  196. #define SPI_BITBANG /* bit-bang SPI */
  197. #define SPI_PORT LCD_PORT /* SPI port data register */
  198. #define SPI_DDR LCD_DDR /* SPI port data direction register */
  199. #define SPI_SCK LCD_SCK /* port pin used for SCK */
  200. #define SPI_MOSI LCD_SDI /* port pin used for MOSI */
  201. #endif
  202.  
  203.  
  204.  
  205. /*
  206. * PCD8544
  207. * - SPI interface using bit-bang SPI
  208. * - for a 180° rotated display (LCD_ROT180)
  209. * - comment out "_VF" font and "_VFP" symbols
  210. * - uncomment "_V_F" font and "_VP_F" symbols
  211. */
  212.  
  213. #if 0
  214. #define LCD_PCD8544 /* display controller PCD8544 */
  215. #define LCD_GRAPHIC /* graphic display */
  216. #define LCD_SPI /* SPI interface */
  217. /* control and data lines */
  218. #define LCD_PORT PORTD /* port data register */
  219. #define LCD_DDR DDRD /* port data direction register */
  220. #define LCD_RES PD4 /* port pin used for /RES (optional) */
  221. #define LCD_SCE PD5 /* port pin used for /SCE (optional) */
  222. #define LCD_DC PD3 /* port pin used for D/C */
  223. #define LCD_SCLK PD2 /* port pin used for SCLK */
  224. #define LCD_SDIN PD1 /* port pin used for SDIN (data input) */
  225. /* display settings */
  226. #define LCD_DOTS_X 84 /* number of horizontal dots */
  227. #define LCD_DOTS_Y 48 /* number of vertical dots */
  228. #define LCD_CONTRAST 66 /* default contrast (1-127) */
  229. /* font and symbols: vertically aligned & flipped */
  230. #define FONT_6X8_VF /* 6x8 font */
  231. //#define FONT_6X8_ISO8859_2_VF /* 6x8 Central Euopean font */
  232. #define SYMBOLS_24X24_VFP /* 24x24 symbols */
  233. //#define SYMBOLS_24X24_ALT1_VFP /* 24x24 alternative symbols #1 */
  234. //#define SYMBOLS_24X24_ALT2_VFP /* 24x24 alternative symbols #2 */
  235. //#define LCD_ROT180 /* rotate output by 180° (not supported yet) */
  236. /* font and symbols: vertically aligned, bank-wise grouping, hor. flipped */
  237. //#define FONT_6X8_V_F /* 6x8 font */
  238. //#define FONT_6X8_ISO8859_2_V_F /* 6x8 Central Euopean font */
  239. //#define SYMBOLS_24X24_VP_F /* 24x24 symbols */
  240. //#define SYMBOLS_24X24_ALT1_VP_F /* 24x24 alternative symbols #1 */
  241. //#define SYMBOLS_24X24_ALT2_VP_F /* 24x24 alternative symbols #2 */
  242. /* SPI bus */
  243. #define SPI_BITBANG /* bit-bang SPI */
  244. #define SPI_PORT LCD_PORT /* SPI port data register */
  245. #define SPI_DDR LCD_DDR /* SPI port data direction register */
  246. #define SPI_SCK LCD_SCLK /* port pin used for SCK */
  247. #define SPI_MOSI LCD_SDIN /* port pin used for MOSI */
  248. #endif
  249.  
  250.  
  251.  
  252. /*
  253. * PCF8814
  254. * - 3 wire SPI interface using bit-bang SPI
  255. */
  256.  
  257. #if 0
  258. #define LCD_PCF8814 /* display controller PCF8814 */
  259. #define LCD_GRAPHIC /* graphic display */
  260. #define LCD_SPI /* SPI interface */
  261. /* control and data lines */
  262. #define LCD_PORT PORTD /* port data register */
  263. #define LCD_DDR DDRD /* port data direction register */
  264. #define LCD_RESET PD4 /* port pin used for /RES */
  265. #define LCD_CS PD5 /* port pin used for /CS (optional) */
  266. #define LCD_SCLK PD2 /* port pin used for SCLK */
  267. #define LCD_SDIN PD1 /* port pin used for SDIN (data input) */
  268. /* display settings */
  269. #define LCD_DOTS_X 96 /* number of horizontal dots */
  270. #define LCD_DOTS_Y 65 /* number of vertical dots */
  271. //#define LCD_FLIP_Y /* enable vertical flip */
  272. #define LCD_CONTRAST 5 /* default contrast (0-255) */
  273. /* font and symbols: vertically aligned & flipped, page-wise grouping */
  274. #define FONT_6X8_VF /* 6x8 font */
  275. //#define FONT_6X8_ISO8859_2_VF /* 6x8 Central European font */
  276. #define SYMBOLS_24X24_VFP /* 24x24 symbols */
  277. //#define SYMBOLS_24X24_ALT1_VFP /* 24x24 alternative symbols #1 */
  278. //#define SYMBOLS_24X24_ALT2_VFP /* 24x24 alternative symbols #2 */
  279. /* SPI bus */
  280. #define SPI_BITBANG /* bit-bang SPI */
  281. #define SPI_9 /* support 9 bit frames */
  282. #define SPI_PORT LCD_PORT /* SPI port data register */
  283. #define SPI_DDR LCD_DDR /* SPI port data direction register */
  284. #define SPI_SCK LCD_SCLK /* port pin used for SCK */
  285. #define SPI_MOSI LCD_SDIN /* port pin used for MOSI */
  286. #endif
  287.  
  288.  
  289.  
  290. /*
  291. * SH1106
  292. * - 4 wire SPI interface using bit-bang SPI
  293. * - untested
  294. */
  295.  
  296. #if 0
  297. #define LCD_SH1106 /* display controller SH1106 */
  298. #define LCD_GRAPHIC /* graphic display */
  299. #define LCD_SPI /* SPI interface */
  300. /* control and data lines */
  301. #define LCD_PORT PORTD /* port data register */
  302. #define LCD_DDR DDRD /* port data direction register */
  303. #define LCD_RESET PD4 /* port pin used for /RES (optional) */
  304. #define LCD_CS PD5 /* port pin used for /CS (optional) */
  305. #define LCD_A0 PD3 /* port pin used for A0 */
  306. #define LCD_SCL PD2 /* port pin used for SCL */
  307. #define LCD_SI PD1 /* port pin used for SI (data input) */
  308. /* display settings */
  309. #define LCD_DOTS_X 128 /* number of horizontal dots */
  310. #define LCD_DOTS_Y 64 /* number of vertical dots */
  311. #define LCD_OFFSET_X 2 /* enable x offset of 2 or 4 dots */
  312. #define LCD_FLIP_X /* enable horizontal flip */
  313. #define LCD_FLIP_Y /* enable vertical flip */
  314. //#define LCD_COM_SEQ /* COM pin layout: sequential */
  315. #define LCD_CONTRAST 127 /* default contrast (0-255) */
  316. /* font and symbols: vertically aligned & flipped, bank-wise grouping */
  317. //#define FONT_6X8_VF /* 6x8 font */
  318. #define FONT_8X8_VF /* 8x8 font */
  319. //#define FONT_8X16_VFP /* 8x16 font */
  320. //#define FONT_6X8_ISO8859_2_VF /* 6x8 Central European font */
  321. //#define FONT_8X8_ISO8859_2_VF /* 8x8 Central European font */
  322. //#define FONT_8X12T_ISO8859_2_VFP /* thin 8x12 Central European font */
  323. //#define FONT_8X16_ISO8859_2_VFP /* 8x16 Central European font */
  324. //#define FONT_8X8_WIN1251_VF /* 8x8 cyrillic font */
  325. //#define FONT_8X8ALT_WIN1251_VF /* 8x8 alternative cyrillic font */
  326. //#define FONT_8X8T_WIN1251_VF /* thin 8x8 cyrillic font */
  327. //#define FONT_8X12T_WIN1251_VFP /* thin 8x12 cyrillic font */
  328. //#define FONT_8X16_WIN1251_VFP /* 8x16 cyrillic font */
  329. #define SYMBOLS_24X24_VFP /* 24x24 symbols */
  330. //#define SYMBOLS_24X24_ALT1_VFP /* 24x24 alternative symbols #1 */
  331. //#define SYMBOLS_24X24_ALT2_VFP /* 24x24 alternative symbols #2 */
  332. /* SPI bus */
  333. #define SPI_BITBANG /* bit-bang SPI */
  334. #define SPI_PORT LCD_PORT /* SPI port data register */
  335. #define SPI_DDR LCD_DDR /* SPI port data direction register */
  336. #define SPI_SCK LCD_SCL /* port pin used for SCK */
  337. #define SPI_MOSI LCD_SI /* port pin used for MOSI */
  338. #endif
  339.  
  340.  
  341.  
  342. /*
  343. * SH1106
  344. * - 3 wire SPI interface using bit-bang SPI
  345. * - untested
  346. */
  347.  
  348. #if 0
  349. #define LCD_SH1106 /* display controller SH1106 */
  350. #define LCD_GRAPHIC /* graphic display */
  351. #define LCD_SPI /* SPI interface */
  352. /* control and data lines */
  353. #define LCD_PORT PORTD /* port data register */
  354. #define LCD_DDR DDRD /* port data direction register */
  355. #define LCD_RESET PD4 /* port pin used for /RES (optional) */
  356. #define LCD_CS PD5 /* port pin used for /CS (optional) */
  357. #define LCD_SCL PD2 /* port pin used for SCL */
  358. #define LCD_SI PD1 /* port pin used for SI (data input) */
  359. /* display settings */
  360. #define LCD_DOTS_X 128 /* number of horizontal dots */
  361. #define LCD_DOTS_Y 64 /* number of vertical dots */
  362. #define LCD_OFFSET_X 2 /* enable x offset of 2 or 4 dots */
  363. #define LCD_FLIP_X /* enable horizontal flip */
  364. #define LCD_FLIP_Y /* enable vertical flip */
  365. //#define LCD_COM_SEQ /* COM pin layout: sequential */
  366. #define LCD_CONTRAST 127 /* default contrast (0-255) */
  367. /* font and symbols: vertically aligned & flipped, bank-wise grouping */
  368. #define FONT_8X8_VF /* 8x8 font */
  369. #define SYMBOLS_24X24_VFP /* 24x24 symbols */
  370. //#define SYMBOLS_24X24_ALT1_VFP /* 24x24 alternative symbols #1 */
  371. //#define SYMBOLS_24X24_ALT2_VFP /* 24x24 alternative symbols #2 */
  372. /* SPI bus */
  373. #define SPI_BITBANG /* bit-bang SPI */
  374. #define SPI_9 /* support 9 bit frames */
  375. #define SPI_PORT LCD_PORT /* SPI port data register */
  376. #define SPI_DDR LCD_DDR /* SPI port data direction register */
  377. #define SPI_SCK LCD_SCL /* port pin used for SCK */
  378. #define SPI_MOSI LCD_SI /* port pin used for MOSI */
  379. #endif
  380.  
  381.  
  382.  
  383. /*
  384. * SH1106
  385. * - I2C interface using bit-bang I2C
  386. */
  387.  
  388. #if 0
  389. #define LCD_SH1106 /* display controller SH1106 */
  390. #define LCD_GRAPHIC /* graphic display */
  391. #define LCD_I2C /* I2C interface */
  392. #define LCD_I2C_ADDR 0x3c /* SH1106's I2C address */
  393. /* control lines */
  394. #define LCD_PORT PORTD /* port data register */
  395. #define LCD_DDR DDRD /* port data direction register */
  396. //#define LCD_RESET PD4 /* port pin used for /RES (optional) */
  397. /* display settings */
  398. #define LCD_DOTS_X 128 /* number of horizontal dots */
  399. #define LCD_DOTS_Y 64 /* number of vertical dots */
  400. #define LCD_OFFSET_X 2 /* enable x offset of 2 or 4 dots */
  401. #define LCD_FLIP_X /* enable horizontal flip */
  402. #define LCD_FLIP_Y /* enable vertical flip */
  403. //#define LCD_COM_SEQ /* COM pin layout: sequential */
  404. #define LCD_CONTRAST 127 /* default contrast (0-255) */
  405. /* font and symbols: vertically aligned & flipped, bank-wise grouping */
  406. #define FONT_8X8_VF /* 8x8 font */
  407. #define SYMBOLS_24X24_VFP /* 24x24 symbols */
  408. //#define SYMBOLS_24X24_ALT1_VFP /* 24x24 alternative symbols #1 */
  409. //#define SYMBOLS_24X24_ALT2_VFP /* 24x24 alternative symbols #2 */
  410. /* I2C bus */
  411. #define I2C_BITBANG /* bit-bang I2C */
  412. #define I2C_FAST_MODE /* 400kHz bus speed */
  413. #define I2C_PORT PORTD /* I2C port data register */
  414. #define I2C_DDR DDRD /* I2C port data direction register */
  415. #define I2C_PIN PIND /* I2C port input pins register */
  416. #define I2C_SDA PD0 /* port pin used for SDA */
  417. #define I2C_SCL PD1 /* port pin used for SCL */
  418. #endif
  419.  
  420.  
  421.  
  422. /*
  423. * SSD1306
  424. * - 4 wire SPI interface using bit-bang SPI
  425. */
  426.  
  427. #if 0
  428. #define LCD_SSD1306 /* display controller SSD1306 */
  429. #define LCD_GRAPHIC /* graphic display */
  430. #define LCD_SPI /* SPI interface */
  431. /* control and data lines */
  432. #define LCD_PORT PORTD /* port data register */
  433. #define LCD_DDR DDRD /* port data direction register */
  434. #define LCD_RESET PD4 /* port pin used for /RES (optional) */
  435. #define LCD_CS PD5 /* port pin used for /CS (optional) */
  436. #define LCD_DC PD3 /* port pin used for D/C */
  437. #define LCD_SCLK PD2 /* port pin used for SCLK */
  438. #define LCD_SDIN PD1 /* port pin used for SDIN (data input) */
  439. /* display settings */
  440. #define LCD_DOTS_X 128 /* number of horizontal dots */
  441. #define LCD_DOTS_Y 64 /* number of vertical dots */
  442. #define LCD_FLIP_X /* enable horizontal flip */
  443. #define LCD_FLIP_Y /* enable vertical flip */
  444. //#define LCD_COM_SEQ /* COM pin layout: sequential */
  445. //#define LCD_COM_REMAP /* COM pin mapping: reversed */
  446. #define LCD_CONTRAST 127 /* default contrast (0-255) */
  447. /* font and symbols: vertically aligned & flipped, bank-wise grouping */
  448. //#define FONT_6X8_VF /* 6x8 font */
  449. #define FONT_8X8_VF /* 8x8 font */
  450. //#define FONT_8X16_VFP /* 8x16 font */
  451. //#define FONT_6X8_ISO8859_2_VF /* 6x8 Central European font */
  452. //#define FONT_8X8_ISO8859_2_VF /* 8x8 Central European font */
  453. //#define FONT_8X12T_ISO8859_2_VFP /* thin 8x12 Central European font */
  454. //#define FONT_8X16_ISO8859_2_VFP /* 8x16 Central European font */
  455. //#define FONT_8X8_WIN1251_VF /* 8x8 cyrillic font */
  456. //#define FONT_8X8ALT_WIN1251_VF /* 8x8 alternative cyrillic font */
  457. //#define FONT_8X8T_WIN1251_VF /* thin 8x8 cyrillic font */
  458. //#define FONT_8X12T_WIN1251_VFP /* thin 8x12 cyrillic font */
  459. //#define FONT_8X16_WIN1251_VFP /* 8x16 cyrillic font */
  460. #define SYMBOLS_24X24_VFP /* 24x24 symbols */
  461. //#define SYMBOLS_24X24_ALT1_VFP /* 24x24 alternative symbols #1 */
  462. //#define SYMBOLS_24X24_ALT2_VFP /* 24x24 alternative symbols #2 */
  463. /* SPI bus */
  464. #define SPI_BITBANG /* bit-bang SPI */
  465. #define SPI_PORT LCD_PORT /* SPI port data register */
  466. #define SPI_DDR LCD_DDR /* SPI port data direction register */
  467. #define SPI_SCK LCD_SCLK /* port pin used for SCK */
  468. #define SPI_MOSI LCD_SDIN /* port pin used for MOSI */
  469. #endif
  470.  
  471.  
  472.  
  473. /*
  474. * SSD1306
  475. * - 3 wire SPI interface using bit-bang SPI
  476. */
  477.  
  478. #if 0
  479. #define LCD_SSD1306 /* display controller SSD1306 */
  480. #define LCD_GRAPHIC /* graphic display */
  481. #define LCD_SPI /* SPI interface */
  482. /* control and data lines */
  483. #define LCD_PORT PORTD /* port data register */
  484. #define LCD_DDR DDRD /* port data direction register */
  485. #define LCD_RESET PD4 /* port pin used for /RES (optional) */
  486. #define LCD_CS PD5 /* port pin used for /CS (optional) */
  487. #define LCD_SCLK PD2 /* port pin used for SCLK */
  488. #define LCD_SDIN PD1 /* port pin used for SDIN (data input) */
  489. /* display settings */
  490. #define LCD_DOTS_X 128 /* number of horizontal dots */
  491. #define LCD_DOTS_Y 64 /* number of vertical dots */
  492. #define LCD_FLIP_X /* enable horizontal flip */
  493. #define LCD_FLIP_Y /* enable vertical flip */
  494. //#define LCD_COM_SEQ /* COM pin layout: sequential */
  495. //#define LCD_COM_REMAP /* COM pin mapping: reversed */
  496. #define LCD_CONTRAST 127 /* default contrast (0-255) */
  497. /* font and symbols: vertically aligned & flipped, bank-wise grouping */
  498. #define FONT_8X8_VF /* 8x8 font */
  499. #define SYMBOLS_24X24_VFP /* 24x24 symbols */
  500. //#define SYMBOLS_24X24_ALT1_VFP /* 24x24 alternative symbols #1 */
  501. //#define SYMBOLS_24X24_ALT2_VFP /* 24x24 alternative symbols #2 */
  502. /* SPI bus */
  503. #define SPI_BITBANG /* bit-bang SPI */
  504. #define SPI_9 /* support 9 bit frames */
  505. #define SPI_PORT LCD_PORT /* SPI port data register */
  506. #define SPI_DDR LCD_DDR /* SPI port data direction register */
  507. #define SPI_SCK LCD_SCLK /* port pin used for SCK */
  508. #define SPI_MOSI LCD_SDIN /* port pin used for MOSI */
  509. #endif
  510.  
  511.  
  512.  
  513. /*
  514. * SSD1306
  515. * - I2C interface using bit-bang I2C
  516. */
  517.  
  518. #if 0
  519. #define LCD_SSD1306 /* display controller SSD1306 */
  520. #define LCD_GRAPHIC /* graphic display */
  521. #define LCD_I2C /* I2C interface */
  522. #define LCD_I2C_ADDR 0x3c /* SSD1306's I2C address */
  523. /* control lines */
  524. #define LCD_PORT PORTD /* port data register */
  525. #define LCD_DDR DDRD /* port data direction register */
  526. #define LCD_RESET PD4 /* port pin used for /RES (optional) */
  527. /* display settings */
  528. #define LCD_DOTS_X 128 /* number of horizontal dots */
  529. #define LCD_DOTS_Y 64 /* number of vertical dots */
  530. #define LCD_FLIP_X /* enable horizontal flip */
  531. #define LCD_FLIP_Y /* enable vertical flip */
  532. //#define LCD_COM_SEQ /* COM pin layout: sequential */
  533. //#define LCD_COM_REMAP /* COM pin mapping: reversed */
  534. #define LCD_CONTRAST 127 /* default contrast (0-255) */
  535. /* font and symbols: vertically aligned & flipped, bank-wise grouping */
  536. #define FONT_8X8_VF /* 8x8 font */
  537. #define SYMBOLS_24X24_VFP /* 24x24 symbols */
  538. //#define SYMBOLS_24X24_ALT1_VFP /* 24x24 alternative symbols #1 */
  539. //#define SYMBOLS_24X24_ALT2_VFP /* 24x24 alternative symbols #2 */
  540. /* I2C bus */
  541. #define I2C_BITBANG /* bit-bang I2C */
  542. #define I2C_FAST_MODE /* 400kHz bus speed */
  543. #define I2C_PORT PORTD /* I2C port data register */
  544. #define I2C_DDR DDRD /* I2C port data direction register */
  545. #define I2C_PIN PIND /* I2C port input pins register */
  546. #define I2C_SDA PD0 /* port pin used for SDA */
  547. #define I2C_SCL PD1 /* port pin used for SCL */
  548. #endif
  549.  
  550.  
  551.  
  552. /*
  553. * ST7036
  554. * - 4 bit parallel interface
  555. * - enable LCD_DB_STD when using port pins 0-3 for LCD_DB4/5/6/7
  556. * - untested!!!
  557. */
  558.  
  559. #if 0
  560. #define LCD_ST7036 /* display controller ST7036 */
  561. #define LCD_TEXT /* character display */
  562. #define LCD_PAR_4 /* 4 bit parallel interface */
  563. /* control and data lines */
  564. #define LCD_PORT PORTD /* port data register */
  565. #define LCD_DDR DDRD /* port data direction register */
  566. //#define LCD_DB_STD /* use standard pins 0-3 for DB4-7 */
  567. #define LCD_DB4 PD0 /* port pin used for DB4 */
  568. #define LCD_DB5 PD1 /* port pin used for DB5 */
  569. #define LCD_DB6 PD2 /* port pin used for DB6 */
  570. #define LCD_DB7 PD3 /* port pin used for DB7 */
  571. #define LCD_RS PD4 /* port pin used for RS */
  572. #define LCD_EN PD5 /* port pin used for E */
  573. //#define LCD_RW ??? /* port pin used for R/W (optional) */
  574. //#define LCD_RESET ??? /* port pin used for XRESET (optional) */
  575. /* display settings */
  576. #define LCD_CHAR_X 16 /* characters per line */
  577. #define LCD_CHAR_Y 3 /* number of lines */
  578. #define LCD_EXTENDED_CMD /* extended instruction set (EXT pin high) */
  579. #define LCD_CONTRAST 32 /* default contrast (0-63) */
  580. /* ST7036 has internal 5x8 font */
  581. #define FONT_ST7036 /* 5x8 font */
  582. #endif
  583.  
  584.  
  585.  
  586. /*
  587. * ST7036
  588. * - 4 wire SPI interface using bit-bang SPI
  589. * - untested!!!
  590. */
  591.  
  592. #if 0
  593. #define LCD_ST7036 /* display controller ST7036 */
  594. #define LCD_TEXT /* character display */
  595. #define LCD_SPI /* SPI interface */
  596. /* control and data lines */
  597. #define LCD_PORT PORTD /* port data register */
  598. #define LCD_DDR DDRD /* port data direction register */
  599. #define LCD_RESET PD4 /* port pin used for XRESET (optional) */
  600. #define LCD_CS PD5 /* port pin used for CSB (optional) */
  601. #define LCD_RS PD3 /* port pin used for RS */
  602. #define LCD_SCL PD2 /* port pin used for SCL */
  603. #define LCD_SI PD1 /* port pin used for SI (data input) */
  604. /* display settings */
  605. #define LCD_CHAR_X 16 /* characters per line */
  606. #define LCD_CHAR_Y 3 /* number of lines */
  607. #define LCD_EXTENDED_CMD /* extended instruction set (EXT pin high) */
  608. #define LCD_CONTRAST 32 /* default contrast (0-63) */
  609. /* ST7036 has internal 5x8 font */
  610. #define FONT_ST7036 /* 5x8 font */
  611. /* SPI bus */
  612. #define SPI_BITBANG /* bit-bang SPI */
  613. #define SPI_PORT LCD_PORT /* SPI port data register */
  614. #define SPI_DDR LCD_DDR /* SPI port data direction register */
  615. #define SPI_SCK LCD_SCL /* port pin used for SCK */
  616. #define SPI_MOSI LCD_SI /* port pin used for MOSI */
  617. #endif
  618.  
  619.  
  620.  
  621. /*
  622. * ST7565R
  623. * - SPI interface using bit-bang SPI
  624. * - settings for Electronic Assembly EA DOGM/DOGL128-6
  625. * - uses LCD_CS to support rotary encoder in parallel at PD2/3
  626. */
  627.  
  628. #if 0
  629. #define LCD_ST7565R /* display controller ST7565R */
  630. #define LCD_GRAPHIC /* graphic display */
  631. #define LCD_SPI /* SPI interface */
  632. /* control and data lines */
  633. #define LCD_PORT PORTD /* port data register */
  634. #define LCD_DDR DDRD /* port data direction register */
  635. #define LCD_RESET PD0 /* port pin used for /RES (optional) */
  636. #define LCD_CS PD5 /* port pin used for /CS1 (optional) */
  637. #define LCD_A0 PD1 /* port pin used for A0 */
  638. #define LCD_SCL PD2 /* port pin used for SCL */
  639. #define LCD_SI PD3 /* port pin used for SI (data input) */
  640. /* display settings */
  641. #define LCD_DOTS_X 128 /* number of horizontal dots */
  642. #define LCD_DOTS_Y 64 /* number of vertical dots */
  643. #define LCD_OFFSET_X /* enable x offset of 4 dots */
  644. //#define LCD_FLIP_X /* enable horizontal flip */
  645. #define LCD_FLIP_Y /* enable vertical flip */
  646. #define LCD_START_Y 0 /* start line (0-63) */
  647. #define LCD_CONTRAST 22 /* default contrast (0-63) */
  648. //#define LCD_LONG_RESET /* long reset for NT7538 */
  649. /* font and symbols: vertically aligned & flipped, bank-wise grouping */
  650. //#define FONT_6X8_VF /* 6x8 font */
  651. #define FONT_8X8_VF /* 8x8 font */
  652. //#define FONT_8X16_VFP /* 8x16 font */
  653. //#define FONT_6X8_ISO8859_2_VF /* 6x8 Central European font */
  654. //#define FONT_8X8_ISO8859_2_VF /* 8x8 Central European font */
  655. //#define FONT_8X12T_ISO8859_2_VFP /* thin 8x12 Central European font */
  656. //#define FONT_8X16_ISO8859_2_VFP /* 8x16 Central European font */
  657. //#define FONT_8X8_WIN1251_VF /* 8x8 cyrillic font */
  658. //#define FONT_8X8ALT_WIN1251_VF /* 8x8 alternative cyrillic font */
  659. //#define FONT_8X8T_WIN1251_VF /* thin 8x8 cyrillic font */
  660. //#define FONT_8X12T_WIN1251_VFP /* thin 8x12 cyrillic font */
  661. //#define FONT_8X16_WIN1251_VFP /* 8x16 cyrillic font */
  662. #define SYMBOLS_24X24_VFP /* 24x24 symbols */
  663. //#define SYMBOLS_24X24_ALT1_VFP /* 24x24 alternative symbols #1 */
  664. //#define SYMBOLS_24X24_ALT2_VFP /* 24x24 alternative symbols #2 */
  665. /* SPI bus */
  666. #define SPI_BITBANG /* bit-bang SPI */
  667. #define SPI_PORT LCD_PORT /* SPI port data register */
  668. #define SPI_DDR LCD_DDR /* SPI port data direction register */
  669. #define SPI_SCK LCD_SCL /* port pin used for SCK */
  670. #define SPI_MOSI LCD_SI /* port pin used for MOSI */
  671. #endif
  672.  
  673.  
  674.  
  675. /*
  676. * ST7735
  677. * - 4 wire SPI interface using bit-bang SPI
  678. */
  679.  
  680. #if 0
  681. #define LCD_ST7735 /* display controller ST7735 */
  682. #define LCD_GRAPHIC /* graphic display */
  683. #define LCD_COLOR /* color display */
  684. #define LCD_SPI /* SPI interface */
  685. /* control and data lines */
  686. #define LCD_PORT PORTD /* port data register */
  687. #define LCD_DDR DDRD /* port data direction register */
  688. #define LCD_RES PD4 /* port pin used for /RESX (optional) */
  689. #define LCD_CS PD5 /* port pin used for /CSX (optional) */
  690. #define LCD_DC PD3 /* port pin used for D/CX */
  691. #define LCD_SCL PD2 /* port pin used for SCL */
  692. #define LCD_SDA PD1 /* port pin used for SDA */
  693. /* display settings */
  694. #define LCD_DOTS_X 128 /* number of horizontal dots */
  695. #define LCD_DOTS_Y 160 /* number of vertical dots */
  696. //#define LCD_OFFSET_X 4 /* enable x offset of 2 or 4 dots */
  697. //#define LCD_OFFSET_Y 2 /* enable y offset of 1 or 2 dots */
  698. //#define LCD_FLIP_X /* enable horizontal flip */
  699. #define LCD_FLIP_Y /* enable vertical flip */
  700. #define LCD_ROTATE /* switch X and Y (rotate by 90°) */
  701. //#define LCD_BGR /* reverse red and blue color channels */
  702. //#define LCD_LATE_ON /* turn on LCD after clearing it */
  703. /* font and symbols: horizontally aligned & flipped */
  704. #define FONT_10X16_HF /* 10x16 font */
  705. //#define FONT_6X8_ISO8859_2_HF /* 6x8 Central European font */
  706. //#define FONT_8X8_ISO8859_2_HF /* 8x8 Central European font */
  707. //#define FONT_8X12T_ISO8859_2_HF /* thin 8x12 Central European font */
  708. //#define FONT_8X16_ISO8859_2_HF /* 8x16 Central European font */
  709. //#define FONT_10X16_ISO8859_2_HF /* 10x16 Central European font */
  710. //#define FONT_8X16_WIN1251_HF /* 8x16 cyrillic font */
  711. //#define FONT_8X16ALT_WIN1251_HF /* 8x16 alternative cyrillic font */
  712. #define SYMBOLS_30X32_HF /* 30x32 symbols */
  713. //#define SYMBOLS_30X32_ALT1_HF /* 30x32 alternative symbols #1 */
  714. //#define SYMBOLS_30X32_ALT2_HF /* 30x32 alternative symbols #2 */
  715. //#define SYMBOLS_32X32_HF /* 32x32 symbols */
  716. //#define SYMBOLS_32X32_ALT1_HF /* 32x32 alternative symbols #1 */
  717. //#define SYMBOLS_32X32_ALT2_HF /* 32x32 alternative symbols #2 */
  718. /* SPI bus */
  719. #define SPI_BITBANG /* bit-bang SPI */
  720. #define SPI_PORT LCD_PORT /* SPI port data register */
  721. #define SPI_DDR LCD_DDR /* SPI port data direction register */
  722. #define SPI_SCK LCD_SCL /* port pin used for SCK */
  723. #define SPI_MOSI LCD_SDA /* port pin used for MOSI */
  724. #endif
  725.  
  726. //For the ST7735 semi-compatible display use:
  727. #if 1
  728. #define LCD_SEMI_ST7735
  729. #define LCD_GRAPHIC /* graphic display */
  730. #define LCD_COLOR /* color display */
  731. #define LCD_SPI /* SPI interface */
  732. #define LCD_PORT PORTD /* port data register */
  733. #define LCD_DDR DDRD /* port data direction register */
  734. #define LCD_RES PD0 /* port pin used for /RESX */
  735. #define LCD_CS PD5 /* port pin used for /CSX (optional) */
  736. #define LCD_DC PD1 /* port pin used for D/CX */
  737. #define LCD_SCL PD2 /* port pin used for SCL */
  738. #define LCD_SDA PD3 /* port pin used for SDA */
  739. #define LCD_DOTS_X 160 /* number of horizontal dots */
  740. #define LCD_DOTS_Y 128 /* number of vertical dots */
  741. #define LCD_LATE_ON /* turn on LCD after clearing it */
  742. #define FONT_8X8_HF /* 8x8 font */
  743. #define SYMBOLS_30X32_HF /* 30x32 symbols */
  744. #define SPI_BITBANG /* bit-bang SPI */
  745. #define SPI_PORT LCD_PORT /* SPI port data register */
  746. #define SPI_DDR LCD_DDR /* SPI port data direction register */
  747. #define SPI_SCK LCD_SCL /* port pin used for SCK */
  748. #define SPI_MOSI LCD_SDA /* port pin used for MOSI */
  749. #endif
  750.  
  751. /*
  752. * ST7920
  753. * - SPI interface using bit-bang SPI
  754. * - for a 180° rotated display (LCD_ROT180)
  755. * - comment out "_H" font and symbols
  756. * - uncomment "_HF" font and symbols
  757. */
  758.  
  759. #if 0
  760. #define LCD_ST7920 /* display controller ST7920 */
  761. #define LCD_GRAPHIC /* graphic display */
  762. #define LCD_SPI /* SPI interface */
  763. /* control and data lines */
  764. #define LCD_PORT PORTD /* port data register */
  765. #define LCD_DDR DDRD /* port data direction register */
  766. #define LCD_RESET PD4 /* port pin used for /RESET (optional) */
  767. #define LCD_CS PD5 /* port pin used for CS (optional) */
  768. #define LCD_SCLK PD2 /* port pin used for SCLK */
  769. #define LCD_SID PD1 /* port pin used for SID (data input) */
  770. /* display settings */
  771. #define LCD_DOTS_X 128 /* number of horizontal dots */
  772. #define LCD_DOTS_Y 64 /* number of vertical dots */
  773. /* font and symbols: horizonally aligned */
  774. #define FONT_8X8_H /* 8x8 font */
  775. //#define FONT_8X8_ISO8859_2_H /* 8x8 Central European font */
  776. #define SYMBOLS_24X24_H /* 24x24 symbols */
  777. //#define SYMBOLS_24X24_ALT1_H /* alternative 24x24 symbols #1 */
  778. //#define SYMBOLS_24X24_ALT2_H /* alternative 24x24 symbols #2 */
  779. //#define LCD_ROT180 /* rotate output by 180° */
  780. /* font and symbols: horizonally aligned & flipped */
  781. //#define FONT_8X8_HF /* 8x8 font */
  782. //#define FONT_8X8_ISO8859_2_HF /* 8x8 Central European font */
  783. //#define SYMBOLS_24X24_HF /* 24x24 symbols */
  784. //#define SYMBOLS_24X24_ALT1_HF /* alternative 24x24 symbols #1 */
  785. //#define SYMBOLS_24X24_ALT2_HF /* alternative 24x24 symbols #2 */
  786. /* SPI bus */
  787. #define SPI_BITBANG /* bit-bang SPI */
  788. #define SPI_PORT LCD_PORT /* SPI port data register */
  789. #define SPI_DDR LCD_DDR /* SPI port data direction register */
  790. #define SPI_SCK LCD_SCLK /* port pin used for SCK */
  791. #define SPI_MOSI LCD_SID /* port pin used for MOSI */
  792. #endif
  793.  
  794.  
  795.  
  796. /*
  797. * ST7920
  798. * - 4 bit parallel interface
  799. * - if you change LCD_DB4/5/6/7 comment out LCD_DB_STD!
  800. * - for a 180° rotated display (LCD_ROT180)
  801. * - comment out "_H" font and symbol
  802. * - uncomment "_HF" font and symbol
  803. */
  804.  
  805. #if 0
  806. #define LCD_ST7920 /* display controller ST7920 */
  807. #define LCD_GRAPHIC /* graphic display */
  808. #define LCD_PAR_4 /* 4 bit parallel interface */
  809. /* control and data lines */
  810. #define LCD_PORT PORTD /* port data register */
  811. #define LCD_DDR DDRD /* port data direction register */
  812. #define LCD_DB_STD /* use standard pins 0-3 for DB4-7 */
  813. #define LCD_DB4 PD0 /* port pin used for DB4 */
  814. #define LCD_DB5 PD1 /* port pin used for DB5 */
  815. #define LCD_DB6 PD2 /* port pin used for DB6 */
  816. #define LCD_DB7 PD3 /* port pin used for DB7 */
  817. #define LCD_RS PD4 /* port pin used for RS */
  818. #define LCD_EN PD5 /* port pin used for E */
  819. //#define LCD_RW PD? /* port pin used for RW (optional) */
  820. //#define LCD_RESET PD? /* port pin used for /RESET (optional) */
  821. /* display settings */
  822. #define LCD_DOTS_X 128 /* number of horizontal dots */
  823. #define LCD_DOTS_Y 64 /* number of vertical dots */
  824. /* font and symbols: horizonally aligned */
  825. #define FONT_8X8_H /* 8x8 font */
  826. #define SYMBOLS_24X24_H /* 24x24 symbols */
  827. //#define SYMBOLS_24X24_ALT1_H /* alternative 24x24 symbols #1 */
  828. //#define SYMBOLS_24X24_ALT2_H /* alternative 24x24 symbols #2 */
  829. //#define LCD_ROT180 /* rotate output by 180° */
  830. /* font and symbols: horizonally aligned & flipped */
  831. //#define FONT_8X8_HF /* 8x8 font */
  832. //#define SYMBOLS_24X24_HF /* 24x24 symbols */
  833. //#define SYMBOLS_24X24_ALT1_HF /* alternative 24x24 symbols #1 */
  834. //#define SYMBOLS_24X24_ALT2_HF /* alternative 24x24 symbols #2 */
  835. #endif
  836.  
  837.  
  838.  
  839. /*
  840. * STE2007
  841. * - 3 wire SPI interface using bit-bang SPI
  842. */
  843.  
  844. #if 0
  845. #define LCD_STE2007 /* display controller STE2007 */
  846. #define LCD_GRAPHIC /* graphic display */
  847. #define LCD_SPI /* SPI interface */
  848. /* control and data lines */
  849. #define LCD_PORT PORTD /* port data register */
  850. #define LCD_DDR DDRD /* port data direction register */
  851. #define LCD_RESET PD4 /* port pin used for /RES (optional) */
  852. #define LCD_CS PD5 /* port pin used for /CS (optional) */
  853. #define LCD_SCLK PD2 /* port pin used for SCLK */
  854. #define LCD_SDIN PD1 /* port pin used for SDIN (data input) */
  855. /* display settings */
  856. #define LCD_DOTS_X 96 /* number of horizontal dots */
  857. #define LCD_DOTS_Y 68 /* number of vertical dots */
  858. //#define LCD_FLIP_X /* enable horizontal flip */
  859. //#define LCD_FLIP_Y /* enable vertical flip */
  860. #define LCD_CONTRAST 16 /* default contrast (0-31) */
  861. /* font and symbols: vertically aligned & flipped */
  862. #define FONT_6X8_VF /* 6x8 font */
  863. //#define FONT_6X8_ISO8859_2_VF /* 6x8 Central European font */
  864. #define SYMBOLS_24X24_VFP /* 24x24 symbols */
  865. //#define SYMBOLS_24X24_ALT1_VFP /* 24x24 alternative symbols #1 */
  866. //#define SYMBOLS_24X24_ALT2_VFP /* 24x24 alternative symbols #2 */
  867. /* SPI bus */
  868. #define SPI_BITBANG /* bit-bang SPI */
  869. #define SPI_9 /* support 9 bit frames */
  870. #define SPI_PORT LCD_PORT /* SPI port data register */
  871. #define SPI_DDR LCD_DDR /* SPI port data direction register */
  872. #define SPI_SCK LCD_SCLK /* port pin used for SCK */
  873. #define SPI_MOSI LCD_SDIN /* port pin used for MOSI */
  874. #endif
  875.  
  876.  
  877.  
  878. /*
  879. * VT100 serial terminal, TTL serial
  880. */
  881.  
  882. #if 0
  883. #define LCD_VT100 /* pseudo display VT100 */
  884. #define LCD_TEXT /* character display */
  885. #define LCD_COLOR /* color display */
  886. #define LCD_CHAR_X 40 /* characters per line */
  887. #define LCD_CHAR_Y 24 /* number of lines */
  888. #define SERIAL_BITBANG /* bit-bang serial */
  889. //#define SERIAL_HARDWARE /* hardware serial */
  890. #endif
  891.  
  892.  
  893.  
  894. /* ************************************************************************
  895. * port and pin assignments
  896. * ************************************************************************ */
  897.  
  898.  
  899. /*
  900. * test pins / probes:
  901. * - Must be an ADC port!
  902. * - It's recommended to use the lower 3 pins for the probes.
  903. * - Don't share this port with POWER_CTRL or TEST_BUTTON!
  904. */
  905.  
  906. #define ADC_PORT PORTC /* port data register */
  907. #define ADC_DDR DDRC /* port data direction register */
  908. #define ADC_PIN PINC /* port input pins register */
  909. #define TP1 PC0 /* test pin / probe #1 */
  910. #define TP2 PC1 /* test pin / probe #2 */
  911. #define TP3 PC2 /* test pin / probe #3 */
  912.  
  913. #define TP_ZENER PC3 /* test pin for for Zener check (10:1 voltage divider) */
  914. #define TP_REF PC4 /* test pin for 2.5V reference and relay */
  915. #define TP_BAT PC5 /* test pin for battery (4:1 voltage divider) */
  916. #define TP_LOGIC PC3 /* test pin for Logic Probe (4:1 voltage divider) */
  917.  
  918.  
  919. /*
  920. * probe resistors
  921. * - For PWM/squarewave output via probe #2 R_RL_2 has to be PB2/OC1B.
  922. * - Don't share this port with POWER_CTRL or TEST_BUTTON!
  923. */
  924.  
  925. #define R_PORT PORTB /* port data register */
  926. #define R_DDR DDRB /* port data direction register */
  927. #define R_RL_1 PB0 /* Rl (680R) for test pin #1 */
  928. #define R_RH_1 PB1 /* Rh (470k) for test pin #1 */
  929. #define R_RL_2 PB2 /* Rl (680R) for test pin #2 */
  930. #define R_RH_2 PB3 /* Rh (470k) for test pin #2 */
  931. #define R_RL_3 PB4 /* Rl (680R) for test pin #3 */
  932. #define R_RH_3 PB5 /* Rh (470k) for test pin #3 */
  933.  
  934.  
  935. /*
  936. * dedicated signal output via OC1B
  937. * - don't change this!
  938. */
  939.  
  940. #define SIGNAL_PORT PORTB /* port data register */
  941. #define SIGNAL_DDR DDRB /* port data direction register */
  942. #define SIGNAL_OUT PB2 /* MCU's OC1B pin */
  943.  
  944.  
  945. /*
  946. * power control
  947. * - can't be same port as ADC_PORT or R_PORT
  948. */
  949.  
  950. #define POWER_PORT PORTD /* port data register */
  951. #define POWER_DDR DDRD /* port data direction register */
  952. #define POWER_CTRL PD6 /* control pin (1: on / 0: off) */
  953.  
  954.  
  955. /*
  956. * test push button
  957. * - can't be same port as ADC_PORT or R_PORT
  958. */
  959.  
  960. #define BUTTON_PORT PORTD /* port data register */
  961. #define BUTTON_DDR DDRD /* port data direction register */
  962. #define BUTTON_PIN PIND /* port input pins register */
  963. #define TEST_BUTTON PD7 /* test/start push button (low active) */
  964.  
  965.  
  966. /*
  967. * rotary encoder
  968. */
  969.  
  970. #define ENCODER_PORT PORTD /* port data register */
  971. #define ENCODER_DDR DDRD /* port data direction register */
  972. #define ENCODER_PIN PIND /* port input pins register */
  973. #define ENCODER_A PD3 /* rotary encoder A signal */
  974. #define ENCODER_B PD1 /* rotary encoder B signal */
  975.  
  976.  
  977. /*
  978. * increase/decrease push buttons
  979. */
  980.  
  981. #define KEY_PORT PORTD /* port data register */
  982. #define KEY_DDR DDRD /* port data direction register */
  983. #define KEY_PIN PIND /* port input pins register */
  984. #define KEY_INC PD2 /* increase push button (low active) */
  985. #define KEY_DEC PD3 /* decrease push button (low active) */
  986.  
  987.  
  988. /*
  989. * frequency counter
  990. * - input must be pin PD4/T0
  991. */
  992.  
  993. #define COUNTER_PORT PORTD /* port data register */
  994. #define COUNTER_DDR DDRD /* port data direction register */
  995. #define COUNTER_IN PD4 /* signal input T0 */
  996.  
  997.  
  998. /*
  999. * ring tester
  1000. * - counter input must be pin PD4/T0 (uses COUNTER_IN)
  1001. */
  1002.  
  1003. #define RINGTESTER_PORT PORTD /* port data register */
  1004. #define RINGTESTER_DDR DDRD /* port data direction register */
  1005. #define RINGTESTER_OUT PD5 /* pulse output */
  1006.  
  1007.  
  1008.  
  1009. /*
  1010. * IR detector/decoder
  1011. * - fixed module connected to dedicated I/O pin
  1012. */
  1013.  
  1014. #define IR_PORT PORTD /* port data register */
  1015. #define IR_DDR DDRD /* port data direction register */
  1016. #define IR_PIN PIND /* port input pins register */
  1017. #define IR_DATA PD5 /* data signal */
  1018.  
  1019.  
  1020. /*
  1021. * SPI
  1022. * - hardware SPI uses
  1023. * SCK PB5, MOSI PB3, MISO PB4 and /SS PB2
  1024. * - could be already set in display section
  1025. * - unused signals can be ignored
  1026. * - /SS is set to output mode for hardware SPI but not used
  1027. */
  1028.  
  1029. /* SPI not set yet (for bit-bang or hardware SPI) */
  1030. #ifndef SPI_PORT
  1031. #define SPI_PORT PORTB /* port data register */
  1032. #define SPI_DDR DDRB /* port data direction register */
  1033. #define SPI_PIN PINB /* port input pins register */
  1034. #define SPI_SCK PB5 /* pin for SCK */
  1035. #define SPI_MOSI PB3 /* pin for MOSI */
  1036. #define SPI_MISO PB4 /* pin for MISO */
  1037. #define SPI_SS PB2 /* pin for /SS */
  1038. #endif
  1039.  
  1040. /* SPI_PIN/SPI_MISO not set yet (for bit-bang SPI with read support) */
  1041. //#define SPI_PIN PINB /* port input pins register */
  1042. //#define SPI_MISO PB4 /* pin for MISO */
  1043.  
  1044.  
  1045. /*
  1046. * I2C
  1047. * - hardware I2C (TWI) uses
  1048. * SDA PC4 and SCL PC5
  1049. * - could be already set in display section
  1050. */
  1051.  
  1052. /* I2C not set yet (for bit-bang I2C) */
  1053. #ifndef I2C_PORT
  1054. #define I2C_PORT PORTC /* port data register */
  1055. #define I2C_DDR DDRC /* port data direction register */
  1056. #define I2C_PIN PINC /* port input pins register */
  1057. #define I2C_SDA PC4 /* pin for SDA */
  1058. #define I2C_SCL PC5 /* pin for SCL */
  1059. #endif
  1060.  
  1061.  
  1062. /*
  1063. * TTL serial interface
  1064. * - hardware USART uses
  1065. * USART0: Rx PD0 and Tx PD1
  1066. */
  1067.  
  1068. /* for hardware RS232 */
  1069. #define SERIAL_USART 0 /* use USART0 */
  1070. /* for bit-bang RS232 */
  1071. #define SERIAL_PORT PORTD /* port data register */
  1072. #define SERIAL_DDR DDRD /* port data direction register */
  1073. #define SERIAL_PIN PIND /* port input pins register */
  1074. #define SERIAL_TX PD1 /* pin for Tx (transmit) */
  1075. #define SERIAL_RX PD0 /* pin for Rx (receive) */
  1076. #define SERIAL_PCINT 16 /* PCINT# for Rx pin */
  1077.  
  1078.  
  1079. /*
  1080. * OneWire
  1081. * - dedicated I/O pin
  1082. */
  1083.  
  1084. #define ONEWIRE_PORT PORTD /* port data register */
  1085. #define ONEWIRE_DDR DDRD /* port data direction register */
  1086. #define ONEWIRE_PIN PIND /* port input pins register */
  1087. #define ONEWIRE_DQ PD5 /* DQ (data line) */
  1088.  
  1089.  
  1090. /*
  1091. * buzzer
  1092. */
  1093.  
  1094. #define BUZZER_PORT PORTD /* port data register */
  1095. #define BUZZER_DDR DDRD /* port data direction register */
  1096. #define BUZZER_CTRL PD5 /* control pin (low: off / high: on) */
  1097.  
  1098.  
  1099. /*
  1100. * MAX6675
  1101. */
  1102.  
  1103. #define MAX6675_PORT PORTD /* port data register */
  1104. #define MAX6675_DDR DDRD /* port data direction register */
  1105. #define MAX6675_CS PD5 /* port pin used for /CS */
  1106.  
  1107.  
  1108. /*
  1109. * MAX31855
  1110. */
  1111.  
  1112. #define MAX31855_PORT PORTD /* port data register */
  1113. #define MAX31855_DDR DDRD /* port data direction register */
  1114. #define MAX31855_CS PD5 /* port pin used for /CS */
  1115.  
  1116.  
  1117. /*
  1118. * boost converter for Zener check (dedicated I/O pin)
  1119. */
  1120.  
  1121. #define BOOST_PORT PORTD /* port data register */
  1122. #define BOOST_DDR DDRD /* port data direction register */
  1123. #define BOOST_CTRL PD5 /* control pin */
  1124.  
  1125.  
  1126. /*
  1127. * flashlight / general purpose switched output
  1128. */
  1129.  
  1130. #define FLASHLIGHT_PORT PORTD /* port data register */
  1131. #define FLASHLIGHT_DDR DDRD /* port data direction register */
  1132. #define FLASHLIGHT_CTRL PD5 /* control pin */
  1133.  
  1134.  
  1135.  
  1136. /* ************************************************************************
  1137. * internal stuff
  1138. * ************************************************************************ */
  1139.  
  1140.  
  1141. /* ADC reference selection: AVcc */
  1142. #define ADC_REF_VCC (1 << REFS0)
  1143.  
  1144. /* ADC reference selection: internal 1.1V bandgap */
  1145. #define ADC_REF_BANDGAP ((1 << REFS1) | (1 << REFS0))
  1146.  
  1147. /* ADC reference selection: filter mask for register bits */
  1148. #define ADC_REF_MASK ((1 << REFS1) | (1 << REFS0))
  1149.  
  1150. /* ADC MUX channel: internal 1.1V bandgap reference */
  1151. #define ADC_CHAN_BANDGAP 0x0e /* 1110 */
  1152.  
  1153. /* ADC MUX channel: filter mask for register bits */
  1154. #define ADC_CHAN_MASK 0b00001111 /* MUX0-3 */
  1155.  
  1156.  
  1157.  
  1158. /* ************************************************************************
  1159. * MCU specific setup to support different AVRs
  1160. * ************************************************************************ */
  1161.  
  1162.  
  1163. /*
  1164. * ATmega 328/328P
  1165. */
  1166.  
  1167. #if defined (__AVR_ATmega328__)
  1168.  
  1169. /* estimated internal resistance of port to GND (in 0.1 Ohms) */
  1170. #define R_MCU_LOW 200
  1171.  
  1172. /* estimated internal resistance of port to VCC (in 0.1 Ohms) */
  1173. #define R_MCU_HIGH 220
  1174.  
  1175. /* voltage offset of MCU's analog comparator (in mV): -50 up to 50 */
  1176. #define COMPARATOR_OFFSET 0
  1177.  
  1178. /* this MCU has 32kB Flash, 1kB EEPROM and 2kB RAM (enable extra features) */
  1179. #define RES_FLASH 32
  1180. #define RES_EEPROM 1
  1181. #define RES_RAM 2
  1182.  
  1183.  
  1184. /*
  1185. * missing or unsupported MCU
  1186. */
  1187.  
  1188. #else
  1189. #error <<< No or wrong MCU type selected! >>>
  1190. #endif
  1191.  
  1192.  
  1193.  
  1194. /* ************************************************************************
  1195. * EOF
  1196. * ************************************************************************ */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement