config_328.h 46 KB

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