X-Git-Url: https://git.rohieb.name/hackover2013-badge-firmware.git/blobdiff_plain/15e15a25d1f49a6be409006506359cab519545fe..99a51263bf54b806197c5bc74444bc8b9ef45c02:/projectconfig.h diff --git a/projectconfig.h b/projectconfig.h index 88fddba..e59629a 100644 --- a/projectconfig.h +++ b/projectconfig.h @@ -47,8 +47,72 @@ different pin configuration, you will need to specify which board you are using by enabling one of the following definitions. The code base will then try to configure itself accordingly for that board. + + CFG_BRD_LPC1343_REFDESIGN + ========================= + + microBuilder.eu LPC1343 Reference Design base board with + on-board peripherals initialised (EEPROM, USB or UART CLI, etc.) + + This is the recommended starting point for new development + since it makes it easy to send printf output to USB CDC, access + the on-board EEPROM, etc. + + CFG_BRD_LPC1343_REFDESIGN_MINIMAL + ================================= + + microBuilder.eu LPC1343 Reference Design base board with + only the most common peripherals initialised by default. + + Results in smallest code since EEPROM, USB, etc., are not + initialised on startup. By default, only the following + peripherals are initialised by systemInit(): + + - CPU (Configures the PLL, etc.) + - GPIO + - SysTick Timer + - UART (with printf support) * + + * Can be removed to save 0.8kb in debug and 0.3 kb in + release. Comment out 'CFG_PRINTF_UART' to disable it. + + The code size can be further reduced by several KB by removing + any IRQ Handlers that are not used. The I2C IRQHandler, for + example, uses ~1KB of flash in debug and ~400KB in release mode, + but because it is referenced in the startup code it is always + included even if I2C is never used in the project. + + Other IRQ Handlers that you might be able to comment out + to save some space are: + + IRQ Handler Debug Release + ------------------------- ------ ------- + I2C_IRQHandler 1160 b 400 b + SSP_IRQHandler 160 b 76 b + UART_IRQHandler 246 b 116 b + WAKEUP_IRQHandler 160 b 100 b + WDT_IRQHandler 50 b 28 b + + CFG_BRD_LPC1343_TFTLCDSTANDALONE_USB + ==================================== + + microBuilder.eu/Adafruit Stand-Alone "Smart LCD" with USB enabled + for the CLI interface. + + CFG_BRD_LPC1343_TFTLCDSTANDALONE_UART + ===================================== + + microBuilder.eu/Adafruit Stand-Alone "Smart LCD" with UART enabled + for the CLI interface. + + CFG_BRD_LPC1343_802154USBSTICK + ============================== + + microBuilder.eu USB stick 802.15.4 868/915MHz RF transceiver + -----------------------------------------------------------------------*/ #define CFG_BRD_LPC1343_REFDESIGN + // #define CFG_BRD_LPC1343_REFDESIGN_MINIMAL // #define CFG_BRD_LPC1343_TFTLCDSTANDALONE_USB // #define CFG_BRD_LPC1343_TFTLCDSTANDALONE_UART // #define CFG_BRD_LPC1343_802154USBSTICK @@ -75,6 +139,7 @@ ILI9325/8 X X X X X X X X X X X X X . . . X ST7565 X X X X X X X X X X X X X . . . X ST7735 . . . . X X X X X X . . . . . . . + SHARPMEM . . . . X X X X . . . . . . . . . SSD1306 . . . . X X X . X X . . . . . . . MCP121 . . . . . . . . . . . . . . X . . @@ -91,6 +156,7 @@ ILI9325/8 . . . . . X X X X . ST7565 . . . . . X X X X . ST7535 . . . . . . . . . . + SHARPMEM . . . . . . . . . . SSD1306 . . . . . . . . . . INTERFACE . . . . . . . . . X[2] @@ -102,12 +168,34 @@ **************************************************************************/ +/************************************************************************** + I2C Addresses + ----------------------------------------------------------------------- + The following addresses are used by the different I2C sensors included + in the code base [1] + + HEX BINARY + ==== ======== + ISL12022M (RTC) 0xDE 1101111x + ISL12022M (SRAM) 0xAE 1010111x + LM75B 0x90 1001000x + MCP24AA 0xA0 1010000x + MCP4725 0xC0 1100000x + TSL2561 0x72 0111001x + TCS3414 0x72 0111001x + + [1] Alternative addresses may exists, but the addresses listed in this + table are the values used in the code base + + **************************************************************************/ + + /*========================================================================= FIRMWARE VERSION SETTINGS -----------------------------------------------------------------------*/ #define CFG_FIRMWARE_VERSION_MAJOR (0) #define CFG_FIRMWARE_VERSION_MINOR (9) - #define CFG_FIRMWARE_VERSION_REVISION (2) + #define CFG_FIRMWARE_VERSION_REVISION (8) /*=========================================================================*/ @@ -137,6 +225,25 @@ /*=========================================================================*/ +/*========================================================================= + ALTERNATE RESET PIN + ----------------------------------------------------------------------- + + CFG_ALTRESET If defined, indicates that a GPIO pin should be + configured as an alternate reset pin in addition + to the dedicated reset pin. + CFG_ALTRESET_PORT The GPIO port where the alt reset pin is located + CFG_ALTRESET_PIN The GPIO pin where the alt reset pin is located + + -----------------------------------------------------------------------*/ + #ifdef CFG_BRD_LPC1343_TFTLCDSTANDALONE_UART + #define CFG_ALTRESET + #define CFG_ALTRESET_PORT (1) + #define CFG_ALTRESET_PIN (5) // P1.5 = RTS + #endif +/*=========================================================================*/ + + /*========================================================================= UART ----------------------------------------------------------------------- @@ -156,13 +263,18 @@ #define CFG_UART_BUFSIZE (512) #endif + #ifdef CFG_BRD_LPC1343_REFDESIGN_MINIMAL + #define CFG_UART_BAUDRATE (115200) + #define CFG_UART_BUFSIZE (512) + #endif + #ifdef CFG_BRD_LPC1343_TFTLCDSTANDALONE_USB #define CFG_UART_BAUDRATE (115200) #define CFG_UART_BUFSIZE (512) #endif #ifdef CFG_BRD_LPC1343_TFTLCDSTANDALONE_UART - #define CFG_UART_BAUDRATE (9600) + #define CFG_UART_BAUDRATE (57600) #define CFG_UART_BUFSIZE (512) #endif @@ -186,6 +298,11 @@ // #define CFG_SSP0_SCKPIN_0_6 #endif + #ifdef CFG_BRD_LPC1343_REFDESIGN_MINIMAL + #define CFG_SSP0_SCKPIN_2_11 + // #define CFG_SSP0_SCKPIN_0_6 + #endif + #if defined CFG_BRD_LPC1343_TFTLCDSTANDALONE_USB || defined CFG_BRD_LPC1343_TFTLCDSTANDALONE_UART #define CFG_SSP0_SCKPIN_2_11 // #define CFG_SSP0_SCKPIN_0_6 @@ -215,6 +332,13 @@ #define CFG_LED_OFF (1) #endif + #ifdef CFG_BRD_LPC1343_REFDESIGN_MINIMAL + #define CFG_LED_PORT (2) + #define CFG_LED_PIN (10) + #define CFG_LED_ON (0) + #define CFG_LED_OFF (1) + #endif + #if defined CFG_BRD_LPC1343_TFTLCDSTANDALONE_USB || defined CFG_BRD_LPC1343_TFTLCDSTANDALONE_UART #define CFG_LED_PORT (2) #define CFG_LED_PIN (10) @@ -262,6 +386,13 @@ #define CFG_SDCARD_CDPIN (0) #endif + #ifdef CFG_BRD_LPC1343_REFDESIGN_MINIMAL + // #define CFG_SDCARD + #define CFG_SDCARD_READONLY (1) // Must be 0 or 1 + #define CFG_SDCARD_CDPORT (3) + #define CFG_SDCARD_CDPIN (0) + #endif + #if defined CFG_BRD_LPC1343_TFTLCDSTANDALONE_USB || defined CFG_BRD_LPC1343_TFTLCDSTANDALONE_UART #define CFG_SDCARD #define CFG_SDCARD_READONLY (1) // Must be 0 or 1 @@ -310,6 +441,14 @@ #define CFG_USBCDC_BUFFERSIZE (256) #endif + #ifdef CFG_BRD_LPC1343_REFDESIGN_MINIMAL + // #define CFG_USBHID + // #define CFG_USBCDC + #define CFG_USBCDC_BAUDRATE (115200) + #define CFG_USBCDC_INITTIMEOUT (5000) + #define CFG_USBCDC_BUFFERSIZE (256) + #endif + #ifdef CFG_BRD_LPC1343_TFTLCDSTANDALONE_USB // #define CFG_USBHID #define CFG_USBCDC @@ -321,7 +460,7 @@ #ifdef CFG_BRD_LPC1343_TFTLCDSTANDALONE_UART // #define CFG_USBHID // #define CFG_USBCDC - #define CFG_USBCDC_BAUDRATE (115200) + #define CFG_USBCDC_BAUDRATE (57600) #define CFG_USBCDC_INITTIMEOUT (5000) #define CFG_USBCDC_BUFFERSIZE (256) #endif @@ -348,20 +487,24 @@ "\n" for *nix Note: If no printf redirection definitions are present, all printf - output will be ignored, though this will also save ~350 bytes flash. - - NOTE: PRINTF Support = ~350 bytes Flash (-Os) + output will be ignored. -----------------------------------------------------------------------*/ #ifdef CFG_BRD_LPC1343_REFDESIGN // #define CFG_PRINTF_UART #define CFG_PRINTF_USBCDC - #define CFG_PRINTF_NEWLINE "\n" + #define CFG_PRINTF_NEWLINE "\r\n" + #endif + + #ifdef CFG_BRD_LPC1343_REFDESIGN_MINIMAL + #define CFG_PRINTF_UART + // #define CFG_PRINTF_USBCDC + #define CFG_PRINTF_NEWLINE "\r\n" #endif #ifdef CFG_BRD_LPC1343_TFTLCDSTANDALONE_USB // #define CFG_PRINTF_UART #define CFG_PRINTF_USBCDC - #define CFG_PRINTF_NEWLINE "\n" + #define CFG_PRINTF_NEWLINE "\r\n" #endif #ifdef CFG_BRD_LPC1343_TFTLCDSTANDALONE_UART @@ -373,7 +516,7 @@ #ifdef CFG_BRD_LPC1343_802154USBSTICK // #define CFG_PRINTF_UART #define CFG_PRINTF_USBCDC - #define CFG_PRINTF_NEWLINE "\n" + #define CFG_PRINTF_NEWLINE "\r\n" #endif /*=========================================================================*/ @@ -429,10 +572,23 @@ #define CFG_INTERFACE_MAXMSGSIZE (256) #define CFG_INTERFACE_PROMPT "LPC1343 >> " #define CFG_INTERFACE_SILENTMODE (0) - #define CFG_INTERFACE_DROPCR (1) + #define CFG_INTERFACE_DROPCR (0) #define CFG_INTERFACE_ENABLEIRQ (0) - #define CFG_INTERFACE_IRQPORT (2) - #define CFG_INTERFACE_IRQPIN (0) + #define CFG_INTERFACE_IRQPORT (0) + #define CFG_INTERFACE_IRQPIN (7) + #define CFG_INTERFACE_SHORTERRORS (0) + #define CFG_INTERFACE_CONFIRMREADY (0) + #endif + + #ifdef CFG_BRD_LPC1343_REFDESIGN_MINIMAL + // #define CFG_INTERFACE + #define CFG_INTERFACE_MAXMSGSIZE (256) + #define CFG_INTERFACE_PROMPT "LPC1343 >> " + #define CFG_INTERFACE_SILENTMODE (0) + #define CFG_INTERFACE_DROPCR (0) + #define CFG_INTERFACE_ENABLEIRQ (0) + #define CFG_INTERFACE_IRQPORT (0) + #define CFG_INTERFACE_IRQPIN (7) #define CFG_INTERFACE_SHORTERRORS (0) #define CFG_INTERFACE_CONFIRMREADY (0) #endif @@ -440,12 +596,12 @@ #ifdef CFG_BRD_LPC1343_TFTLCDSTANDALONE_USB #define CFG_INTERFACE #define CFG_INTERFACE_MAXMSGSIZE (256) - #define CFG_INTERFACE_PROMPT "LCD >> " + #define CFG_INTERFACE_PROMPT "CMD >> " #define CFG_INTERFACE_SILENTMODE (0) - #define CFG_INTERFACE_DROPCR (1) + #define CFG_INTERFACE_DROPCR (0) #define CFG_INTERFACE_ENABLEIRQ (0) - #define CFG_INTERFACE_IRQPORT (2) - #define CFG_INTERFACE_IRQPIN (0) + #define CFG_INTERFACE_IRQPORT (0) + #define CFG_INTERFACE_IRQPIN (7) #define CFG_INTERFACE_SHORTERRORS (0) #define CFG_INTERFACE_CONFIRMREADY (0) #define CFG_INTERFACE_SHORTERRORS_UNKNOWNCOMMAND "?" @@ -457,14 +613,14 @@ #ifdef CFG_BRD_LPC1343_TFTLCDSTANDALONE_UART #define CFG_INTERFACE #define CFG_INTERFACE_MAXMSGSIZE (256) - #define CFG_INTERFACE_PROMPT "LCD >> " + #define CFG_INTERFACE_PROMPT ">>" #define CFG_INTERFACE_SILENTMODE (1) #define CFG_INTERFACE_DROPCR (1) #define CFG_INTERFACE_ENABLEIRQ (1) - #define CFG_INTERFACE_IRQPORT (2) - #define CFG_INTERFACE_IRQPIN (0) + #define CFG_INTERFACE_IRQPORT (0) + #define CFG_INTERFACE_IRQPIN (7) #define CFG_INTERFACE_SHORTERRORS (1) - #define CFG_INTERFACE_CONFIRMREADY (1) + #define CFG_INTERFACE_CONFIRMREADY (0) #define CFG_INTERFACE_SHORTERRORS_UNKNOWNCOMMAND "?" #define CFG_INTERFACE_SHORTERRORS_TOOMANYARGS ">" #define CFG_INTERFACE_SHORTERRORS_TOOFEWARGS "<" @@ -476,10 +632,10 @@ #define CFG_INTERFACE_MAXMSGSIZE (256) #define CFG_INTERFACE_PROMPT "CMD >> " #define CFG_INTERFACE_SILENTMODE (0) - #define CFG_INTERFACE_DROPCR (1) + #define CFG_INTERFACE_DROPCR (0) #define CFG_INTERFACE_ENABLEIRQ (0) - #define CFG_INTERFACE_IRQPORT (2) - #define CFG_INTERFACE_IRQPIN (0) + #define CFG_INTERFACE_IRQPORT (0) + #define CFG_INTERFACE_IRQPIN (7) #define CFG_INTERFACE_SHORTERRORS (0) #define CFG_INTERFACE_CONFIRMREADY (0) #endif @@ -539,9 +695,14 @@ #define CFG_I2CEEPROM_SIZE (3072) #endif + #ifdef CFG_BRD_LPC1343_REFDESIGN_MINIMAL + // #define CFG_I2CEEPROM + #define CFG_I2CEEPROM_SIZE (3072) + #endif + #if defined CFG_BRD_LPC1343_TFTLCDSTANDALONE_USB || defined CFG_BRD_LPC1343_TFTLCDSTANDALONE_UART #define CFG_I2CEEPROM - #define CFG_I2CEEPROM_SIZE (4096) + #define CFG_I2CEEPROM_SIZE (3072) #endif #ifdef CFG_BRD_LPC1343_802154USBSTICK @@ -586,6 +747,7 @@ #define CFG_EEPROM_RESERVED (0x00FF) // Protect first 256 bytes of memory #define CFG_EEPROM_CHIBI_IEEEADDR (uint16_t)(0x0000) // 8 #define CFG_EEPROM_CHIBI_SHORTADDR (uint16_t)(0x0009) // 2 + #define CFG_EEPROM_UART_SPEED (uint16_t)(0x0020) // 4 #define CFG_EEPROM_TOUCHSCREEN_CALIBRATED (uint16_t)(0x0030) // 1 #define CFG_EEPROM_TOUCHSCREEN_CAL_AN (uint16_t)(0x0031) // 4 #define CFG_EEPROM_TOUCHSCREEN_CAL_BN (uint16_t)(0x0035) // 4 @@ -595,7 +757,6 @@ #define CFG_EEPROM_TOUCHSCREEN_CAL_FN (uint16_t)(0x0045) // 4 #define CFG_EEPROM_TOUCHSCREEN_CAL_DIVIDER (uint16_t)(0x0049) // 4 #define CFG_EEPROM_TOUCHSCREEN_THRESHHOLD (uint16_t)(0x004D) // 1 - #define CFG_EEPROM_UART_SPEED (uint16_t)(0x0020) // 4 /*=========================================================================*/ @@ -648,6 +809,16 @@ #define CFG_CHIBI_BUFFERSIZE (128) #endif + #ifdef CFG_BRD_LPC1343_REFDESIGN_MINIMAL + // #define CFG_CHIBI + #define CFG_CHIBI_MODE (0) // OQPSK_868MHZ + #define CFG_CHIBI_POWER (0xE9) // CHB_PWR_EU2_3DBM + #define CFG_CHIBI_CHANNEL (0) // 868-868.6 MHz + #define CFG_CHIBI_PANID (0x1234) + #define CFG_CHIBI_PROMISCUOUS (0) + #define CFG_CHIBI_BUFFERSIZE (128) + #endif + #if defined CFG_BRD_LPC1343_TFTLCDSTANDALONE_USB || defined CFG_BRD_LPC1343_TFTLCDSTANDALONE_UART // #define CFG_CHIBI #define CFG_CHIBI_MODE (0) // OQPSK_868MHZ @@ -710,6 +881,13 @@ #define CFG_TFTLCD_TS_KEYPADDELAY (100) #endif + #ifdef CFG_BRD_LPC1343_REFDESIGN_MINIMAL + // #define CFG_TFTLCD + #define CFG_TFTLCD_INCLUDESMALLFONTS (0) + #define CFG_TFTLCD_TS_DEFAULTTHRESHOLD (50) + #define CFG_TFTLCD_TS_KEYPADDELAY (100) + #endif + #if defined CFG_BRD_LPC1343_TFTLCDSTANDALONE_USB || defined CFG_BRD_LPC1343_TFTLCDSTANDALONE_UART #define CFG_TFTLCD #define CFG_TFTLCD_INCLUDESMALLFONTS (0) @@ -727,7 +905,7 @@ /*========================================================================= - 128x64 Graphic LCDs + Monochrome/Bitmap Graphic LCDs ----------------------------------------------------------------------- CFG_ST7565 If defined, this will cause drivers for @@ -735,15 +913,16 @@ CFG_SSD1306 If defined, this will cause drivers for the 128x64 pixel SSD1306 OLED display to be included - - Note: LPC1114 @ 36MHz and the ST7565 with the - backlight enabled consumes ~35mA + CFG_SHARPMEM If defined, this will cause drivers for + Sharp Memory Displays to be included DEPENDENCIES: ST7565 requires the use of pins 2.1-6. DEPENDENCIES: SSD1306 requires the use of pins 2.1-6. + DEPENDENCIES: SHARPMEM requires the use of pins 2.1-4. -----------------------------------------------------------------------*/ // #define CFG_ST7565 // #define CFG_SSD1306 + // #define CFG_SHARPMEM /*=========================================================================*/ @@ -779,8 +958,8 @@ =========================================================================*/ -#if !defined CFG_BRD_LPC1343_REFDESIGN && !defined CFG_BRD_LPC1343_TFTLCDSTANDALONE_USB && !defined CFG_BRD_LPC1343_TFTLCDSTANDALONE_UART && !defined CFG_BRD_LPC1343_802154USBSTICK - #error "You must defined a target board (CFG_BRD_LPC1343_REFDESIGN or CFG_BRD_LPC1343_TFTLCDSTANDALONE or CFG_BRD_LPC1343_TFTLCDSTANDALONE_UART or CFG_BRD_LPC1343_802154USBSTICK)" +#if !defined CFG_BRD_LPC1343_REFDESIGN && !defined CFG_BRD_LPC1343_REFDESIGN_MINIMAL && !defined CFG_BRD_LPC1343_TFTLCDSTANDALONE_USB && !defined CFG_BRD_LPC1343_TFTLCDSTANDALONE_UART && !defined CFG_BRD_LPC1343_802154USBSTICK + #error "You must defined a target board (CFG_BRD_LPC1343_REFDESIGN or CFG_BRD_LPC1343_REFDESIGN_MINIMAL or CFG_BRD_LPC1343_TFTLCDSTANDALONE or CFG_BRD_LPC1343_TFTLCDSTANDALONE_UART or CFG_BRD_LPC1343_802154USBSTICK)" #endif #if defined CFG_PRINTF_USBCDC && defined CFG_PRINTF_UART