From 0dab6926b30647e4c3bb1b56f39ccef761733ef5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20=27Morty=27=20Str=C3=BCbe?= Date: Mon, 1 Dec 2014 13:58:34 +0100 Subject: [PATCH] Move MAX, MIN and ABS to sys/cc.h --- apps/er-coap/er-coap-engine.c | 1 + apps/er-coap/er-coap-separate.c | 1 + apps/er-coap/er-coap.c | 1 + apps/er-coap/er-coap.h | 4 ---- apps/mqtt/mqtt.c | 3 +-- apps/rest-engine/rest-engine.h | 4 ---- apps/shell/shell-power.c | 1 + apps/shell/shell-sky.c | 3 +-- apps/shell/shell-tcpsend.c | 5 +---- apps/shell/shell-time.c | 6 +----- apps/telnetd/telnetd.c | 2 +- core/lib/settings.c | 4 ---- core/net/ip/tcp-socket.c | 2 +- core/net/ipv4/uip.c | 3 ++- core/net/ipv6/uip6.c | 2 +- core/net/mac/contikimac/contikimac.c | 4 ---- core/net/mac/cxmac/cxmac.c | 5 +---- core/net/rime/broadcast-announcement.c | 2 -- core/net/rime/ipolite.c | 9 +-------- core/net/rime/polite-announcement.c | 4 +--- core/net/rime/polite.c | 10 +--------- core/sys/cc.h | 13 +++++++++++++ cpu/avr/dev/usb/compiler.h | 3 --- cpu/cc26xx/dev/cc26xx-rf.c | 5 +---- cpu/rl78/adf7023/ADF7023.c | 4 +--- examples/cc26xx/cc26xx-web-demo/net-uart.c | 5 +---- .../resources/res-plugtest-large-update.c | 1 + examples/sky/sky-collect.c | 3 +-- examples/tcp-socket/tcp-server.c | 2 +- platform/avr-ravenlcd/lcd.c | 2 +- platform/avr-ravenusb/cdc_task.c | 5 +++-- platform/cooja/contiki-cooja-main.c | 3 +-- platform/exp5438/hal_lcd.h | 12 ------------ 33 files changed, 41 insertions(+), 93 deletions(-) diff --git a/apps/er-coap/er-coap-engine.c b/apps/er-coap/er-coap-engine.c index 76a230545..4871368b4 100644 --- a/apps/er-coap/er-coap-engine.c +++ b/apps/er-coap/er-coap-engine.c @@ -36,6 +36,7 @@ * Matthias Kovatsch */ +#include "sys/cc.h" #include #include #include diff --git a/apps/er-coap/er-coap-separate.c b/apps/er-coap/er-coap-separate.c index d35566d79..5e2242b9c 100644 --- a/apps/er-coap/er-coap-separate.c +++ b/apps/er-coap/er-coap-separate.c @@ -36,6 +36,7 @@ * Matthias Kovatsch */ +#include "sys/cc.h" #include #include #include "er-coap-separate.h" diff --git a/apps/er-coap/er-coap.c b/apps/er-coap/er-coap.c index f73b04186..34c671623 100644 --- a/apps/er-coap/er-coap.c +++ b/apps/er-coap/er-coap.c @@ -39,6 +39,7 @@ #include #include #include "contiki.h" +#include "sys/cc.h" #include "contiki-net.h" #include "er-coap.h" diff --git a/apps/er-coap/er-coap.h b/apps/er-coap/er-coap.h index 48f6e4b4a..69ea8b363 100644 --- a/apps/er-coap/er-coap.h +++ b/apps/er-coap/er-coap.h @@ -79,10 +79,6 @@ enum { OPTION_MAP_SIZE = sizeof(uint8_t) * 8 }; #define SET_OPTION(packet, opt) ((packet)->options[opt / OPTION_MAP_SIZE] |= 1 << (opt % OPTION_MAP_SIZE)) #define IS_OPTION(packet, opt) ((packet)->options[opt / OPTION_MAP_SIZE] & (1 << (opt % OPTION_MAP_SIZE))) -#ifndef MIN -#define MIN(a, b) ((a) < (b) ? (a) : (b)) -#endif /* MIN */ - /* parsed message struct */ typedef struct { uint8_t *buffer; /* pointer to CoAP header / incoming packet buffer / memory to serialize packet */ diff --git a/apps/mqtt/mqtt.c b/apps/mqtt/mqtt.c index 112c584cb..f56df3a16 100644 --- a/apps/mqtt/mqtt.c +++ b/apps/mqtt/mqtt.c @@ -57,13 +57,12 @@ #include "lib/assert.h" #include "lib/list.h" +#include "sys/cc.h" #include #include #include /*---------------------------------------------------------------------------*/ -#define MIN(a, b) ((a) < (b) ? (a) : (b)) -/*---------------------------------------------------------------------------*/ #define DEBUG 0 #if DEBUG #define PRINTF(...) PRINTF(__VA_ARGS__) diff --git a/apps/rest-engine/rest-engine.h b/apps/rest-engine/rest-engine.h index 3a2848f58..41e181c33 100644 --- a/apps/rest-engine/rest-engine.h +++ b/apps/rest-engine/rest-engine.h @@ -62,10 +62,6 @@ #define REST_MAX_CHUNK_SIZE 64 #endif -#ifndef MIN -#define MIN(a, b) ((a) < (b) ? (a) : (b)) -#endif /* MIN */ - struct resource_s; struct periodic_resource_s; diff --git a/apps/shell/shell-power.c b/apps/shell/shell-power.c index c4414c9a1..0e5cb0aed 100644 --- a/apps/shell/shell-power.c +++ b/apps/shell/shell-power.c @@ -42,6 +42,7 @@ #include "sys/energest.h" #include +#include "sys/cc.h" struct power_msg { uint16_t len; diff --git a/apps/shell/shell-sky.c b/apps/shell/shell-sky.c index 65c4859ed..a25b15957 100644 --- a/apps/shell/shell-sky.c +++ b/apps/shell/shell-sky.c @@ -38,6 +38,7 @@ */ #include "contiki.h" +#include "sys/cc.h" #include "shell-sky.h" #include "dev/watchdog.h" @@ -84,8 +85,6 @@ SHELL_COMMAND(rfchannel_command, "rfchannel : change CC2420 radio channel (11 - 26)", &shell_rfchannel_process); /*---------------------------------------------------------------------------*/ -#define MAX(a, b) ((a) > (b)? (a): (b)) -#define MIN(a, b) ((a) < (b)? (a): (b)) struct spectrum { int channel[16]; }; diff --git a/apps/shell/shell-tcpsend.c b/apps/shell/shell-tcpsend.c index 923cda181..7ef93b671 100644 --- a/apps/shell/shell-tcpsend.c +++ b/apps/shell/shell-tcpsend.c @@ -36,13 +36,10 @@ #include #include "contiki.h" +#include "sys/cc.h" #include "shell.h" #include "telnet.h" -#ifndef MIN -#define MIN(a, b) ((a) < (b)? (a) : (b)) -#endif /* MIN */ - /*---------------------------------------------------------------------------*/ PROCESS(shell_tcpsend_process, "tcpsend"); SHELL_COMMAND(tcpsend_command, diff --git a/apps/shell/shell-time.c b/apps/shell/shell-time.c index 0c3ac03c1..fb2b7e7f1 100644 --- a/apps/shell/shell-time.c +++ b/apps/shell/shell-time.c @@ -38,6 +38,7 @@ */ #include "contiki.h" +#include "sys/cc.h" #include "shell-time.h" #include "sys/clock.h" @@ -51,11 +52,6 @@ #define MAX_COMMANDLENGTH 64 #define PERIOD_INTERVAL 60 -#ifndef MIN -#define MIN(a, b) ((a) < (b)? (a) : (b)) -#endif /* MIN */ - - /*---------------------------------------------------------------------------*/ PROCESS(shell_time_process, "time"); SHELL_COMMAND(time_command, diff --git a/apps/telnetd/telnetd.c b/apps/telnetd/telnetd.c index 95786442b..c168b19b8 100644 --- a/apps/telnetd/telnetd.c +++ b/apps/telnetd/telnetd.c @@ -33,6 +33,7 @@ #include +#include "sys/cc.h" #include "contiki-lib.h" #include "contiki-net.h" #include "lib/petsciiconv.h" @@ -103,7 +104,6 @@ static uint8_t connected; #define MAX_SILENCE_TIME (CLOCK_SECOND * 30) -#define MIN(a, b) ((a) < (b)? (a): (b)) /*---------------------------------------------------------------------------*/ static void buf_init(struct telnetd_buf *buf) diff --git a/core/lib/settings.c b/core/lib/settings.c index b085f7219..1b97b28b5 100644 --- a/core/lib/settings.c +++ b/core/lib/settings.c @@ -65,10 +65,6 @@ #define SETTINGS_BOTTOM_ADDR (SETTINGS_TOP_ADDR + 1 - SETTINGS_MAX_SIZE) #endif -#ifndef MIN -#define MIN(a,b) ((a)<(b)?a:b) -#endif - typedef struct { #if SETTINGS_CONF_SUPPORT_LARGE_VALUES uint8_t size_extra; diff --git a/core/net/ip/tcp-socket.c b/core/net/ip/tcp-socket.c index 285be2768..eac008cde 100644 --- a/core/net/ip/tcp-socket.c +++ b/core/net/ip/tcp-socket.c @@ -30,6 +30,7 @@ */ #include "contiki.h" +#include "sys/cc.h" #include "contiki-net.h" #include "lib/list.h" @@ -39,7 +40,6 @@ #include #include -#define MIN(a, b) ((a) < (b) ? (a) : (b)) static void relisten(struct tcp_socket *s); diff --git a/core/net/ipv4/uip.c b/core/net/ipv4/uip.c index 9668d1f2b..1c3c24aaf 100644 --- a/core/net/ipv4/uip.c +++ b/core/net/ipv4/uip.c @@ -78,6 +78,8 @@ #include "net/ipv4/uip-neighbor.h" #include +#include "sys/cc.h" + /*---------------------------------------------------------------------------*/ /* Variable definitions. */ @@ -1953,7 +1955,6 @@ void uip_send(const void *data, int len) { int copylen; -#define MIN(a,b) ((a) < (b)? (a): (b)) copylen = MIN(len, UIP_BUFSIZE - UIP_LLH_LEN - UIP_TCPIP_HLEN - (int)((char *)uip_sappdata - (char *)&uip_buf[UIP_LLH_LEN + UIP_TCPIP_HLEN])); if(copylen > 0) { diff --git a/core/net/ipv6/uip6.c b/core/net/ipv6/uip6.c index c88822fbf..73abd1115 100644 --- a/core/net/ipv6/uip6.c +++ b/core/net/ipv6/uip6.c @@ -71,6 +71,7 @@ * the packet back to the peer. */ +#include "sys/cc.h" #include "net/ip/uip.h" #include "net/ip/uipopt.h" #include "net/ipv6/uip-icmp6.h" @@ -2332,7 +2333,6 @@ void uip_send(const void *data, int len) { int copylen; -#define MIN(a,b) ((a) < (b)? (a): (b)) if(uip_sappdata != NULL) { copylen = MIN(len, UIP_BUFSIZE - UIP_LLH_LEN - UIP_TCPIP_HLEN - diff --git a/core/net/mac/contikimac/contikimac.c b/core/net/mac/contikimac/contikimac.c index 32cc65bbf..7aea60928 100644 --- a/core/net/mac/contikimac/contikimac.c +++ b/core/net/mac/contikimac/contikimac.c @@ -229,10 +229,6 @@ static struct compower_activity current_packet; #define DEFAULT_STREAM_TIME (4 * CYCLE_TIME) -#ifndef MIN -#define MIN(a, b) ((a) < (b)? (a) : (b)) -#endif /* MIN */ - #if CONTIKIMAC_CONF_BROADCAST_RATE_LIMIT static struct timer broadcast_rate_timer; static int broadcast_rate_counter; diff --git a/core/net/mac/cxmac/cxmac.c b/core/net/mac/cxmac/cxmac.c index 770a5c19d..e07fde3d9 100644 --- a/core/net/mac/cxmac/cxmac.c +++ b/core/net/mac/cxmac/cxmac.c @@ -52,6 +52,7 @@ #include "sys/rtimer.h" #include "contiki-conf.h" +#include "sys/cc.h" #ifdef EXPERIMENT_SETUP #include "experiment-setup.h" @@ -215,10 +216,6 @@ static linkaddr_t is_streaming_to, is_streaming_to_too; static rtimer_clock_t stream_until; #define DEFAULT_STREAM_TIME (RTIMER_ARCH_SECOND) -#ifndef MIN -#define MIN(a, b) ((a) < (b)? (a) : (b)) -#endif /* MIN */ - /*---------------------------------------------------------------------------*/ static void on(void) diff --git a/core/net/rime/broadcast-announcement.c b/core/net/rime/broadcast-announcement.c index b865c507b..945d0a78d 100644 --- a/core/net/rime/broadcast-announcement.c +++ b/core/net/rime/broadcast-announcement.c @@ -92,8 +92,6 @@ static struct broadcast_announcement_state { #define PRINTF(...) #endif -#define MIN(a, b) ((a)<(b)?(a):(b)) - /*---------------------------------------------------------------------------*/ static void send_adv(void *ptr) diff --git a/core/net/rime/ipolite.c b/core/net/rime/ipolite.c index d667a0714..11fbd6b17 100644 --- a/core/net/rime/ipolite.c +++ b/core/net/rime/ipolite.c @@ -42,20 +42,13 @@ * @{ */ +#include "sys/cc.h" #include "net/rime/rime.h" #include "net/rime/ipolite.h" #include "lib/random.h" #include -#ifndef MAX -#define MAX(a, b) ((a) > (b)? (a) : (b)) -#endif /* MAX */ - -#ifndef MIN -#define MIN(a, b) ((a) < (b)? (a) : (b)) -#endif /* MIN */ - #define DEBUG 0 #if DEBUG #include diff --git a/core/net/rime/polite-announcement.c b/core/net/rime/polite-announcement.c index 1383eaf43..d678931d8 100644 --- a/core/net/rime/polite-announcement.c +++ b/core/net/rime/polite-announcement.c @@ -43,7 +43,7 @@ */ #include "contiki.h" - +#include "sys/cc.h" #include "lib/list.h" #include "net/rime/rime.h" #include "net/rime/announcement.h" @@ -90,8 +90,6 @@ static struct polite_announcement_state { #define PRINTF(...) #endif -#define MIN(a, b) ((a)<(b)?(a):(b)) - /*---------------------------------------------------------------------------*/ static void send_adv(clock_time_t interval) diff --git a/core/net/rime/polite.c b/core/net/rime/polite.c index 531ae6228..6d0afed9b 100644 --- a/core/net/rime/polite.c +++ b/core/net/rime/polite.c @@ -42,21 +42,13 @@ * @{ */ +#include "sys/cc.h" #include "net/rime/rime.h" #include "net/rime/polite.h" #include "lib/random.h" #include -#ifndef MAX -#define MAX(a,b) ((a) > (b)? (a) : (b)) -#endif /* MAX */ - -#ifndef MIN -#define MIN(a, b) ((a) < (b)? (a) : (b)) -#endif /* MIN */ - - /*---------------------------------------------------------------------------*/ static void recv(struct abc_conn *abc) diff --git a/core/sys/cc.h b/core/sys/cc.h index 90ef3e710..9416ea090 100644 --- a/core/sys/cc.h +++ b/core/sys/cc.h @@ -127,6 +127,19 @@ #define NULL 0 #endif /* NULL */ +#ifndef MAX +#define MAX(n, m) (((n) < (m)) ? (m) : (n)) +#endif + +#ifndef MIN +#define MIN(n, m) (((n) < (m)) ? (n) : (m)) +#endif + +#ifndef ABS +#define ABS(n) (((n) < 0) ? -(n) : (n)) +#endif + + #define CC_CONCAT2(s1, s2) s1##s2 /** * A C preprocessing macro for concatenating to diff --git a/cpu/avr/dev/usb/compiler.h b/cpu/avr/dev/usb/compiler.h index aaa9f1ede..50a02a92d 100644 --- a/cpu/avr/dev/usb/compiler.h +++ b/cpu/avr/dev/usb/compiler.h @@ -280,9 +280,6 @@ typedef char r_uart_ptchar; #define OUT_X(addrx,value) (*addrx = value) #define IN_X(addrx) (*addrx) -# define Max(a, b) ( (a)>(b) ? (a) : (b) ) // Take the max between a and b -# define Min(a, b) ( (a)<(b) ? (a) : (b) ) // Take the min between a and b - // Align on the upper value on a boundary // i.e. Upper(0, 4)= 4 // Upper(1, 4)= 4 diff --git a/cpu/cc26xx/dev/cc26xx-rf.c b/cpu/cc26xx/dev/cc26xx-rf.c index f7b28b4e1..45eb9adad 100644 --- a/cpu/cc26xx/dev/cc26xx-rf.c +++ b/cpu/cc26xx/dev/cc26xx-rf.c @@ -46,6 +46,7 @@ #include "sys/energest.h" #include "sys/clock.h" #include "sys/rtimer.h" +#include "sys/cc.h" #include "lpm.h" #include "ti-lib.h" /*---------------------------------------------------------------------------*/ @@ -76,10 +77,6 @@ while(!(cond) && RTIMER_CLOCK_LT(RTIMER_NOW(), t0 + (max_time))); \ } while(0) /*---------------------------------------------------------------------------*/ -#ifndef MIN -#define MIN(n, m) (((n) < (m)) ? (n) : (m)) -#endif -/*---------------------------------------------------------------------------*/ #ifdef __GNUC__ #define CC_ALIGN_ATTR(n) __attribute__ ((aligned(n))) #else diff --git a/cpu/rl78/adf7023/ADF7023.c b/cpu/rl78/adf7023/ADF7023.c index c8f30be38..a82c1638d 100644 --- a/cpu/rl78/adf7023/ADF7023.c +++ b/cpu/rl78/adf7023/ADF7023.c @@ -45,6 +45,7 @@ #include "sfrs-ext.h" #include "contiki.h" /* for clock_wait() and CLOCK_SECOND. */ +#include "sys/cc.h" /******************************************************************************/ /*************************** Macros Definitions *******************************/ @@ -91,9 +92,6 @@ while(condition) { body; break_loop(); } \ } while(0) -#undef MIN -#define MIN(x, y) (((x) < (y)) ? (x) : (y)) - /******************************************************************************/ /************************ Variables Definitions *******************************/ /******************************************************************************/ diff --git a/examples/cc26xx/cc26xx-web-demo/net-uart.c b/examples/cc26xx/cc26xx-web-demo/net-uart.c index 96463aee0..043a50cf1 100644 --- a/examples/cc26xx/cc26xx-web-demo/net-uart.c +++ b/examples/cc26xx/cc26xx-web-demo/net-uart.c @@ -65,6 +65,7 @@ #include "lpm.h" #include "net-uart.h" #include "httpd-simple.h" +#include "sys/cc.h" #include "ti-lib.h" @@ -86,10 +87,6 @@ #define ADDRESS_CONVERSION_OK 1 #define ADDRESS_CONVERSION_ERROR 0 /*---------------------------------------------------------------------------*/ -#ifndef MIN -#define MIN(n, m) (((n) < (m)) ? (n) : (m)) -#endif -/*---------------------------------------------------------------------------*/ static struct uip_udp_conn *udp_conn = NULL; static uint8_t buffer[MAX_MSG_SIZE]; diff --git a/examples/er-rest-example/resources/res-plugtest-large-update.c b/examples/er-rest-example/resources/res-plugtest-large-update.c index e48d08b5f..12c7d1e9f 100644 --- a/examples/er-rest-example/resources/res-plugtest-large-update.c +++ b/examples/er-rest-example/resources/res-plugtest-large-update.c @@ -37,6 +37,7 @@ */ #include +#include "sys/cc.h" #include "rest-engine.h" #include "er-coap.h" #include "er-plugtest.h" diff --git a/examples/sky/sky-collect.c b/examples/sky/sky-collect.c index d49dc8184..04cedf696 100644 --- a/examples/sky/sky-collect.c +++ b/examples/sky/sky-collect.c @@ -38,6 +38,7 @@ */ #include "contiki.h" +#include "sys/cc.h" #include "net/netstack.h" #include "net/rime/rime.h" #include "net/rime/collect.h" @@ -120,8 +121,6 @@ PROCESS_THREAD(depth_blink_process, ev, data) PROCESS_END(); } /*---------------------------------------------------------------------------*/ -#define MAX(a, b) ((a) > (b)? (a): (b)) -#define MIN(a, b) ((a) < (b)? (a): (b)) struct spectrum { int channel[16]; }; diff --git a/examples/tcp-socket/tcp-server.c b/examples/tcp-socket/tcp-server.c index f2e776784..e25d65579 100644 --- a/examples/tcp-socket/tcp-server.c +++ b/examples/tcp-socket/tcp-server.c @@ -30,6 +30,7 @@ */ #include "contiki-net.h" +#include "sys/cc.h" #include #include @@ -104,7 +105,6 @@ PROCESS_THREAD(tcp_server_process, ev, data) while(bytes_to_send > 0) { PROCESS_PAUSE(); int len, tosend; -#define MIN(a,b) ((a)<(b)?(a):(b)) tosend = MIN(bytes_to_send, sizeof(outputbuf)); len = tcp_socket_send(&socket, (uint8_t *)"", tosend); bytes_to_send -= len; diff --git a/platform/avr-ravenlcd/lcd.c b/platform/avr-ravenlcd/lcd.c index 0fe92b80a..3c4f9e230 100644 --- a/platform/avr-ravenlcd/lcd.c +++ b/platform/avr-ravenlcd/lcd.c @@ -411,7 +411,7 @@ lcd_num_putdec(int numb, lcd_padding_t padding) } /* Convert to BCD */ - bcd = itobcd(abs(numb)); + bcd = itobcd(ABS(numb)); /* Print */ return lcd_num_print(bcd, (bool)(numb<0), padding); diff --git a/platform/avr-ravenusb/cdc_task.c b/platform/avr-ravenusb/cdc_task.c index eb2ef3d8b..64af3741e 100644 --- a/platform/avr-ravenusb/cdc_task.c +++ b/platform/avr-ravenusb/cdc_task.c @@ -48,6 +48,7 @@ #include "contiki.h" +#include "sys/cc.h" #include "usb_drv.h" #include "usb_descriptors.h" #include "usb_specific_request.h" @@ -753,7 +754,7 @@ uint16_t p=(uint16_t)&__bss_end; radio_get_rssi_value(&RSSI); RSSI*=3; #endif - maxRSSI[i-11]=Max(maxRSSI[i-11],RSSI); + maxRSSI[i-11]=MAX(maxRSSI[i-11],RSSI); accRSSI[i-11]+=RSSI; } if(j&(1<<7)) { @@ -774,7 +775,7 @@ uint16_t p=(uint16_t)&__bss_end; #endif PRINTF_P(PSTR("\n")); for(i=11;i<=26;i++) { - uint8_t activity=Min(maxRSSI[i-11],accRSSI[i-11]/(1<<7)); + uint8_t activity=MIN(maxRSSI[i-11],accRSSI[i-11]/(1<<7)); PRINTF_P(PSTR(" %d: %02ddB "),i, -91+(maxRSSI[i-11]-1)); for(;activity--;maxRSSI[i-11]--) { PRINTF_P(PSTR("#")); diff --git a/platform/cooja/contiki-cooja-main.c b/platform/cooja/contiki-cooja-main.c index 084c605cc..eddfe1adf 100644 --- a/platform/cooja/contiki-cooja-main.c +++ b/platform/cooja/contiki-cooja-main.c @@ -40,6 +40,7 @@ #include #include "contiki.h" +#include "sys/cc.h" #include "sys/clock.h" #include "sys/etimer.h" @@ -136,8 +137,6 @@ long referenceVar; static struct cooja_mt_thread rtimer_thread; static struct cooja_mt_thread process_run_thread; -#define MIN(a, b) ( (a)<(b) ? (a) : (b) ) - /*---------------------------------------------------------------------------*/ #if NETSTACK_CONF_WITH_IPV4 static void diff --git a/platform/exp5438/hal_lcd.h b/platform/exp5438/hal_lcd.h index 5d76c6c6a..6842c4952 100644 --- a/platform/exp5438/hal_lcd.h +++ b/platform/exp5438/hal_lcd.h @@ -37,18 +37,6 @@ #ifndef HAL_LCD_H #define HAL_LCD_H -#ifndef MIN -# define MIN(n, m) (((n) < (m)) ? (n) : (m)) -#endif - -#ifndef MAX -# define MAX(n, m) (((n) < (m)) ? (m) : (n)) -#endif - -#ifndef ABS -# define ABS(n) (((n) < 0) ? -(n) : (n)) -#endif - #define LCD_BACKLT_OUT P8OUT #define LCD_BACKLT_DIR P8DIR #define LCD_BACKLT_SEL P8SEL