These are the examples provided for [[/users/frank26080115/libraries/LPC1700CMSIS_Lib/]] Note, the entire "program" is not compilable!
CAN/CAN_LedControl/can_ledcontrol.c@0:bf7b9fba3924, 2011-03-20 (annotated)
- Committer:
- frank26080115
- Date:
- Sun Mar 20 05:38:56 2011 +0000
- Revision:
- 0:bf7b9fba3924
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
frank26080115 | 0:bf7b9fba3924 | 1 | /***********************************************************************//** |
frank26080115 | 0:bf7b9fba3924 | 2 | * @file can_ledcontrol.c |
frank26080115 | 0:bf7b9fba3924 | 3 | * @purpose This example used to test Bypass mode |
frank26080115 | 0:bf7b9fba3924 | 4 | * @version 1.0 |
frank26080115 | 0:bf7b9fba3924 | 5 | * @date 16. July. 2010 |
frank26080115 | 0:bf7b9fba3924 | 6 | * @author NXP MCU SW Application Team |
frank26080115 | 0:bf7b9fba3924 | 7 | *--------------------------------------------------------------------- |
frank26080115 | 0:bf7b9fba3924 | 8 | * Software that is described herein is for illustrative purposes only |
frank26080115 | 0:bf7b9fba3924 | 9 | * which provides customers with programming information regarding the |
frank26080115 | 0:bf7b9fba3924 | 10 | * products. This software is supplied "AS IS" without any warranties. |
frank26080115 | 0:bf7b9fba3924 | 11 | * NXP Semiconductors assumes no responsibility or liability for the |
frank26080115 | 0:bf7b9fba3924 | 12 | * use of the software, conveys no license or title under any patent, |
frank26080115 | 0:bf7b9fba3924 | 13 | * copyright, or mask work right to the product. NXP Semiconductors |
frank26080115 | 0:bf7b9fba3924 | 14 | * reserves the right to make changes in the software without |
frank26080115 | 0:bf7b9fba3924 | 15 | * notification. NXP Semiconductors also make no representation or |
frank26080115 | 0:bf7b9fba3924 | 16 | * warranty that such application will be suitable for the specified |
frank26080115 | 0:bf7b9fba3924 | 17 | * use without further testing or modification. |
frank26080115 | 0:bf7b9fba3924 | 18 | **********************************************************************/ |
frank26080115 | 0:bf7b9fba3924 | 19 | #include "lpc17xx_can.h" |
frank26080115 | 0:bf7b9fba3924 | 20 | #include "lpc17xx_libcfg.h" |
frank26080115 | 0:bf7b9fba3924 | 21 | #include "lpc17xx_pinsel.h" |
frank26080115 | 0:bf7b9fba3924 | 22 | #include "debug_frmwrk.h" |
frank26080115 | 0:bf7b9fba3924 | 23 | #include "lpc17xx_gpio.h" |
frank26080115 | 0:bf7b9fba3924 | 24 | |
frank26080115 | 0:bf7b9fba3924 | 25 | /* Example group ----------------------------------------------------------- */ |
frank26080115 | 0:bf7b9fba3924 | 26 | /** @defgroup CAN_LedControl CAN_LedControl |
frank26080115 | 0:bf7b9fba3924 | 27 | * @ingroup CAN_Examples |
frank26080115 | 0:bf7b9fba3924 | 28 | * @{ |
frank26080115 | 0:bf7b9fba3924 | 29 | */ |
frank26080115 | 0:bf7b9fba3924 | 30 | |
frank26080115 | 0:bf7b9fba3924 | 31 | /************************** PRIVATE VARIABLES *************************/ |
frank26080115 | 0:bf7b9fba3924 | 32 | uint8_t menu[]= |
frank26080115 | 0:bf7b9fba3924 | 33 | "*******************************************************************************\n\r" |
frank26080115 | 0:bf7b9fba3924 | 34 | "Hello NXP Semiconductors \n\r" |
frank26080115 | 0:bf7b9fba3924 | 35 | "CAN demo \n\r" |
frank26080115 | 0:bf7b9fba3924 | 36 | "\t - MCU: LPC17xx \n\r" |
frank26080115 | 0:bf7b9fba3924 | 37 | "\t - Core: ARM CORTEX-M3 \n\r" |
frank26080115 | 0:bf7b9fba3924 | 38 | "\t - Communicate via: UART0 - 115200 bps \n\r" |
frank26080115 | 0:bf7b9fba3924 | 39 | "Use two CAN peripherals: CAN1 and CAN2 to communicate\n\r" |
frank26080115 | 0:bf7b9fba3924 | 40 | "Use CAN frames to control LED display\n\r" |
frank26080115 | 0:bf7b9fba3924 | 41 | "*******************************************************************************\n\r"; |
frank26080115 | 0:bf7b9fba3924 | 42 | |
frank26080115 | 0:bf7b9fba3924 | 43 | /** CAN variable definition **/ |
frank26080115 | 0:bf7b9fba3924 | 44 | CAN_MSG_Type TXMsg, RXMsg; // messages for test Bypass mode |
frank26080115 | 0:bf7b9fba3924 | 45 | uint8_t LED_Value; |
frank26080115 | 0:bf7b9fba3924 | 46 | uint32_t LED[8] = {(1<<6),(1<<5),(1<<4),(1<<3),(1<<2),(1<<31),(1<<29),(1<<28)}; |
frank26080115 | 0:bf7b9fba3924 | 47 | |
frank26080115 | 0:bf7b9fba3924 | 48 | /************************** PRIVATE FUNCTIONS *************************/ |
frank26080115 | 0:bf7b9fba3924 | 49 | void CAN_IRQHandler(void); |
frank26080115 | 0:bf7b9fba3924 | 50 | |
frank26080115 | 0:bf7b9fba3924 | 51 | void CAN_InitMessage(void); |
frank26080115 | 0:bf7b9fba3924 | 52 | void print_menu(); |
frank26080115 | 0:bf7b9fba3924 | 53 | |
frank26080115 | 0:bf7b9fba3924 | 54 | /*----------------- INTERRUPT SERVICE ROUTINES --------------------------*/ |
frank26080115 | 0:bf7b9fba3924 | 55 | /*********************************************************************//** |
frank26080115 | 0:bf7b9fba3924 | 56 | * @brief CAN_IRQ Handler, control receive message operation |
frank26080115 | 0:bf7b9fba3924 | 57 | * param[in] none |
frank26080115 | 0:bf7b9fba3924 | 58 | * @return none |
frank26080115 | 0:bf7b9fba3924 | 59 | **********************************************************************/ |
frank26080115 | 0:bf7b9fba3924 | 60 | void CAN_IRQHandler() |
frank26080115 | 0:bf7b9fba3924 | 61 | { |
frank26080115 | 0:bf7b9fba3924 | 62 | uint8_t IntStatus; |
frank26080115 | 0:bf7b9fba3924 | 63 | uint32_t data,i; |
frank26080115 | 0:bf7b9fba3924 | 64 | /* get interrupt status |
frank26080115 | 0:bf7b9fba3924 | 65 | * Note that: Interrupt register CANICR will be reset after read. |
frank26080115 | 0:bf7b9fba3924 | 66 | * So function "CAN_IntGetStatus" should be call only one time |
frank26080115 | 0:bf7b9fba3924 | 67 | */ |
frank26080115 | 0:bf7b9fba3924 | 68 | IntStatus = CAN_IntGetStatus(LPC_CAN2); |
frank26080115 | 0:bf7b9fba3924 | 69 | //check receive interrupt |
frank26080115 | 0:bf7b9fba3924 | 70 | if((IntStatus>>0)&0x01) |
frank26080115 | 0:bf7b9fba3924 | 71 | { |
frank26080115 | 0:bf7b9fba3924 | 72 | CAN_ReceiveMsg(LPC_CAN2,&RXMsg); |
frank26080115 | 0:bf7b9fba3924 | 73 | data = RXMsg.dataA[0]; |
frank26080115 | 0:bf7b9fba3924 | 74 | for(i=0;i<8;i++) |
frank26080115 | 0:bf7b9fba3924 | 75 | { |
frank26080115 | 0:bf7b9fba3924 | 76 | if ((data >> i)&0x01) |
frank26080115 | 0:bf7b9fba3924 | 77 | { |
frank26080115 | 0:bf7b9fba3924 | 78 | if(i<5) |
frank26080115 | 0:bf7b9fba3924 | 79 | GPIO_SetValue(2,LED[i]); |
frank26080115 | 0:bf7b9fba3924 | 80 | else |
frank26080115 | 0:bf7b9fba3924 | 81 | GPIO_SetValue(1,LED[i]); |
frank26080115 | 0:bf7b9fba3924 | 82 | } |
frank26080115 | 0:bf7b9fba3924 | 83 | else |
frank26080115 | 0:bf7b9fba3924 | 84 | { |
frank26080115 | 0:bf7b9fba3924 | 85 | if(i<5) |
frank26080115 | 0:bf7b9fba3924 | 86 | GPIO_ClearValue(2,LED[i]); |
frank26080115 | 0:bf7b9fba3924 | 87 | else |
frank26080115 | 0:bf7b9fba3924 | 88 | GPIO_ClearValue(1,LED[i]); |
frank26080115 | 0:bf7b9fba3924 | 89 | } |
frank26080115 | 0:bf7b9fba3924 | 90 | } |
frank26080115 | 0:bf7b9fba3924 | 91 | |
frank26080115 | 0:bf7b9fba3924 | 92 | } |
frank26080115 | 0:bf7b9fba3924 | 93 | } |
frank26080115 | 0:bf7b9fba3924 | 94 | |
frank26080115 | 0:bf7b9fba3924 | 95 | /*-------------------------PRIVATE FUNCTIONS----------------------------*/ |
frank26080115 | 0:bf7b9fba3924 | 96 | /*********************************************************************//** |
frank26080115 | 0:bf7b9fba3924 | 97 | * @brief Initialize transmit and receive message for Bypass operation |
frank26080115 | 0:bf7b9fba3924 | 98 | * @param[in] none |
frank26080115 | 0:bf7b9fba3924 | 99 | * @return none |
frank26080115 | 0:bf7b9fba3924 | 100 | **********************************************************************/ |
frank26080115 | 0:bf7b9fba3924 | 101 | void CAN_InitMessage(void) { |
frank26080115 | 0:bf7b9fba3924 | 102 | TXMsg.format = EXT_ID_FORMAT; |
frank26080115 | 0:bf7b9fba3924 | 103 | TXMsg.id = 0x00001234; |
frank26080115 | 0:bf7b9fba3924 | 104 | TXMsg.len = 8; |
frank26080115 | 0:bf7b9fba3924 | 105 | TXMsg.type = DATA_FRAME; |
frank26080115 | 0:bf7b9fba3924 | 106 | TXMsg.dataA[0] = TXMsg.dataA[1] = TXMsg.dataA[2] = TXMsg.dataA[3] = 0x00000000; |
frank26080115 | 0:bf7b9fba3924 | 107 | TXMsg.dataB[0] = TXMsg.dataB[1] = TXMsg.dataB[2] = TXMsg.dataB[3] = 0x00000000; |
frank26080115 | 0:bf7b9fba3924 | 108 | |
frank26080115 | 0:bf7b9fba3924 | 109 | RXMsg.format = 0x00; |
frank26080115 | 0:bf7b9fba3924 | 110 | RXMsg.id = 0x00; |
frank26080115 | 0:bf7b9fba3924 | 111 | RXMsg.len = 0x00; |
frank26080115 | 0:bf7b9fba3924 | 112 | RXMsg.type = 0x00; |
frank26080115 | 0:bf7b9fba3924 | 113 | RXMsg.dataA[0] = RXMsg.dataA[1] = RXMsg.dataA[2] = RXMsg.dataA[3] = 0x00000000; |
frank26080115 | 0:bf7b9fba3924 | 114 | RXMsg.dataB[0] = RXMsg.dataB[1] = RXMsg.dataB[2] = RXMsg.dataB[3] = 0x00000000; |
frank26080115 | 0:bf7b9fba3924 | 115 | } |
frank26080115 | 0:bf7b9fba3924 | 116 | |
frank26080115 | 0:bf7b9fba3924 | 117 | /*********************************************************************//** |
frank26080115 | 0:bf7b9fba3924 | 118 | * @brief print menu |
frank26080115 | 0:bf7b9fba3924 | 119 | * @param[in] none |
frank26080115 | 0:bf7b9fba3924 | 120 | * @return none |
frank26080115 | 0:bf7b9fba3924 | 121 | **********************************************************************/ |
frank26080115 | 0:bf7b9fba3924 | 122 | void print_menu() |
frank26080115 | 0:bf7b9fba3924 | 123 | { |
frank26080115 | 0:bf7b9fba3924 | 124 | _DBG(menu); |
frank26080115 | 0:bf7b9fba3924 | 125 | } |
frank26080115 | 0:bf7b9fba3924 | 126 | |
frank26080115 | 0:bf7b9fba3924 | 127 | /*-------------------------MAIN FUNCTION------------------------------*/ |
frank26080115 | 0:bf7b9fba3924 | 128 | /*********************************************************************//** |
frank26080115 | 0:bf7b9fba3924 | 129 | * @brief c_entry: Main CAN program body |
frank26080115 | 0:bf7b9fba3924 | 130 | * @param[in] none |
frank26080115 | 0:bf7b9fba3924 | 131 | * @return int |
frank26080115 | 0:bf7b9fba3924 | 132 | **********************************************************************/ |
frank26080115 | 0:bf7b9fba3924 | 133 | int c_entry(void) { /* Main Program */ |
frank26080115 | 0:bf7b9fba3924 | 134 | PINSEL_CFG_Type PinCfg; |
frank26080115 | 0:bf7b9fba3924 | 135 | uint32_t test; |
frank26080115 | 0:bf7b9fba3924 | 136 | |
frank26080115 | 0:bf7b9fba3924 | 137 | /* Initialize debug via UART0 |
frank26080115 | 0:bf7b9fba3924 | 138 | * 115200bps |
frank26080115 | 0:bf7b9fba3924 | 139 | * 8 data bit |
frank26080115 | 0:bf7b9fba3924 | 140 | * No parity |
frank26080115 | 0:bf7b9fba3924 | 141 | * 1 stop bit |
frank26080115 | 0:bf7b9fba3924 | 142 | * No flow control |
frank26080115 | 0:bf7b9fba3924 | 143 | */ |
frank26080115 | 0:bf7b9fba3924 | 144 | debug_frmwrk_init(); |
frank26080115 | 0:bf7b9fba3924 | 145 | print_menu(); |
frank26080115 | 0:bf7b9fba3924 | 146 | |
frank26080115 | 0:bf7b9fba3924 | 147 | /* LED setting */ |
frank26080115 | 0:bf7b9fba3924 | 148 | GPIO_SetDir(1,(1<<28)|(1<<29)|(1<<31),1); |
frank26080115 | 0:bf7b9fba3924 | 149 | GPIO_SetDir(2,(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6),1); |
frank26080115 | 0:bf7b9fba3924 | 150 | |
frank26080115 | 0:bf7b9fba3924 | 151 | /* Pin configuration |
frank26080115 | 0:bf7b9fba3924 | 152 | * CAN1: select P0.0 as RD1. P0.1 as TD1 |
frank26080115 | 0:bf7b9fba3924 | 153 | * CAN2: select P2.7 as RD2, P2.8 as RD2 |
frank26080115 | 0:bf7b9fba3924 | 154 | */ |
frank26080115 | 0:bf7b9fba3924 | 155 | PinCfg.Funcnum = 1; |
frank26080115 | 0:bf7b9fba3924 | 156 | PinCfg.OpenDrain = 0; |
frank26080115 | 0:bf7b9fba3924 | 157 | PinCfg.Pinmode = 0; |
frank26080115 | 0:bf7b9fba3924 | 158 | PinCfg.Pinnum = 0; |
frank26080115 | 0:bf7b9fba3924 | 159 | PinCfg.Portnum = 0; |
frank26080115 | 0:bf7b9fba3924 | 160 | PINSEL_ConfigPin(&PinCfg); |
frank26080115 | 0:bf7b9fba3924 | 161 | PinCfg.Pinnum = 1; |
frank26080115 | 0:bf7b9fba3924 | 162 | PINSEL_ConfigPin(&PinCfg); |
frank26080115 | 0:bf7b9fba3924 | 163 | |
frank26080115 | 0:bf7b9fba3924 | 164 | PinCfg.Pinnum = 7; |
frank26080115 | 0:bf7b9fba3924 | 165 | PinCfg.Portnum = 2; |
frank26080115 | 0:bf7b9fba3924 | 166 | PINSEL_ConfigPin(&PinCfg); |
frank26080115 | 0:bf7b9fba3924 | 167 | PinCfg.Pinnum = 8; |
frank26080115 | 0:bf7b9fba3924 | 168 | PINSEL_ConfigPin(&PinCfg); |
frank26080115 | 0:bf7b9fba3924 | 169 | |
frank26080115 | 0:bf7b9fba3924 | 170 | //Initialize CAN1 & CAN2 |
frank26080115 | 0:bf7b9fba3924 | 171 | CAN_Init(LPC_CAN1, 125000); |
frank26080115 | 0:bf7b9fba3924 | 172 | CAN_Init(LPC_CAN2, 125000); |
frank26080115 | 0:bf7b9fba3924 | 173 | |
frank26080115 | 0:bf7b9fba3924 | 174 | //Enable Interrupt |
frank26080115 | 0:bf7b9fba3924 | 175 | CAN_IRQCmd(LPC_CAN2, CANINT_RIE, ENABLE); |
frank26080115 | 0:bf7b9fba3924 | 176 | CAN_SetAFMode(LPC_CANAF,CAN_AccBP); |
frank26080115 | 0:bf7b9fba3924 | 177 | CAN_InitMessage(); |
frank26080115 | 0:bf7b9fba3924 | 178 | |
frank26080115 | 0:bf7b9fba3924 | 179 | //Enable CAN Interrupt |
frank26080115 | 0:bf7b9fba3924 | 180 | NVIC_EnableIRQ(CAN_IRQn); |
frank26080115 | 0:bf7b9fba3924 | 181 | while(1) |
frank26080115 | 0:bf7b9fba3924 | 182 | { |
frank26080115 | 0:bf7b9fba3924 | 183 | _DBG("Press LED value that you want to display \n\r" |
frank26080115 | 0:bf7b9fba3924 | 184 | "This value should be in range from 0x00 to 0xFF: "); |
frank26080115 | 0:bf7b9fba3924 | 185 | loop: |
frank26080115 | 0:bf7b9fba3924 | 186 | LED_Value = 0; |
frank26080115 | 0:bf7b9fba3924 | 187 | test = _DG; |
frank26080115 | 0:bf7b9fba3924 | 188 | switch(test) |
frank26080115 | 0:bf7b9fba3924 | 189 | { |
frank26080115 | 0:bf7b9fba3924 | 190 | case '0': LED_Value = 0; break; |
frank26080115 | 0:bf7b9fba3924 | 191 | case '1': LED_Value = 1; break; |
frank26080115 | 0:bf7b9fba3924 | 192 | case '2': LED_Value = 2; break; |
frank26080115 | 0:bf7b9fba3924 | 193 | case '3': LED_Value = 3; break; |
frank26080115 | 0:bf7b9fba3924 | 194 | case '4': LED_Value = 4; break; |
frank26080115 | 0:bf7b9fba3924 | 195 | case '5': LED_Value = 5; break; |
frank26080115 | 0:bf7b9fba3924 | 196 | case '6': LED_Value = 6; break; |
frank26080115 | 0:bf7b9fba3924 | 197 | case '7': LED_Value = 7; break; |
frank26080115 | 0:bf7b9fba3924 | 198 | case '8': LED_Value = 8; break; |
frank26080115 | 0:bf7b9fba3924 | 199 | case '9': LED_Value = 9; break; |
frank26080115 | 0:bf7b9fba3924 | 200 | case 'A': LED_Value = 0x0A; break; |
frank26080115 | 0:bf7b9fba3924 | 201 | case 'a': LED_Value = 0x0A; break; |
frank26080115 | 0:bf7b9fba3924 | 202 | case 'B': LED_Value = 0x0B; break; |
frank26080115 | 0:bf7b9fba3924 | 203 | case 'b': LED_Value = 0x0B; break; |
frank26080115 | 0:bf7b9fba3924 | 204 | case 'C': LED_Value = 0x0C; break; |
frank26080115 | 0:bf7b9fba3924 | 205 | case 'c': LED_Value = 0x0C; break; |
frank26080115 | 0:bf7b9fba3924 | 206 | case 'D': LED_Value = 0x0D; break; |
frank26080115 | 0:bf7b9fba3924 | 207 | case 'd': LED_Value = 0x0D; break; |
frank26080115 | 0:bf7b9fba3924 | 208 | case 'E': LED_Value = 0x0E; break; |
frank26080115 | 0:bf7b9fba3924 | 209 | case 'e': LED_Value = 0x0E; break; |
frank26080115 | 0:bf7b9fba3924 | 210 | case 'F': LED_Value = 0x0F; break; |
frank26080115 | 0:bf7b9fba3924 | 211 | case 'f': LED_Value = 0x0F; break; |
frank26080115 | 0:bf7b9fba3924 | 212 | default: |
frank26080115 | 0:bf7b9fba3924 | 213 | _DBG_("\n\rInvalid input, please type again!"); |
frank26080115 | 0:bf7b9fba3924 | 214 | goto loop; |
frank26080115 | 0:bf7b9fba3924 | 215 | } |
frank26080115 | 0:bf7b9fba3924 | 216 | test = _DG; |
frank26080115 | 0:bf7b9fba3924 | 217 | switch(test) |
frank26080115 | 0:bf7b9fba3924 | 218 | { |
frank26080115 | 0:bf7b9fba3924 | 219 | case '0': LED_Value = (LED_Value<<4)|0; break; |
frank26080115 | 0:bf7b9fba3924 | 220 | case '1': LED_Value = (LED_Value<<4)|1; break; |
frank26080115 | 0:bf7b9fba3924 | 221 | case '2': LED_Value = (LED_Value<<4)|2; break; |
frank26080115 | 0:bf7b9fba3924 | 222 | case '3': LED_Value = (LED_Value<<4)|3; break; |
frank26080115 | 0:bf7b9fba3924 | 223 | case '4': LED_Value = (LED_Value<<4)|4; break; |
frank26080115 | 0:bf7b9fba3924 | 224 | case '5': LED_Value = (LED_Value<<4)|5; break; |
frank26080115 | 0:bf7b9fba3924 | 225 | case '6': LED_Value = (LED_Value<<4)|6; break; |
frank26080115 | 0:bf7b9fba3924 | 226 | case '7': LED_Value = (LED_Value<<4)|7; break; |
frank26080115 | 0:bf7b9fba3924 | 227 | case '8': LED_Value = (LED_Value<<4)|8; break; |
frank26080115 | 0:bf7b9fba3924 | 228 | case '9': LED_Value = (LED_Value<<4)|9; break; |
frank26080115 | 0:bf7b9fba3924 | 229 | case 'A': LED_Value = (LED_Value<<4)|0x0A; break; |
frank26080115 | 0:bf7b9fba3924 | 230 | case 'a': LED_Value = (LED_Value<<4)|0x0A; break; |
frank26080115 | 0:bf7b9fba3924 | 231 | case 'B': LED_Value = (LED_Value<<4)|0x0B; break; |
frank26080115 | 0:bf7b9fba3924 | 232 | case 'b': LED_Value = (LED_Value<<4)|0x0B; break; |
frank26080115 | 0:bf7b9fba3924 | 233 | case 'C': LED_Value = (LED_Value<<4)|0x0C; break; |
frank26080115 | 0:bf7b9fba3924 | 234 | case 'c': LED_Value = (LED_Value<<4)|0x0C; break; |
frank26080115 | 0:bf7b9fba3924 | 235 | case 'D': LED_Value = (LED_Value<<4)|0x0D; break; |
frank26080115 | 0:bf7b9fba3924 | 236 | case 'd': LED_Value = (LED_Value<<4)|0x0D; break; |
frank26080115 | 0:bf7b9fba3924 | 237 | case 'E': LED_Value = (LED_Value<<4)|0x0E; break; |
frank26080115 | 0:bf7b9fba3924 | 238 | case 'e': LED_Value = (LED_Value<<4)|0x0E; break; |
frank26080115 | 0:bf7b9fba3924 | 239 | case 'F': LED_Value = (LED_Value<<4)|0x0F; break; |
frank26080115 | 0:bf7b9fba3924 | 240 | case 'f': LED_Value = (LED_Value<<4)|0x0F; break; |
frank26080115 | 0:bf7b9fba3924 | 241 | default: |
frank26080115 | 0:bf7b9fba3924 | 242 | _DBG_("\n\rInvalid input, please type again!"); |
frank26080115 | 0:bf7b9fba3924 | 243 | goto loop; |
frank26080115 | 0:bf7b9fba3924 | 244 | } |
frank26080115 | 0:bf7b9fba3924 | 245 | _DBH32(LED_Value);_DBG_(""); |
frank26080115 | 0:bf7b9fba3924 | 246 | _DBG_("Display LED... ");_DBG_(""); |
frank26080115 | 0:bf7b9fba3924 | 247 | TXMsg.dataA[0] = LED_Value; |
frank26080115 | 0:bf7b9fba3924 | 248 | CAN_SendMsg(LPC_CAN1, &TXMsg); |
frank26080115 | 0:bf7b9fba3924 | 249 | } |
frank26080115 | 0:bf7b9fba3924 | 250 | return 1; |
frank26080115 | 0:bf7b9fba3924 | 251 | } |
frank26080115 | 0:bf7b9fba3924 | 252 | |
frank26080115 | 0:bf7b9fba3924 | 253 | /* With ARM and GHS toolsets, the entry point is main() - this will |
frank26080115 | 0:bf7b9fba3924 | 254 | allow the linker to generate wrapper code to setup stacks, allocate |
frank26080115 | 0:bf7b9fba3924 | 255 | heap area, and initialize and copy code and data segments. For GNU |
frank26080115 | 0:bf7b9fba3924 | 256 | toolsets, the entry point is through __start() in the crt0_gnu.asm |
frank26080115 | 0:bf7b9fba3924 | 257 | file, and that startup code will setup stacks and data */ |
frank26080115 | 0:bf7b9fba3924 | 258 | int main(void) { |
frank26080115 | 0:bf7b9fba3924 | 259 | return c_entry(); |
frank26080115 | 0:bf7b9fba3924 | 260 | } |
frank26080115 | 0:bf7b9fba3924 | 261 | |
frank26080115 | 0:bf7b9fba3924 | 262 | #ifdef DEBUG |
frank26080115 | 0:bf7b9fba3924 | 263 | /******************************************************************************* |
frank26080115 | 0:bf7b9fba3924 | 264 | * @brief Reports the name of the source file and the source line number |
frank26080115 | 0:bf7b9fba3924 | 265 | * where the CHECK_PARAM error has occurred. |
frank26080115 | 0:bf7b9fba3924 | 266 | * @param[in] file Pointer to the source file name |
frank26080115 | 0:bf7b9fba3924 | 267 | * @param[in] line assert_param error line source number |
frank26080115 | 0:bf7b9fba3924 | 268 | * @return None |
frank26080115 | 0:bf7b9fba3924 | 269 | *******************************************************************************/ |
frank26080115 | 0:bf7b9fba3924 | 270 | void check_failed(uint8_t *file, uint32_t line) { |
frank26080115 | 0:bf7b9fba3924 | 271 | /* User can add his own implementation to report the file name and line number, |
frank26080115 | 0:bf7b9fba3924 | 272 | ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */ |
frank26080115 | 0:bf7b9fba3924 | 273 | |
frank26080115 | 0:bf7b9fba3924 | 274 | /* Infinite loop */ |
frank26080115 | 0:bf7b9fba3924 | 275 | while (1) |
frank26080115 | 0:bf7b9fba3924 | 276 | ; |
frank26080115 | 0:bf7b9fba3924 | 277 | } |
frank26080115 | 0:bf7b9fba3924 | 278 | #endif |
frank26080115 | 0:bf7b9fba3924 | 279 | |
frank26080115 | 0:bf7b9fba3924 | 280 | /* |
frank26080115 | 0:bf7b9fba3924 | 281 | * @} |
frank26080115 | 0:bf7b9fba3924 | 282 | */ |