├── .cproject ├── .project ├── ChangeLog.txt ├── License.txt ├── Makefile ├── PinoutDIP28.png ├── PinoutQFP48.png ├── PinoutQFP48_LPC1100XL.PNG ├── Readme.txt ├── build ├── codelite │ ├── LPC1114 CodeBase.workspace │ ├── LPC1114 CodeBase.workspace.session │ └── LPC1114_CodeBase.project └── crossworks │ ├── LPC1114_CodeBase.hzp │ └── LPC1114_CodeBase.hzs ├── core ├── adc │ ├── adc.c │ └── adc.h ├── cmd │ ├── cmd.c │ └── cmd.h ├── cpu │ ├── cpu.c │ └── cpu.h ├── gpio │ ├── gpio.c │ └── gpio.h ├── i2c │ ├── i2c.c │ └── i2c.h ├── iap │ ├── iap.c │ └── iap.h ├── libc │ ├── stdio.c │ └── string.c ├── pmu │ ├── pmu.c │ └── pmu.h ├── pwm │ ├── pwm.c │ ├── pwm.h │ └── pwm_100us_50percent.png ├── ssp │ ├── ssp.c │ └── ssp.h ├── systick │ ├── systick.c │ └── systick.h ├── timer16 │ ├── timer16.c │ └── timer16.h ├── timer32 │ ├── timer32.c │ └── timer32.h ├── uart │ ├── uart.c │ ├── uart.h │ └── uart_buf.c └── wdt │ ├── wdt.c │ └── wdt.h ├── drivers ├── dac │ └── mcp4725 │ │ ├── mcp4725.c │ │ └── mcp4725.h ├── displays │ ├── bitmap │ │ ├── ST7565 │ │ │ ├── ST7565.c │ │ │ └── ST7565.h │ │ ├── readme.txt │ │ └── ssd1306 │ │ │ ├── ssd1306.c │ │ │ └── ssd1306.h │ ├── smallfonts.c │ └── smallfonts.h ├── eeprom │ ├── eeprom.c │ ├── eeprom.h │ └── mcp24aa │ │ ├── mcp24aa.c │ │ └── mcp24aa.h ├── fatfs │ ├── ccsbcs.c │ ├── diskio.h │ ├── ff.c │ ├── ff.h │ ├── ffconf.h │ ├── integer.h │ └── mmc.c ├── motor │ └── stepper │ │ ├── stepper.c │ │ └── stepper.h ├── rf │ ├── chibi │ │ ├── chb.c │ │ ├── chb.h │ │ ├── chb_buf.c │ │ ├── chb_buf.h │ │ ├── chb_drvr.c │ │ ├── chb_drvr.h │ │ ├── chb_eeprom.c │ │ ├── chb_eeprom.h │ │ ├── chb_libpcap.c │ │ ├── chb_libpcap.h │ │ ├── chb_spi.c │ │ ├── chb_spi.h │ │ └── types.h │ └── pn532 │ │ ├── helpers │ │ ├── pn532_mifare.h │ │ ├── pn532_mifare_classic.c │ │ ├── pn532_mifare_classic.h │ │ ├── pn532_mifare_ultralight.c │ │ └── pn532_mifare_ultralight.h │ │ ├── pn532.c │ │ ├── pn532.h │ │ ├── pn532_bus.h │ │ ├── pn532_bus_i2c.c │ │ └── pn532_bus_uart.c ├── rsa │ ├── rsa.c │ └── rsa.h └── sensors │ ├── lm75b │ ├── lm75b.c │ └── lm75b.h │ └── tsl2561 │ ├── tsl2561.c │ └── tsl2561.h ├── lpc111x.h ├── lpc1xxx ├── LPC11xx_handlers.c ├── LPC1xxx_startup.c └── linkscript.ld ├── main.c ├── project ├── cmd_tbl.h ├── commands.c ├── commands.h ├── commands │ ├── cmd_chibi_addr.c │ ├── cmd_chibi_tx.c │ ├── cmd_deepsleep.c │ ├── cmd_i2ceeprom_read.c │ ├── cmd_i2ceeprom_write.c │ ├── cmd_lm75b_gettemp.c │ ├── cmd_reset.c │ ├── cmd_sd_dir.c │ └── cmd_sysinfo.c └── readme.txt ├── projectconfig.h ├── sysdefs.h ├── sysinit.c ├── sysinit.h └── tools ├── codelite_debug ├── CM3.zip └── README.txt ├── examples ├── basics │ ├── blinky │ │ ├── main.c │ │ └── readme.txt │ └── blinky_nonblocking │ │ ├── main.c │ │ └── readme.txt ├── chibi │ ├── receive │ │ ├── main.c │ │ └── readme.txt │ ├── sniffer_sd │ │ ├── main.c │ │ └── readme.txt │ ├── sniffer_wsbridge │ │ ├── main.c │ │ └── readme.txt │ ├── transmit │ │ ├── main.c │ │ └── readme.txt │ └── transmit_temp │ │ ├── main.c │ │ └── readme.txt ├── default │ ├── main.c │ └── readme.txt ├── lcd │ └── lpc1343tftlcd_uart │ │ ├── main.c │ │ └── readme.txt └── readme.txt ├── readme.txt ├── schematics ├── AT86RF212LPC1114_v1.6.pdf └── LPC1114BaseBoard_v1.3.pdf └── wsbridge └── v0.50 ├── Exe ├── Linux │ └── wsbridge └── Win │ └── wsbridge.exe ├── Linux ├── Makefile └── main.c └── Win ├── wsbridge.sln ├── wsbridge.suo └── wsbridge ├── Program.cs ├── Properties └── AssemblyInfo.cs ├── wsbridge.csproj └── wsbridge.csproj.user /.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | LPC1114_CodeBase 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.cdt.managedbuilder.core.genmakebuilder 10 | clean,full,incremental, 11 | 12 | 13 | ?name? 14 | 15 | 16 | 17 | org.eclipse.cdt.make.core.append_environment 18 | true 19 | 20 | 21 | org.eclipse.cdt.make.core.autoBuildTarget 22 | all 23 | 24 | 25 | org.eclipse.cdt.make.core.buildArguments 26 | 27 | 28 | 29 | org.eclipse.cdt.make.core.buildCommand 30 | make 31 | 32 | 33 | org.eclipse.cdt.make.core.cleanBuildTarget 34 | clean 35 | 36 | 37 | org.eclipse.cdt.make.core.contents 38 | org.eclipse.cdt.make.core.activeConfigSettings 39 | 40 | 41 | org.eclipse.cdt.make.core.enableAutoBuild 42 | false 43 | 44 | 45 | org.eclipse.cdt.make.core.enableCleanBuild 46 | true 47 | 48 | 49 | org.eclipse.cdt.make.core.enableFullBuild 50 | true 51 | 52 | 53 | org.eclipse.cdt.make.core.fullBuildTarget 54 | all 55 | 56 | 57 | org.eclipse.cdt.make.core.stopOnError 58 | true 59 | 60 | 61 | org.eclipse.cdt.make.core.useDefaultBuildCmd 62 | true 63 | 64 | 65 | 66 | 67 | org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder 68 | full,incremental, 69 | 70 | 71 | 72 | 73 | 74 | org.eclipse.cdt.core.cnature 75 | org.eclipse.cdt.core.ccnature 76 | org.eclipse.cdt.managedbuilder.core.managedBuildNature 77 | org.eclipse.cdt.managedbuilder.core.ScannerConfigNature 78 | 79 | 80 | -------------------------------------------------------------------------------- /License.txt: -------------------------------------------------------------------------------- 1 | Software License Agreement (BSD License) 2 | 3 | Unless otherwise noted, Copyright (c) 2010, microBuilder SARL. 4 | Portions Copyright (c) 2010 Roel Verdult. 5 | All rights reserved. 6 | 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted provided that the following conditions are met: 9 | 1. Redistributions of source code must retain the above copyright 10 | notice, this list of conditions and the following disclaimer. 11 | 2. Redistributions in binary form must reproduce the above copyright 12 | notice, this list of conditions and the following disclaimer in the 13 | documentation and/or other materials provided with the distribution. 14 | 3. Neither the name of the copyright holders nor the 15 | names of its contributors may be used to endorse or promote products 16 | derived from this software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY 19 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY 22 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 25 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /PinoutDIP28.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microbuilder/LPC1114CodeBase/c1dc51a7029aeba2a2f4d8792a0da17ccd1c0665/PinoutDIP28.png -------------------------------------------------------------------------------- /PinoutQFP48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microbuilder/LPC1114CodeBase/c1dc51a7029aeba2a2f4d8792a0da17ccd1c0665/PinoutQFP48.png -------------------------------------------------------------------------------- /PinoutQFP48_LPC1100XL.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microbuilder/LPC1114CodeBase/c1dc51a7029aeba2a2f4d8792a0da17ccd1c0665/PinoutQFP48_LPC1100XL.PNG -------------------------------------------------------------------------------- /Readme.txt: -------------------------------------------------------------------------------- 1 | This software is based on the freely available LPC1114 Reference Design available 2 | at www.microBuilder.eu, and is licensed under the BSD license (see license.txt 3 | for details). 4 | 5 | The latest version of the software is always available at the following url: 6 | 7 | http://www.microbuilder.eu/Projects/LPC1114ReferenceDesign/LPC1114CodeBase.aspx 8 | 9 | Online documentation is available at: 10 | 11 | http://www.microbuilder.eu/Projects/LPC1114ReferenceDesign/CodeBaseDocumentation.aspx -------------------------------------------------------------------------------- /build/codelite/LPC1114 CodeBase.workspace: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /build/codelite/LPC1114 CodeBase.workspace.session: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /core/adc/adc.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************/ 2 | /*! 3 | @file adc.h 4 | @author K. Townsend (microBuilder.eu) 5 | @date 22 March 2010 6 | @version 0.10 7 | 8 | @section LICENSE 9 | 10 | Software License Agreement (BSD License) 11 | 12 | Copyright (c) 2010, microBuilder SARL 13 | All rights reserved. 14 | 15 | Redistribution and use in source and binary forms, with or without 16 | modification, are permitted provided that the following conditions are met: 17 | 1. Redistributions of source code must retain the above copyright 18 | notice, this list of conditions and the following disclaimer. 19 | 2. Redistributions in binary form must reproduce the above copyright 20 | notice, this list of conditions and the following disclaimer in the 21 | documentation and/or other materials provided with the distribution. 22 | 3. Neither the name of the copyright holders nor the 23 | names of its contributors may be used to endorse or promote products 24 | derived from this software without specific prior written permission. 25 | 26 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY 27 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 28 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 29 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY 30 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 31 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 32 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 33 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 34 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 35 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 36 | */ 37 | /**************************************************************************/ 38 | 39 | #ifndef _ADC_H_ 40 | #define _ADC_H_ 41 | 42 | #include "projectconfig.h" 43 | 44 | uint32_t adcRead (uint8_t channelNum); 45 | void adcInit (void); 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /core/cmd/cmd.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************/ 2 | /*! 3 | @file cmd.h 4 | @author K. Townsend (microBuilder.eu) 5 | @date 22 March 2010 6 | @version 0.10 7 | 8 | @section LICENSE 9 | 10 | Software License Agreement (BSD License) 11 | 12 | Copyright (c) 2010, microBuilder SARL 13 | All rights reserved. 14 | 15 | Redistribution and use in source and binary forms, with or without 16 | modification, are permitted provided that the following conditions are met: 17 | 1. Redistributions of source code must retain the above copyright 18 | notice, this list of conditions and the following disclaimer. 19 | 2. Redistributions in binary form must reproduce the above copyright 20 | notice, this list of conditions and the following disclaimer in the 21 | documentation and/or other materials provided with the distribution. 22 | 3. Neither the name of the copyright holders nor the 23 | names of its contributors may be used to endorse or promote products 24 | derived from this software without specific prior written permission. 25 | 26 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY 27 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 28 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 29 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY 30 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 31 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 32 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 33 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 34 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 35 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 36 | */ 37 | /**************************************************************************/ 38 | 39 | #ifndef __CMD_H__ 40 | #define __CMD_H__ 41 | 42 | #include "projectconfig.h" 43 | 44 | typedef struct 45 | { 46 | char *command; 47 | uint8_t minArgs; 48 | uint8_t maxArgs; 49 | uint8_t hidden; 50 | void (*func)(uint8_t argc, char **argv); 51 | const char *description; 52 | const char *parameters; 53 | } cmd_t; 54 | 55 | void cmdPoll(); 56 | void cmdRx(uint8_t c); 57 | void cmdParse(char *cmd); 58 | void cmdInit(); 59 | 60 | #endif -------------------------------------------------------------------------------- /core/cpu/cpu.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************/ 2 | /*! 3 | @file cpu.h 4 | @author K. Townsend (microBuilder.eu) 5 | @date 22 March 2010 6 | @version 0.10 7 | 8 | @section LICENSE 9 | 10 | Software License Agreement (BSD License) 11 | 12 | Copyright (c) 2010, microBuilder SARL 13 | All rights reserved. 14 | 15 | Redistribution and use in source and binary forms, with or without 16 | modification, are permitted provided that the following conditions are met: 17 | 1. Redistributions of source code must retain the above copyright 18 | notice, this list of conditions and the following disclaimer. 19 | 2. Redistributions in binary form must reproduce the above copyright 20 | notice, this list of conditions and the following disclaimer in the 21 | documentation and/or other materials provided with the distribution. 22 | 3. Neither the name of the copyright holders nor the 23 | names of its contributors may be used to endorse or promote products 24 | derived from this software without specific prior written permission. 25 | 26 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY 27 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 28 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 29 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY 30 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 31 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 32 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 33 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 34 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 35 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 36 | */ 37 | /**************************************************************************/ 38 | 39 | #ifndef _CPU_H_ 40 | #define _CPU_H_ 41 | 42 | #include "projectconfig.h" 43 | 44 | typedef enum 45 | { 46 | CPU_MULTIPLIER_1 = 0, 47 | CPU_MULTIPLIER_2, 48 | CPU_MULTIPLIER_3, 49 | CPU_MULTIPLIER_4 50 | } 51 | cpuMultiplier_t; 52 | 53 | void cpuPllSetup (cpuMultiplier_t multiplier); 54 | void cpuInit (void); 55 | uint32_t cpuGetDeviceID (void); 56 | void cpuReset (void); 57 | 58 | #endif -------------------------------------------------------------------------------- /core/gpio/gpio.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************/ 2 | /*! 3 | @file gpio.h 4 | @author K. Townsend (microBuilder.eu) 5 | @date 22 March 2010 6 | @version 0.10 7 | 8 | @section LICENSE 9 | 10 | Software License Agreement (BSD License) 11 | 12 | Copyright (c) 2010, microBuilder SARL 13 | All rights reserved. 14 | 15 | Redistribution and use in source and binary forms, with or without 16 | modification, are permitted provided that the following conditions are met: 17 | 1. Redistributions of source code must retain the above copyright 18 | notice, this list of conditions and the following disclaimer. 19 | 2. Redistributions in binary form must reproduce the above copyright 20 | notice, this list of conditions and the following disclaimer in the 21 | documentation and/or other materials provided with the distribution. 22 | 3. Neither the name of the copyright holders nor the 23 | names of its contributors may be used to endorse or promote products 24 | derived from this software without specific prior written permission. 25 | 26 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY 27 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 28 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 29 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY 30 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 31 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 32 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 33 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 34 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 35 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 36 | */ 37 | /**************************************************************************/ 38 | 39 | #ifndef _GPIO_H_ 40 | #define _GPIO_H_ 41 | 42 | #include "projectconfig.h" 43 | 44 | /**************************************************************************/ 45 | /*! 46 | Indicates whether the interrupt should be configured as edge or 47 | level sensitive. 48 | */ 49 | /**************************************************************************/ 50 | typedef enum gpioInterruptSense_e 51 | { 52 | gpioInterruptSense_Edge = 0, 53 | gpioInterruptSense_Level 54 | } 55 | gpioInterruptSense_t; 56 | 57 | /**************************************************************************/ 58 | /*! 59 | Indicates whether one edge or both edges trigger an interrupt. 60 | Setting this to Double will cause both edges to trigger an interrupt. 61 | */ 62 | /**************************************************************************/ 63 | typedef enum gpioInterruptEdge_e 64 | { 65 | gpioInterruptEdge_Single = 0, 66 | gpioInterruptEdge_Double 67 | } 68 | gpioInterruptEdge_t; 69 | 70 | /**************************************************************************/ 71 | /*! 72 | Indicates whether the interrupt should be triggered in the rising 73 | or falling edge. ActiveHigh means that a HIGH level on the pin will 74 | trigger an interrupt, ActiveLow means that a LOW level on the pin 75 | will trigger an interrupt. 76 | */ 77 | /**************************************************************************/ 78 | typedef enum gpioInterruptEvent_e 79 | { 80 | gpioInterruptEvent_ActiveHigh = 0, 81 | gpioInterruptEvent_ActiveLow 82 | } 83 | gpioInterruptEvent_t; 84 | 85 | typedef enum gpioDirection_e 86 | { 87 | gpioDirection_Input = 0, 88 | gpioDirection_Output 89 | } 90 | gpioDirection_t; 91 | 92 | typedef enum gpioPullupMode_e 93 | { 94 | gpioPullupMode_Inactive = IOCON_COMMON_MODE_INACTIVE, 95 | gpioPullupMode_PullDown = IOCON_COMMON_MODE_PULLDOWN, 96 | gpioPullupMode_PullUp = IOCON_COMMON_MODE_PULLUP, 97 | gpioPullupMode_Repeater = IOCON_COMMON_MODE_REPEATER 98 | } 99 | gpioPullupMode_t; 100 | 101 | void gpioDisableInternalResistors (void); 102 | void gpioInit (void); 103 | void gpioSetDir (uint32_t portNum, uint32_t bitPos, gpioDirection_t dir); 104 | uint32_t gpioGetValue (uint32_t portNum, uint32_t bitPos); 105 | extern void gpioSetValue (const uint32_t portNum, const uint32_t bitPos, const uint32_t bitVal); 106 | void gpioSetInterrupt (uint32_t portNum, uint32_t bitPos, gpioInterruptSense_t sense, gpioInterruptEdge_t edge, gpioInterruptEvent_t event); 107 | void gpioIntEnable (uint32_t portNum, uint32_t bitPos); 108 | void gpioIntDisable (uint32_t portNum, uint32_t bitPos); 109 | uint32_t gpioIntStatus (uint32_t portNum, uint32_t bitPos); 110 | void gpioIntClear (uint32_t portNum, uint32_t bitPos); 111 | void gpioSetPullup (volatile uint32_t *ioconRegister, gpioPullupMode_t mode); 112 | 113 | #endif -------------------------------------------------------------------------------- /core/i2c/i2c.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * i2c.h: Header file for NXP LPC11xx Family Microprocessors 3 | * 4 | * Copyright(C) 2006, NXP Semiconductor 5 | * Parts of this code are (C) 2010, MyVoice CAD/CAM Services 6 | * All rights reserved. 7 | * 8 | * History 9 | * 2006.07.19 ver 1.00 Preliminary version, first Release 10 | * 2010.07.19 ver 1.10 Rob Jansen - MyVoice CAD/CAM Services 11 | * Updated to reflect new code 12 | * 2011.02.19 ver 1.20 KTownsend - microBuilder.eu 13 | * - Added slave mode status values to 14 | * I2C_IRQHandler 15 | * 16 | ******************************************************************************/ 17 | #ifndef __I2C_H 18 | #define __I2C_H 19 | 20 | #include "projectconfig.h" 21 | 22 | /* 23 | * These are states returned by the I2CEngine: 24 | * 25 | * IDLE - is never returned but only used internally 26 | * PENDING - is never returned but only used internally in the I2C functions 27 | * ACK - The transaction finished and the slave returned ACK (on all bytes) 28 | * NACK - The transaction is aborted since the slave returned a NACK 29 | * SLA_NACK - The transaction is aborted since the slave returned a NACK on the SLA 30 | * this can be intentional (e.g. an 24LC08 EEPROM states it is busy) 31 | * or the slave is not available/accessible at all. 32 | * ARB_LOSS - Arbitration loss during any part of the transaction. 33 | * This could only happen in a multi master system or could also 34 | * identify a hardware problem in the system. 35 | */ 36 | #define I2CSTATE_IDLE 0x000 37 | #define I2CSTATE_PENDING 0x001 38 | #define I2CSTATE_ACK 0x101 39 | #define I2CSTATE_NACK 0x102 40 | #define I2CSTATE_SLA_NACK 0x103 41 | #define I2CSTATE_ARB_LOSS 0x104 42 | 43 | #define FAST_MODE_PLUS 0 44 | 45 | #define I2C_BUFSIZE 64 46 | #define MAX_TIMEOUT 0x00FFFFFF 47 | 48 | #define I2CMASTER 0x01 49 | #define I2CSLAVE 0x02 50 | 51 | #define SLAVE_ADDR 0xA0 52 | #define READ_WRITE 0x01 53 | 54 | #define RD_BIT 0x01 55 | 56 | #define I2C_GENERALCALL 0x00 /* General Call Address (to 'ping' I2C bus for devices) */ 57 | 58 | #define I2C_IDLE 0 59 | #define I2C_STARTED 1 60 | #define I2C_RESTARTED 2 61 | #define I2C_REPEATED_START 3 62 | #define DATA_ACK 4 63 | #define DATA_NACK 5 64 | #define I2C_WR_STARTED 6 65 | #define I2C_RD_STARTED 7 66 | 67 | /* I2C Control Set Register */ 68 | #define I2CONSET_I2EN 0x00000040 /* I2C Interface Enable */ 69 | #define I2CONSET_AA 0x00000004 /* Assert acknowledge flag */ 70 | #define I2CONSET_SI 0x00000008 /* I2C interrupt flag */ 71 | #define I2CONSET_STO 0x00000010 /* STOP flag */ 72 | #define I2CONSET_STA 0x00000020 /* START flag */ 73 | 74 | /* I2C Control clear Register */ 75 | #define I2CONCLR_AAC 0x00000004 /* Assert acklnowedge clear bit*/ 76 | #define I2CONCLR_SIC 0x00000008 /* I2C interrupt clear bit */ 77 | #define I2CONCLR_STAC 0x00000020 /* START flag clear bit */ 78 | #define I2CONCLR_I2ENC 0x00000040 /* I2C interface disable bit */ 79 | 80 | #define I2DAT_I2C 0x00000000 /* I2C Data Reg */ 81 | #define I2ADR_I2C 0x00000000 /* I2C Slave Address Reg */ 82 | 83 | /* SCLH and SCLL = I2C PCLK High/Low cycles for I2C clock and 84 | determine the data rate/duty cycle for I2C: 85 | 86 | I2CBitFrequency = I2CPCLK / (I2CSCLH + I2CSCLL) 87 | 88 | Standard Mode (100KHz) = CFG_CPU_CCLK / 200000 89 | Fast Mode (400KHz) = CFG_CPU_CCLK / 800000 90 | Fast- Mode Plus (1MHz) = CFG_CPU_CCLK / 2000000 */ 91 | 92 | #define I2SCLH_SCLH CFG_CPU_CCLK / 200000 /* Standard Mode I2C SCL Duty Cycle High (400KHz) */ 93 | #define I2SCLL_SCLL CFG_CPU_CCLK / 200000 /* Fast Mode I2C SCL Duty Cycle Low (400KHz) */ 94 | #define I2SCLH_HS_SCLH CFG_CPU_CCLK / 2000000 /* Fast Plus I2C SCL Duty Cycle High Reg */ 95 | #define I2SCLL_HS_SCLL CFG_CPU_CCLK / 2000000 /* Fast Plus I2C SCL Duty Cycle Low Reg */ 96 | 97 | extern volatile uint8_t I2CMasterBuffer[I2C_BUFSIZE]; // Master Mode 98 | extern volatile uint8_t I2CSlaveBuffer[I2C_BUFSIZE]; // Master Mode 99 | // extern volatile uint8_t I2CWrBuffer[I2C_BUFSIZE]; // Slave Mode 100 | // extern volatile uint8_t I2CRdBuffer[I2C_BUFSIZE]; // Slave Mode 101 | extern volatile uint32_t I2CReadLength, I2CWriteLength; 102 | 103 | extern void I2C_IRQHandler( void ); 104 | extern uint32_t i2cInit( uint32_t I2cMode ); 105 | extern uint32_t i2cEngine( void ); 106 | 107 | #endif /* end __I2C_H */ 108 | /**************************************************************************** 109 | ** End Of File 110 | *****************************************************************************/ 111 | -------------------------------------------------------------------------------- /core/iap/iap.c: -------------------------------------------------------------------------------- 1 | /**************************************************************************/ 2 | /*! 3 | @file iap.c 4 | Source: http://knowledgebase.nxp.com/showthread.php?t=1594 5 | */ 6 | /**************************************************************************/ 7 | #include "iap.h" 8 | 9 | IAP_return_t iap_return; 10 | 11 | #define IAP_ADDRESS 0x1FFF1FF1 12 | uint32_t param_table[5]; 13 | 14 | /**************************************************************************/ 15 | /*! 16 | Sends the IAP command and stores the result 17 | */ 18 | /**************************************************************************/ 19 | void iap_entry(uint32_t param_tab[], uint32_t result_tab[]) 20 | { 21 | void (*iap)(uint32_t[], uint32_t[]); 22 | iap = (void (*)(uint32_t[], uint32_t[]))IAP_ADDRESS; 23 | iap(param_tab,result_tab); 24 | } 25 | 26 | /**************************************************************************/ 27 | /*! 28 | Returns the CPU's unique 128-bit serial number (4 words long) 29 | 30 | @section Example 31 | 32 | @code 33 | #include "core/iap/iap.h" 34 | 35 | IAP_return_t iap_return; 36 | iap_return = iapReadSerialNumber(); 37 | 38 | if (iap_return.ReturnCode == 0) 39 | { 40 | printf("Serial Number: %08X %08X %08X %08X %s", 41 | iap_return.Result[0], 42 | iap_return.Result[1], 43 | iap_return.Result[2], 44 | iap_return.Result[3], 45 | CFG_PRINTF_NEWLINE); 46 | } 47 | @endcode 48 | */ 49 | /**************************************************************************/ 50 | IAP_return_t iapReadSerialNumber(void) 51 | { 52 | // ToDo: Why does IAP sometime cause the application to halt when read??? 53 | param_table[0] = IAP_CMD_READUID; 54 | iap_entry(param_table,(uint32_t*)(&iap_return)); 55 | return iap_return; 56 | } 57 | 58 | -------------------------------------------------------------------------------- /core/iap/iap.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************/ 2 | /*! 3 | @file iap.h 4 | @author K. Townsend (microBuilder.eu) 5 | 6 | @section LICENSE 7 | 8 | Software License Agreement (BSD License) 9 | 10 | Copyright (c) 2010, microBuilder SARL 11 | All rights reserved. 12 | 13 | Redistribution and use in source and binary forms, with or without 14 | modification, are permitted provided that the following conditions are met: 15 | 1. Redistributions of source code must retain the above copyright 16 | notice, this list of conditions and the following disclaimer. 17 | 2. Redistributions in binary form must reproduce the above copyright 18 | notice, this list of conditions and the following disclaimer in the 19 | documentation and/or other materials provided with the distribution. 20 | 3. Neither the name of the copyright holders nor the 21 | names of its contributors may be used to endorse or promote products 22 | derived from this software without specific prior written permission. 23 | 24 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY 25 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 26 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 27 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY 28 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 29 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 30 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 31 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 32 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 33 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | */ 35 | /**************************************************************************/ 36 | 37 | #ifndef _IAP_H_ 38 | #define _IAP_H_ 39 | 40 | #include "projectconfig.h" 41 | 42 | #define IAP_CMD_PREPARESECTORFORWRITE (50) 43 | #define IAP_CMD_COPYRAMTOFLASH (51) 44 | #define CAP_CMD_ERASESECTORS (52) 45 | #define IAP_CMD_BLANKCHECKSECTOR (53) 46 | #define IAP_CMD_READPARTID (54) 47 | #define IAP_CMD_READBOOTCODEVERSION (55) 48 | #define IAP_CMD_COMPARE (56) 49 | #define IAP_CMD_REINVOKEISP (57) 50 | #define IAP_CMD_READUID (58) 51 | 52 | typedef struct 53 | { 54 | unsigned int ReturnCode; 55 | unsigned int Result[4]; 56 | } IAP_return_t; 57 | 58 | IAP_return_t iapReadSerialNumber(void); 59 | 60 | #endif -------------------------------------------------------------------------------- /core/pmu/pmu.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************/ 2 | /*! 3 | @file pmu.h 4 | @author K. Townsend (microBuilder.eu) 5 | @date 22 March 2010 6 | @version 0.10 7 | 8 | @section LICENSE 9 | 10 | Software License Agreement (BSD License) 11 | 12 | Copyright (c) 2010, microBuilder SARL 13 | All rights reserved. 14 | 15 | Redistribution and use in source and binary forms, with or without 16 | modification, are permitted provided that the following conditions are met: 17 | 1. Redistributions of source code must retain the above copyright 18 | notice, this list of conditions and the following disclaimer. 19 | 2. Redistributions in binary form must reproduce the above copyright 20 | notice, this list of conditions and the following disclaimer in the 21 | documentation and/or other materials provided with the distribution. 22 | 3. Neither the name of the copyright holders nor the 23 | names of its contributors may be used to endorse or promote products 24 | derived from this software without specific prior written permission. 25 | 26 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY 27 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 28 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 29 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY 30 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 31 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 32 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 33 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 34 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 35 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 36 | */ 37 | /**************************************************************************/ 38 | 39 | #ifndef __PMU_H__ 40 | #define __PMU_H__ 41 | 42 | #include "projectconfig.h" 43 | 44 | /**************************************************************************/ 45 | /*! 46 | Pointers to the power profiles functions in LPC1100L series MCUs. 47 | */ 48 | /**************************************************************************/ 49 | typedef struct _PWRD 50 | { 51 | void (*set_pll)(unsigned int cmd[], unsigned int resp[]); 52 | void (*set_power)(unsigned int cmd[], unsigned int resp[]); 53 | } PWRD; 54 | 55 | /**************************************************************************/ 56 | /*! 57 | ROM entry table ... this is used to access power profiles in ROM. 58 | */ 59 | /**************************************************************************/ 60 | typedef struct _ROM 61 | { 62 | const unsigned p_usbd; 63 | const unsigned p_clib; 64 | const unsigned p_cand; 65 | const PWRD * pPWRD; 66 | const unsigned p_dev1; 67 | const unsigned p_dev2; 68 | const unsigned p_dev3; 69 | const unsigned p_dev4; 70 | } ROM; 71 | 72 | /**************************************************************************/ 73 | /*! 74 | Indicates a specific LPC1100L power-profile (only relevant to 'L' 75 | series chips). 76 | */ 77 | /**************************************************************************/ 78 | typedef enum pmuPowerProfile_e 79 | { 80 | pmuPowerProfile_Default = 0, 81 | pmuPowerProfile_Performance = 1, 82 | pmuPowerProfile_Efficiency = 2, 83 | pmuPowerProfile_LowCurrent = 3 84 | } 85 | pmuPowerProfile_t; 86 | 87 | void WAKEUP_IRQHandler( void ); 88 | void pmuInit( void ); 89 | void pmuSleep( void ); 90 | void pmuDeepSleep(uint32_t wakeupSeconds); 91 | void pmuPowerDown( void ); 92 | 93 | #endif 94 | -------------------------------------------------------------------------------- /core/pwm/pwm.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************/ 2 | /*! 3 | @file pwm.h 4 | @author K. Townsend (microBuilder.eu) 5 | 6 | @section LICENSE 7 | 8 | Software License Agreement (BSD License) 9 | 10 | Copyright (c) 2010, microBuilder SARL 11 | All rights reserved. 12 | 13 | Redistribution and use in source and binary forms, with or without 14 | modification, are permitted provided that the following conditions are met: 15 | 1. Redistributions of source code must retain the above copyright 16 | notice, this list of conditions and the following disclaimer. 17 | 2. Redistributions in binary form must reproduce the above copyright 18 | notice, this list of conditions and the following disclaimer in the 19 | documentation and/or other materials provided with the distribution. 20 | 3. Neither the name of the copyright holders nor the 21 | names of its contributors may be used to endorse or promote products 22 | derived from this software without specific prior written permission. 23 | 24 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY 25 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 26 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 27 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY 28 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 29 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 30 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 31 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 32 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 33 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | */ 35 | /**************************************************************************/ 36 | 37 | #ifndef _PWM_H_ 38 | #define _PWM_H_ 39 | 40 | #include "projectconfig.h" 41 | 42 | void pwmInit( void ); 43 | void pwmStart( void ); 44 | void pwmStop( void ); 45 | void pwmStartFixed( uint32_t pulses ); 46 | int pwmSetDutyCycle( uint32_t percentage ); 47 | int pwmSetFrequencyInTicks( uint16_t ticks ); 48 | int pwmSetFrequencyInMicroseconds(uint16_t us ); 49 | 50 | #endif -------------------------------------------------------------------------------- /core/pwm/pwm_100us_50percent.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microbuilder/LPC1114CodeBase/c1dc51a7029aeba2a2f4d8792a0da17ccd1c0665/core/pwm/pwm_100us_50percent.png -------------------------------------------------------------------------------- /core/ssp/ssp.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microbuilder/LPC1114CodeBase/c1dc51a7029aeba2a2f4d8792a0da17ccd1c0665/core/ssp/ssp.c -------------------------------------------------------------------------------- /core/ssp/ssp.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************/ 2 | /*! 3 | @file ssp.h 4 | @author K. Townsend (microBuilder.eu) 5 | @date 22 March 2010 6 | @version 0.10 7 | 8 | @section LICENSE 9 | 10 | Software License Agreement (BSD License) 11 | 12 | Copyright (c) 2010, microBuilder SARL 13 | All rights reserved. 14 | 15 | Redistribution and use in source and binary forms, with or without 16 | modification, are permitted provided that the following conditions are met: 17 | 1. Redistributions of source code must retain the above copyright 18 | notice, this list of conditions and the following disclaimer. 19 | 2. Redistributions in binary form must reproduce the above copyright 20 | notice, this list of conditions and the following disclaimer in the 21 | documentation and/or other materials provided with the distribution. 22 | 3. Neither the name of the copyright holders nor the 23 | names of its contributors may be used to endorse or promote products 24 | derived from this software without specific prior written permission. 25 | 26 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY 27 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 28 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 29 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY 30 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 31 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 32 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 33 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 34 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 35 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 36 | */ 37 | /**************************************************************************/ 38 | 39 | #ifndef _SSP_H_ 40 | #define _SSP_H_ 41 | 42 | #include "projectconfig.h" 43 | #include "core/gpio/gpio.h" 44 | 45 | #define SSP_FIFOSIZE 8 /* SPI read and write buffer size */ 46 | #define SSP_MAX_TIMEOUT 0xFF 47 | 48 | #define SSP0_CSPORT 0 49 | #define SSP0_CSPIN 2 50 | 51 | #define SSP1_CSPORT 2 52 | #define SSP1_CSPIN 0 53 | 54 | /* Macro definitions to enable and disable SPI */ 55 | #define ssp0Select() do {gpioSetValue(SSP0_CSPORT, SSP0_CSPIN, 0);} while (0) 56 | #define ssp0Deselect() do {gpioSetValue(SSP0_CSPORT, SSP0_CSPIN, 1);} while (0) 57 | 58 | #define ssp1Select() do {gpioSetValue(SSP1_CSPORT, SSP1_CSPIN, 0);} while (0) 59 | #define ssp1Deselect() do {gpioSetValue(SSP1_CSPORT, SSP1_CSPIN, 1);} while (0) 60 | 61 | /**************************************************************************/ 62 | /*! 63 | Indicates whether the clock should be high or low between frames. 64 | */ 65 | /**************************************************************************/ 66 | typedef enum sspClockPolarity_e 67 | { 68 | sspClockPolarity_Low = 0, 69 | sspClockPolarity_High 70 | } 71 | sspClockPolarity_t; 72 | 73 | /**************************************************************************/ 74 | /*! 75 | Indicates whether the bits start at the rising or falling edge of 76 | the clock transition. 77 | */ 78 | /**************************************************************************/ 79 | typedef enum sspClockPhase_e 80 | { 81 | sspClockPhase_RisingEdge = 0, 82 | sspClockPhase_FallingEdge 83 | } 84 | sspClockPhase_t; 85 | 86 | extern void SSP0_IRQHandler (void); 87 | void sspInit (uint8_t portNum, sspClockPolarity_t polarity, sspClockPhase_t phase); 88 | void sspSend (uint8_t portNum, uint8_t *buf, uint32_t length); 89 | void sspReceive (uint8_t portNum, uint8_t *buf, uint32_t length); 90 | 91 | #endif 92 | -------------------------------------------------------------------------------- /core/systick/systick.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************/ 2 | /*! 3 | @file systick.h 4 | @author K. Townsend (microBuilder.eu) 5 | @date 22 March 2010 6 | @version 0.10 7 | 8 | @section LICENSE 9 | 10 | Software License Agreement (BSD License) 11 | 12 | Copyright (c) 2010, microBuilder SARL 13 | All rights reserved. 14 | 15 | Redistribution and use in source and binary forms, with or without 16 | modification, are permitted provided that the following conditions are met: 17 | 1. Redistributions of source code must retain the above copyright 18 | notice, this list of conditions and the following disclaimer. 19 | 2. Redistributions in binary form must reproduce the above copyright 20 | notice, this list of conditions and the following disclaimer in the 21 | documentation and/or other materials provided with the distribution. 22 | 3. Neither the name of the copyright holders nor the 23 | names of its contributors may be used to endorse or promote products 24 | derived from this software without specific prior written permission. 25 | 26 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY 27 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 28 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 29 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY 30 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 31 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 32 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 33 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 34 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 35 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 36 | */ 37 | /**************************************************************************/ 38 | 39 | #ifndef _SYSTICK_H_ 40 | #define _SYSTICK_H_ 41 | 42 | #include "projectconfig.h" 43 | 44 | void systickInit (uint32_t delayMs); 45 | void systickDelay (uint32_t delayTicks) ; 46 | uint32_t systickGetTicks(void); 47 | uint32_t systickGetRollovers(void); 48 | uint32_t systickGetSecondsActive(void); 49 | 50 | #endif -------------------------------------------------------------------------------- /core/timer16/timer16.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************/ 2 | /*! 3 | @file timer16.h 4 | @author K. Townsend (microBuilder.eu) 5 | @date 22 March 2010 6 | @version 0.10 7 | 8 | @section LICENSE 9 | 10 | Software License Agreement (BSD License) 11 | 12 | Copyright (c) 2010, microBuilder SARL 13 | All rights reserved. 14 | 15 | Redistribution and use in source and binary forms, with or without 16 | modification, are permitted provided that the following conditions are met: 17 | 1. Redistributions of source code must retain the above copyright 18 | notice, this list of conditions and the following disclaimer. 19 | 2. Redistributions in binary form must reproduce the above copyright 20 | notice, this list of conditions and the following disclaimer in the 21 | documentation and/or other materials provided with the distribution. 22 | 3. Neither the name of the copyright holders nor the 23 | names of its contributors may be used to endorse or promote products 24 | derived from this software without specific prior written permission. 25 | 26 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY 27 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 28 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 29 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY 30 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 31 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 32 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 33 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 34 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 35 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 36 | */ 37 | /**************************************************************************/ 38 | 39 | #ifndef __TIMER16_H__ 40 | #define __TIMER16_H__ 41 | 42 | #include "projectconfig.h" 43 | 44 | #define TIMER16_DEFAULTINTERVAL (0xFFFF) // ~5.46mS @ 12MHz, ~1.82mS @ 36MHz, ~1.37mS @ 48MHz 45 | 46 | #define TIMER16_CCLK_100US ((CFG_CPU_CCLK/SCB_SYSAHBCLKDIV) / 10000) 47 | #define TIMER16_CCLK_1MS ((CFG_CPU_CCLK/SCB_SYSAHBCLKDIV) / 1000) 48 | 49 | void TIMER16_0_IRQHandler(void); 50 | void TIMER16_1_IRQHandler(void); 51 | 52 | void timer16DelayTicks(uint8_t timerNum, uint16_t delayInTicks); 53 | void timer16DelayUS(uint8_t timerNum, uint16_t delayInUS); 54 | void timer16Enable(uint8_t timerNum); 55 | void timer16Disable(uint8_t timerNum); 56 | void timer16Reset(uint8_t timerNum); 57 | void timer16Init(uint8_t timerNum, uint16_t timerInterval); 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /core/timer32/timer32.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************/ 2 | /*! 3 | @file timer32.h 4 | @author K. Townsend (microBuilder.eu) 5 | @date 22 March 2010 6 | @version 0.10 7 | 8 | @section LICENSE 9 | 10 | Software License Agreement (BSD License) 11 | 12 | Copyright (c) 2010, microBuilder SARL 13 | All rights reserved. 14 | 15 | Redistribution and use in source and binary forms, with or without 16 | modification, are permitted provided that the following conditions are met: 17 | 1. Redistributions of source code must retain the above copyright 18 | notice, this list of conditions and the following disclaimer. 19 | 2. Redistributions in binary form must reproduce the above copyright 20 | notice, this list of conditions and the following disclaimer in the 21 | documentation and/or other materials provided with the distribution. 22 | 3. Neither the name of the copyright holders nor the 23 | names of its contributors may be used to endorse or promote products 24 | derived from this software without specific prior written permission. 25 | 26 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY 27 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 28 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 29 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY 30 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 31 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 32 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 33 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 34 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 35 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 36 | */ 37 | /**************************************************************************/ 38 | 39 | #ifndef __TIMER32_H__ 40 | #define __TIMER32_H__ 41 | 42 | #include "projectconfig.h" 43 | 44 | #define TIMER32_CCLK_1US ((CFG_CPU_CCLK/SCB_SYSAHBCLKDIV) / 1000000) 45 | #define TIMER32_CCLK_10US ((CFG_CPU_CCLK/SCB_SYSAHBCLKDIV) / 100000) 46 | #define TIMER32_CCLK_100US ((CFG_CPU_CCLK/SCB_SYSAHBCLKDIV) / 10000) 47 | #define TIMER32_CCLK_1MS ((CFG_CPU_CCLK/SCB_SYSAHBCLKDIV) / 1000) 48 | #define TIMER32_CCLK_10MS ((CFG_CPU_CCLK/SCB_SYSAHBCLKDIV) / 100) 49 | #define TIMER32_CCLK_100MS ((CFG_CPU_CCLK/SCB_SYSAHBCLKDIV) / 10) 50 | #define TIMER32_CCLK_1S (CFG_CPU_CCLK/SCB_SYSAHBCLKDIV) 51 | #define TIMER32_DEFAULTINTERVAL (TIMER32_CCLK_100US) 52 | 53 | #define TIMER32_DELAY_100US (1) // 100uS delay = 1 tick 54 | #define TIMER32_DELAY_1MS (10) // 1mS delay = 10 ticks 55 | #define TIMER32_DELAY_1S (10000) // 1S delay = 10000 ticks 56 | 57 | void TIMER32_0_IRQHandler(void); 58 | void TIMER32_1_IRQHandler(void); 59 | 60 | void timer32Delay(uint8_t timerNum, uint32_t delay); 61 | void timer32Enable(uint8_t timerNum); 62 | void timer32Disable(uint8_t timerNum); 63 | void timer32Reset(uint8_t timerNum); 64 | void timer32Init(uint8_t timerNum, uint32_t timerInterval); 65 | 66 | #endif 67 | -------------------------------------------------------------------------------- /core/uart/uart.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************/ 2 | /*! 3 | @file uart.h 4 | @author K. Townsend (microBuilder.eu) 5 | @date 22 March 2010 6 | @version 0.10 7 | 8 | @section LICENSE 9 | 10 | Software License Agreement (BSD License) 11 | 12 | Copyright (c) 2010, microBuilder SARL 13 | All rights reserved. 14 | 15 | Redistribution and use in source and binary forms, with or without 16 | modification, are permitted provided that the following conditions are met: 17 | 1. Redistributions of source code must retain the above copyright 18 | notice, this list of conditions and the following disclaimer. 19 | 2. Redistributions in binary form must reproduce the above copyright 20 | notice, this list of conditions and the following disclaimer in the 21 | documentation and/or other materials provided with the distribution. 22 | 3. Neither the name of the copyright holders nor the 23 | names of its contributors may be used to endorse or promote products 24 | derived from this software without specific prior written permission. 25 | 26 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY 27 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 28 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 29 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY 30 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 31 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 32 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 33 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 34 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 35 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 36 | */ 37 | /**************************************************************************/ 38 | 39 | #ifndef __UART_H__ 40 | #define __UART_H__ 41 | 42 | #include "projectconfig.h" 43 | 44 | // Buffer used for circular fifo 45 | typedef struct _uart_buffer_t 46 | { 47 | uint8_t ep_dir; 48 | volatile uint8_t len; 49 | volatile uint8_t wr_ptr; 50 | volatile uint8_t rd_ptr; 51 | uint8_t buf[CFG_UART_BUFSIZE]; 52 | } uart_buffer_t; 53 | 54 | // UART Protocol control block 55 | typedef struct _uart_pcb_t 56 | { 57 | BOOL initialised; 58 | uint32_t status; 59 | uint32_t pending_tx_data; 60 | uart_buffer_t rxfifo; 61 | } uart_pcb_t; 62 | 63 | void UART_IRQHandler(void); 64 | uart_pcb_t *uartGetPCB(); 65 | void uartInit(uint32_t Baudrate); 66 | void uartSend(uint8_t *BufferPtr, uint32_t Length); 67 | void uartSendByte (uint8_t byte); 68 | 69 | // Rx Buffer access control 70 | void uartRxBufferInit(); 71 | uint8_t uartRxBufferRead(); 72 | void uartRxBufferWrite(uint8_t data); 73 | void uartRxBufferClearFIFO(); 74 | uint8_t uartRxBufferDataPending(); 75 | bool uartRxBufferReadArray(byte_t* rx, size_t* len); 76 | 77 | #endif 78 | -------------------------------------------------------------------------------- /core/wdt/wdt.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************/ 2 | /*! 3 | @file wdt.h 4 | @author K. Townsend (microBuilder.eu) 5 | @date 22 March 2010 6 | @version 0.10 7 | 8 | @section LICENSE 9 | 10 | Software License Agreement (BSD License) 11 | 12 | Copyright (c) 2010, microBuilder SARL 13 | All rights reserved. 14 | 15 | Redistribution and use in source and binary forms, with or without 16 | modification, are permitted provided that the following conditions are met: 17 | 1. Redistributions of source code must retain the above copyright 18 | notice, this list of conditions and the following disclaimer. 19 | 2. Redistributions in binary form must reproduce the above copyright 20 | notice, this list of conditions and the following disclaimer in the 21 | documentation and/or other materials provided with the distribution. 22 | 3. Neither the name of the copyright holders nor the 23 | names of its contributors may be used to endorse or promote products 24 | derived from this software without specific prior written permission. 25 | 26 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY 27 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 28 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 29 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY 30 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 31 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 32 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 33 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 34 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 35 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 36 | */ 37 | /**************************************************************************/ 38 | 39 | #ifndef _WDT_H_ 40 | #define _WDT_H_ 41 | 42 | #include "projectconfig.h" 43 | 44 | void wdtInit (void); 45 | void wdtFeed (void); 46 | 47 | #endif -------------------------------------------------------------------------------- /drivers/dac/mcp4725/mcp4725.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************/ 2 | /*! 3 | @file mcp4725.h 4 | @author K. Townsend (microBuilder.eu) 5 | 6 | @section LICENSE 7 | 8 | Software License Agreement (BSD License) 9 | 10 | Copyright (c) 2010, microBuilder SARL 11 | All rights reserved. 12 | 13 | Redistribution and use in source and binary forms, with or without 14 | modification, are permitted provided that the following conditions are met: 15 | 1. Redistributions of source code must retain the above copyright 16 | notice, this list of conditions and the following disclaimer. 17 | 2. Redistributions in binary form must reproduce the above copyright 18 | notice, this list of conditions and the following disclaimer in the 19 | documentation and/or other materials provided with the distribution. 20 | 3. Neither the name of the copyright holders nor the 21 | names of its contributors may be used to endorse or promote products 22 | derived from this software without specific prior written permission. 23 | 24 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY 25 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 26 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 27 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY 28 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 29 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 30 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 31 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 32 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 33 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | */ 35 | /**************************************************************************/ 36 | 37 | #ifndef _MCP4725_H_ 38 | #define _MCP4725_H_ 39 | 40 | #include "projectconfig.h" 41 | 42 | #define MCP4725_ADDRESS (0xC0) // 1100000x - Assumes A0 is GND and A2,A1 are 0 (MCP4725A0T-E/CH) 43 | #define MCP4725_READ (0x01) 44 | #define MCP4726_CMD_WRITEDAC (0x40) // Writes data to the DAC 45 | #define MCP4726_CMD_WRITEDACEEPROM (0x60) // Writes data to the DAC and the EEPROM (persisting the assigned value after reset) 46 | 47 | int mcp4725Init(); 48 | void mcp4725SetVoltage( uint16_t output, bool writeEEPROM ); 49 | void mcp472ReadConfig( uint8_t *status, uint16_t *value ); 50 | 51 | #endif -------------------------------------------------------------------------------- /drivers/displays/bitmap/ST7565/ST7565.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************/ 2 | /*! 3 | @file ST7565.h 4 | @author K. Townsend (microBuilder.eu) 5 | @date 22 March 2010 6 | @version 0.10 7 | 8 | @section LICENSE 9 | 10 | Software License Agreement (BSD License) 11 | 12 | Copyright (c) 2010, microBuilder SARL 13 | All rights reserved. 14 | 15 | Redistribution and use in source and binary forms, with or without 16 | modification, are permitted provided that the following conditions are met: 17 | 1. Redistributions of source code must retain the above copyright 18 | notice, this list of conditions and the following disclaimer. 19 | 2. Redistributions in binary form must reproduce the above copyright 20 | notice, this list of conditions and the following disclaimer in the 21 | documentation and/or other materials provided with the distribution. 22 | 3. Neither the name of the copyright holders nor the 23 | names of its contributors may be used to endorse or promote products 24 | derived from this software without specific prior written permission. 25 | 26 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY 27 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 28 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 29 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY 30 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 31 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 32 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 33 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 34 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 35 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 36 | */ 37 | /**************************************************************************/ 38 | #ifndef __ST7565_H__ 39 | #define __ST7565_H__ 40 | 41 | #include "projectconfig.h" 42 | 43 | #include "drivers/displays/smallfonts.h" 44 | 45 | // Pin Definitions 46 | #define ST7565_A0_PORT (2) // Register Select Pin (A0) 47 | #define ST7565_A0_PIN (4) 48 | #define ST7565_RST_PORT (2) // Reset 49 | #define ST7565_RST_PIN (5) 50 | #define ST7565_CS_PORT (2) // Select 51 | #define ST7565_CS_PIN (6) 52 | #define ST7565_BL_PORT (2) // Backlight 53 | #define ST7565_BL_PIN (7) 54 | #define ST7565_SCLK_PORT (2) // Serial Clock 55 | #define ST7565_SCLK_PIN (8) 56 | #define ST7565_SDAT_PORT (2) // Serial Data 57 | #define ST7565_SDAT_PIN (9) 58 | 59 | // Commands 60 | #define ST7565_CMD_DISPLAY_OFF 0xAE 61 | #define ST7565_CMD_DISPLAY_ON 0xAF 62 | #define ST7565_CMD_SET_DISP_START_LINE 0x40 63 | #define ST7565_CMD_SET_PAGE 0xB0 64 | #define ST7565_CMD_SET_COLUMN_UPPER 0x10 65 | #define ST7565_CMD_SET_COLUMN_LOWER 0x00 66 | #define ST7565_CMD_SET_ADC_NORMAL 0xA0 67 | #define ST7565_CMD_SET_ADC_REVERSE 0xA1 68 | #define ST7565_CMD_SET_DISP_NORMAL 0xA6 69 | #define ST7565_CMD_SET_DISP_REVERSE 0xA7 70 | #define ST7565_CMD_SET_ALLPTS_NORMAL 0xA4 71 | #define ST7565_CMD_SET_ALLPTS_ON 0xA5 72 | #define ST7565_CMD_SET_BIAS_9 0xA2 73 | #define ST7565_CMD_SET_BIAS_7 0xA3 74 | #define ST7565_CMD_RMW 0xE0 75 | #define ST7565_CMD_RMW_CLEAR 0xEE 76 | #define ST7565_CMD_INTERNAL_RESET 0xE2 77 | #define ST7565_CMD_SET_COM_NORMAL 0xC0 78 | #define ST7565_CMD_SET_COM_REVERSE 0xC8 79 | #define ST7565_CMD_SET_POWER_CONTROL 0x28 80 | #define ST7565_CMD_SET_RESISTOR_RATIO 0x20 81 | #define ST7565_CMD_SET_VOLUME_FIRST 0x81 82 | #define ST7565_CMD_SET_VOLUME_SECOND 0 83 | #define ST7565_CMD_SET_STATIC_OFF 0xAC 84 | #define ST7565_CMD_SET_STATIC_ON 0xAD 85 | #define ST7565_CMD_SET_STATIC_REG 0x0 86 | #define ST7565_CMD_SET_BOOSTER_FIRST 0xF8 87 | #define ST7565_CMD_SET_BOOSTER_234 0 88 | #define ST7565_CMD_SET_BOOSTER_5 1 89 | #define ST7565_CMD_SET_BOOSTER_6 3 90 | #define ST7565_CMD_NOP 0xE3 91 | #define ST7565_CMD_TEST 0xF0 92 | 93 | // Initialisation/Config Prototypes 94 | void st7565Init( void ); 95 | void st7565Command( uint8_t c ); 96 | void st7565Data( uint8_t d ); 97 | void st7565SetBrightness( uint8_t val ); 98 | 99 | // Backlight Prototypes 100 | void st7565Backlight(bool state); 101 | 102 | // Drawing Prototypes 103 | void st7565ClearScreen( void ); 104 | void st7565Refresh( void ); 105 | void st7565DrawPixel( uint8_t x, uint8_t y ); 106 | void st7565ClearPixel( uint8_t x, uint8_t y ); 107 | uint8_t st7565GetPixel( uint8_t x, uint8_t y ); 108 | void st7565DrawString( uint16_t x, uint16_t y, char* text, struct FONT_DEF font ); 109 | void st7565ShiftFrameBuffer( uint8_t pixels ); 110 | 111 | #endif 112 | -------------------------------------------------------------------------------- /drivers/displays/bitmap/readme.txt: -------------------------------------------------------------------------------- 1 | Bitmap LCDs 2 | =========== 3 | 4 | This folder contains drivers for 1-bit graphic LCDs (128x64 pixel ST7565, etc.) 5 | or text-only displays. They are placed in a seperate folder because the 6 | drawing routines are handled quite differently than the generic drawing code 7 | for TFT LCDs. 8 | 9 | SSD1306 Driver for 128x64 OLED displays using the SSD1306 controller. 10 | Simulates SPI mode using GPIO pins. 11 | ST7565 Driver for 128x64 pixel I2C-based displays (available from 12 | Adafruit Industries, for example). Simulates SPI mode using 13 | GPIO pins. -------------------------------------------------------------------------------- /drivers/displays/smallfonts.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microbuilder/LPC1114CodeBase/c1dc51a7029aeba2a2f4d8792a0da17ccd1c0665/drivers/displays/smallfonts.c -------------------------------------------------------------------------------- /drivers/displays/smallfonts.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************/ 2 | /*! 3 | @file smallfonts.h 4 | @author K. Townsend (microBuilder.eu) 5 | @date 22 March 2010 6 | @version 0.10 7 | 8 | @section LICENSE 9 | 10 | Software License Agreement (BSD License) 11 | 12 | Copyright (c) 2010, microBuilder SARL 13 | All rights reserved. 14 | 15 | Redistribution and use in source and binary forms, with or without 16 | modification, are permitted provided that the following conditions are met: 17 | 1. Redistributions of source code must retain the above copyright 18 | notice, this list of conditions and the following disclaimer. 19 | 2. Redistributions in binary form must reproduce the above copyright 20 | notice, this list of conditions and the following disclaimer in the 21 | documentation and/or other materials provided with the distribution. 22 | 3. Neither the name of the copyright holders nor the 23 | names of its contributors may be used to endorse or promote products 24 | derived from this software without specific prior written permission. 25 | 26 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY 27 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 28 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 29 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY 30 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 31 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 32 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 33 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 34 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 35 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 36 | */ 37 | /**************************************************************************/ 38 | #ifndef __SMALLFONTS_H_ 39 | #define __SMALLFONTS_H_ 40 | 41 | /* Partially based on original code for the KS0108 by Stephane Rey */ 42 | /* Current version by Kevin Townsend */ 43 | /* Last Updated: 12 May 2009 */ 44 | 45 | #include "projectconfig.h" 46 | 47 | struct FONT_DEF 48 | { 49 | uint8_t u8Width; /* Character width for storage */ 50 | uint8_t u8Height; /* Character height for storage */ 51 | uint8_t u8FirstChar; /* The first character available */ 52 | uint8_t u8LastChar; /* The last character available */ 53 | const uint8_t *au8FontTable; /* Font table start address in memory */ 54 | }; 55 | 56 | extern const struct FONT_DEF Font_System3x6; 57 | extern const struct FONT_DEF Font_System5x8; 58 | extern const struct FONT_DEF Font_System7x8; 59 | extern const struct FONT_DEF Font_8x8; 60 | extern const struct FONT_DEF Font_8x8Thin; 61 | 62 | extern const uint8_t au8FontSystem3x6[]; 63 | extern const uint8_t au8FontSystem5x8[]; 64 | extern const uint8_t au8FontSystem7x8[]; 65 | extern const uint8_t au8Font8x8[]; 66 | extern const uint8_t au8Font8x8Thin[]; 67 | 68 | #endif 69 | -------------------------------------------------------------------------------- /drivers/eeprom/eeprom.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************/ 2 | /*! 3 | @file eeprom.h 4 | @author K. Townsend (microBuilder.eu) 5 | 6 | @section LICENSE 7 | 8 | Software License Agreement (BSD License) 9 | 10 | Copyright (c) 2010, microBuilder SARL 11 | All rights reserved. 12 | 13 | Redistribution and use in source and binary forms, with or without 14 | modification, are permitted provided that the following conditions are met: 15 | 1. Redistributions of source code must retain the above copyright 16 | notice, this list of conditions and the following disclaimer. 17 | 2. Redistributions in binary form must reproduce the above copyright 18 | notice, this list of conditions and the following disclaimer in the 19 | documentation and/or other materials provided with the distribution. 20 | 3. Neither the name of the copyright holders nor the 21 | names of its contributors may be used to endorse or promote products 22 | derived from this software without specific prior written permission. 23 | 24 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY 25 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 26 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 27 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY 28 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 29 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 30 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 31 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 32 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 33 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | */ 35 | /**************************************************************************/ 36 | #ifndef __EEPROM_H__ 37 | #define __EEPROM_H__ 38 | 39 | #include "projectconfig.h" 40 | 41 | // Method Prototypes 42 | bool eepromCheckAddress ( uint16_t addr ); 43 | uint8_t eepromReadU8 ( uint16_t addr ); 44 | int8_t eepromReadS8 ( uint16_t addr ); 45 | uint16_t eepromReadU16 ( uint16_t addr ); 46 | int16_t eepromReadS16 ( uint16_t addr ); 47 | uint32_t eepromReadU32 ( uint16_t addr ); 48 | int32_t eepromReadS32 ( uint16_t addr ); 49 | uint64_t eepromReadU64 ( uint16_t addr ); 50 | int64_t eepromReadS64 ( uint16_t addr ); 51 | void eepromReadBuffer ( uint16_t addr, uint8_t *buffer, uint32_t bufferLength); 52 | void eepromWriteU8 ( uint16_t addr, uint8_t value ); 53 | void eepromWriteS8 ( uint16_t addr, int8_t value ); 54 | void eepromWriteU16 ( uint16_t addr, uint16_t value ); 55 | void eepromWriteS16 ( uint16_t addr, int16_t value ); 56 | void eepromWriteU32 ( uint16_t addr, uint32_t value ); 57 | void eepromWriteS32 ( uint16_t addr, int32_t value ); 58 | void eepromWriteU64 ( uint16_t addr, uint64_t value ); 59 | void eepromWriteS64 ( uint16_t addr, int64_t value ); 60 | 61 | #endif 62 | -------------------------------------------------------------------------------- /drivers/eeprom/mcp24aa/mcp24aa.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************/ 2 | /*! 3 | @file mcp24aa.h 4 | @author K. Townsend (microBuilder.eu) 5 | @date 22 March 2010 6 | @version 0.10 7 | 8 | @section LICENSE 9 | 10 | Software License Agreement (BSD License) 11 | 12 | Copyright (c) 2010, microBuilder SARL 13 | All rights reserved. 14 | 15 | Redistribution and use in source and binary forms, with or without 16 | modification, are permitted provided that the following conditions are met: 17 | 1. Redistributions of source code must retain the above copyright 18 | notice, this list of conditions and the following disclaimer. 19 | 2. Redistributions in binary form must reproduce the above copyright 20 | notice, this list of conditions and the following disclaimer in the 21 | documentation and/or other materials provided with the distribution. 22 | 3. Neither the name of the copyright holders nor the 23 | names of its contributors may be used to endorse or promote products 24 | derived from this software without specific prior written permission. 25 | 26 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY 27 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 28 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 29 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY 30 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 31 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 32 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 33 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 34 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 35 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 36 | */ 37 | /**************************************************************************/ 38 | 39 | #ifndef _MCP24AA_H_ 40 | #define _MCP24AA_H_ 41 | 42 | #include "projectconfig.h" 43 | 44 | #define MCP24AA_ADDR 0xA0 // 10100000 45 | #define MCP24AA_RW 0x01 46 | #define MCP24AA_READBIT 0x01 47 | #define MCP24AA_MAXADDR 0xFFF // 4K = 4096 48 | 49 | typedef enum 50 | { 51 | MCP24AA_ERROR_OK = 0, // Everything executed normally 52 | MCP24AA_ERROR_I2CINIT, // Unable to initialise I2C 53 | MCP24AA_ERROR_I2CBUSY, // I2C already in use 54 | MCP24AA_ERROR_ADDRERR, // Address out of range 55 | MCP24AA_ERROR_BUFFEROVERFLOW, // Max 8 bytes can be read/written in one operation 56 | MCP24AA_ERROR_LAST 57 | } 58 | mcp24aaError_e; 59 | 60 | mcp24aaError_e mcp24aaInit (void); 61 | mcp24aaError_e mcp24aaReadBuffer (uint16_t address, uint8_t *buffer, uint32_t bufferLength); 62 | mcp24aaError_e mcp24aaWriteBuffer (uint16_t address, uint8_t *buffer, uint32_t bufferLength); 63 | mcp24aaError_e mcp24aaReadByte (uint16_t address, uint8_t *buffer); 64 | mcp24aaError_e mcp24aaWriteByte (uint16_t address, uint8_t value); 65 | 66 | 67 | #endif 68 | -------------------------------------------------------------------------------- /drivers/fatfs/diskio.h: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------- 2 | / Low level disk interface modlue include file R0.05 (C)ChaN, 2007 3 | /-----------------------------------------------------------------------*/ 4 | 5 | #ifndef _DISKIO 6 | 7 | #define _READONLY 0 /* 1: Read-only mode */ 8 | #define _USE_IOCTL 1 9 | 10 | #include "integer.h" 11 | 12 | 13 | /* Status of Disk Functions */ 14 | typedef BYTE DSTATUS; 15 | 16 | /* Results of Disk Functions */ 17 | typedef enum { 18 | RES_OK = 0, /* 0: Successful */ 19 | RES_ERROR, /* 1: R/W Error */ 20 | RES_WRPRT, /* 2: Write Protected */ 21 | RES_NOTRDY, /* 3: Not Ready */ 22 | RES_PARERR /* 4: Invalid Parameter */ 23 | } DRESULT; 24 | 25 | 26 | /*---------------------------------------*/ 27 | /* Prototypes for disk control functions */ 28 | 29 | DSTATUS disk_initialize (BYTE); 30 | DSTATUS disk_status (BYTE); 31 | DRESULT disk_read (BYTE, BYTE*, DWORD, BYTE); 32 | #if _READONLY == 0 33 | DRESULT disk_write (BYTE, const BYTE*, DWORD, BYTE); 34 | #endif 35 | DRESULT disk_ioctl (BYTE, BYTE, void*); 36 | void disk_timerproc (void); 37 | 38 | 39 | 40 | 41 | /* Disk Status Bits (DSTATUS) */ 42 | 43 | #define STA_NOINIT 0x01 /* Drive not initialized */ 44 | #define STA_NODISK 0x02 /* No medium in the drive */ 45 | #define STA_PROTECT 0x04 /* Write protected */ 46 | 47 | 48 | 49 | /* Command code for disk_ioctrl() */ 50 | 51 | /* Generic command */ 52 | #define CTRL_SYNC 0 /* Mandatory for write functions */ 53 | #define GET_SECTOR_COUNT 1 /* Mandatory for only f_mkfs() */ 54 | #define GET_SECTOR_SIZE 2 55 | #define GET_BLOCK_SIZE 3 /* Mandatory for only f_mkfs() */ 56 | #define CTRL_POWER 4 57 | #define CTRL_LOCK 5 58 | #define CTRL_EJECT 6 59 | /* MMC/SDC command */ 60 | #define MMC_GET_TYPE 10 61 | #define MMC_GET_CSD 11 62 | #define MMC_GET_CID 12 63 | #define MMC_GET_OCR 13 64 | #define MMC_GET_SDSTAT 14 65 | /* ATA/CF command */ 66 | #define ATA_GET_REV 20 67 | #define ATA_GET_MODEL 21 68 | #define ATA_GET_SN 22 69 | 70 | 71 | 72 | /* Card type flags (CardType) */ 73 | #define CT_MMC 0x01 /* MMC ver 3 */ 74 | #define CT_SD1 0x02 /* SD ver 1 */ 75 | #define CT_SD2 0x04 /* SD ver 2 */ 76 | #define CT_SDC (CT_SD1|CT_SD2) /* SD */ 77 | #define CT_BLOCK 0x08 /* Block addressing */ 78 | 79 | 80 | #define _DISKIO 81 | #endif 82 | -------------------------------------------------------------------------------- /drivers/fatfs/integer.h: -------------------------------------------------------------------------------- 1 | /*-------------------------------------------*/ 2 | /* Integer type definitions for FatFs module */ 3 | /*-------------------------------------------*/ 4 | 5 | #ifndef _INTEGER 6 | 7 | #if 0 8 | #include 9 | #else 10 | 11 | /* These types must be 16-bit, 32-bit or larger integer */ 12 | typedef int INT; 13 | typedef unsigned int UINT; 14 | 15 | /* These types must be 8-bit integer */ 16 | typedef signed char CHAR; 17 | typedef unsigned char UCHAR; 18 | typedef unsigned char BYTE; 19 | 20 | /* These types must be 16-bit integer */ 21 | typedef short SHORT; 22 | typedef unsigned short USHORT; 23 | typedef unsigned short WORD; 24 | typedef unsigned short WCHAR; 25 | 26 | /* These types must be 32-bit integer */ 27 | typedef long LONG; 28 | typedef unsigned long ULONG; 29 | typedef unsigned long DWORD; 30 | 31 | #endif 32 | 33 | #define _INTEGER 34 | #endif 35 | -------------------------------------------------------------------------------- /drivers/motor/stepper/stepper.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************/ 2 | /*! 3 | @file stepper.h 4 | @author K. Townsend (microBuilder.eu) 5 | 6 | @section LICENSE 7 | 8 | Software License Agreement (BSD License) 9 | 10 | Copyright (c) 2010, microBuilder SARL 11 | All rights reserved. 12 | 13 | Redistribution and use in source and binary forms, with or without 14 | modification, are permitted provided that the following conditions are met: 15 | 1. Redistributions of source code must retain the above copyright 16 | notice, this list of conditions and the following disclaimer. 17 | 2. Redistributions in binary form must reproduce the above copyright 18 | notice, this list of conditions and the following disclaimer in the 19 | documentation and/or other materials provided with the distribution. 20 | 3. Neither the name of the copyright holders nor the 21 | names of its contributors may be used to endorse or promote products 22 | derived from this software without specific prior written permission. 23 | 24 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY 25 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 26 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 27 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY 28 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 29 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 30 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 31 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 32 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 33 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | */ 35 | /**************************************************************************/ 36 | 37 | #ifndef _STEPPER_H_ 38 | #define _STEPPER_H_ 39 | 40 | #include "projectconfig.h" 41 | 42 | #define STEPPER_IN1_PORT (2) 43 | #define STEPPER_IN1_PIN (8) 44 | #define STEPPER_IN2_PORT (2) 45 | #define STEPPER_IN2_PIN (9) 46 | #define STEPPER_IN3_PORT (2) 47 | #define STEPPER_IN3_PIN (10) 48 | #define STEPPER_IN4_PORT (2) 49 | #define STEPPER_IN4_PIN (11) 50 | 51 | void stepperInit( uint32_t steps ); 52 | void stepperSetSpeed( uint32_t rpm ); 53 | int64_t stepperGetPosition(); 54 | uint32_t stepperGetRotation(); 55 | void stepperMoveHome(); 56 | void stepperSetHome(); 57 | void stepperMoveZero(); 58 | void stepperSetZero(); 59 | void stepperStep( int32_t steps ); 60 | 61 | #endif -------------------------------------------------------------------------------- /drivers/rf/chibi/chb.h: -------------------------------------------------------------------------------- 1 | /******************************************************************* 2 | Copyright (C) 2009 FreakLabs 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions 7 | are met: 8 | 9 | 1. Redistributions of source code must retain the above copyright 10 | notice, this list of conditions and the following disclaimer. 11 | 2. Redistributions in binary form must reproduce the above copyright 12 | notice, this list of conditions and the following disclaimer in the 13 | documentation and/or other materials provided with the distribution. 14 | 3. Neither the name of the the copyright holder nor the names of its contributors 15 | may be used to endorse or promote products derived from this software 16 | without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND 19 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 | OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 | SUCH DAMAGE. 29 | 30 | Originally written by Christopher Wang aka Akiba. 31 | Please post support questions to the FreakLabs forum. 32 | 33 | *******************************************************************/ 34 | #ifndef CHIBI_H 35 | #define CHIBI_H 36 | 37 | #include "types.h" 38 | 39 | #define CHB_HDR_SZ 9 // FCF + seq + pan_id + dest_addr + src_addr (2 + 1 + 2 + 2 + 2) 40 | #define CHB_FCS_LEN 2 41 | #define CHB_MAX_PAYLOAD 100 42 | 43 | 44 | // frame_type = data 45 | // security enabled = false 46 | // frame pending = false 47 | // ack request = false 48 | // pan ID compression = true 49 | #define CHB_FCF_BYTE_0 0x41 50 | 51 | // dest addr = 16-bit 52 | // frame version = 802.15.4 (not 2003) 53 | // src addr = 16-bit 54 | #define CHB_FCF_BYTE_1 0x98 55 | 56 | #define CHB_ACK_REQ_POS 5 57 | 58 | enum 59 | { 60 | CHB_SUCCESS = 0, 61 | CHB_SUCCESS_DATA_PENDING = 1, 62 | CHB_CHANNEL_ACCESS_FAILURE = 3, 63 | CHB_NO_ACK = 5, 64 | CHB_INVALID = 7 65 | }; 66 | 67 | // Chibi protocol control block 68 | typedef struct 69 | { 70 | U16 src_addr; 71 | U8 seq; 72 | volatile bool data_rcv; 73 | volatile bool tx_end; 74 | 75 | // stats 76 | U16 rcvd_xfers; 77 | U16 txd_success; 78 | U16 txd_noack; 79 | U16 txd_channel_fail; 80 | U16 overflow; 81 | U16 underrun; 82 | U8 battlow; 83 | U8 ed; 84 | U8 crc; 85 | } chb_pcb_t; 86 | 87 | typedef struct 88 | { 89 | U8 len; 90 | U16 src_addr; 91 | U16 dest_addr; 92 | U8 data[CHB_MAX_PAYLOAD]; 93 | } chb_rx_data_t; 94 | 95 | void chb_init(); 96 | chb_pcb_t *chb_get_pcb(); 97 | U8 chb_write(U16 addr, U8 *data, U8 len); 98 | U8 chb_read(chb_rx_data_t *rx); 99 | 100 | #endif 101 | -------------------------------------------------------------------------------- /drivers/rf/chibi/chb_buf.c: -------------------------------------------------------------------------------- 1 | /******************************************************************* 2 | Copyright (C) 2009 FreakLabs 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions 7 | are met: 8 | 9 | 1. Redistributions of source code must retain the above copyright 10 | notice, this list of conditions and the following disclaimer. 11 | 2. Redistributions in binary form must reproduce the above copyright 12 | notice, this list of conditions and the following disclaimer in the 13 | documentation and/or other materials provided with the distribution. 14 | 3. Neither the name of the the copyright holder nor the names of its contributors 15 | may be used to endorse or promote products derived from this software 16 | without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND 19 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 | OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 | SUCH DAMAGE. 29 | 30 | Originally written by Christopher Wang aka Akiba. 31 | Please post support questions to the FreakLabs forum. 32 | 33 | *******************************************************************/ 34 | #include 35 | 36 | #include "projectconfig.h" 37 | #include "chb_buf.h" 38 | 39 | static U8 chb_buf[CFG_CHIBI_BUFFERSIZE]; 40 | static volatile U32 rd_ptr, wr_ptr; 41 | static volatile U32 len; 42 | 43 | /**************************************************************************/ 44 | /*! 45 | 46 | */ 47 | /**************************************************************************/ 48 | void chb_buf_init() 49 | { 50 | rd_ptr = 0; 51 | wr_ptr = 0; 52 | len = 0; 53 | } 54 | 55 | /**************************************************************************/ 56 | /*! 57 | 58 | */ 59 | /**************************************************************************/ 60 | void chb_buf_write(U8 data) 61 | { 62 | chb_buf[wr_ptr] = data; 63 | wr_ptr = (wr_ptr + 1) % CFG_CHIBI_BUFFERSIZE; 64 | len++; 65 | } 66 | 67 | /**************************************************************************/ 68 | /*! 69 | 70 | */ 71 | /**************************************************************************/ 72 | U8 chb_buf_read() 73 | { 74 | U8 data; 75 | 76 | data = chb_buf[rd_ptr]; 77 | rd_ptr = (rd_ptr + 1) % CFG_CHIBI_BUFFERSIZE; 78 | len--; 79 | return data; 80 | } 81 | 82 | /**************************************************************************/ 83 | /*! 84 | 85 | */ 86 | /**************************************************************************/ 87 | U32 chb_buf_get_len() 88 | { 89 | return len; 90 | } 91 | -------------------------------------------------------------------------------- /drivers/rf/chibi/chb_buf.h: -------------------------------------------------------------------------------- 1 | /******************************************************************* 2 | Copyright (C) 2009 FreakLabs 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions 7 | are met: 8 | 9 | 1. Redistributions of source code must retain the above copyright 10 | notice, this list of conditions and the following disclaimer. 11 | 2. Redistributions in binary form must reproduce the above copyright 12 | notice, this list of conditions and the following disclaimer in the 13 | documentation and/or other materials provided with the distribution. 14 | 3. Neither the name of the the copyright holder nor the names of its contributors 15 | may be used to endorse or promote products derived from this software 16 | without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND 19 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 | OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 | SUCH DAMAGE. 29 | 30 | Originally written by Christopher Wang aka Akiba. 31 | Please post support questions to the FreakLabs forum. 32 | 33 | *******************************************************************/ 34 | #ifndef CHB_BUF_H 35 | #define CHB_BUF_H 36 | 37 | #include "types.h" 38 | 39 | void chb_buf_init(); 40 | void chb_buf_write(U8 data); 41 | U8 chb_buf_read(); 42 | U32 chb_buf_get_len(); 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /drivers/rf/chibi/chb_eeprom.c: -------------------------------------------------------------------------------- 1 | /******************************************************************* 2 | Copyright (C) 2009 FreakLabs 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions 7 | are met: 8 | 9 | 1. Redistributions of source code must retain the above copyright 10 | notice, this list of conditions and the following disclaimer. 11 | 2. Redistributions in binary form must reproduce the above copyright 12 | notice, this list of conditions and the following disclaimer in the 13 | documentation and/or other materials provided with the distribution. 14 | 3. Neither the name of the the copyright holder nor the names of its contributors 15 | may be used to endorse or promote products derived from this software 16 | without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND 19 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 | OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 | SUCH DAMAGE. 29 | 30 | Originally written by Christopher Wang aka Akiba. 31 | Please post support questions to the FreakLabs forum. 32 | 33 | *******************************************************************/ 34 | /*! 35 | \file 36 | \ingroup 37 | 38 | 39 | */ 40 | /**************************************************************************/ 41 | #include "chb_eeprom.h" 42 | #include "drivers/eeprom/eeprom.h" 43 | 44 | /**************************************************************************/ 45 | /*! 46 | 47 | */ 48 | /**************************************************************************/ 49 | void chb_eeprom_write(uint16_t addr, uint8_t *buf, uint16_t size) 50 | { 51 | // Write the address one byte at a time 52 | uint16_t a = 0; 53 | while (a < size) 54 | { 55 | eepromWriteU8(addr + a, buf[a]); 56 | a++; 57 | } 58 | } 59 | 60 | /**************************************************************************/ 61 | /*! 62 | 63 | */ 64 | /**************************************************************************/ 65 | void chb_eeprom_read(uint16_t addr, uint8_t *buf, uint16_t size) 66 | { 67 | // Read the contents at address 68 | eepromReadBuffer(addr, buf, size); 69 | } 70 | 71 | -------------------------------------------------------------------------------- /drivers/rf/chibi/chb_eeprom.h: -------------------------------------------------------------------------------- 1 | /******************************************************************* 2 | Copyright (C) 2009 FreakLabs 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions 7 | are met: 8 | 9 | 1. Redistributions of source code must retain the above copyright 10 | notice, this list of conditions and the following disclaimer. 11 | 2. Redistributions in binary form must reproduce the above copyright 12 | notice, this list of conditions and the following disclaimer in the 13 | documentation and/or other materials provided with the distribution. 14 | 3. Neither the name of the the copyright holder nor the names of its contributors 15 | may be used to endorse or promote products derived from this software 16 | without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND 19 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 | OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 | SUCH DAMAGE. 29 | 30 | Originally written by Christopher Wang aka Akiba. 31 | Please post support questions to the FreakLabs forum. 32 | 33 | *******************************************************************/ 34 | /*! 35 | \file 36 | \ingroup 37 | 38 | 39 | */ 40 | /**************************************************************************/ 41 | #ifndef CHB_EEPROM_H 42 | #define CHB_EEPROM_H 43 | 44 | #include "projectconfig.h" 45 | #include "types.h" 46 | 47 | void chb_eeprom_write(U16 addr, U8 *buf, U16 size); 48 | void chb_eeprom_read(U16 addr, U8 *buf, U16 size); 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /drivers/rf/chibi/chb_libpcap.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************/ 2 | /*! 3 | @file chb_libpcap.h 4 | @author K. Townsend (microBuilder.eu) 5 | 6 | @section LICENSE 7 | 8 | Software License Agreement (BSD License) 9 | 10 | Copyright (c) 2011, microBuilder SARL 11 | All rights reserved. 12 | 13 | Redistribution and use in source and binary forms, with or without 14 | modification, are permitted provided that the following conditions are met: 15 | 1. Redistributions of source code must retain the above copyright 16 | notice, this list of conditions and the following disclaimer. 17 | 2. Redistributions in binary form must reproduce the above copyright 18 | notice, this list of conditions and the following disclaimer in the 19 | documentation and/or other materials provided with the distribution. 20 | 3. Neither the name of the copyright holders nor the 21 | names of its contributors may be used to endorse or promote products 22 | derived from this software without specific prior written permission. 23 | 24 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY 25 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 26 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 27 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY 28 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 29 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 30 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 31 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 32 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 33 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | */ 35 | /**************************************************************************/ 36 | #ifndef CHB_LIBPCAP_H 37 | #define CHB_LIBPCAP_H 38 | 39 | #include "projectconfig.h" 40 | 41 | typedef enum libpcap_error 42 | { 43 | LIBPCAP_OK = 0, 44 | LIBPCAP_ERROR_NOTINITIALISED = 1, 45 | LIBPCAP_ERROR_FATFS_NODISK = 10, 46 | LIBPCAP_ERROR_FATFS_INITFAILED = 11, 47 | LIBPCAP_ERROR_FATFS_FAILEDTOMOUNTDRIVE = 12, 48 | LIBPCAP_ERROR_FATFS_UNABLETOCREATEFILE = 13, 49 | LIBPCAP_ERROR_FATFS_UNABLETOOPENFILE = 14 50 | } libpcap_error_t; 51 | 52 | libpcap_error_t libpcapInit(char *filename); 53 | libpcap_error_t libpcapWriteFrame(const uint8_t * frame_buffer, uint32_t frame_len); 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /drivers/rf/chibi/chb_spi.c: -------------------------------------------------------------------------------- 1 | /******************************************************************* 2 | Copyright (C) 2009 FreakLabs 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions 7 | are met: 8 | 9 | 1. Redistributions of source code must retain the above copyright 10 | notice, this list of conditions and the following disclaimer. 11 | 2. Redistributions in binary form must reproduce the above copyright 12 | notice, this list of conditions and the following disclaimer in the 13 | documentation and/or other materials provided with the distribution. 14 | 3. Neither the name of the the copyright holder nor the names of its contributors 15 | may be used to endorse or promote products derived from this software 16 | without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND 19 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 | OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 | SUCH DAMAGE. 29 | 30 | Originally written by Christopher Wang aka Akiba. 31 | Please post support questions to the FreakLabs forum. 32 | 33 | *******************************************************************/ 34 | /*! 35 | \file 36 | \ingroup 37 | 38 | 39 | */ 40 | /**************************************************************************/ 41 | #include "chb.h" 42 | #include "chb_spi.h" 43 | #include "core/ssp/ssp.h" 44 | 45 | /**************************************************************************/ 46 | /*! 47 | 48 | */ 49 | /**************************************************************************/ 50 | void chb_spi_init() 51 | { 52 | // initialise spi, high between frames and transition on trailing edge 53 | sspInit(0, sspClockPolarity_High, sspClockPhase_FallingEdge); 54 | 55 | // set the slave select to idle 56 | CHB_SPI_DISABLE(); 57 | } 58 | 59 | /**************************************************************************/ 60 | /*! 61 | This function both reads and writes data. For write operations, include data 62 | to be written as argument. For read ops, use dummy data as arg. Returned 63 | data is read byte val. 64 | */ 65 | /**************************************************************************/ 66 | U8 chb_xfer_byte(U8 data) 67 | { 68 | /* Move on only if NOT busy and TX FIFO not full */ 69 | while ((SSP_SSP0SR & (SSP_SSP0SR_TNF_MASK | SSP_SSP0SR_BSY_MASK)) != SSP_SSP0SR_TNF_NOTFULL); 70 | SSP_SSP0DR = data; 71 | 72 | /* Wait until the busy bit is cleared and receive buffer is not empty */ 73 | while ((SSP_SSP0SR & (SSP_SSP0SR_BSY_MASK | SSP_SSP0SR_RNE_MASK)) != SSP_SSP0SR_RNE_NOTEMPTY); 74 | 75 | // Read the queue 76 | return SSP_SSP0DR; 77 | } 78 | -------------------------------------------------------------------------------- /drivers/rf/chibi/chb_spi.h: -------------------------------------------------------------------------------- 1 | /******************************************************************* 2 | Copyright (C) 2009 FreakLabs 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions 7 | are met: 8 | 9 | 1. Redistributions of source code must retain the above copyright 10 | notice, this list of conditions and the following disclaimer. 11 | 2. Redistributions in binary form must reproduce the above copyright 12 | notice, this list of conditions and the following disclaimer in the 13 | documentation and/or other materials provided with the distribution. 14 | 3. Neither the name of the the copyright holder nor the names of its contributors 15 | may be used to endorse or promote products derived from this software 16 | without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND 19 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 | OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 | SUCH DAMAGE. 29 | 30 | Originally written by Christopher Wang aka Akiba. 31 | Please post support questions to the FreakLabs forum. 32 | 33 | *******************************************************************/ 34 | /*! 35 | \file 36 | \ingroup 37 | 38 | 39 | */ 40 | /**************************************************************************/ 41 | 42 | #ifndef CHB_SPI_H 43 | #define CHB_SPI_H 44 | 45 | #include "projectconfig.h" 46 | #include "core/gpio/gpio.h" 47 | 48 | #define CHB_SSPORT (0) // P0.2 = SSEL 49 | #define CHB_SSPIN (2) 50 | 51 | #define CHB_SPI_ENABLE() do {gpioSetValue(CHB_SSPORT, CHB_SSPIN, 0);} while (0) // Drive SSEL low 52 | #define CHB_SPI_DISABLE() do {gpioSetValue(CHB_SSPORT, CHB_SSPIN, 1);} while (0) // Drive SSEL high 53 | 54 | #define CHB_SPIPORT 0 55 | #define CHB_SCK 1 // PB.1 - Output: SPI Serial Clock (SCLK) 56 | #define CHB_MOSI 2 // PB.2 - Output: SPI Master out - slave in (MOSI) 57 | #define CHB_MISO 3 // PB.3 - Input: SPI Master in - slave out (MISO) 58 | 59 | void chb_spi_init(); 60 | U8 chb_xfer_byte(U8 data); 61 | 62 | #endif 63 | -------------------------------------------------------------------------------- /drivers/rf/chibi/types.h: -------------------------------------------------------------------------------- 1 | /******************************************************************* 2 | Copyright (C) 2009 FreakLabs 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions 7 | are met: 8 | 9 | 1. Redistributions of source code must retain the above copyright 10 | notice, this list of conditions and the following disclaimer. 11 | 2. Redistributions in binary form must reproduce the above copyright 12 | notice, this list of conditions and the following disclaimer in the 13 | documentation and/or other materials provided with the distribution. 14 | 3. Neither the name of the the copyright holder nor the names of its contributors 15 | may be used to endorse or promote products derived from this software 16 | without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND 19 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 | OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 | SUCH DAMAGE. 29 | 30 | Originally written by Christopher Wang aka Akiba. 31 | Please post support questions to the FreakLabs forum. 32 | *******************************************************************/ 33 | /*! 34 | \file types.h 35 | \ingroup usb 36 | */ 37 | /*******************************************************************/ 38 | #ifndef TYPES_H 39 | #define TYPES_H 40 | 41 | #include 42 | #include 43 | 44 | // Standard data types 45 | typedef uint8_t U8; /// Generic 8 bit unsigned data type 46 | typedef uint16_t U16; /// Generic 16 bit unsigned data type 47 | typedef uint32_t U32; /// Generic 32 bit unsigned data type 48 | typedef uint64_t U64; /// Generic 64 bit unsigned data type 49 | 50 | typedef int8_t S8; /// Generic 8 bit signed data type 51 | typedef int16_t S16; /// Generic 16 bit signed data type 52 | typedef int32_t S32; /// Generic 32 bit signed data type 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /drivers/rf/pn532/helpers/pn532_mifare.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************/ 2 | /*! 3 | @file pn532_mifare.h 4 | */ 5 | /**************************************************************************/ 6 | 7 | #ifndef __PN532_MIFARE_H__ 8 | #define __PN532_MIFARE_H__ 9 | 10 | #include "projectconfig.h" 11 | 12 | // These may need to be enlarged for multi card support 13 | #define PN532_RESPONSELEN_INLISTPASSIVETARGET (64) 14 | #define PN532_RESPONSELEN_INDATAEXCHANGE (64) 15 | 16 | typedef enum pn532_mifare_cmd_e 17 | { 18 | PN532_MIFARE_CMD_AUTH_A = 0x60, 19 | PN532_MIFARE_CMD_AUTH_B = 0x61, 20 | PN532_MIFARE_CMD_READ = 0x30, 21 | PN532_MIFARE_CMD_WRITE = 0xA0, 22 | PN532_MIFARE_CMD_TRANSFER = 0xB0, 23 | PN532_MIFARE_CMD_DECREMENT = 0xC0, 24 | PN532_MIFARE_CMD_INCREMENT = 0xC1, 25 | PN532_MIFARE_CMD_STORE = 0xC2 26 | } 27 | pn532_mifare_cmd_t; 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /drivers/rf/pn532/helpers/pn532_mifare_classic.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************/ 2 | /*! 3 | @file pn532_mifare_classic.h 4 | */ 5 | /**************************************************************************/ 6 | 7 | #ifndef __PN532_MIFARE_CLASSIC_H__ 8 | #define __PN532_MIFARE_CLASSIC_H__ 9 | 10 | #include "projectconfig.h" 11 | #include "pn532_mifare.h" 12 | 13 | pn532_error_t pn532_mifareclassic_WaitForPassiveTarget (byte_t * pbtCUID, size_t * szCUIDLen); 14 | pn532_error_t pn532_mifareclassic_AuthenticateBlock (byte_t * pbtCUID, size_t szCUIDLen, uint32_t uiBlockNumber, uint8_t uiKeyType, byte_t * pbtKeys); 15 | pn532_error_t pn532_mifareclassic_ReadDataBlock (uint8_t uiBlockNumber, byte_t * pbtData); 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /drivers/rf/pn532/helpers/pn532_mifare_ultralight.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************/ 2 | /*! 3 | @file pn532_mifare_ultralight.h 4 | */ 5 | /**************************************************************************/ 6 | 7 | #ifndef __PN532_MIFARE_ULTRALIGHT_H__ 8 | #define __PN532_MIFARE_ULTRALIGHT_H__ 9 | 10 | #include "projectconfig.h" 11 | #include "pn532_mifare.h" 12 | 13 | pn532_error_t pn532_mifareultralight_WaitForPassiveTarget (byte_t * pbtCUID, size_t * szCUIDLen); 14 | pn532_error_t pn532_mifareultralight_ReadPage (uint8_t page, byte_t * pbtBuffer); 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /drivers/rf/pn532/pn532_bus.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************/ 2 | /*! 3 | @file pn532_bus.h 4 | */ 5 | /**************************************************************************/ 6 | 7 | #ifndef __PN532_BUS_H__ 8 | #define __PN532_BUS_H__ 9 | 10 | #include "projectconfig.h" 11 | #include "pn532.h" 12 | 13 | // #define PN532_BUS_UART 14 | #define PN532_BUS_I2C 15 | 16 | #define PN532_RSTPD_PORT (3) 17 | #define PN532_RSTPD_PIN (1) 18 | #define PN532_I2C_IRQPORT (1) 19 | #define PN532_I2C_IRQPIN (10) 20 | 21 | #define PN532_NORMAL_FRAME__DATA_MAX_LEN (254) 22 | #define PN532_NORMAL_FRAME__OVERHEAD (8) 23 | #define PN532_EXTENDED_FRAME__DATA_MAX_LEN (264) 24 | #define PN532_EXTENDED_FRAME__OVERHEAD (11) 25 | #define PN532_BUFFER_LEN (PN532_EXTENDED_FRAME__DATA_MAX_LEN + PN532_EXTENDED_FRAME__OVERHEAD) 26 | 27 | #define PN532_UART_BAUDRATE (115200) 28 | 29 | #define PN532_I2C_ADDRESS (0x48) 30 | #define PN532_I2C_READBIT (0x01) 31 | #define PN532_I2C_READYTIMEOUT (20) // Max number of attempts to read Ready bit (see UM 5-Nov-2007 Section 6.2.4) 32 | 33 | // Generic interface for the different serial buses available on the PN532 34 | void pn532_bus_HWInit(void); 35 | pn532_error_t pn532_bus_SendCommand(const byte_t * pbtData, const size_t szData); 36 | pn532_error_t pn532_bus_ReadResponse(byte_t * pbtResponse, size_t * pszRxLen); 37 | pn532_error_t pn532_bus_Wakeup(void); 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /drivers/rsa/rsa.c: -------------------------------------------------------------------------------- 1 | /**************************************************************************/ 2 | /*! 3 | @file rsa.c 4 | @author Kyle Loudon 5 | modified: microBuilder.eu 6 | @date 4 January, 2010 7 | @version 1.0 8 | 9 | Basic RSA-encryption using 64-bit math (32-bit keys). 10 | 11 | Based on the examples from "Mastering Algorithms with C" by 12 | Kyle Loudon (O'Reilly, 1999). 13 | 14 | For details on how to generate a valid RSA key pair, see: 15 | http://www.microbuilder.eu/Tutorials/SoftwareDevelopment/RSAEncryption.aspx 16 | 17 | @warning Most versions of libc used for embedded systems do not 18 | include support for 64-bit integers with printf, etc. (to 19 | keep the compiled code size and memory usage as small as 20 | possible). Unless you have explicitly added long long 21 | support for printf, you should not try to display 64-bit 22 | values with it (%lld, etc.). Using 32-bit values (changing 23 | the definition of huge_t to uint32_t) will avoid this issue 24 | entirely, though at the expense of weaker encryption. 25 | */ 26 | /**************************************************************************/ 27 | 28 | #include "rsa.h" 29 | 30 | static huge_t modexp(huge_t a, huge_t b, huge_t n) 31 | { 32 | huge_t y; 33 | y = 1; 34 | 35 | /* Compute pow(a, b) % n using the binary square and multiply method. */ 36 | while (b != 0) 37 | { 38 | /* For each 1 in b, accumulate y. */ 39 | if (b & 1) 40 | { 41 | y = (y * a) % n; 42 | } 43 | 44 | /* Square a for each bit in b. */ 45 | a = (a * a) % n; 46 | 47 | /* Prepare for the next bit in b. */ 48 | b = b >> 1; 49 | } 50 | 51 | return y; 52 | } 53 | 54 | void rsaTest() 55 | { 56 | huge_t rsaOrig, rsaDecrypted, rsaEncrypted; 57 | rsaPubKey_t publicKey; 58 | rsaPriKey_t privateKey; 59 | int i; 60 | 61 | printf("Encrypting with RSA %s", CFG_PRINTF_NEWLINE); 62 | 63 | #if CFG_RSA_BITS == 64 64 | // Values based on 64-bit math (huge_t = uint64_t) 65 | // which will result in more secure encryption, but also 66 | // increases the size of the encrypted text 67 | publicKey.e = 21; 68 | publicKey.n = 16484947; 69 | privateKey.d = 15689981; 70 | privateKey.n = 16484947; 71 | #endif 72 | 73 | #if CFG_RSA_BITS == 32 74 | // Alternative values with 32-bit math (huge_t = uint32_t) 75 | // or when smaller encrypted text is desired 76 | publicKey.e = 17; 77 | publicKey.n = 209; 78 | privateKey.d = 53; 79 | privateKey.n = 209; 80 | #endif 81 | 82 | #if CFG_RSA_BITS == 64 83 | printf("Starting RSA encryption/decryption test %s", CFG_PRINTF_NEWLINE); 84 | #endif 85 | #if CFG_RSA_BITS == 32 86 | printf("d=%u, e=%u, n=%u %s", (unsigned int)privateKey.d, (unsigned int)publicKey.e, (unsigned int)publicKey.n, CFG_PRINTF_NEWLINE); 87 | #endif 88 | 89 | for (i = 0; i < 128; i++) 90 | { 91 | rsaOrig = i; 92 | rsaEncrypt(rsaOrig, &rsaEncrypted, publicKey); 93 | rsaDecrypt(rsaEncrypted, &rsaDecrypted, privateKey); 94 | 95 | if (rsaOrig == rsaDecrypted) 96 | { 97 | #if CFG_RSA_BITS == 64 98 | printf("Encrypted and decrypted %d %s", i, CFG_PRINTF_NEWLINE); 99 | #endif 100 | #if CFG_RSA_BITS == 32 101 | printf("In=%5u, Encrypted=%5u, Out=%5u (OK) %s", (unsigned int)rsaOrig, (unsigned int)rsaEncrypted, (unsigned int)rsaDecrypted, CFG_PRINTF_NEWLINE); 102 | #endif 103 | } 104 | else 105 | { 106 | #if CFG_RSA_BITS == 64 107 | printf("Failed to decrypt %d %s", i, CFG_PRINTF_NEWLINE); 108 | #endif 109 | #if CFG_RSA_BITS == 32 110 | printf("In=%5u, Encrypted=%5u, Out=%5u (ERROR) %s", (unsigned int)rsaOrig, (unsigned int)rsaEncrypted, (unsigned int)rsaDecrypted, CFG_PRINTF_NEWLINE); 111 | #endif 112 | } 113 | } 114 | } 115 | 116 | void rsaEncrypt(huge_t plaintext, huge_t *ciphertext, rsaPubKey_t pubkey) 117 | { 118 | *ciphertext = modexp(plaintext, pubkey.e, pubkey.n); 119 | 120 | return; 121 | } 122 | 123 | void rsaDecrypt(huge_t ciphertext, huge_t *plaintext, rsaPriKey_t prikey) 124 | { 125 | *plaintext = modexp(ciphertext, prikey.d, prikey.n); 126 | 127 | return; 128 | } 129 | -------------------------------------------------------------------------------- /drivers/rsa/rsa.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************/ 2 | /*! 3 | @file rsa.h 4 | @author Kyle Loudon 5 | modified: microBuilder.eu 6 | @date 4 January, 2010 7 | @version 1.0 8 | 9 | Basic RSA-encryption using 64-bit math (32-bit keys). 10 | 11 | Based on the examples from "Mastering Algorithms with C" by 12 | Kyle Loudon (O'Reilly, 1999). 13 | */ 14 | /**************************************************************************/ 15 | 16 | #ifndef _RSA_H_ 17 | #define _RSA_H_ 18 | 19 | #include "projectconfig.h" 20 | 21 | /* In a secure implementation, huge_t should be at least 400 decimal digits, * 22 | * instead of the 20 provided by a 64-bit value. This means that key values * 23 | * can be no longer than 10 digits in length in the current implementation. */ 24 | #if CFG_RSA_BITS == 64 25 | typedef uint64_t huge_t; 26 | #endif 27 | #if CFG_RSA_BITS == 32 28 | typedef uint32_t huge_t; 29 | #endif 30 | 31 | /* Structure for RSA public keys. */ 32 | typedef struct rsaPubKey_s 33 | { 34 | huge_t e; 35 | huge_t n; 36 | } 37 | rsaPubKey_t; 38 | 39 | /* Define a structure for RSA private keys. */ 40 | typedef struct rsaPriKey_s 41 | { 42 | huge_t d; 43 | huge_t n; 44 | } 45 | rsaPriKey_t; 46 | 47 | void rsaTest(); 48 | void rsaEncrypt(huge_t plaintext, huge_t *ciphertext, rsaPubKey_t pubkey); 49 | void rsaDecrypt(huge_t ciphertext, huge_t *plaintext, rsaPriKey_t prikey); 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /drivers/sensors/lm75b/lm75b.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microbuilder/LPC1114CodeBase/c1dc51a7029aeba2a2f4d8792a0da17ccd1c0665/drivers/sensors/lm75b/lm75b.c -------------------------------------------------------------------------------- /drivers/sensors/lm75b/lm75b.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************/ 2 | /*! 3 | @file lm75b.h 4 | @author K. Townsend (microBuilder.eu) 5 | @date 22 March 2010 6 | @version 0.10 7 | 8 | @section LICENSE 9 | 10 | Software License Agreement (BSD License) 11 | 12 | Copyright (c) 2010, microBuilder SARL 13 | All rights reserved. 14 | 15 | Redistribution and use in source and binary forms, with or without 16 | modification, are permitted provided that the following conditions are met: 17 | 1. Redistributions of source code must retain the above copyright 18 | notice, this list of conditions and the following disclaimer. 19 | 2. Redistributions in binary form must reproduce the above copyright 20 | notice, this list of conditions and the following disclaimer in the 21 | documentation and/or other materials provided with the distribution. 22 | 3. Neither the name of the copyright holders nor the 23 | names of its contributors may be used to endorse or promote products 24 | derived from this software without specific prior written permission. 25 | 26 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY 27 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 28 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 29 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY 30 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 31 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 32 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 33 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 34 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 35 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 36 | */ 37 | /**************************************************************************/ 38 | 39 | #ifndef _LM75B_H_ 40 | #define _LM75B_H_ 41 | 42 | #include "projectconfig.h" 43 | #include "core/i2c/i2c.h" 44 | 45 | #define LM75B_ADDRESS (0x90) // 100 1000 shifted left 1 bit = 0x90 46 | #define LM75B_READBIT (0x01) 47 | 48 | #define LM75B_REGISTER_TEMPERATURE (0x00) 49 | #define LM75B_REGISTER_CONFIGURATION (0x01) 50 | 51 | #define LM75B_CONFIG_SHUTDOWN_MASK (0x01) 52 | #define LM75B_CONFIG_SHUTDOWN_POWERON (0x00) 53 | #define LM75B_CONFIG_SHUTDOWN_SHUTDOWN (0x01) 54 | 55 | typedef enum 56 | { 57 | LM75B_ERROR_OK = 0, // Everything executed normally 58 | LM75B_ERROR_I2CINIT, // Unable to initialise I2C 59 | LM75B_ERROR_I2CBUSY, // I2C already in use 60 | LM75B_ERROR_LAST 61 | } 62 | lm75bError_e; 63 | 64 | lm75bError_e lm75bInit(void); 65 | lm75bError_e lm75bGetTemperature (int32_t *temp); 66 | lm75bError_e lm75bConfigWrite (uint8_t configValue); 67 | 68 | #endif 69 | 70 | 71 | -------------------------------------------------------------------------------- /lpc1xxx/LPC1xxx_startup.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Software License Agreement (BSD License) 3 | * 4 | * Copyright (c) 2010, Roel Verdult 5 | * All rights reserved. 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 3. Neither the name of the copyright holders nor the 15 | * names of its contributors may be used to endorse or promote products 16 | * derived from this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY 19 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY 22 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 25 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | * 29 | */ 30 | 31 | // These are defined and created by the linker, locating them in memory 32 | extern unsigned char _etext; 33 | extern unsigned char _data; 34 | extern unsigned char _edata; 35 | extern unsigned char _bss; 36 | extern unsigned char _ebss; 37 | 38 | // Prototype the required startup functions 39 | extern void main(void); 40 | 41 | // The entry point of the application, prepare segments, 42 | // initialize the cpu and execute main() 43 | void boot_entry(void) 44 | { 45 | register unsigned char *src, *dst; 46 | 47 | // Get physical data address and copy it to sram 48 | src = &_etext; 49 | dst = &_data; 50 | while(dst < &_edata) { 51 | *dst++ = *src++; 52 | } 53 | 54 | // Clear the bss segment 55 | dst = &_bss; 56 | while(dst < &_ebss) { 57 | *dst++ = 0; 58 | } 59 | 60 | // Execute the code at the program entry point 61 | main(); 62 | 63 | // Do nothing when returned from main, just keep looping 64 | while(1); 65 | } 66 | -------------------------------------------------------------------------------- /lpc1xxx/linkscript.ld: -------------------------------------------------------------------------------- 1 | /* 2 | * Software License Agreement (BSD License) 3 | * 4 | * Copyright (c) 2010, Roel Verdult 5 | * All rights reserved. 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 3. Neither the name of the copyright holders nor the 15 | * names of its contributors may be used to endorse or promote products 16 | * derived from this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY 19 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY 22 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 25 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | * 29 | */ 30 | 31 | sram_top = ORIGIN(sram) + LENGTH(sram); 32 | ENTRY(boot_entry) 33 | 34 | SECTIONS 35 | { 36 | .text : 37 | { 38 | KEEP(*(.irq_vectors)) 39 | *(.text*) 40 | *(.rodata*) 41 | } > flash 42 | 43 | /* 44 | * More information about Special Section Indexes is available in the 45 | * free "ELF for the ARM Architecture" document from ARM Limited 46 | * http://simplemachines.it/doc/aaelf.pdf 47 | * 48 | */ 49 | .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } > flash 50 | __exidx_start = .; 51 | .ARM.exidx : { *(.ARM.exidx* .gnu.linkonce.armexidx.*) } > flash 52 | __exidx_end = .; 53 | 54 | _etext = .; 55 | 56 | .data : AT (__exidx_end) 57 | { 58 | _data = .; 59 | *(vtable) 60 | *(.data*) 61 | _edata = .; 62 | } > sram 63 | 64 | /* zero initialized data */ 65 | .bss : 66 | { 67 | _bss = .; 68 | *(.bss*) 69 | *(COMMON) 70 | _ebss = .; 71 | } > sram 72 | 73 | end = .; 74 | 75 | /* For GDB compatibility we decrease the top with 16 bytes */ 76 | stack_entry = sram_top - 16; 77 | } 78 | -------------------------------------------------------------------------------- /main.c: -------------------------------------------------------------------------------- 1 | /**************************************************************************/ 2 | /*! 3 | @file main.c 4 | @author K. Townsend (microBuilder.eu) 5 | 6 | @section LICENSE 7 | 8 | Software License Agreement (BSD License) 9 | 10 | Copyright (c) 2011, microBuilder SARL 11 | All rights reserved. 12 | 13 | Redistribution and use in source and binary forms, with or without 14 | modification, are permitted provided that the following conditions are met: 15 | 1. Redistributions of source code must retain the above copyright 16 | notice, this list of conditions and the following disclaimer. 17 | 2. Redistributions in binary form must reproduce the above copyright 18 | notice, this list of conditions and the following disclaimer in the 19 | documentation and/or other materials provided with the distribution. 20 | 3. Neither the name of the copyright holders nor the 21 | names of its contributors may be used to endorse or promote products 22 | derived from this software without specific prior written permission. 23 | 24 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY 25 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 26 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 27 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY 28 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 29 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 30 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 31 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 32 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 33 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | */ 35 | /**************************************************************************/ 36 | #include "projectconfig.h" 37 | #include "sysinit.h" 38 | 39 | #include "core/gpio/gpio.h" 40 | #include "core/systick/systick.h" 41 | 42 | #ifdef CFG_INTERFACE 43 | #include "core/cmd/cmd.h" 44 | #endif 45 | 46 | /**************************************************************************/ 47 | /*! 48 | Main program entry point. After reset, normal code execution will 49 | begin here. 50 | */ 51 | /**************************************************************************/ 52 | int main(void) 53 | { 54 | // Configure cpu and mandatory peripherals 55 | systemInit(); 56 | 57 | uint32_t currentSecond, lastSecond; 58 | currentSecond = lastSecond = 0; 59 | 60 | while (1) 61 | { 62 | // Toggle LED once per second 63 | currentSecond = systickGetSecondsActive(); 64 | if (currentSecond != lastSecond) 65 | { 66 | lastSecond = currentSecond; 67 | gpioSetValue(CFG_LED_PORT, CFG_LED_PIN, lastSecond % 2); 68 | } 69 | 70 | // Poll for CLI input if CFG_INTERFACE is enabled in projectconfig.h 71 | #ifdef CFG_INTERFACE 72 | cmdPoll(); 73 | #endif 74 | } 75 | 76 | return 0; 77 | } 78 | -------------------------------------------------------------------------------- /project/cmd_tbl.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************/ 2 | /*! 3 | @file cmd_tbl.h 4 | @author K. Townsend (microBuilder.eu) 5 | 6 | @section LICENSE 7 | 8 | Software License Agreement (BSD License) 9 | 10 | Copyright (c) 2010, microBuilder SARL 11 | All rights reserved. 12 | 13 | Redistribution and use in source and binary forms, with or without 14 | modification, are permitted provided that the following conditions are met: 15 | 1. Redistributions of source code must retain the above copyright 16 | notice, this list of conditions and the following disclaimer. 17 | 2. Redistributions in binary form must reproduce the above copyright 18 | notice, this list of conditions and the following disclaimer in the 19 | documentation and/or other materials provided with the distribution. 20 | 3. Neither the name of the copyright holders nor the 21 | names of its contributors may be used to endorse or promote products 22 | derived from this software without specific prior written permission. 23 | 24 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY 25 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 26 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 27 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY 28 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 29 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 30 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 31 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 32 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 33 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | */ 35 | /**************************************************************************/ 36 | 37 | #ifndef __CMD_TBL_H__ 38 | #define __CMD_TBL_H__ 39 | 40 | #define CMD_COUNT (sizeof(cmd_tbl)/sizeof(cmd_t)) 41 | 42 | #include 43 | 44 | #ifdef CFG_INTERFACE_UART 45 | #include "core/uart/uart.h" 46 | #endif 47 | 48 | // Function prototypes for the command table 49 | void cmd_help(uint8_t argc, char **argv); // handled by core/cmd/cmd.c 50 | void cmd_sysinfo(uint8_t argc, char **argv); 51 | void cmd_reset(uint8_t argc, char **argv); 52 | 53 | #ifdef CFG_CHIBI 54 | void cmd_chibi_addr(uint8_t argc, char **argv); 55 | void cmd_chibi_ieeeaddr(uint8_t argc, char **argv); 56 | void cmd_chibi_tx(uint8_t argc, char **argv); 57 | #endif 58 | 59 | #ifdef CFG_I2CEEPROM 60 | void cmd_i2ceeprom_read(uint8_t argc, char **argv); 61 | void cmd_i2ceeprom_write(uint8_t argc, char **argv); 62 | #endif 63 | 64 | #ifdef CFG_LM75B 65 | void cmd_lm75b_gettemp(uint8_t argc, char **argv); 66 | #endif 67 | 68 | #ifdef CFG_SDCARD 69 | void cmd_sd_dir(uint8_t argc, char **argv); 70 | #endif 71 | 72 | void cmd_deepsleep(uint8_t argc, char **argv); 73 | 74 | #define CMD_NOPARAMS "This command has no parameters" 75 | 76 | /**************************************************************************/ 77 | /*! 78 | Command list for the command-line interpreter and the name of the 79 | corresponding method that handles the command. 80 | 81 | Note that a trailing ',' is required on the last entry, which will 82 | cause a NULL entry to be appended to the end of the table. 83 | */ 84 | /**************************************************************************/ 85 | cmd_t cmd_tbl[] = 86 | { 87 | // command name, min args, max args, hidden, function name, command description, syntax 88 | { "?", 0, 0, 0, cmd_help , "Help" , CMD_NOPARAMS }, 89 | { "V", 0, 0, 0, cmd_sysinfo , "System Info" , CMD_NOPARAMS }, 90 | { "Z", 0, 0, 0, cmd_reset , "Reset" , CMD_NOPARAMS }, 91 | 92 | #ifdef CFG_CHIBI 93 | { "A", 0, 1, 0, cmd_chibi_addr , "Get/Set node address" , "'A [<1-65534>|]'" }, 94 | { "S", 2, 99, 0, cmd_chibi_tx , "Send msg to node(s)" , "'S '" }, 95 | #endif 96 | 97 | #ifdef CFG_I2CEEPROM 98 | { "e", 1, 1, 0, cmd_i2ceeprom_read , "EEPROM Read" , "'e '" }, 99 | { "w", 2, 2, 0, cmd_i2ceeprom_write , "EEPROM Write" , "'w '" }, 100 | #endif 101 | 102 | #ifdef CFG_LM75B 103 | { "m", 0, 0, 0, cmd_lm75b_gettemp , "Temperature (Celsius)" , CMD_NOPARAMS }, 104 | #endif 105 | 106 | #ifdef CFG_SDCARD 107 | { "d", 0, 1, 0, cmd_sd_dir , "Dir (SD Card)" , "'d []'" }, 108 | #endif 109 | 110 | { "z", 0, 0, 0, cmd_deepsleep , "Deep sleep for ~10 seconds" , CMD_NOPARAMS }, 111 | }; 112 | 113 | #endif -------------------------------------------------------------------------------- /project/commands.c: -------------------------------------------------------------------------------- 1 | /**************************************************************************/ 2 | /*! 3 | @file commands.c 4 | @author K. Townsend (microBuilder.eu) 5 | 6 | @brief Common helper-functions for all commands in the 'core/cmd' 7 | command-line interpretter. 8 | 9 | @section LICENSE 10 | 11 | Software License Agreement (BSD License) 12 | 13 | Copyright (c) 2010, microBuilder SARL 14 | All rights reserved. 15 | 16 | Redistribution and use in source and binary forms, with or without 17 | modification, are permitted provided that the following conditions are met: 18 | 1. Redistributions of source code must retain the above copyright 19 | notice, this list of conditions and the following disclaimer. 20 | 2. Redistributions in binary form must reproduce the above copyright 21 | notice, this list of conditions and the following disclaimer in the 22 | documentation and/or other materials provided with the distribution. 23 | 3. Neither the name of the copyright holders nor the 24 | names of its contributors may be used to endorse or promote products 25 | derived from this software without specific prior written permission. 26 | 27 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY 28 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 29 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 30 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY 31 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 32 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 33 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 34 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 35 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 36 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 37 | */ 38 | /**************************************************************************/ 39 | 40 | #include 41 | #include // memset 42 | #include // isdigit, isspace, etc. 43 | 44 | #include "core/cmd/cmd.h" 45 | #include "commands.h" 46 | 47 | /**************************************************************************/ 48 | /*! 49 | @brief Attempts to convert the supplied decimal or hexadecimal 50 | string to the matching 32-bit value. All hexadecimal values 51 | must be preceded by either '0x' or '0X' to be properly parsed. 52 | 53 | @param[in] s 54 | Input string 55 | @param[out] result 56 | Signed 32-bit integer to hold the conversion results 57 | 58 | @section Example 59 | 60 | @code 61 | char *hex = "0xABCD"; 62 | char *dec = "1234"; 63 | 64 | // Convert supplied values to integers 65 | int32_t hexValue, decValue; 66 | getNumber (hex, &hexValue); 67 | getNumber (dec, &decValue); 68 | 69 | @endcode 70 | */ 71 | /**************************************************************************/ 72 | int getNumber (char *s, int32_t *result) 73 | { 74 | int32_t value; 75 | uint32_t mustBeHex = FALSE; 76 | uint32_t sgn = 1; 77 | const unsigned char hexToDec [] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 255, 255, 255, 255, 255, 255, 255, 10, 11, 12, 13, 14, 15}; 78 | 79 | if (!s) 80 | return 0; 81 | 82 | // Check if this is a hexadecimal value 83 | if ((strlen (s) > 2) && (!strncmp (s, "0x", 2) || !strncmp (s, "0X", 2))) 84 | { 85 | mustBeHex = TRUE; 86 | s += 2; 87 | } 88 | 89 | // Check for negative sign 90 | if (!mustBeHex && *s && (*s == '-')) 91 | { 92 | sgn = -1; 93 | s++; 94 | } 95 | 96 | // Try to convert value 97 | for (value = 0; *s; s++) 98 | { 99 | if (mustBeHex && isxdigit ((uint8_t)*s)) 100 | value = (value << 4) | hexToDec [toupper((uint8_t)*s) - '0']; 101 | else if (isdigit ((uint8_t)*s)) 102 | value = (value * 10) + ((uint8_t)*s - '0'); 103 | else 104 | { 105 | printf ("Malformed number. Must be decimal number, or hex value preceeded by '0x'%s", CFG_PRINTF_NEWLINE); 106 | return 0; 107 | } 108 | } 109 | 110 | // Set number to negative value if required 111 | if (!mustBeHex) 112 | value *= sgn; 113 | 114 | *result = value; 115 | 116 | return 1; 117 | } 118 | 119 | 120 | 121 | -------------------------------------------------------------------------------- /project/commands.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************/ 2 | /*! 3 | @file commands.h 4 | @author K. Townsend (microBuilder.eu) 5 | 6 | @section LICENSE 7 | 8 | Software License Agreement (BSD License) 9 | 10 | Copyright (c) 2010, microBuilder SARL 11 | All rights reserved. 12 | 13 | Redistribution and use in source and binary forms, with or without 14 | modification, are permitted provided that the following conditions are met: 15 | 1. Redistributions of source code must retain the above copyright 16 | notice, this list of conditions and the following disclaimer. 17 | 2. Redistributions in binary form must reproduce the above copyright 18 | notice, this list of conditions and the following disclaimer in the 19 | documentation and/or other materials provided with the distribution. 20 | 3. Neither the name of the copyright holders nor the 21 | names of its contributors may be used to endorse or promote products 22 | derived from this software without specific prior written permission. 23 | 24 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY 25 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 26 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 27 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY 28 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 29 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 30 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 31 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 32 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 33 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | */ 35 | /**************************************************************************/ 36 | #ifndef __COMMANDS_H__ 37 | #define __COMMANDS_H__ 38 | 39 | #include "projectconfig.h" 40 | 41 | // Method Prototypes 42 | int getNumber (char *s, int32_t *result); 43 | 44 | #endif -------------------------------------------------------------------------------- /project/commands/cmd_chibi_addr.c: -------------------------------------------------------------------------------- 1 | /**************************************************************************/ 2 | /*! 3 | @file cmd_chibi_addr.c 4 | @author K. Townsend (microBuilder.eu) 5 | 6 | @brief Code to execute for cmd_chibi_addr in the 'core/cmd' 7 | command-line interpretter. 8 | 9 | @section LICENSE 10 | 11 | Software License Agreement (BSD License) 12 | 13 | Copyright (c) 2010, microBuilder SARL 14 | All rights reserved. 15 | 16 | Redistribution and use in source and binary forms, with or without 17 | modification, are permitted provided that the following conditions are met: 18 | 1. Redistributions of source code must retain the above copyright 19 | notice, this list of conditions and the following disclaimer. 20 | 2. Redistributions in binary form must reproduce the above copyright 21 | notice, this list of conditions and the following disclaimer in the 22 | documentation and/or other materials provided with the distribution. 23 | 3. Neither the name of the copyright holders nor the 24 | names of its contributors may be used to endorse or promote products 25 | derived from this software without specific prior written permission. 26 | 27 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY 28 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 29 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 30 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY 31 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 32 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 33 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 34 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 35 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 36 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 37 | */ 38 | /**************************************************************************/ 39 | #include 40 | 41 | #include "projectconfig.h" 42 | #include "core/cmd/cmd.h" 43 | #include "commands.h" // Generic helper functions 44 | 45 | #ifdef CFG_CHIBI 46 | #include "drivers/rf/chibi/chb.h" 47 | #include "drivers/rf/chibi/chb_drvr.h" 48 | 49 | /**************************************************************************/ 50 | /*! 51 | Gets or sets the 16-bit sensor node address. This value can be 52 | anything between 1-65534 (0x0001-0xFFFE), and in decimal or 53 | hexadecimal notation. All hexadecimal values must be preceded by 54 | '0x' or '0X' to be properly interpreted (ex. 0x009F). 55 | */ 56 | /**************************************************************************/ 57 | void cmd_chibi_addr(uint8_t argc, char **argv) 58 | { 59 | if (argc > 0) 60 | { 61 | // Try to convert supplied value to an integer 62 | int32_t addr; 63 | getNumber (argv[0], &addr); 64 | 65 | // Check for invalid values (getNumber may complain about this as well) 66 | if (addr <= 0 || addr > 0xFFFF) 67 | { 68 | printf("Invalid Address: 1-65534 or 0x0001-0xFFFE required.%s", CFG_PRINTF_NEWLINE); 69 | return; 70 | } 71 | if (addr == 0xFFFF) 72 | { 73 | printf("Invalid Address: 0xFFFF reserved for broadcast.%s", CFG_PRINTF_NEWLINE); 74 | return; 75 | } 76 | 77 | // Write address to EEPROM and update peripheral control block 78 | chb_set_short_addr((uint16_t)addr); 79 | chb_pcb_t *pcb = chb_get_pcb(); 80 | printf("Address set to: 0x%04X%s", pcb->src_addr, CFG_PRINTF_NEWLINE); 81 | } 82 | else 83 | { 84 | // Display the current address 85 | chb_pcb_t *pcb = chb_get_pcb(); 86 | printf("0x%04X%s", pcb->src_addr, CFG_PRINTF_NEWLINE); 87 | } 88 | } 89 | 90 | #endif 91 | -------------------------------------------------------------------------------- /project/commands/cmd_chibi_tx.c: -------------------------------------------------------------------------------- 1 | /**************************************************************************/ 2 | /*! 3 | @file cmd_chibi_tx.c 4 | @author K. Townsend (microBuilder.eu) 5 | 6 | @brief Code to execute for cmd_chibi_tx in the 'core/cmd' 7 | command-line interpretter. 8 | 9 | @section LICENSE 10 | 11 | Software License Agreement (BSD License) 12 | 13 | Copyright (c) 2010, microBuilder SARL 14 | All rights reserved. 15 | 16 | Redistribution and use in source and binary forms, with or without 17 | modification, are permitted provided that the following conditions are met: 18 | 1. Redistributions of source code must retain the above copyright 19 | notice, this list of conditions and the following disclaimer. 20 | 2. Redistributions in binary form must reproduce the above copyright 21 | notice, this list of conditions and the following disclaimer in the 22 | documentation and/or other materials provided with the distribution. 23 | 3. Neither the name of the copyright holders nor the 24 | names of its contributors may be used to endorse or promote products 25 | derived from this software without specific prior written permission. 26 | 27 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY 28 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 29 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 30 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY 31 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 32 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 33 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 34 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 35 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 36 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 37 | */ 38 | /**************************************************************************/ 39 | #include 40 | #include 41 | 42 | #include "projectconfig.h" 43 | #include "core/cmd/cmd.h" 44 | #include "commands.h" // Generic helper functions 45 | 46 | #ifdef CFG_CHIBI 47 | #include "drivers/rf/chibi/chb.h" 48 | #include "drivers/rf/chibi/chb_drvr.h" 49 | 50 | /**************************************************************************/ 51 | /*! 52 | Sends text or data via Chibi 53 | 54 | */ 55 | /**************************************************************************/ 56 | void cmd_chibi_tx(uint8_t argc, char **argv) 57 | { 58 | uint8_t i, len, *data_ptr, data[50]; 59 | uint16_t addr; 60 | 61 | // Try to convert supplied address to an integer 62 | int32_t addr32; 63 | getNumber (argv[0], &addr32); 64 | 65 | // Check for invalid values (getNumber may complain about this as well) 66 | if (addr32 <= 0 || addr32 > 0xFFFF) 67 | { 68 | printf("Invalid Address: 1-65534 or 0x0001-0xFFFE required.%s", CFG_PRINTF_NEWLINE); 69 | return; 70 | } 71 | 72 | // Address seems to be OK 73 | addr = (uint16_t)addr32; 74 | 75 | // Get message contents 76 | data_ptr = data; 77 | for (i=0; i 40 | 41 | #include "projectconfig.h" 42 | #include "core/cmd/cmd.h" 43 | #include "commands.h" 44 | 45 | #include "core/pmu/pmu.h" 46 | 47 | /**************************************************************************/ 48 | /*! 49 | Puts the device into deep sleep 50 | */ 51 | /**************************************************************************/ 52 | void cmd_deepsleep(uint8_t argc, char **argv) 53 | { 54 | // ToDo: Some peripherals may need to be manually disabled for the 55 | // lowest possible power consumption in deep sleep mode 56 | 57 | // Enter deep sleep mode (wakeup after ~10 seconds) 58 | // Note that the exact delay is variable since the internal WDT oscillator 59 | // is used for lowest possible power consumption and because it requires 60 | // no external components, but it only has +-/40% accuracy 61 | printf("Entering Deep Sleep mode for 10 seconds%s", CFG_PRINTF_NEWLINE); 62 | pmuDeepSleep(10); 63 | 64 | // On wakeup, the WAKEUP interrupt will be fired, which is handled 65 | // by WAKEUP_IRQHandler in 'core/pmu/pmu.c'. This will set the CPU 66 | // back to an appropriate state, and execution will be returned to 67 | // the point that it left off before deep sleep mode was entered. 68 | printf("Woke up from deep sleep"); 69 | } 70 | -------------------------------------------------------------------------------- /project/commands/cmd_i2ceeprom_read.c: -------------------------------------------------------------------------------- 1 | /**************************************************************************/ 2 | /*! 3 | @file cmd_i2ceeprom_read.c 4 | @author K. Townsend (microBuilder.eu) 5 | 6 | @brief Code to execute for cmd_i2ceeprom_read in the 'core/cmd' 7 | command-line interpretter. 8 | 9 | @section LICENSE 10 | 11 | Software License Agreement (BSD License) 12 | 13 | Copyright (c) 2010, microBuilder SARL 14 | All rights reserved. 15 | 16 | Redistribution and use in source and binary forms, with or without 17 | modification, are permitted provided that the following conditions are met: 18 | 1. Redistributions of source code must retain the above copyright 19 | notice, this list of conditions and the following disclaimer. 20 | 2. Redistributions in binary form must reproduce the above copyright 21 | notice, this list of conditions and the following disclaimer in the 22 | documentation and/or other materials provided with the distribution. 23 | 3. Neither the name of the copyright holders nor the 24 | names of its contributors may be used to endorse or promote products 25 | derived from this software without specific prior written permission. 26 | 27 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY 28 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 29 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 30 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY 31 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 32 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 33 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 34 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 35 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 36 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 37 | */ 38 | /**************************************************************************/ 39 | #include 40 | 41 | #include "projectconfig.h" 42 | #include "core/cmd/cmd.h" 43 | #include "project/commands.h" // Generic helper functions 44 | 45 | #ifdef CFG_I2CEEPROM 46 | #include "drivers/eeprom/eeprom.h" 47 | 48 | /**************************************************************************/ 49 | /*! 50 | Reads a single byte at the supplied EEPROM address 51 | */ 52 | /**************************************************************************/ 53 | void cmd_i2ceeprom_read(uint8_t argc, char **argv) 54 | { 55 | uint16_t addr; 56 | uint8_t value; 57 | 58 | // Try to convert supplied address to an integer 59 | int32_t addr32; 60 | getNumber (argv[0], &addr32); 61 | 62 | // Check for invalid values (getNumber may complain about this as well) 63 | if (addr32 < 0 || eepromCheckAddress(addr32)) 64 | { 65 | printf("Address out of range %s", CFG_PRINTF_NEWLINE); 66 | return; 67 | } 68 | 69 | // Address seems to be OK 70 | addr = (uint16_t)addr32; 71 | value = eepromReadU8(addr); 72 | 73 | printf("0x%02X%s", value, CFG_PRINTF_NEWLINE); 74 | } 75 | 76 | #endif 77 | -------------------------------------------------------------------------------- /project/commands/cmd_i2ceeprom_write.c: -------------------------------------------------------------------------------- 1 | /**************************************************************************/ 2 | /*! 3 | @file cmd_i2ceeprom_write.c 4 | @author K. Townsend (microBuilder.eu) 5 | 6 | @brief Code to execute for cmd_i2ceeprom_write in the 'core/cmd' 7 | command-line interpretter. 8 | 9 | @section LICENSE 10 | 11 | Software License Agreement (BSD License) 12 | 13 | Copyright (c) 2010, microBuilder SARL 14 | All rights reserved. 15 | 16 | Redistribution and use in source and binary forms, with or without 17 | modification, are permitted provided that the following conditions are met: 18 | 1. Redistributions of source code must retain the above copyright 19 | notice, this list of conditions and the following disclaimer. 20 | 2. Redistributions in binary form must reproduce the above copyright 21 | notice, this list of conditions and the following disclaimer in the 22 | documentation and/or other materials provided with the distribution. 23 | 3. Neither the name of the copyright holders nor the 24 | names of its contributors may be used to endorse or promote products 25 | derived from this software without specific prior written permission. 26 | 27 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY 28 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 29 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 30 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY 31 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 32 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 33 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 34 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 35 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 36 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 37 | */ 38 | /**************************************************************************/ 39 | #include 40 | 41 | #include "projectconfig.h" 42 | #include "core/cmd/cmd.h" 43 | #include "project/commands.h" // Generic helper functions 44 | 45 | #ifdef CFG_I2CEEPROM 46 | #include "drivers/eeprom/eeprom.h" 47 | 48 | /**************************************************************************/ 49 | /*! 50 | Writes a single byte at the supplied EEPROM address 51 | */ 52 | /**************************************************************************/ 53 | void cmd_i2ceeprom_write(uint8_t argc, char **argv) 54 | { 55 | uint16_t addr; 56 | uint8_t val; 57 | 58 | // Try to convert supplied address to an integer 59 | int32_t addr32; 60 | getNumber (argv[0], &addr32); 61 | 62 | // Check for invalid values (getNumber may complain about this as well) 63 | if (addr32 < 0 || eepromCheckAddress(addr32)) 64 | { 65 | printf("Address out of range %s", CFG_PRINTF_NEWLINE); 66 | return; 67 | } 68 | 69 | // Address seems to be OK 70 | addr = (uint16_t)addr32; 71 | 72 | // Make sure this isn't in the reserved system config space 73 | if (addr <= CFG_EEPROM_RESERVED) 74 | { 75 | printf("ERROR: Reserved address (0x%04X-0x%04X)%s", 0, CFG_EEPROM_RESERVED, CFG_PRINTF_NEWLINE); 76 | return; 77 | } 78 | // Try to convert supplied data to an integer 79 | int32_t val32; 80 | getNumber (argv[1], &val32); 81 | 82 | // Check for invalid values (getNumber may complain about this as well) 83 | if (val32 < 0 || val32 > 0xFF) 84 | { 85 | printf("Invalid Data: 0-255 or 0x00-0xFF required.%s", CFG_PRINTF_NEWLINE); 86 | return; 87 | } 88 | 89 | // Data seems to be OK 90 | val = (uint8_t)val32; 91 | 92 | // Write data at supplied address 93 | eepromWriteU8(addr, val); 94 | 95 | // Write successful 96 | printf("0x%02X written at 0x%04X%s", val, addr, CFG_PRINTF_NEWLINE); 97 | } 98 | 99 | #endif 100 | -------------------------------------------------------------------------------- /project/commands/cmd_lm75b_gettemp.c: -------------------------------------------------------------------------------- 1 | /**************************************************************************/ 2 | /*! 3 | @file cmd_lm75b_gettemp.c 4 | @author K. Townsend (microBuilder.eu) 5 | 6 | @brief Code to execute for cmd_lm75b_gettemp in the 'core/cmd' 7 | command-line interpretter. 8 | 9 | @section LICENSE 10 | 11 | Software License Agreement (BSD License) 12 | 13 | Copyright (c) 2010, microBuilder SARL 14 | All rights reserved. 15 | 16 | Redistribution and use in source and binary forms, with or without 17 | modification, are permitted provided that the following conditions are met: 18 | 1. Redistributions of source code must retain the above copyright 19 | notice, this list of conditions and the following disclaimer. 20 | 2. Redistributions in binary form must reproduce the above copyright 21 | notice, this list of conditions and the following disclaimer in the 22 | documentation and/or other materials provided with the distribution. 23 | 3. Neither the name of the copyright holders nor the 24 | names of its contributors may be used to endorse or promote products 25 | derived from this software without specific prior written permission. 26 | 27 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY 28 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 29 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 30 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY 31 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 32 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 33 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 34 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 35 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 36 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 37 | */ 38 | /**************************************************************************/ 39 | #include 40 | 41 | #include "projectconfig.h" 42 | #include "core/cmd/cmd.h" 43 | #include "commands.h" // Generic helper functions 44 | 45 | #ifdef CFG_LM75B 46 | #include "drivers/sensors/lm75b/lm75b.h" 47 | 48 | /**************************************************************************/ 49 | /*! 50 | Gets the current temperature in degrees celsius from the LM75B 51 | */ 52 | /**************************************************************************/ 53 | void cmd_lm75b_gettemp(uint8_t argc, char **argv) 54 | { 55 | int32_t temp = 0; 56 | 57 | // Get the current temperature (in 0.125°C units) 58 | lm75bGetTemperature(&temp); 59 | 60 | // Multiply value by 125 for fixed-point math (0.125°C per unit) 61 | temp *= 125; 62 | 63 | // Use modulus operator to display decimal value 64 | printf("%d.%d C%s", (int)(temp / 1000), (int)(temp % 1000), CFG_PRINTF_NEWLINE); 65 | } 66 | 67 | #endif 68 | -------------------------------------------------------------------------------- /project/commands/cmd_reset.c: -------------------------------------------------------------------------------- 1 | /**************************************************************************/ 2 | /*! 3 | @file cmd_reset.c 4 | @author K. Townsend (microBuilder.eu) 5 | 6 | @brief Code to execute for cmd_reset in the 'core/cmd' 7 | command-line interpretter. 8 | 9 | @section LICENSE 10 | 11 | Software License Agreement (BSD License) 12 | 13 | Copyright (c) 2010, microBuilder SARL 14 | All rights reserved. 15 | 16 | Redistribution and use in source and binary forms, with or without 17 | modification, are permitted provided that the following conditions are met: 18 | 1. Redistributions of source code must retain the above copyright 19 | notice, this list of conditions and the following disclaimer. 20 | 2. Redistributions in binary form must reproduce the above copyright 21 | notice, this list of conditions and the following disclaimer in the 22 | documentation and/or other materials provided with the distribution. 23 | 3. Neither the name of the copyright holders nor the 24 | names of its contributors may be used to endorse or promote products 25 | derived from this software without specific prior written permission. 26 | 27 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY 28 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 29 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 30 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY 31 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 32 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 33 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 34 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 35 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 36 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 37 | */ 38 | /**************************************************************************/ 39 | #include 40 | 41 | #include "projectconfig.h" 42 | #include "core/cmd/cmd.h" 43 | #include "core/cpu/cpu.h" 44 | #include "project/commands.h" // Generic helper functions 45 | 46 | /**************************************************************************/ 47 | /*! 48 | Resets the board using the AIRCR register 49 | */ 50 | /**************************************************************************/ 51 | void cmd_reset(uint8_t argc, char **argv) 52 | { 53 | cpuReset(); 54 | } 55 | 56 | -------------------------------------------------------------------------------- /project/readme.txt: -------------------------------------------------------------------------------- 1 | Project Folder 2 | ============================================================================== 3 | All project-specific files should be stored in the /project folder to try to 4 | keep the generic HW-level code and drivers seperate from the business logic 5 | of your individual project. This makes it easier to reuse your code in other 6 | projects, and also update the drivers and HW-level code if newer version of 7 | these common-files become available. 8 | 9 | 10 | FILES 11 | ============================================================================== 12 | cmd_tbl.h Contains the master command list for the 13 | command-line interface if CFG_INTERFACE is 14 | enabled in projectconfig.h. All commands 15 | must be present in this list to be properly 16 | handled by the CLI. 17 | 18 | commands.c/.h Common helper functions for the command-line 19 | interface. 20 | 21 | 22 | FOLDERS 23 | ============================================================================== 24 | commands Code to implements specific commands for the 25 | command-line interface. Requires CFG_INTERFACE 26 | to be enabled in projectconfig.h. Generally, 27 | each command will be stored in a seperate file 28 | (ex.: "command/cmd_hello.c"), though this isn't 29 | a strict requirement and you may wish to store 30 | multiple related commands in one .c file, such 31 | as 'cmds_graphics.c' etc. 32 | 33 | documentation Project-specific documentation is stored here 34 | -------------------------------------------------------------------------------- /sysdefs.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************/ 2 | /*! 3 | @file sysdefs.h 4 | @author K. Townsend (microBuilder.eu) 5 | @date 22 March 2010 6 | @version 0.10 7 | 8 | @section LICENSE 9 | 10 | Software License Agreement (BSD License) 11 | 12 | Copyright (c) 2010, microBuilder SARL 13 | All rights reserved. 14 | 15 | Redistribution and use in source and binary forms, with or without 16 | modification, are permitted provided that the following conditions are met: 17 | 1. Redistributions of source code must retain the above copyright 18 | notice, this list of conditions and the following disclaimer. 19 | 2. Redistributions in binary form must reproduce the above copyright 20 | notice, this list of conditions and the following disclaimer in the 21 | documentation and/or other materials provided with the distribution. 22 | 3. Neither the name of the copyright holders nor the 23 | names of its contributors may be used to endorse or promote products 24 | derived from this software without specific prior written permission. 25 | 26 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY 27 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 28 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 29 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY 30 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 31 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 32 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 33 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 34 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 35 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 36 | */ 37 | /**************************************************************************/ 38 | 39 | #ifndef _SYSDEFS_H_ 40 | #define _SYSDEFS_H_ 41 | 42 | #include 43 | #include 44 | #include 45 | 46 | // Stay compatible with ugly "windows" style 47 | #define BOOL bool 48 | #define TRUE true 49 | #define FALSE false 50 | 51 | typedef volatile uint8_t REG8; 52 | typedef volatile uint16_t REG16; 53 | typedef volatile uint32_t REG32; 54 | typedef unsigned char byte_t; 55 | 56 | #define pREG8 (REG8 *) 57 | #define pREG16 (REG16 *) 58 | #define pREG32 (REG32 *) 59 | 60 | #ifndef NULL 61 | #define NULL ((void *) 0) 62 | #endif 63 | 64 | #endif 65 | 66 | -------------------------------------------------------------------------------- /sysinit.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************/ 2 | /*! 3 | @file sysinit.h 4 | @author K. Townsend (microBuilder.eu) 5 | @date 22 March 2010 6 | @version 0.10 7 | 8 | @section LICENSE 9 | 10 | Software License Agreement (BSD License) 11 | 12 | Copyright (c) 2010, microBuilder SARL 13 | All rights reserved. 14 | 15 | Redistribution and use in source and binary forms, with or without 16 | modification, are permitted provided that the following conditions are met: 17 | 1. Redistributions of source code must retain the above copyright 18 | notice, this list of conditions and the following disclaimer. 19 | 2. Redistributions in binary form must reproduce the above copyright 20 | notice, this list of conditions and the following disclaimer in the 21 | documentation and/or other materials provided with the distribution. 22 | 3. Neither the name of the copyright holders nor the 23 | names of its contributors may be used to endorse or promote products 24 | derived from this software without specific prior written permission. 25 | 26 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY 27 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 28 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 29 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY 30 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 31 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 32 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 33 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 34 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 35 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 36 | */ 37 | /**************************************************************************/ 38 | 39 | #ifndef __SYSINIT_H__ 40 | #define __SYSINIT_H__ 41 | 42 | #include "projectconfig.h" 43 | 44 | #include "core/gpio/gpio.h" 45 | #include "core/systick/systick.h" 46 | 47 | // Function prototypes 48 | void systemInit(); 49 | 50 | #endif -------------------------------------------------------------------------------- /tools/codelite_debug/CM3.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microbuilder/LPC1114CodeBase/c1dc51a7029aeba2a2f4d8792a0da17ccd1c0665/tools/codelite_debug/CM3.zip -------------------------------------------------------------------------------- /tools/codelite_debug/README.txt: -------------------------------------------------------------------------------- 1 | This slightly modified debug DLL can be used to allow full step-through and HW debugging in CodeLite using a Segger J-Link. 2 | 3 | It was created by AC Verbeck, and the original announcement can be found here: 4 | 5 | http://codelite.org/forum/viewtopic.php?f=11&t=1537 6 | 7 | To include debug information in the compiled firmware, open the make file and set the following field to TRUE 8 | 9 | -------------- 10 | 11 | ########################################################################## 12 | # Debug settings 13 | ########################################################################## 14 | 15 | # Set DEBUGBUILD to 'TRUE' for full debugging (larger, slower binaries), 16 | # or to 'FALSE' for release builds (smallest, fastest binaries) 17 | DEBUGBUILD = FALSE 18 | 19 | -------------- -------------------------------------------------------------------------------- /tools/examples/basics/blinky/main.c: -------------------------------------------------------------------------------- 1 | /**************************************************************************/ 2 | /*! 3 | @file main.c 4 | @author K. Townsend (microBuilder.eu) 5 | 6 | @section LICENSE 7 | 8 | Software License Agreement (BSD License) 9 | 10 | Copyright (c) 2010, microBuilder SARL 11 | All rights reserved. 12 | 13 | Redistribution and use in source and binary forms, with or without 14 | modification, are permitted provided that the following conditions are met: 15 | 1. Redistributions of source code must retain the above copyright 16 | notice, this list of conditions and the following disclaimer. 17 | 2. Redistributions in binary form must reproduce the above copyright 18 | notice, this list of conditions and the following disclaimer in the 19 | documentation and/or other materials provided with the distribution. 20 | 3. Neither the name of the copyright holders nor the 21 | names of its contributors may be used to endorse or promote products 22 | derived from this software without specific prior written permission. 23 | 24 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY 25 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 26 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 27 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY 28 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 29 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 30 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 31 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 32 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 33 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | */ 35 | /**************************************************************************/ 36 | #include 37 | #include 38 | #include 39 | 40 | #include "projectconfig.h" 41 | #include "sysinit.h" 42 | 43 | #include "core/gpio/gpio.h" 44 | #include "core/systick/systick.h" 45 | 46 | /**************************************************************************/ 47 | /*! 48 | Cause the LED to blink once per second using a blocking delay 49 | */ 50 | /**************************************************************************/ 51 | int main(void) 52 | { 53 | // Configure cpu and mandatory peripherals 54 | systemInit(); 55 | 56 | while (1) 57 | { 58 | // Wait one second 59 | systickDelay(1000); 60 | // Toggle the LED 61 | if (gpioGetValue(CFG_LED_PORT, CFG_LED_PIN) == CFG_LED_OFF) 62 | { 63 | gpioSetValue (CFG_LED_PORT, CFG_LED_PIN, CFG_LED_ON); 64 | } 65 | else 66 | { 67 | gpioSetValue (CFG_LED_PORT, CFG_LED_PIN, CFG_LED_OFF); 68 | } 69 | } 70 | 71 | return 0; 72 | } 73 | -------------------------------------------------------------------------------- /tools/examples/basics/blinky/readme.txt: -------------------------------------------------------------------------------- 1 | Causes the LED to blink once per second -------------------------------------------------------------------------------- /tools/examples/basics/blinky_nonblocking/main.c: -------------------------------------------------------------------------------- 1 | /**************************************************************************/ 2 | /*! 3 | @file main.c 4 | @author K. Townsend (microBuilder.eu) 5 | 6 | @section LICENSE 7 | 8 | Software License Agreement (BSD License) 9 | 10 | Copyright (c) 2010, microBuilder SARL 11 | All rights reserved. 12 | 13 | Redistribution and use in source and binary forms, with or without 14 | modification, are permitted provided that the following conditions are met: 15 | 1. Redistributions of source code must retain the above copyright 16 | notice, this list of conditions and the following disclaimer. 17 | 2. Redistributions in binary form must reproduce the above copyright 18 | notice, this list of conditions and the following disclaimer in the 19 | documentation and/or other materials provided with the distribution. 20 | 3. Neither the name of the copyright holders nor the 21 | names of its contributors may be used to endorse or promote products 22 | derived from this software without specific prior written permission. 23 | 24 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY 25 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 26 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 27 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY 28 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 29 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 30 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 31 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 32 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 33 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | */ 35 | /**************************************************************************/ 36 | #include "projectconfig.h" 37 | #include "sysinit.h" 38 | 39 | #include "core/gpio/gpio.h" 40 | #include "core/systick/systick.h" 41 | 42 | #ifdef CFG_INTERFACE 43 | #include "core/cmd/cmd.h" 44 | #endif 45 | 46 | /**************************************************************************/ 47 | /*! 48 | Causes the LED to flash every second using a non-blocking delay, 49 | and constantly checks if any incoming characters have arrived in 50 | the UART buffer for the CLI 51 | 52 | projectconfig.h settings: 53 | -------------------------------------------------- 54 | CFG_INTERFACE -> Enabled 55 | */ 56 | /**************************************************************************/ 57 | int main(void) 58 | { 59 | // Configure cpu and mandatory peripherals 60 | systemInit(); 61 | 62 | uint32_t currentSecond, lastSecond; 63 | currentSecond = lastSecond = 0; 64 | 65 | // Toggle LED once per second and constantly check CLI input 66 | while (1) 67 | { 68 | // Get the number of seconds the CPU has been active 69 | // If the value has changed we've advanced at least 1 second 70 | currentSecond = systickGetSecondsActive(); 71 | if (currentSecond != lastSecond) 72 | { 73 | lastSecond = currentSecond; 74 | // Toggle the LED 75 | if (gpioGetValue(CFG_LED_PORT, CFG_LED_PIN) == CFG_LED_OFF) 76 | { 77 | gpioSetValue (CFG_LED_PORT, CFG_LED_PIN, CFG_LED_ON); 78 | } 79 | else 80 | { 81 | gpioSetValue (CFG_LED_PORT, CFG_LED_PIN, CFG_LED_OFF); 82 | } 83 | } 84 | 85 | // Poll for CLI input if CFG_INTERFACE is enabled in projectconfig.h 86 | #ifdef CFG_INTERFACE 87 | cmdPoll(); 88 | #endif 89 | } 90 | 91 | return 0; 92 | } 93 | -------------------------------------------------------------------------------- /tools/examples/basics/blinky_nonblocking/readme.txt: -------------------------------------------------------------------------------- 1 | Causes the LED to blink once per second using a non-blocking delay, as well 2 | as constantly checking the UART buffer for incoming data to be passed to the 3 | CLI. You can connect to the CLI using UART, send and receive commands, and 4 | the LED should continue blinking (as long as a command is not using the MCU). -------------------------------------------------------------------------------- /tools/examples/chibi/receive/main.c: -------------------------------------------------------------------------------- 1 | /**************************************************************************/ 2 | /*! 3 | @file main.c 4 | @author K. Townsend (microBuilder.eu) 5 | 6 | @section LICENSE 7 | 8 | Software License Agreement (BSD License) 9 | 10 | Copyright (c) 2010, microBuilder SARL 11 | All rights reserved. 12 | 13 | Redistribution and use in source and binary forms, with or without 14 | modification, are permitted provided that the following conditions are met: 15 | 1. Redistributions of source code must retain the above copyright 16 | notice, this list of conditions and the following disclaimer. 17 | 2. Redistributions in binary form must reproduce the above copyright 18 | notice, this list of conditions and the following disclaimer in the 19 | documentation and/or other materials provided with the distribution. 20 | 3. Neither the name of the copyright holders nor the 21 | names of its contributors may be used to endorse or promote products 22 | derived from this software without specific prior written permission. 23 | 24 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY 25 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 26 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 27 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY 28 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 29 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 30 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 31 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 32 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 33 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | */ 35 | /**************************************************************************/ 36 | #include "projectconfig.h" 37 | #include "sysinit.h" 38 | 39 | #include "core/gpio/gpio.h" 40 | #include "drivers/rf/chibi/chb.h" 41 | #include "drivers/rf/chibi/chb_drvr.h" 42 | 43 | static chb_rx_data_t rx_data; 44 | 45 | /**************************************************************************/ 46 | /*! 47 | Constantly checks for incoming messages, and displays them using 48 | printf when they arrive. This program will display messages sent 49 | to the global broadcast address (0xFFFF) or messages addressed to 50 | this node using it's unique 16-bit ID. 51 | 52 | projectconfig.h settings: 53 | -------------------------------------------------- 54 | CFG_CHIBI -> Enabled 55 | CFG_CHIBI_PROMISCUOUS -> 0 56 | CFG_CHIBI_BUFFERSIZE -> 128 57 | */ 58 | /**************************************************************************/ 59 | int main(void) 60 | { 61 | // Configure cpu and mandatory peripherals 62 | systemInit(); 63 | 64 | // Make sure that projectconfig.h is properly configured for this example 65 | #if !defined CFG_CHIBI 66 | #error "CFG_CHIBI must be enabled in projectconfig.h for this example" 67 | #endif 68 | #if CFG_CHIBI_PROMISCUOUS != 0 69 | #error "CFG_CHIBI_PROMISCUOUS must be set to 0 in projectconfig.h for this example" 70 | #endif 71 | 72 | // Get a reference to the Chibi peripheral control block 73 | chb_pcb_t *pcb = chb_get_pcb(); 74 | 75 | while(1) 76 | { 77 | // Check for incoming messages 78 | while (pcb->data_rcv) 79 | { 80 | // Enable LED to indicate message reception 81 | gpioSetValue (CFG_LED_PORT, CFG_LED_PIN, CFG_LED_ON); 82 | // get the length of the data 83 | rx_data.len = chb_read(&rx_data); 84 | // make sure the length is nonzero 85 | if (rx_data.len) 86 | { 87 | printf("Message received from node %02X: %s, len=%d, rssi=%02X.%s", rx_data.src_addr, rx_data.data, rx_data.len, pcb->ed, CFG_PRINTF_NEWLINE); 88 | } 89 | // Disable LED 90 | gpioSetValue (CFG_LED_PORT, CFG_LED_PIN, CFG_LED_OFF); 91 | } 92 | } 93 | 94 | return 0; 95 | } 96 | -------------------------------------------------------------------------------- /tools/examples/chibi/receive/readme.txt: -------------------------------------------------------------------------------- 1 | Looks for any incoming messages using the global broadcast address 2 | (0xFFFF) of this node's addresses and displays the message content 3 | using printf (redirect to UART by default). -------------------------------------------------------------------------------- /tools/examples/chibi/sniffer_sd/main.c: -------------------------------------------------------------------------------- 1 | /**************************************************************************/ 2 | /*! 3 | @file main.c 4 | @author K. Townsend (microBuilder.eu) 5 | 6 | @section LICENSE 7 | 8 | Software License Agreement (BSD License) 9 | 10 | Copyright (c) 2010, microBuilder SARL 11 | All rights reserved. 12 | 13 | Redistribution and use in source and binary forms, with or without 14 | modification, are permitted provided that the following conditions are met: 15 | 1. Redistributions of source code must retain the above copyright 16 | notice, this list of conditions and the following disclaimer. 17 | 2. Redistributions in binary form must reproduce the above copyright 18 | notice, this list of conditions and the following disclaimer in the 19 | documentation and/or other materials provided with the distribution. 20 | 3. Neither the name of the copyright holders nor the 21 | names of its contributors may be used to endorse or promote products 22 | derived from this software without specific prior written permission. 23 | 24 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY 25 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 26 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 27 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY 28 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 29 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 30 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 31 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 32 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 33 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | */ 35 | /**************************************************************************/ 36 | #include "projectconfig.h" 37 | #include "sysinit.h" 38 | 39 | #include "core/gpio/gpio.h" 40 | 41 | #if defined CFG_CHIBI && defined CFG_SDCARD 42 | #include 43 | #include 44 | #include "drivers/rf/chibi/chb.h" 45 | #include "drivers/rf/chibi/chb_drvr.h" 46 | #include "drivers/rf/chibi/chb_libpcap.h" 47 | static chb_rx_data_t rx_data; 48 | #endif 49 | 50 | /**************************************************************************/ 51 | /*! 52 | Use Chibi as a wireless sniffer and write all captured frames 53 | to the SD card in libpcap format 54 | 55 | projectconfig.h settings: 56 | -------------------------------------------------- 57 | CFG_CHIBI, CFG_SDCARD -> Enabled 58 | CFG_CHIBI_PROMISCUOUS -> 1 59 | CFG_CHIBI_BUFFERSIZE -> 1024 60 | */ 61 | /**************************************************************************/ 62 | int main(void) 63 | { 64 | // Configure cpu and mandatory peripherals 65 | systemInit(); 66 | 67 | // Check if projectconfig.h is properly configured for this example 68 | #if !defined CFG_CHIBI 69 | #error "CFG_CHIBI must be enabled in projectconfig.h for this example" 70 | #endif 71 | #if CFG_CHIBI_PROMISCUOUS == 0 72 | #error "CFG_CHIBI_PROMISCUOUS must set to 1 in projectconfig.h for this example" 73 | #endif 74 | #if !defined CFG_SDCARD 75 | #error "CFG_SDCARD must be enabled in projectconfig.h for this example" 76 | #endif 77 | 78 | #if defined CFG_CHIBI && defined CFG_SDCARD && CFG_CHIBI_PROMISCUOUS != 0 79 | // Get a reference to the Chibi peripheral control block 80 | chb_pcb_t *pcb = chb_get_pcb(); 81 | 82 | // Create a binary file to store captured data 83 | libpcap_error_t error; 84 | error = libpcapInit("/capture.cap"); 85 | if (error) 86 | { 87 | // Something happened trying to create the file or access the SD card 88 | switch (error) 89 | { 90 | case LIBPCAP_ERROR_FATFS_NODISK: 91 | printf("No Disk\r\n"); 92 | break; 93 | case LIBPCAP_ERROR_FATFS_INITFAILED: 94 | printf("Init Failed\r\n"); 95 | break; 96 | case LIBPCAP_ERROR_FATFS_FAILEDTOMOUNTDRIVE: 97 | printf("Failed to mount drive\r\n"); 98 | break; 99 | case LIBPCAP_ERROR_FATFS_UNABLETOCREATEFILE: 100 | printf("Unable to create file\r\n"); 101 | break; 102 | } 103 | 104 | // Quit the program 105 | return -1; 106 | } 107 | 108 | // Wait for incoming frames and log them to disk in libpcap format. 109 | while(1) 110 | { 111 | // Check for incoming messages 112 | while (pcb->data_rcv) 113 | { 114 | // get the length of the data 115 | rx_data.len = chb_read(&rx_data); 116 | // make sure the length is non-zero 117 | if (rx_data.len) 118 | { 119 | // Enable LED to indicate message reception 120 | gpioSetValue (CFG_LED_PORT, CFG_LED_PIN, CFG_LED_ON); 121 | // Write frame content to disk 122 | libpcapWriteFrame(rx_data.data, rx_data.len); 123 | // Disable LED 124 | gpioSetValue (CFG_LED_PORT, CFG_LED_PIN, CFG_LED_OFF); 125 | } 126 | } 127 | } 128 | #endif 129 | 130 | return 0; 131 | } 132 | -------------------------------------------------------------------------------- /tools/examples/chibi/sniffer_sd/readme.txt: -------------------------------------------------------------------------------- 1 | Uses 'PROMISCUOUS' mode in Chibi, which listens to ANY message available within 2 | hearing range, and logs the messages to the SD card in libpcap format (which can be 3 | opened directly in Wireshark). This useful functionality is perfect for debugging 4 | wireless sensor networks since you can capture, log and later analyse all traffic 5 | and frame data moving around the wireless sensor network. -------------------------------------------------------------------------------- /tools/examples/chibi/sniffer_wsbridge/main.c: -------------------------------------------------------------------------------- 1 | /**************************************************************************/ 2 | /*! 3 | @file main.c 4 | @author K. Townsend (microBuilder.eu) 5 | 6 | @section LICENSE 7 | 8 | Software License Agreement (BSD License) 9 | 10 | Copyright (c) 2010, microBuilder SARL 11 | All rights reserved. 12 | 13 | Redistribution and use in source and binary forms, with or without 14 | modification, are permitted provided that the following conditions are met: 15 | 1. Redistributions of source code must retain the above copyright 16 | notice, this list of conditions and the following disclaimer. 17 | 2. Redistributions in binary form must reproduce the above copyright 18 | notice, this list of conditions and the following disclaimer in the 19 | documentation and/or other materials provided with the distribution. 20 | 3. Neither the name of the copyright holders nor the 21 | names of its contributors may be used to endorse or promote products 22 | derived from this software without specific prior written permission. 23 | 24 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY 25 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 26 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 27 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY 28 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 29 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 30 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 31 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 32 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 33 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | */ 35 | /**************************************************************************/ 36 | #include "projectconfig.h" 37 | #include "sysinit.h" 38 | 39 | #include "core/gpio/gpio.h" 40 | 41 | #if defined CFG_CHIBI 42 | #include 43 | #include 44 | #include "drivers/rf/chibi/chb.h" 45 | #include "drivers/rf/chibi/chb_drvr.h" 46 | #include "core/uart/uart.h" 47 | static chb_rx_data_t rx_data; 48 | #endif 49 | 50 | /**************************************************************************/ 51 | /*! 52 | Use Chibi as a wireless sniffer and write all captured frames 53 | to the SD card in libpcap format 54 | 55 | projectconfig.h settings: 56 | -------------------------------------------------- 57 | CFG_CHIBI -> Enabled 58 | CFG_CHIBI_PROMISCUOUS -> 1 59 | CFG_CHIBI_BUFFERSIZE -> 1024 60 | */ 61 | /**************************************************************************/ 62 | int main(void) 63 | { 64 | // Configure cpu and mandatory peripherals 65 | systemInit(); 66 | 67 | // Check if projectconfig.h is properly configured for this example 68 | #if !defined CFG_CHIBI 69 | #error "CFG_CHIBI must be enabled in projectconfig.h for this example" 70 | #endif 71 | #if CFG_CHIBI_PROMISCUOUS == 0 72 | #error "CFG_CHIBI_PROMISCUOUS must set to 1 in projectconfig.h for this example" 73 | #endif 74 | #if !defined CFG_PRINTF_UART 75 | #error "CFG_PRINTF_UART must be enabled in projectconfig.h for this example" 76 | #endif 77 | #if defined CFG_INTERFACE 78 | #error "CFG_INTERFACE must be disabled in projectconfig.h for this example" 79 | #endif 80 | 81 | #if defined CFG_CHIBI && CFG_CHIBI_PROMISCUOUS != 0 82 | // Get a reference to the Chibi peripheral control block 83 | chb_pcb_t *pcb = chb_get_pcb(); 84 | 85 | // Wait for incoming frames and transmit the raw data over uart 86 | while(1) 87 | { 88 | // Check for incoming messages 89 | while (pcb->data_rcv) 90 | { 91 | // get the length of the data 92 | rx_data.len = chb_read(&rx_data); 93 | // make sure the length is nonzero 94 | if (rx_data.len) 95 | { 96 | // Enable LED to indicate message reception 97 | gpioSetValue (CFG_LED_PORT, CFG_LED_PIN, CFG_LED_ON); 98 | 99 | // Send raw data to UART for processing on 100 | // the PC (requires WSBridge - www.freaklabs.org) 101 | uint8_t i; 102 | for (i=0; i 43 | #include 44 | #include "drivers/rf/chibi/chb.h" 45 | #include "drivers/rf/chibi/chb_drvr.h" 46 | #endif 47 | 48 | /**************************************************************************/ 49 | /*! 50 | Broadcast a basic message every 250 milliseconds 51 | 52 | projectconfig.h settings: 53 | -------------------------------------------------- 54 | CFG_CHIBI -> Enabled 55 | CFG_CHIBI_PROMISCUOUS -> 0 56 | CFG_CHIBI_BUFFERSIZE -> 128 57 | */ 58 | /**************************************************************************/ 59 | int main(void) 60 | { 61 | // Configure cpu and mandatory peripherals 62 | systemInit(); 63 | 64 | // Make sure that projectconfig.h is properly configured for this example 65 | #if !defined CFG_CHIBI 66 | #error "CFG_CHIBI must be enabled in projectconfig.h for this example" 67 | #endif 68 | #if CFG_CHIBI_PROMISCUOUS != 0 69 | #error "CFG_CHIBI_PROMISCUOUS must be set to 0 in projectconfig.h for this example" 70 | #endif 71 | 72 | #ifdef CFG_CHIBI 73 | uint32_t counter = 0; 74 | chb_pcb_t *pcb = chb_get_pcb(); 75 | 76 | while(1) 77 | { 78 | // Enable LED 79 | gpioSetValue (CFG_LED_PORT, CFG_LED_PIN, CFG_LED_ON); 80 | // Create and send the message 81 | char text[10]; 82 | counter++; 83 | itoa(counter, text, 10); 84 | chb_write(0xFFFF, text, strlen(text) + 1); 85 | // Disable LED 86 | gpioSetValue (CFG_LED_PORT, CFG_LED_PIN, CFG_LED_OFF); 87 | systickDelay(250); 88 | } 89 | #endif 90 | 91 | return 0; 92 | } 93 | -------------------------------------------------------------------------------- /tools/examples/chibi/transmit/readme.txt: -------------------------------------------------------------------------------- 1 | Broadcasts a basic messages every 250 milliseconds that will be 2 | received by every node within hearing distance. -------------------------------------------------------------------------------- /tools/examples/chibi/transmit_temp/main.c: -------------------------------------------------------------------------------- 1 | /**************************************************************************/ 2 | /*! 3 | @file main.c 4 | @author K. Townsend (microBuilder.eu) 5 | 6 | @section LICENSE 7 | 8 | Software License Agreement (BSD License) 9 | 10 | Copyright (c) 2010, microBuilder SARL 11 | All rights reserved. 12 | 13 | Redistribution and use in source and binary forms, with or without 14 | modification, are permitted provided that the following conditions are met: 15 | 1. Redistributions of source code must retain the above copyright 16 | notice, this list of conditions and the following disclaimer. 17 | 2. Redistributions in binary form must reproduce the above copyright 18 | notice, this list of conditions and the following disclaimer in the 19 | documentation and/or other materials provided with the distribution. 20 | 3. Neither the name of the copyright holders nor the 21 | names of its contributors may be used to endorse or promote products 22 | derived from this software without specific prior written permission. 23 | 24 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY 25 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 26 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 27 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY 28 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 29 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 30 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 31 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 32 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 33 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | */ 35 | /**************************************************************************/ 36 | #include "projectconfig.h" 37 | #include "sysinit.h" 38 | 39 | #include "core/gpio/gpio.h" 40 | #include "core/pmu/pmu.h" 41 | 42 | #if defined CFG_CHIBI 43 | #include 44 | #include 45 | #include "drivers/rf/chibi/chb.h" 46 | #include "drivers/rf/chibi/chb_drvr.h" 47 | #endif 48 | 49 | #ifdef CFG_LM75B 50 | #include "drivers/sensors/lm75b/lm75b.h" 51 | #endif 52 | 53 | /**************************************************************************/ 54 | /*! 55 | Broadcast a basic message every 250 milliseconds 56 | 57 | projectconfig.h settings: 58 | -------------------------------------------------- 59 | CFG_CHIBI -> Enabled 60 | CFG_CHIBI_PROMISCUOUS -> 0 61 | CFG_CHIBI_BUFFERSIZE -> 128 62 | */ 63 | /**************************************************************************/ 64 | int main(void) 65 | { 66 | // Configure cpu and mandatory peripherals 67 | systemInit(); 68 | 69 | // Make sure that projectconfig.h is properly configured for this example 70 | #if !defined CFG_BRD_LPC1114_802154WIRELESS 71 | #error "Warning: This example (probably) only works with the LPC1114 802.15.4 Wireless board" 72 | #endif 73 | #if !defined CFG_CHIBI 74 | #error "CFG_CHIBI must be enabled in projectconfig.h for this example" 75 | #endif 76 | #if !defined CFG_LM75B 77 | #error "CFG_LM75B must be enabled in projectconfig.h for this example" 78 | #endif 79 | #if CFG_CHIBI_PROMISCUOUS != 0 80 | #error "CFG_CHIBI_PROMISCUOUS must be set to 0 in projectconfig.h for this example" 81 | #endif 82 | 83 | char text[128]; 84 | int32_t temp; 85 | 86 | // Get a reference to the wireless peripheral control block 87 | chb_pcb_t *pcb = chb_get_pcb(); 88 | 89 | // Send the temperature every 5 seconds and going into deep sleep between messages 90 | while(1) 91 | { 92 | // Get the current temperature (in 0.125°C units) 93 | lm75bGetTemperature(&temp); 94 | // Multiply value by 125 for fixed-point math (0.125°C per unit) 95 | temp *= 125; 96 | // Use modulus operator to display decimal value 97 | sprintf(text, "Current Temp: %d.%d C", (int)(temp / 1000), (int)(temp % 1000)); 98 | // Enable LED 99 | gpioSetValue (CFG_LED_PORT, CFG_LED_PIN, CFG_LED_ON); 100 | chb_write(0xFFFF, text, strlen(text) + 1); 101 | // Disable LED 102 | gpioSetValue (CFG_LED_PORT, CFG_LED_PIN, CFG_LED_OFF); 103 | // Deep sleep for 5 seconds 104 | pmuDeepSleep(5); 105 | } 106 | 107 | return 0; 108 | } 109 | -------------------------------------------------------------------------------- /tools/examples/chibi/transmit_temp/readme.txt: -------------------------------------------------------------------------------- 1 | This example will read the temperature sensor once every 5 seconds 2 | and broadcast the data. Once the temperature has been read, the 3 | board will go into deep sleep (normally consuming <25uA on the 4 | LPC1114 802.15.4 Wireless Sensor Board). 5 | 6 | This simple example shows an easy way to send sensor readings using 7 | battery power for a period of several years. 8 | -------------------------------------------------------------------------------- /tools/examples/default/main.c: -------------------------------------------------------------------------------- 1 | /**************************************************************************/ 2 | /*! 3 | @file main.c 4 | @author K. Townsend (microBuilder.eu) 5 | 6 | @section LICENSE 7 | 8 | Software License Agreement (BSD License) 9 | 10 | Copyright (c) 2011, microBuilder SARL 11 | All rights reserved. 12 | 13 | Redistribution and use in source and binary forms, with or without 14 | modification, are permitted provided that the following conditions are met: 15 | 1. Redistributions of source code must retain the above copyright 16 | notice, this list of conditions and the following disclaimer. 17 | 2. Redistributions in binary form must reproduce the above copyright 18 | notice, this list of conditions and the following disclaimer in the 19 | documentation and/or other materials provided with the distribution. 20 | 3. Neither the name of the copyright holders nor the 21 | names of its contributors may be used to endorse or promote products 22 | derived from this software without specific prior written permission. 23 | 24 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY 25 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 26 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 27 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY 28 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 29 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 30 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 31 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 32 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 33 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | */ 35 | /**************************************************************************/ 36 | #include 37 | #include 38 | #include 39 | 40 | #include "projectconfig.h" 41 | #include "sysinit.h" 42 | 43 | #include "core/gpio/gpio.h" 44 | #include "core/systick/systick.h" 45 | 46 | #ifdef CFG_INTERFACE 47 | #include "core/cmd/cmd.h" 48 | #endif 49 | 50 | /**************************************************************************/ 51 | /*! 52 | Main program entry point. After reset, normal code execution will 53 | begin here. 54 | */ 55 | /**************************************************************************/ 56 | int main(void) 57 | { 58 | // Configure cpu and mandatory peripherals 59 | systemInit(); 60 | 61 | uint32_t currentSecond, lastSecond; 62 | currentSecond = lastSecond = 0; 63 | 64 | while (1) 65 | { 66 | // Toggle LED once per second 67 | currentSecond = systickGetSecondsActive(); 68 | if (currentSecond != lastSecond) 69 | { 70 | lastSecond = currentSecond; 71 | gpioSetValue(CFG_LED_PORT, CFG_LED_PIN, lastSecond % 2); 72 | } 73 | 74 | // Poll for CLI input if CFG_INTERFACE is enabled in projectconfig.h 75 | #ifdef CFG_INTERFACE 76 | cmdPoll(); 77 | #endif 78 | } 79 | 80 | return 0; 81 | } 82 | -------------------------------------------------------------------------------- /tools/examples/default/readme.txt: -------------------------------------------------------------------------------- 1 | This is the default main.c file used in the code base and will cause 2 | the test LED to blinks once per second and process any incoming data 3 | for the CLI if CFG_INTERFACE is enabled in projectconfig.h -------------------------------------------------------------------------------- /tools/examples/lcd/lpc1343tftlcd_uart/main.c: -------------------------------------------------------------------------------- 1 | /**************************************************************************/ 2 | /*! 3 | @file main.c 4 | @author K. Townsend (microBuilder.eu) 5 | 6 | @section LICENSE 7 | 8 | Software License Agreement (BSD License) 9 | 10 | Copyright (c) 2010, microBuilder SARL 11 | All rights reserved. 12 | 13 | Redistribution and use in source and binary forms, with or without 14 | modification, are permitted provided that the following conditions are met: 15 | 1. Redistributions of source code must retain the above copyright 16 | notice, this list of conditions and the following disclaimer. 17 | 2. Redistributions in binary form must reproduce the above copyright 18 | notice, this list of conditions and the following disclaimer in the 19 | documentation and/or other materials provided with the distribution. 20 | 3. Neither the name of the copyright holders nor the 21 | names of its contributors may be used to endorse or promote products 22 | derived from this software without specific prior written permission. 23 | 24 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY 25 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 26 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 27 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY 28 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 29 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 30 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 31 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 32 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 33 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | */ 35 | /**************************************************************************/ 36 | #include "projectconfig.h" 37 | #include "sysinit.h" 38 | 39 | #include "core/gpio/gpio.h" 40 | 41 | #ifdef CFG_PRINTF_UART 42 | #include "core/uart/uart.h" 43 | #endif 44 | 45 | /**************************************************************************/ 46 | /*! 47 | Sends a command to the TFT LCD, blocks until the command has 48 | finished executing on the LCD side, and returns any response 49 | */ 50 | /**************************************************************************/ 51 | byte_t* lcd(const byte_t* command) 52 | { 53 | byte_t abtRx[256]; 54 | size_t szRxLen; 55 | 56 | // Send the command to the LCD with '\n' (triggers cmd execution) 57 | printf("%s\n", command); 58 | 59 | // Wait for LCD busy pin to clear 60 | while (gpioGetValue(1, 4) == 1); 61 | 62 | // Check if there's a response on the uart buffer 63 | if (uartRxBufferReadArray(abtRx,&szRxLen)) 64 | { 65 | // ToDo: scan until \r or \n 66 | // debug_printf(abtRx); 67 | } 68 | else 69 | { 70 | return ""; 71 | } 72 | } 73 | 74 | /**************************************************************************/ 75 | /*! 76 | This assumes that the LPC1343 TFTLCD board is hooked up to UART on 77 | the LPC1114, and that the LCD 'busy' pin is connected to pin 1.4. 78 | */ 79 | /**************************************************************************/ 80 | int main(void) 81 | { 82 | // Configure cpu and mandatory peripherals 83 | systemInit(); 84 | 85 | // Clear the UART buffer 86 | uartRxBufferInit(); 87 | gpioSetDir(1, 4, 0); 88 | 89 | // Wait for LCD busy pin to clear (1 = active, 0 = ready) 90 | while (gpioGetValue(1, 4) == 1); 91 | 92 | lcd("clr24 255 255 255"); 93 | lcd("text 10 10 0x0000 1 Message received from 0xBEEF"); 94 | lcd("text 10 30 0x0000 1 RSSI:"); 95 | lcd("progress 80 25 100 15 67 0x1234 0x123F"); 96 | lcd("btn 10 130 220 35 0 Send Reply"); 97 | lcd("text 10 180 0x0000 0 THIS"); 98 | lcd("text 10 190 0x0000 0 is"); 99 | lcd("text 10 200 0x0000 0 a"); 100 | lcd("text 10 210 0x0000 0 TEST"); 101 | lcd("text 10 220 0x0000 0 WITH"); 102 | lcd("text 10 230 0x0000 0 multiple"); 103 | lcd("text 10 240 0x0000 0 command lines"); 104 | 105 | // Wait forever 106 | while(1) 107 | { 108 | } 109 | 110 | return 0; 111 | } 112 | -------------------------------------------------------------------------------- /tools/examples/lcd/lpc1343tftlcd_uart/readme.txt: -------------------------------------------------------------------------------- 1 | Shows a basic example of sending commands to the LPC1343 TFT LCD using UART. -------------------------------------------------------------------------------- /tools/examples/readme.txt: -------------------------------------------------------------------------------- 1 | This folder contains various examples showing how to use the LPC1114 to 2 | accomplish certain tasks or get started using a specific peripheral, etc.. 3 | 4 | To use them, replace the main.c file in the root folder of the lpc1343 5 | code base with the main.c in the example folder and recompiled your 6 | project. Any changes that need to be made to projectconfig.h 7 | should be indicated in the comments of the new main.c file. -------------------------------------------------------------------------------- /tools/readme.txt: -------------------------------------------------------------------------------- 1 | This folder contains a number of tools that may be useful when developing with 2 | the LPC1114 Reference Board 3 | 4 | =============================================================================== 5 | examples 6 | ----------------------------------------------------------------------------- 7 | Various examples to help you get started with the LPC1114 or use a specific 8 | peripheral or external device 9 | =============================================================================== 10 | 11 | =============================================================================== 12 | schematics 13 | ----------------------------------------------------------------------------- 14 | Schematics showing the pin connections that are assumed to be used by the 15 | LPC1114 Code Base. 16 | 17 | LPC1114BaseBoard_v1.3 - Generic LPC1114 Base Board 18 | AT86RF212LPC1114_v1.6 - LPC1114 + 700/800/900 MHz 802.15.4 Transceiver 19 | This schematic shows the pin connections that 20 | are assumed for Chibi and the micro-SD card reader 21 | =============================================================================== 22 | 23 | =============================================================================== 24 | wsbridge (courtesy freaklabs.org) 25 | ----------------------------------------------------------------------------- 26 | This simple application acts as a bridge between Chibi and Wireshark. The 27 | Chibi stack need to be put into promiscuous mode (CFG_CHIBI_PROMISCUOUS = 1). 28 | From there, raw 802.15.4 data frames are output via UART to WSBridge which 29 | feeds them into Wireshark. 30 | 31 | For more information see the following links: 32 | 33 | http://freaklabs.org/index.php/WSBridge.html 34 | http://bit.ly/fcTVke 35 | =============================================================================== 36 | 37 | 38 | -------------------------------------------------------------------------------- /tools/schematics/AT86RF212LPC1114_v1.6.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microbuilder/LPC1114CodeBase/c1dc51a7029aeba2a2f4d8792a0da17ccd1c0665/tools/schematics/AT86RF212LPC1114_v1.6.pdf -------------------------------------------------------------------------------- /tools/schematics/LPC1114BaseBoard_v1.3.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microbuilder/LPC1114CodeBase/c1dc51a7029aeba2a2f4d8792a0da17ccd1c0665/tools/schematics/LPC1114BaseBoard_v1.3.pdf -------------------------------------------------------------------------------- /tools/wsbridge/v0.50/Exe/Linux/wsbridge: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microbuilder/LPC1114CodeBase/c1dc51a7029aeba2a2f4d8792a0da17ccd1c0665/tools/wsbridge/v0.50/Exe/Linux/wsbridge -------------------------------------------------------------------------------- /tools/wsbridge/v0.50/Exe/Win/wsbridge.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microbuilder/LPC1114CodeBase/c1dc51a7029aeba2a2f4d8792a0da17ccd1c0665/tools/wsbridge/v0.50/Exe/Win/wsbridge.exe -------------------------------------------------------------------------------- /tools/wsbridge/v0.50/Linux/Makefile: -------------------------------------------------------------------------------- 1 | 2 | CC = gcc 3 | CFLAGS = -c 4 | SOURCES = main.c 5 | OBJECTS = $(SOURCES:.c=.o) 6 | EXE = wsbridge 7 | 8 | all: $(SOURCES) $(EXE) 9 | 10 | $(EXE): $(OBJECTS) 11 | $(CC) $(OBJECTS) -o $@ 12 | 13 | %.o:%.c 14 | $(CC) $(CFLAGS) $< -o $@ 15 | 16 | clean: 17 | rm *.o 18 | -------------------------------------------------------------------------------- /tools/wsbridge/v0.50/Win/wsbridge.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 10.00 3 | # Visual Studio 2008 4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "wsbridge", "wsbridge\wsbridge.csproj", "{9CAFA529-8FF4-42D4-B6A6-54992B3BB40F}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Any CPU = Debug|Any CPU 9 | Release|Any CPU = Release|Any CPU 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {9CAFA529-8FF4-42D4-B6A6-54992B3BB40F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 13 | {9CAFA529-8FF4-42D4-B6A6-54992B3BB40F}.Debug|Any CPU.Build.0 = Debug|Any CPU 14 | {9CAFA529-8FF4-42D4-B6A6-54992B3BB40F}.Release|Any CPU.ActiveCfg = Release|Any CPU 15 | {9CAFA529-8FF4-42D4-B6A6-54992B3BB40F}.Release|Any CPU.Build.0 = Release|Any CPU 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /tools/wsbridge/v0.50/Win/wsbridge.suo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microbuilder/LPC1114CodeBase/c1dc51a7029aeba2a2f4d8792a0da17ccd1c0665/tools/wsbridge/v0.50/Win/wsbridge.suo -------------------------------------------------------------------------------- /tools/wsbridge/v0.50/Win/wsbridge/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("pcap")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("pcap")] 13 | [assembly: AssemblyCopyright("Copyright © 2010")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("75eb0967-9c50-430e-a562-d0f7bee8f2cc")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /tools/wsbridge/v0.50/Win/wsbridge/wsbridge.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Debug 5 | AnyCPU 6 | 9.0.21022 7 | 2.0 8 | {9CAFA529-8FF4-42D4-B6A6-54992B3BB40F} 9 | Exe 10 | Properties 11 | wsbridge 12 | wsbridge 13 | v3.5 14 | 512 15 | publish\ 16 | true 17 | Disk 18 | false 19 | Foreground 20 | 7 21 | Days 22 | false 23 | false 24 | true 25 | 0 26 | 1.0.0.%2a 27 | false 28 | false 29 | true 30 | 31 | 32 | true 33 | full 34 | false 35 | bin\Debug\ 36 | DEBUG;TRACE 37 | prompt 38 | 4 39 | 40 | 41 | pdbonly 42 | true 43 | bin\Release\ 44 | TRACE 45 | prompt 46 | 4 47 | 48 | 49 | 50 | 51 | 3.5 52 | 53 | 54 | 3.5 55 | 56 | 57 | 3.5 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | False 69 | .NET Framework 2.0 %28x86%29 70 | false 71 | 72 | 73 | False 74 | .NET Framework 3.0 %28x86%29 75 | false 76 | 77 | 78 | False 79 | .NET Framework 3.5 80 | true 81 | 82 | 83 | False 84 | Windows Installer 3.1 85 | true 86 | 87 | 88 | 89 | 96 | -------------------------------------------------------------------------------- /tools/wsbridge/v0.50/Win/wsbridge/wsbridge.csproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | publish\ 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | en-US 13 | false 14 | 15 | --------------------------------------------------------------------------------