Skip to content

Commit

Permalink
commiting first version of the code
Browse files Browse the repository at this point in the history
  • Loading branch information
macpod committed Nov 6, 2012
1 parent d226639 commit 8bee68a
Show file tree
Hide file tree
Showing 33 changed files with 6,935 additions and 0 deletions.
1,579 changes: 1,579 additions & 0 deletions lasershark/.cproject

Large diffs are not rendered by default.

83 changes: 83 additions & 0 deletions lasershark/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>lasershark</name>
<comment></comment>
<projects>
<project>CMSISv2p00_LPC13xx</project>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
<triggers>clean,full,incremental,</triggers>
<arguments>
<dictionary>
<key>?name?</key>
<value></value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.append_environment</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.autoBuildTarget</key>
<value>all</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.buildArguments</key>
<value></value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.buildCommand</key>
<value>make</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.buildLocation</key>
<value>${workspace_loc:/lasershark/Release}</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.cleanBuildTarget</key>
<value>clean</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.contents</key>
<value>org.eclipse.cdt.make.core.activeConfigSettings</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableAutoBuild</key>
<value>false</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableCleanBuild</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableFullBuild</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.fullBuildTarget</key>
<value>all</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.stopOnError</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.useDefaultBuildCmd</key>
<value>true</value>
</dictionary>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
<triggers>full,incremental,</triggers>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.cdt.core.cnature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
</natures>
</projectDescription>
3 changes: 3 additions & 0 deletions lasershark/.settings/org.eclipse.ltk.core.refactoring.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#Tue Nov 06 00:15:51 EST 2012
eclipse.preferences.version=1
org.eclipse.ltk.core.refactoring.enable.project.refactoring.history=false
50 changes: 50 additions & 0 deletions lasershark/Debug/makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
################################################################################
# Automatically-generated file. Do not edit!
################################################################################

-include ../makefile.init

RM := rm -rf

# All of the sources participating in the build are defined here
-include sources.mk
-include subdir.mk
-include src/subdir.mk
-include objects.mk

ifneq ($(MAKECMDGOALS),clean)
ifneq ($(strip $(C_DEPS)),)
-include $(C_DEPS)
endif
endif

-include ../makefile.defs

# Add inputs and outputs from these tool invocations to the build variables

# All Target
all: lasershark.axf

# Tool invocations
lasershark.axf: $(OBJS) $(USER_OBJS)
@echo 'Building target: $@'
@echo 'Invoking: MCU Linker'
arm-none-eabi-gcc -nostdlib -L"/home/nelsonjm/embedded/lpcxpresso/CMSISv2p00_LPC13xx/Debug" -Xlinker -Map="lasershark.map" -Xlinker --gc-sections -mcpu=cortex-m3 -mthumb -T "lasershark_Debug.ld" -o"lasershark.axf" $(OBJS) $(USER_OBJS) $(LIBS)
@echo 'Finished building target: $@'
@echo ' '
$(MAKE) --no-print-directory post-build

# Other Targets
clean:
-$(RM) $(OBJS)$(C_DEPS)$(EXECUTABLES) lasershark.axf
-@echo ' '

post-build:
-@echo 'Performing post-build steps'
-arm-none-eabi-size lasershark.axf; arm-none-eabi-objcopy -v -O binary lasershark.axf lasershark.bin; checksum -v lasershark.bin;
-@echo ' '

.PHONY: all clean dependents
.SECONDARY: post-build

-include ../makefile.targets
50 changes: 50 additions & 0 deletions lasershark/Release/makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
################################################################################
# Automatically-generated file. Do not edit!
################################################################################

-include ../makefile.init

RM := rm -rf

# All of the sources participating in the build are defined here
-include sources.mk
-include subdir.mk
-include src/subdir.mk
-include objects.mk

ifneq ($(MAKECMDGOALS),clean)
ifneq ($(strip $(C_DEPS)),)
-include $(C_DEPS)
endif
endif

-include ../makefile.defs

# Add inputs and outputs from these tool invocations to the build variables

# All Target
all: lasershark.axf

# Tool invocations
lasershark.axf: $(OBJS) $(USER_OBJS)
@echo 'Building target: $@'
@echo 'Invoking: MCU Linker'
arm-none-eabi-gcc -nostdlib -L"/home/nelsonjm/embedded/lpcxpresso/CMSISv2p00_LPC13xx/Release" -Xlinker -Map="lasershark.map" -Xlinker --gc-sections -mcpu=cortex-m3 -mthumb -T "lasershark_Release.ld" -o"lasershark.axf" $(OBJS) $(USER_OBJS) $(LIBS)
@echo 'Finished building target: $@'
@echo ' '
$(MAKE) --no-print-directory post-build

# Other Targets
clean:
-$(RM) $(OBJS)$(C_DEPS)$(EXECUTABLES) lasershark.axf
-@echo ' '

post-build:
-@echo 'Performing post-build steps'
-arm-none-eabi-size lasershark.axf; arm-none-eabi-objcopy -v -O binary lasershark.axf lasershark.bin; checksum -v lasershark.bin;
-@echo ' '

.PHONY: all clean dependents
.SECONDARY: post-build

-include ../makefile.targets
42 changes: 42 additions & 0 deletions lasershark/inc/config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*****************************************************************************
* config.h: config file for usbcdc example for NXP LPC13xx Family
* Microprocessors
*
* Copyright(C) 2008, NXP Semiconductor
* All rights reserved.
*
* History
* 2008.07.19 ver 1.00 Preliminary version, first Release
*
******************************************************************************/

/*
Overview:
This example shows how to use the USB driver to implement a CDC class USB peripheral.
To run this example, you must attach a USB cable to the board. See
the "Getting Started Guide" appendix for details.
How to use:
Click the debug toolbar button.
Click the go button.
Plug the LPCXpresso's target side into a PC using a USB cable retrofit
or a 3rd party base board.
* You should be able to see a new COM port on your PC.
*/

