config_328.h 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855
  1. /* ************************************************************************
  2. *
  3. * ATmega 328 specific global configuration, setup and settings
  4. *
  5. * (c) 2012-2020 by Markus Reschke
  6. * based on code from Markus Frejek and Karl-Heinz Kübbeler
  7. *
  8. * ************************************************************************ */
  9. /* source management */
  10. #define CONFIG_328_H
  11. /* ************************************************************************
  12. * LCD module
  13. * ************************************************************************ */
  14. /*
  15. * LCD module / controller
  16. *
  17. * Please uncomment the package matching your LCD module and adjust
  18. * settings. And comment out the default package if not used.
  19. *
  20. * To uncomment, remove the enclosing "#if 0" and "#endif" or put
  21. * a "//" in front of both. To comment out, remove the "//" in front
  22. * of the "#if 0" and "#endif".
  23. *
  24. * Individual settings can be enabled by removing the leading "//", or
  25. * disabled by placing a "//" in front of the setting.
  26. */
  27. /*
  28. * HD44780, 4 bit parallel interface
  29. * - if you change LCD_DB4/5/6/7 comment out LCD_DB_STD!
  30. */
  31. #if 0
  32. #define LCD_HD44780 /* display controller HD44780 */
  33. #define LCD_TEXT /* character display */
  34. #define LCD_PAR_4 /* 4 bit parallel interface */
  35. #define LCD_PORT PORTD /* port data register */
  36. #define LCD_DDR DDRD /* port data direction register */
  37. #define LCD_DB_STD /* use standard pins 0-3 for DB4-7 */
  38. #define LCD_DB4 PD0 /* port pin used for DB4 */
  39. #define LCD_DB5 PD1 /* port pin used for DB5 */
  40. #define LCD_DB6 PD2 /* port pin used for DB6 */
  41. #define LCD_DB7 PD3 /* port pin used for DB7 */
  42. #define LCD_RS PD4 /* port pin used for RS */
  43. #define LCD_EN1 PD5 /* port pin used for E */
  44. #define LCD_CHAR_X 16 /* characters per line */
  45. #define LCD_CHAR_Y 2 /* number of lines */
  46. /* HD44780 has an internal 5x7 font */
  47. #define FONT_HD44780_INT /* International font (English) */
  48. //#define FONT_HD44780_WIN1251 /* Cyrillic font (European) */
  49. #endif
  50. /*
  51. * HD44780, PCF8574 based backpack (bit-bang I2C)
  52. * - if you change LCD_DB4/5/6/7 comment out LCD_DB_STD!
  53. * - PCF8574T is 0x27, PCF8574AT is 0x3f
  54. */
  55. #if 0
  56. #define LCD_HD44780 /* display controller HD44780 */
  57. #define LCD_TEXT /* character display */
  58. #define LCD_PCF8574 /* PCF8574 backpack */
  59. #define LCD_I2C_ADDR 0x3f /* PCF8574's I2C address */
  60. #define LCD_DB_STD /* use standard pins 4-7 for DB4-7 */
  61. #define LCD_DB4 PCF8574_P4 /* port pin used for DB4 */
  62. #define LCD_DB5 PCF8574_P5 /* port pin used for DB5 */
  63. #define LCD_DB6 PCF8574_P6 /* port pin used for DB6 */
  64. #define LCD_DB7 PCF8574_P7 /* port pin used for DB7 */
  65. #define LCD_RS PCF8574_P0 /* port pin used for RS */
  66. #define LCD_RW PCF8574_P1 /* port pin used for RW */
  67. #define LCD_EN1 PCF8574_P2 /* port pin used for E */
  68. #define LCD_LED PCF8574_P3 /* port pin used for backlight */
  69. #define LCD_CHAR_X 16 /* characters per line */
  70. #define LCD_CHAR_Y 2 /* number of lines */
  71. /* HD44780 has an internal 5x7 font */
  72. #define FONT_HD44780_INT /* International font (English) */
  73. //#define FONT_HD44780_WIN1251 /* Cyrillic font (European) */
  74. #define I2C_BITBANG /* bit-bang I2C */
  75. #define I2C_STANDARD_MODE /* 100kHz bus speed */
  76. #define I2C_PORT PORTD /* I2C port data register */
  77. #define I2C_DDR DDRD /* I2C port data direction register */
  78. #define I2C_PIN PIND /* I2C port input pins register */
  79. #define I2C_SDA PD0 /* port pin used for SDA */
  80. #define I2C_SCL PD1 /* port pin used for SCL */
  81. #endif
  82. /*
  83. * ST7565R, SPI interface (bit-bang)
  84. * - settings for Electronic Assembly EA DOGM/DOGL128-6
  85. * - uses LCD_CS to support rotary encoder in parallel at PD2/3
  86. */
  87. #if 0
  88. #define LCD_ST7565R /* display controller ST7565R */
  89. #define LCD_GRAPHIC /* graphic display */
  90. #define LCD_SPI /* SPI interface */
  91. #define LCD_PORT PORTD /* port data register */
  92. #define LCD_DDR DDRD /* port data direction register */
  93. #define LCD_RESET PD0 /* port pin used for /RES (optional) */
  94. #define LCD_CS PD5 /* port pin used for /CS1 (optional) */
  95. #define LCD_A0 PD1 /* port pin used for A0 */
  96. #define LCD_SCL PD2 /* port pin used for SCL */
  97. #define LCD_SI PD3 /* port pin used for SI (LCD's data input) */
  98. #define LCD_DOTS_X 128 /* number of horizontal dots */
  99. #define LCD_DOTS_Y 64 /* number of vertical dots */
  100. //#define LCD_FLIP_X /* enable horizontal flip */
  101. #define LCD_OFFSET_X /* enable x offset of 4 dots */
  102. #define LCD_FLIP_Y /* enable vertical flip */
  103. #define LCD_START_Y 0 /* start line (0-63) */
  104. #define LCD_CONTRAST 22 /* default contrast (0-63) */
  105. /* font and symbols: vertically aligned & flipped, bank-wise grouping */
  106. //#define FONT_6X8_VF /* 6x8 font */
  107. #define FONT_8X8_VF /* 8x8 font */
  108. //#define FONT_8X16_VFP /* 8x16 font */
  109. //#define FONT_6X8_ISO8859_2_VF /* 6x8 Central European font */
  110. //#define FONT_8X8_ISO8859_2_VF /* 8x8 Central European font */
  111. //#define FONT_8X12T_ISO8859_2_VFP /* thin 8x12 Central European font */
  112. //#define FONT_8X16_ISO8859_2_VFP /* 8x16 Central European font */
  113. //#define FONT_8X8_WIN1251_VF /* 8x8 cyrillic font */
  114. //#define FONT_8X8T_WIN1251_VF /* thin 8x8 cyrillic font */
  115. //#define FONT_8X12T_WIN1251_VFP /* thin 8x12 cyrillic font */
  116. //#define FONT_8X16_WIN1251_VFP /* 8x16 cyrillic font */
  117. #define SYMBOLS_24X24_VFP /* 24x24 symbols */
  118. #define SPI_BITBANG /* bit-bang SPI */
  119. #define SPI_PORT LCD_PORT /* SPI port data register */
  120. #define SPI_DDR LCD_DDR /* SPI port data direction register */
  121. #define SPI_SCK LCD_SCL /* port pin used for SCK */
  122. #define SPI_MOSI LCD_SI /* port pin used for MOSI */
  123. #endif
  124. /*
  125. * ILI9342, SPI interface (bit-bang)
  126. */
  127. #if 0
  128. #define LCD_ILI9341 /* display controller ILI9341/ILI9342 */
  129. #define LCD_GRAPHIC /* graphic display */
  130. #define LCD_COLOR /* color display */
  131. #define LCD_SPI /* SPI interface */
  132. #define LCD_PORT PORTD /* port data register */
  133. #define LCD_DDR DDRD /* port data direction register */
  134. #define LCD_RES PD4 /* port pin used for /RES (optional) */
  135. #define LCD_CS PD5 /* port pin used for /CS (optional) */
  136. #define LCD_DC PD3 /* port pin used for D/C */
  137. #define LCD_SCK PD2 /* port pin used for SCK */
  138. #define LCD_SDI PD1 /* port pin used for SDI (LCD's data input) */
  139. //#define LCD_SDO PD0 /* port pin used for SDO (LCD's data output) */
  140. #define LCD_DOTS_X 320 /* number of horizontal dots */
  141. #define LCD_DOTS_Y 240 /* number of vertical dots */
  142. //#define LCD_FLIP_X /* enable horizontal flip */
  143. //#define LCD_FLIP_Y /* enable vertical flip */
  144. //#define LCD_ROTATE /* switch X and Y (rotate by 90°) */
  145. /* font and symbols: horizontally aligned & flipped */
  146. #define FONT_16X26_HF /* 16x26 font */
  147. //#define FONT_16X26_ISO8859_2_HF /* 16x26 Central European font */
  148. #define SYMBOLS_32X32_HF /* 32x32 symbols */
  149. #define SPI_BITBANG /* bit-bang SPI */
  150. #define SPI_PORT LCD_PORT /* SPI port data register */
  151. #define SPI_DDR LCD_DDR /* SPI port data direction register */
  152. #define SPI_SCK LCD_SCK /* port pin used for SCK */
  153. #define SPI_MOSI LCD_SDI /* port pin used for MOSI */
  154. #endif
  155. /*
  156. * ST7735, SPI interface (bit-bang, 4 wire)
  157. */
  158. #if 1
  159. #define LCD_ST7735 /* display controller ST7735 */
  160. #define LCD_GRAPHIC /* graphic display */
  161. #define LCD_COLOR /* color display */
  162. #define LCD_SPI /* SPI interface */
  163. #define LCD_PORT PORTD /* port data register */
  164. #define LCD_DDR DDRD /* port data direction register */
  165. #define LCD_RES PD0 /* port pin used for /RESX (optional) */
  166. #define LCD_CS PD5 /* port pin used for /CSX (optional) */
  167. #define LCD_DC PD1 /* port pin used for D/CX */
  168. #define LCD_SCL PD2 /* port pin used for SCL */
  169. #define LCD_SDA PD3 /* port pin used for SDA */
  170. #define LCD_DOTS_X 128 /* number of horizontal dots */
  171. #define LCD_DOTS_Y 160 /* number of vertical dots */
  172. #define LCD_FLIP_X /* enable horizontal flip */
  173. //#define LCD_FLIP_Y /* enable vertical flip */
  174. #define LCD_ROTATE /* switch X and Y (rotate by 90°) */
  175. //#define LCD_OFFSET_X 4 /* enable x offset of 2 or 4 dots */
  176. //#define LCD_OFFSET_Y 2 /* enable y offset of 1 or 2 dots */
  177. #define LCD_LATE_ON /* turn on LCD after clearing it */
  178. /* font and symbols: horizontally aligned & flipped */
  179. #define FONT_10X16_HF /* 10x16 font */
  180. //#define FONT_10X16_ISO8859_2_HF /* 10x16 Central European font */
  181. //#define FONT_8X16_WIN1251_HF /* 8x16 cyrillic font */
  182. #define SYMBOLS_24X24_HF /* 24x24 symbols */
  183. #define SPI_BITBANG /* bit-bang SPI */
  184. #define SPI_PORT LCD_PORT /* SPI port data register */
  185. #define SPI_DDR LCD_DDR /* SPI port data direction register */
  186. #define SPI_SCK LCD_SCL /* port pin used for SCK */
  187. #define SPI_MOSI LCD_SDA /* port pin used for MOSI */
  188. #endif
  189. /*
  190. * PCD8544, SPI interface (bit-bang)
  191. * - for a 180° rotated display (LCD_ROT180)
  192. * - comment out "_VF" font and "_VFP" symbols
  193. * - uncomment "_V_F" font and "_VP_F" symbols
  194. */
  195. #if 0
  196. #define LCD_PCD8544 /* display controller PCD8544 */
  197. #define LCD_GRAPHIC /* graphic display */
  198. #define LCD_SPI /* SPI interface */
  199. #define LCD_PORT PORTD /* port data register */
  200. #define LCD_DDR DDRD /* port data direction register */
  201. #define LCD_RES PD4 /* port pin used for /RES (optional) */
  202. #define LCD_SCE PD5 /* port pin used for /SCE (optional) */
  203. #define LCD_DC PD3 /* port pin used for D/C */
  204. #define LCD_SCLK PD2 /* port pin used for SCLK */
  205. #define LCD_SDIN PD1 /* port pin used for SDIN (LCD's data input) */
  206. #define LCD_DOTS_X 84 /* number of horizontal dots */
  207. #define LCD_DOTS_Y 48 /* number of vertical dots */
  208. #define LCD_CONTRAST 66 /* default contrast (1-127) */
  209. /* font and symbols: vertically aligned & flipped */
  210. #define FONT_6X8_VF /* 6x8 font */
  211. //#define FONT_6X8_ISO8859_2_VF /* 6x8 Central Euopean font */
  212. #define SYMBOLS_24X24_VFP /* 24x24 symbols, vertically aligned & flipped */
  213. //#define LCD_ROT180 /* rotate output by 180° (not supported yet) */
  214. /* font and symbols: vertically aligned, bank-wise grouping, hor. flipped */
  215. //#define FONT_6X8_V_F /* 6x8 font */
  216. //#define FONT_6X8_ISO8859_2_V_F /* 6x8 Central Euopean font */
  217. //#define SYMBOLS_24X24_VP_F /* 24x24 symbols */
  218. #define SPI_BITBANG /* bit-bang SPI */
  219. #define SPI_PORT LCD_PORT /* SPI port data register */
  220. #define SPI_DDR LCD_DDR /* SPI port data direction register */
  221. #define SPI_SCK LCD_SCLK /* port pin used for SCK */
  222. #define SPI_MOSI LCD_SDIN /* port pin used for MOSI */
  223. #endif
  224. /*
  225. * ST7920, SPI interface (bit-bang)
  226. * - for a 180° rotated display (LCD_ROT180)
  227. * - comment out "_H" font and symbols
  228. * - uncomment "_HF" font and symbols
  229. */
  230. #if 0
  231. #define LCD_ST7920 /* display controller ST7920 */
  232. #define LCD_GRAPHIC /* graphic display */
  233. #define LCD_SPI /* SPI interface */
  234. #define LCD_PORT PORTD /* port data register */
  235. #define LCD_DDR DDRD /* port data direction register */
  236. #define LCD_RESET PD4 /* port pin used for /RESET (optional) */
  237. #define LCD_CS PD5 /* port pin used for CS (optional) */
  238. #define LCD_SCLK PD2 /* port pin used for SCLK */
  239. #define LCD_SID PD1 /* port pin used for SID (LCD's data input) */
  240. #define LCD_DOTS_X 128 /* number of horizontal dots */
  241. #define LCD_DOTS_Y 64 /* number of vertical dots */
  242. /* font and symbols: horizonally aligned */
  243. #define FONT_8X8_H /* 8x8 font */
  244. //#define FONT_8X8_ISO8859_2_H /* 8x8 Central European font */
  245. #define SYMBOLS_24X24_H /* 24x24 symbols */
  246. //#define LCD_ROT180 /* rotate output by 180° */
  247. /* font and symbols: horizonally aligned & flipped */
  248. //#define FONT_8X8_HF /* 8x8 font */
  249. //#define FONT_8X8_ISO8859_2_HF /* 8x8 Central European font */
  250. //#define SYMBOLS_24X24_HF /* 24x24 symbols */
  251. #define SPI_BITBANG /* bit-bang SPI */
  252. #define SPI_PORT LCD_PORT /* SPI port data register */
  253. #define SPI_DDR LCD_DDR /* SPI port data direction register */
  254. #define SPI_SCK LCD_SCLK /* port pin used for SCK */
  255. #define SPI_MOSI LCD_SID /* port pin used for MOSI */
  256. #endif
  257. /*
  258. * ST7920, 4 bit parallel interface
  259. * - if you change LCD_DB4/5/6/7 comment out LCD_DB_STD!
  260. * - for a 180° rotated display (LCD_ROT180)
  261. * - comment out "_H" font and symbol
  262. * - uncomment "_HF" font and symbol
  263. */
  264. #if 0
  265. #define LCD_ST7920 /* display controller ST7920 */
  266. #define LCD_GRAPHIC /* graphic display */
  267. #define LCD_PAR_4 /* 4 bit parallel interface */
  268. #define LCD_PORT PORTD /* port data register */
  269. #define LCD_DDR DDRD /* port data direction register */
  270. #define LCD_DB_STD /* use standard pins 0-3 for DB4-7 */
  271. #define LCD_DB4 PD0 /* port pin used for DB4 */
  272. #define LCD_DB5 PD1 /* port pin used for DB5 */
  273. #define LCD_DB6 PD2 /* port pin used for DB6 */
  274. #define LCD_DB7 PD3 /* port pin used for DB7 */
  275. #define LCD_RS PD4 /* port pin used for RS */
  276. #define LCD_EN PD5 /* port pin used for E */
  277. #define LCD_DOTS_X 128 /* number of horizontal dots */
  278. #define LCD_DOTS_Y 64 /* number of vertical dots */
  279. /* font and symbols: horizonally aligned */
  280. #define FONT_8X8_H /* 8x8 font */
  281. #define SYMBOLS_24X24_H /* 24x24 symbols */
  282. //#define LCD_ROT180 /* rotate output by 180° */
  283. /* font and symbols: horizonally aligned & flipped */
  284. //#define FONT_8X8_HF /* 8x8 font */
  285. //#define SYMBOLS_24X24_HF /* 24x24 symbols */
  286. #endif
  287. /*
  288. * ILI9163, SPI interface (bit-bang, 4 wire)
  289. */
  290. #if 0
  291. #define LCD_ILI9163 /* display controller ILI9163 */
  292. #define LCD_GRAPHIC /* graphic display */
  293. #define LCD_COLOR /* color display */
  294. #define LCD_SPI /* SPI interface */
  295. #define LCD_PORT PORTD /* port data register */
  296. #define LCD_DDR DDRD /* port data direction register */
  297. #define LCD_RES PD4 /* port pin used for /RESX (optional) */
  298. #define LCD_CS PD5 /* port pin used for /CSX (optional) */
  299. #define LCD_DC PD3 /* port pin used for D/CX */
  300. #define LCD_SCL PD2 /* port pin used for SCL */
  301. #define LCD_SDA PD1 /* port pin used for SDA/SDIO */
  302. #define LCD_DOTS_X 128 /* number of horizontal dots */
  303. #define LCD_DOTS_Y 128 /* number of vertical dots */
  304. #define LCD_OFFSET_X 32 /* x offset of 32 dots (160-128) */
  305. //#define LCD_FLIP_X /* enable horizontal flip */
  306. #define LCD_FLIP_Y /* enable vertical flip */
  307. #define LCD_ROTATE /* switch X and Y (rotate by 90°) */
  308. //#define LCD_LATE_ON /* turn on LCD after clearing it */
  309. /* font and symbols: horizonally aligned & flipped */
  310. #define FONT_8X8_HF /* 8x8 font */
  311. //#define FONT_10X16_HF /* 10x16 font */
  312. //#define FONT_8X8_ISO8859_2_HF /* 8x8 Central European font */
  313. //#define FONT_8X16_WIN1251_HF /* 8x16 cyrillic font */
  314. #define SYMBOLS_30X32_HF /* 30x32 symbols */
  315. #define SPI_BITBANG /* bit-bang SPI */
  316. #define SPI_PORT LCD_PORT /* SPI port data register */
  317. #define SPI_DDR LCD_DDR /* SPI port data direction register */
  318. #define SPI_SCK LCD_SCL /* port pin used for SCK */
  319. #define SPI_MOSI LCD_SDA /* port pin used for MOSI */
  320. #endif
  321. /*
  322. * SSD1306, SPI interface (bit-bang, 4 wire)
  323. */
  324. #if 0
  325. #define LCD_SSD1306 /* display controller SSD1306 */
  326. #define LCD_GRAPHIC /* graphic display */
  327. #define LCD_SPI /* SPI interface */
  328. #define LCD_PORT PORTD /* port data register */
  329. #define LCD_DDR DDRD /* port data direction register */
  330. #define LCD_RESET PD4 /* port pin used for /RES (optional) */
  331. #define LCD_CS PD5 /* port pin used for /CS (optional) */
  332. #define LCD_DC PD3 /* port pin used for D/C */
  333. #define LCD_SCLK PD2 /* port pin used for SCLK */
  334. #define LCD_SDIN PD1 /* port pin used for SDIN (LCD's data input) */
  335. #define LCD_DOTS_X 128 /* number of horizontal dots */
  336. #define LCD_DOTS_Y 64 /* number of vertical dots */
  337. #define LCD_FLIP_X /* enable horizontal flip */
  338. #define LCD_FLIP_Y /* enable vertical flip */
  339. #define LCD_CONTRAST 127 /* default contrast (0-255) */
  340. /* font and symbols: vertically aligned & flipped, bank-wise grouping */
  341. //#define FONT_6X8_VF /* 6x8 font */
  342. #define FONT_8X8_VF /* 8x8 font */
  343. //#define FONT_8X16_VFP /* 8x16 font */
  344. //#define FONT_6X8_ISO8859_2_VF /* 6x8 Central European font */
  345. //#define FONT_8X8_ISO8859_2_VF /* 8x8 Central European font */
  346. //#define FONT_8X12T_ISO8859_2_VFP /* thin 8x12 Central European font */
  347. //#define FONT_8X16_ISO8859_2_VFP /* 8x16 Central European font */
  348. //#define FONT_8X8_WIN1251_VF /* 8x8 cyrillic font */
  349. //#define FONT_8X8T_WIN1251_VF /* thin 8x8 cyrillic font */
  350. //#define FONT_8X12T_WIN1251_VFP /* thin 8x12 cyrillic font */
  351. //#define FONT_8X16_WIN1251_VFP /* 8x16 cyrillic font */
  352. #define SYMBOLS_24X24_VFP /* 24x24 symbols */
  353. #define SPI_BITBANG /* bit-bang SPI */
  354. #define SPI_PORT LCD_PORT /* SPI port data register */
  355. #define SPI_DDR LCD_DDR /* SPI port data direction register */
  356. #define SPI_SCK LCD_SCLK /* port pin used for SCK */
  357. #define SPI_MOSI LCD_SDIN /* port pin used for MOSI */
  358. #endif
  359. /*
  360. * SSD1306, SPI interface (bit-bang, 3 wire)
  361. */
  362. #if 0
  363. #define LCD_SSD1306 /* display controller SSD1306 */
  364. #define LCD_GRAPHIC /* graphic display */
  365. #define LCD_SPI /* SPI interface */
  366. #define LCD_PORT PORTD /* port data register */
  367. #define LCD_DDR DDRD /* port data direction register */
  368. #define LCD_RESET PD4 /* port pin used for /RES (optional) */
  369. #define LCD_CS PD5 /* port pin used for /CS (optional) */
  370. #define LCD_SCLK PD2 /* port pin used for SCLK */
  371. #define LCD_SDIN PD1 /* port pin used for SDIN (LCD's data input) */
  372. #define LCD_DOTS_X 128 /* number of horizontal dots */
  373. #define LCD_DOTS_Y 64 /* number of vertical dots */
  374. #define LCD_FLIP_X /* enable horizontal flip */
  375. #define LCD_FLIP_Y /* enable vertical flip */
  376. #define LCD_CONTRAST 127 /* default contrast (0-255) */
  377. /* font and symbols: vertically aligned & flipped, bank-wise grouping */
  378. #define FONT_8X8_VF /* 8x8 font */
  379. #define SYMBOLS_24X24_VFP /* 24x24 symbols */
  380. #define SPI_BITBANG /* bit-bang SPI */
  381. #define SPI_9 /* support 9 bit frames */
  382. #define SPI_PORT LCD_PORT /* SPI port data register */
  383. #define SPI_DDR LCD_DDR /* SPI port data direction register */
  384. #define SPI_SCK LCD_SCLK /* port pin used for SCK */
  385. #define SPI_MOSI LCD_SDIN /* port pin used for MOSI */
  386. #endif
  387. /*
  388. * SSD1306, I2C interface (bit-bang)
  389. */
  390. #if 0
  391. #define LCD_SSD1306 /* display controller SSD1306 */
  392. #define LCD_GRAPHIC /* graphic display */
  393. #define LCD_I2C /* I2C interface */
  394. #define LCD_I2C_ADDR 0x3c /* SSD1306's I2C address */
  395. #define LCD_PORT PORTD /* port data register */
  396. #define LCD_DDR DDRD /* port data direction register */
  397. #define LCD_RESET PD4 /* port pin used for /RES (optional) */
  398. #define LCD_DOTS_X 128 /* number of horizontal dots */
  399. #define LCD_DOTS_Y 64 /* number of vertical dots */
  400. #define LCD_FLIP_X /* enable horizontal flip */
  401. #define LCD_FLIP_Y /* enable vertical flip */
  402. #define LCD_CONTRAST 127 /* default contrast (0-255) */
  403. /* font and symbols: vertically aligned & flipped, bank-wise grouping */
  404. #define FONT_8X8_VF /* 8x8 font */
  405. #define SYMBOLS_24X24_VFP /* 24x24 symbols */
  406. #define I2C_BITBANG /* bit-bang I2C */
  407. #define I2C_FAST_MODE /* 400kHz bus speed */
  408. #define I2C_PORT PORTD /* I2C port data register */
  409. #define I2C_DDR DDRD /* I2C port data direction register */
  410. #define I2C_PIN PIND /* I2C port input pins register */
  411. #define I2C_SDA PD0 /* port pin used for SDA */
  412. #define I2C_SCL PD1 /* port pin used for SCL */
  413. #endif
  414. /*
  415. * STE2007, SPI interface (bit-bang, 3 wire)
  416. */
  417. #if 0
  418. #define LCD_STE2007 /* display controller STE2007 */
  419. #define LCD_GRAPHIC /* graphic display */
  420. #define LCD_SPI /* SPI interface */
  421. #define LCD_PORT PORTD /* port data register */
  422. #define LCD_DDR DDRD /* port data direction register */
  423. #define LCD_RESET PD4 /* port pin used for /RES (optional) */
  424. #define LCD_CS PD5 /* port pin used for /CS (optional) */
  425. #define LCD_SCLK PD2 /* port pin used for SCLK */
  426. #define LCD_SDIN PD1 /* port pin used for SDIN (LCD's data input) */
  427. #define LCD_DOTS_X 96 /* number of horizontal dots */
  428. #define LCD_DOTS_Y 68 /* number of vertical dots */
  429. //#define LCD_FLIP_X /* enable horizontal flip */
  430. //#define LCD_FLIP_Y /* enable vertical flip */
  431. #define LCD_CONTRAST 16 /* default contrast (0-31) */
  432. /* font and symbols: vertically aligned & flipped */
  433. #define FONT_6X8_VF /* 6x8 font */
  434. //#define FONT_6X8_ISO8859_2_VF /* 6x8 Central European font */
  435. #define SYMBOLS_24X24_VFP /* 24x24 symbols */
  436. #define SPI_BITBANG /* bit-bang SPI */
  437. #define SPI_9 /* support 9 bit frames */
  438. #define SPI_PORT LCD_PORT /* SPI port data register */
  439. #define SPI_DDR LCD_DDR /* SPI port data direction register */
  440. #define SPI_SCK LCD_SCLK /* port pin used for SCK */
  441. #define SPI_MOSI LCD_SDIN /* port pin used for MOSI */
  442. #endif
  443. /*
  444. * PCF8814, SPI interface (bit-bang, 3 wire)
  445. */
  446. #if 0
  447. #define LCD_PCF8814 /* display controller PCF8814 */
  448. #define LCD_GRAPHIC /* graphic display */
  449. #define LCD_SPI /* SPI interface */
  450. #define LCD_PORT PORTD /* port data register */
  451. #define LCD_DDR DDRD /* port data direction register */
  452. #define LCD_RESET PD4 /* port pin used for /RES */
  453. #define LCD_CS PD5 /* port pin used for /CS (optional) */
  454. #define LCD_SCLK PD2 /* port pin used for SCLK */
  455. #define LCD_SDIN PD1 /* port pin used for SDIN (LCD's data input) */
  456. #define LCD_DOTS_X 96 /* number of horizontal dots */
  457. #define LCD_DOTS_Y 65 /* number of vertical dots */
  458. //#define LCD_FLIP_Y /* enable vertical flip */
  459. #define LCD_CONTRAST 5 /* default contrast (0-255) */
  460. /* font and symbols: vertically aligned & flipped, page-wise grouping */
  461. #define FONT_6X8_VF /* 6x8 font */
  462. //#define FONT_6X8_ISO8859_2_VF /* 6x8 Central European font */
  463. #define SYMBOLS_24X24_VFP /* 24x24 symbols */
  464. #define SPI_BITBANG /* bit-bang SPI */
  465. #define SPI_9 /* support 9 bit frames */
  466. #define SPI_PORT LCD_PORT /* SPI port data register */
  467. #define SPI_DDR LCD_DDR /* SPI port data direction register */
  468. #define SPI_SCK LCD_SCLK /* port pin used for SCK */
  469. #define SPI_MOSI LCD_SDIN /* port pin used for MOSI */
  470. #endif
  471. /*
  472. * ST7036, 4 bit parallel interface
  473. * - enable LCD_DB_STD when using port pins 0-3 for LCD_DB4/5/6/7
  474. * - untested!!!
  475. */
  476. #if 0
  477. #define LCD_ST7036 /* display controller ST7036 */
  478. #define LCD_TEXT /* character display */
  479. #define LCD_PAR_4 /* 4 bit parallel interface */
  480. #define LCD_PORT PORTD /* port data register */
  481. #define LCD_DDR DDRD /* port data direction register */
  482. //#define LCD_DB_STD /* use standard pins 0-3 for DB4-7 */
  483. #define LCD_DB4 PD0 /* port pin used for DB4 */
  484. #define LCD_DB5 PD1 /* port pin used for DB5 */
  485. #define LCD_DB6 PD2 /* port pin used for DB6 */
  486. #define LCD_DB7 PD3 /* port pin used for DB7 */
  487. #define LCD_RS PD4 /* port pin used for RS */
  488. #define LCD_EN PD5 /* port pin used for E */
  489. //#define LCD_RW ??? /* port pin used for R/W (optional) */
  490. //#define LCD_RESET ??? /* port pin used for XRESET (optional) */
  491. #define LCD_CHAR_X 16 /* characters per line */
  492. #define LCD_CHAR_Y 3 /* number of lines */
  493. #define LCD_EXTENDED_CMD /* extended instruction set (EXT pin high) */
  494. #define LCD_CONTRAST 32 /* default contrast (0-63) */
  495. /* ST7036 has internal 5x8 font */
  496. #define FONT_ST7036 /* 5x8 font */
  497. #endif
  498. /*
  499. * ST7036, SPI interface (bit-bang, 4 wire)
  500. * - untested!!!
  501. */
  502. #if 0
  503. #define LCD_ST7036 /* display controller ST7036 */
  504. #define LCD_TEXT /* character display */
  505. #define LCD_SPI /* SPI interface */
  506. #define LCD_PORT PORTD /* port data register */
  507. #define LCD_DDR DDRD /* port data direction register */
  508. #define LCD_RESET PD4 /* port pin used for XRESET (optional) */
  509. #define LCD_CS PD5 /* port pin used for CSB (optional) */
  510. #define LCD_RS PD3 /* port pin used for RS */
  511. #define LCD_SCL PD2 /* port pin used for SCL */
  512. #define LCD_SI PD1 /* port pin used for SI (LCD's data input) */
  513. #define LCD_CHAR_X 16 /* characters per line */
  514. #define LCD_CHAR_Y 3 /* number of lines */
  515. #define LCD_EXTENDED_CMD /* extended instruction set (EXT pin high) */
  516. #define LCD_CONTRAST 32 /* default contrast (0-63) */
  517. /* ST7036 has internal 5x8 font */
  518. #define FONT_ST7036 /* 5x8 font */
  519. #define SPI_BITBANG /* bit-bang SPI */
  520. #define SPI_PORT LCD_PORT /* SPI port data register */
  521. #define SPI_DDR LCD_DDR /* SPI port data direction register */
  522. #define SPI_SCK LCD_SCL /* port pin used for SCK */
  523. #define SPI_MOSI LCD_SI /* port pin used for MOSI */
  524. #endif
  525. /*
  526. * VT100 serial terminal, TTL serial
  527. */
  528. #if 0
  529. #define LCD_VT100 /* pseudo display VT100 */
  530. #define LCD_TEXT /* character display */
  531. #define LCD_COLOR /* color display */
  532. #define LCD_CHAR_X 40 /* characters per line */
  533. #define LCD_CHAR_Y 24 /* number of lines */
  534. #define SERIAL_BITBANG /* bit-bang serial */
  535. //#define SERIAL_HARDWARE /* hardware serial */
  536. #endif
  537. /*
  538. * check if a LCD module is specified
  539. */
  540. #if !defined(LCD_TEXT) && !defined(LCD_GRAPHIC)
  541. #error <<< No LCD module specified! >>>
  542. #endif
  543. /* ************************************************************************
  544. * port and pin assignments
  545. * ************************************************************************ */
  546. /*
  547. * Test probes:
  548. * - Must be an ADC port
  549. * - Lower 3 pins of the port must be used for probe pins.
  550. * - Please don't change the definitions of TP1, TP2 and TP3!
  551. * - Don't share this port with POWER_CTRL or TEST_BUTTON!
  552. */
  553. #define ADC_PORT PORTC /* ADC port data register */
  554. #define ADC_DDR DDRC /* ADC port data direction register */
  555. #define ADC_PIN PINC /* port input pins register */
  556. #define TP1 PC0 /* test pin 1 */
  557. #define TP2 PC1 /* test pin 2 */
  558. #define TP3 PC2 /* test pin 3 */
  559. #define TP_ZENER PC3 /* test pin with 10:1 voltage divider */
  560. #define TP_REF PC4 /* test pin with 2.5V reference and relay */
  561. #define TP_BAT PC5 /* test pin with 4:1 voltage divider */
  562. /*
  563. * Probe resistors
  564. * - For PWM/squarewave output via probe #2 R_RL_2 has to be PB2/OC1B.
  565. * - Don't share this port with POWER_CTRL or TEST_BUTTON!
  566. */
  567. #define R_PORT PORTB /* port data register */
  568. #define R_DDR DDRB /* port data direction register */
  569. #define R_RL_1 PB0 /* Rl (680R) for test pin #1 */
  570. #define R_RH_1 PB1 /* Rh (470k) for test pin #1 */
  571. #define R_RL_2 PB2 /* Rl (680R) for test pin #2 */
  572. #define R_RH_2 PB3 /* Rh (470k) for test pin #2 */
  573. #define R_RL_3 PB4 /* Rl (680R) for test pin #3 */
  574. #define R_RH_3 PB5 /* Rh (470k) for test pin #3 */
  575. /*
  576. * dedicated signal output via OC1B
  577. * - don't change this!
  578. */
  579. #define SIGNAL_PORT PORTB /* port data register */
  580. #define SIGNAL_DDR DDRB /* port data direction register */
  581. #define SIGNAL_OUT PB2 /* MCU's OC1B pin */
  582. /*
  583. * power control
  584. * - can't be same port as ADC_PORT or R_PORT
  585. */
  586. #define POWER_PORT PORTD /* port data register */
  587. #define POWER_DDR DDRD /* port data direction register */
  588. #define POWER_CTRL PD6 /* controls power (1: on / 0: off) */
  589. /*
  590. * test push button
  591. * - can't be same port as ADC_PORT or R_PORT
  592. */
  593. #define BUTTON_PORT PORTD /* port data register */
  594. #define BUTTON_DDR DDRD /* port data direction register */
  595. #define BUTTON_PIN PIND /* port input pins register */
  596. #define TEST_BUTTON PD7 /* test/start push button (low active) */
  597. /*
  598. * rotary encoder
  599. */
  600. #define ENCODER_PORT PORTD /* port data register */
  601. #define ENCODER_DDR DDRD /* port data direction register */
  602. #define ENCODER_PIN PIND /* port input pins register */
  603. #define ENCODER_A PD1 /* rotary encoder A signal */
  604. #define ENCODER_B PD3 /* rotary encoder B signal */
  605. /*
  606. * increase/decrease push buttons
  607. */
  608. #define KEY_PORT PORTD /* port data register */
  609. #define KEY_DDR DDRD /* port data direction register */
  610. #define KEY_PIN PIND /* port input pins register */
  611. #define KEY_INC PD2 /* increase push button (low active) */
  612. #define KEY_DEC PD3 /* decrease push button (low active) */
  613. /*
  614. * frequency counter
  615. * - input must be pin PD4/T0
  616. */
  617. #define COUNTER_PORT PORTD /* port data register */
  618. #define COUNTER_DDR DDRD /* port data direction register */
  619. #define COUNTER_IN PD4 /* signal input T0 */
  620. /*
  621. * IR detector/decoder
  622. * - fixed module connected to dedicated I/O pin
  623. */
  624. #define IR_PORT PORTC /* port data register */
  625. #define IR_DDR DDRC /* port data direction register */
  626. #define IR_PIN PINC /* port input pins register */
  627. #define IR_DATA PC6 /* data signal */
  628. /*
  629. * SPI
  630. * - hardware SPI uses PB5, PB3 and PB4
  631. * - could be already set in display section
  632. */
  633. /* for bit-bang SPI */
  634. #ifndef SPI_PORT
  635. #define SPI_PORT PORTB /* port data register */
  636. #define SPI_DDR DDRB /* port data direction register */
  637. #define SPI_PIN PINB /* port input pins register */
  638. #define SPI_SCK PB5 /* pin for SCK */
  639. #define SPI_MOSI PB3 /* pin for MOSI */
  640. #define SPI_MISO PB4 /* pin for MISO */
  641. #endif
  642. /*
  643. * I2C
  644. * - hardware I2C (TWI) uses PC4 & PC5
  645. * - could be already set in display section
  646. */
  647. /* for bit-bang I2C */
  648. #ifndef I2C_PORT
  649. #define I2C_PORT PORTC /* port data register */
  650. #define I2C_DDR DDRC /* port data direction register */
  651. #define I2C_PIN PINC /* port input pins register */
  652. #define I2C_SDA PC4 /* pin for SDA */
  653. #define I2C_SCL PC5 /* pin for SCL */
  654. #endif
  655. /*
  656. * TTL serial interface
  657. * - hardware USART0 uses PD0 & PD1
  658. */
  659. /* for hardware RS232 */
  660. #define SERIAL_USART 0 /* use USART0 */
  661. /* for bit-bang RS232 */
  662. #define SERIAL_PORT PORTD /* port data register */
  663. #define SERIAL_DDR DDRD /* port data direction register */
  664. #define SERIAL_PIN PIND /* port input pins register */
  665. #define SERIAL_TX PD1 /* pin for Tx (transmit) */
  666. #define SERIAL_RX PD0 /* pin for Rx (receive) */
  667. #define SERIAL_PCINT 16 /* PCINT# for Rx pin */
  668. /*
  669. * OneWire
  670. * - dedicated I/O pin
  671. */
  672. #define ONEWIRE_PORT PORTC /* port data register */
  673. #define ONEWIRE_DDR DDRC /* port data direction register */
  674. #define ONEWIRE_PIN PINC /* port input pins register */
  675. #define ONEWIRE_DQ PC6 /* DQ (data line) */
  676. /* ************************************************************************
  677. * internal stuff
  678. * ************************************************************************ */
  679. /* ADC reference selection: AVcc */
  680. #define ADC_REF_VCC (1 << REFS0)
  681. /* ADC reference selection: internal 1.1V bandgap */
  682. #define ADC_REF_BANDGAP ((1 << REFS1) | (1 << REFS0))
  683. /* ADC reference selection bit mask */
  684. #define ADC_REF_MASK ((1 << REFS1) | (1 << REFS0))
  685. /* ADC MUX channel for internal 1.1V bandgap reference */
  686. #define ADC_BANDGAP 0x0e /* 1110 */
  687. /* ************************************************************************
  688. * MCU specific setup to support different AVRs
  689. * ************************************************************************ */
  690. /*
  691. * ATmega 328/328P
  692. */
  693. #if defined(__AVR_ATmega328__)
  694. /* estimated internal resistance of port to GND (in 0.1 Ohms) */
  695. #define R_MCU_LOW 200
  696. /* estimated internal resistance of port to VCC (in 0.1 Ohms) */
  697. #define R_MCU_HIGH 220
  698. /* voltage offset of MCU's analog comparator (in mV): -50 up to 50 */
  699. #define COMPARATOR_OFFSET 0
  700. /* this MCU has 32kB Flash, 1kB EEPROM and 2kB RAM (enable extra features) */
  701. #define RES_FLASH 32
  702. #define RES_EEPROM 1
  703. #define RES_RAM 2
  704. /*
  705. * missing or unsupported MCU
  706. */
  707. #else
  708. #error <<< No or wrong MCU type selected! >>>
  709. #endif
  710. /* ************************************************************************
  711. * EOF
  712. * ************************************************************************ */