#define NXP_VID 0x1FC9
#define MY_VID 0x04D8

#define USB_VENDOR_ID NXP_VID // Vendor ID
#define USB_PROD_ID MY_VID // Product ID
#define USB_DEVICE 0x0100 // Device ID

#define LED_PORT 2 // Port for led
#define USR1_LED_BIT 9 // Bit on port for led
#define USR2_LED_BIT 10 // Bit on port for led


/*********************************************************************************
** End Of File
*********************************************************************************/
46 changes: 46 additions & 0 deletions lasershark/inc/dac124s085.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
dac123s085.h - Lasershark firmware.
Copyright (C) 2012 Jeffrey Nelson <nelsonjm@macpod.net>
This file is part of Lasershark's Firmware.
Lasershark is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
Lasershark is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Lasershark. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef DAC124S085_H
#define DAC124S085_H

#include <stdint.h>
#include <stdbool.h>

#define DAC124S085_INPUT_REG_DATA_MASK 0x0FFF

#define DAC124S085_INPUT_REG_A 0x0000
#define DAC124S085_INPUT_REG_B 0x4000
#define DAC124S085_INPUT_REG_C 0x8000
#define DAC124S085_INPUT_REG_D 0xC000

#define DAC124S085_OP_WRITE_NO_UPDATE 0x0000
#define DAC124S085_OP_WRITE_UPDATE_OUTPUTS 0x1000
#define DAC124S085_OP_WRITE_ALL_UPDATE 0x2000
#define DAC124S085_OP_POWER_DOWN 0x3000

#define DAC124S085_DAC_VAL_MIN 0
#define DAC124S085_DAC_VAL_MID 0x7FF
#define DAC124S085_DAC_VAL_MAX 0xFFF

void dac124s085_init(void);
__inline void dac124s085_dac(volatile const uint16_t *abcd);
__inline void dac124s085_dac_chn_set(uint16_t reg, uint16_t val, bool update_outputs);
#endif

102 changes: 102 additions & 0 deletions lasershark/inc/gpio.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
/*****************************************************************************
* gpio.h: Header file for NXP LPC13xx Family Microprocessors
*
* Copyright(C) 2008, NXP Semiconductor
* All rights reserved.
*
* History
* 2012.10.15 ver 1.1 Added gpio toggle function <nelsonjm@macpod.net>
* 2008.09.01 ver 1.00 Preliminary version, first Release
* 2009.12.09 ver 1.05 Mod to use mask registers for GPIO writes + inlining (.h)
*
******************************************************************************/
#ifndef __GPIO_H
#define __GPIO_H

#include "LPC13xx.h"

#define PORT0 0
#define PORT1 1
#define PORT2 2
#define PORT3 3

void GPIO_IRQHandler(void);
void GPIOInit( void );
void GPIOSetInterrupt( uint32_t portNum, uint32_t bitPosi, uint32_t sense,
uint32_t single, uint32_t event );
void GPIOIntEnable( uint32_t portNum, uint32_t bitPosi );
void GPIOIntDisable( uint32_t portNum, uint32_t bitPosi );
uint32_t GPIOIntStatus( uint32_t portNum, uint32_t bitPosi );
void GPIOIntClear( uint32_t portNum, uint32_t bitPosi );

static LPC_GPIO_TypeDef (* const LPC_GPIO[4]) = { LPC_GPIO0, LPC_GPIO1, LPC_GPIO2, LPC_GPIO3 };

/*****************************************************************************
** Function name: GPIOSetValue
**
** Descriptions: Set/clear a bitvalue in a specific bit position
** in GPIO portX(X is the port number.)
**
** parameters: port num, bit position, bit value
** Returned value: None
**
*****************************************************************************/
static __INLINE void GPIOSetValue( uint32_t portNum, uint32_t bitPosi, uint32_t bitVal )
{
LPC_GPIO[portNum]->MASKED_ACCESS[(1<<bitPosi)] = (bitVal<<bitPosi);
}


/*****************************************************************************
** Function name: GPIOGetValue
**
** Descriptions: Set/clear a bitvalue in a specific bit position
** in GPIO portX(X is the port number.)
**
** parameters: port num, bit position, bit value
** Returned value: None
**
*****************************************************************************/
static __INLINE uint32_t GPIOGetValue( uint32_t portNum, uint32_t bitPosi)
{
return (LPC_GPIO[portNum]->MASKED_ACCESS[(1<<bitPosi)])>>bitPosi;
}


/*****************************************************************************
** Function name: GPIOToggleValue
**
** Descriptions: Toggles bitvalue in a specific bit position
** in GPIO portX(X is the port number.)
**
** parameters: port num, bit position
** Returned value: None
**
*****************************************************************************/
static __INLINE void GPIOToggleValue( uint32_t portNum, uint32_t bitPosi)
{
GPIOSetValue(portNum, bitPosi, ~GPIOGetValue(portNum, bitPosi));

}

/*****************************************************************************
** Function name: GPIOSetDir
**
** Descriptions: Set the direction in GPIO port
**
** parameters: port num, bit position, direction (1 out, 0 input)
** Returned value: None
**
*****************************************************************************/
static __INLINE void GPIOSetDir( uint32_t portNum, uint32_t bitPosi, uint32_t dir )
{
if(dir)
LPC_GPIO[portNum]->DIR |= 1<<bitPosi;
else
LPC_GPIO[portNum]->DIR &= ~(1<<bitPosi);
}

#endif /* end __GPIO_H */
/*****************************************************************************
** End Of File
******************************************************************************/
Loading

0 comments on commit 8bee68a

Please sign in to comment.