<folder Name="pwm">
<file file_name="../../core/pwm/pwm.c"/>
</folder>
+ <folder Name="swspi">
+ <file file_name="../../core/swspi/swspi.c"/>
+ </folder>
</folder>
<file file_name="../../lpc134x.h"/>
<file file_name="../../projectconfig.h"/>
<!DOCTYPE CrossStudio_for_ARM_Session_File>
<session>
<Bookmarks/>
- <Breakpoints/>
+ <Breakpoints>
+ <BreakpointListItem line="184" action="" hardwareBreakpoint="" trigger="" useHWbreakpoint="false" group="Breakpoints" type="Breakpoint" state="2" counter="0" isFunctionBreakpoint="false" filename="C:\Dropbox\microBuilder\Code\LPC1343\LPC1343_CodeBase_GIT\drivers\sensors\adbm-a350\adbm-a350.c" expression="" />
+ </Breakpoints>
<ETMWindow>
<ETMRegister number="0" value="800" />
<ETMRegister number="8" value="6f" />
<ProjectSessionItem path="LPC1343_CodeBase" name="unnamed" />
<ProjectSessionItem path="LPC1343_CodeBase;LPC1343_CodeBase" name="unnamed" />
<ProjectSessionItem path="LPC1343_CodeBase;LPC1343_CodeBase;Source Files" name="unnamed" />
- <ProjectSessionItem path="LPC1343_CodeBase;LPC1343_CodeBase;Source Files;drivers" name="unnamed" />
- <ProjectSessionItem path="LPC1343_CodeBase;LPC1343_CodeBase;Source Files;drivers;dac" name="unnamed" />
- <ProjectSessionItem path="LPC1343_CodeBase;LPC1343_CodeBase;Source Files;drivers;dac;mcp4725" name="unnamed" />
</Project>
<Register1>
- <RegisterWindow openNodes="GPIO2" binaryNodes="" hiddenNodes="" unsignedNodes="" visibleGroups="CPU;CoreDebug;GPIO2" decimalNodes="" octalNodes="" asciiNodes="" />
+ <RegisterWindow openNodes="GPIO1" binaryNodes="" hiddenNodes="" unsignedNodes="" visibleGroups="CPU;CoreDebug;GPIO2;GPIO1" decimalNodes="" octalNodes="" asciiNodes="" />
</Register1>
<Register2>
<RegisterWindow openNodes="" binaryNodes="" hiddenNodes="" unsignedNodes="" visibleGroups="" decimalNodes="" octalNodes="" asciiNodes="" />
<Watches active="0" update="Never" />
</Watch4>
<Files>
- <SessionOpenFile useTextEdit="1" useBinaryEdit="0" codecName="Latin1" x="3" debugPath="C:\Dropbox\microBuilder\Code\LPC1343\LPC1343_CodeBase_GIT\main.c" y="69" path="C:\Dropbox\microBuilder\Code\LPC1343\LPC1343_CodeBase_GIT\main.c" left="0" selected="1" name="unnamed" top="54" />
- <SessionOpenFile useTextEdit="1" useBinaryEdit="0" codecName="Latin1" x="0" debugPath="C:\Dropbox\microBuilder\Code\LPC1343\LPC1343_CodeBase_GIT\core\adc\adc.c" y="30" path="C:\Dropbox\microBuilder\Code\LPC1343\LPC1343_CodeBase_GIT\core\adc\adc.c" left="0" selected="0" name="unnamed" top="0" />
- <SessionOpenFile useTextEdit="1" useBinaryEdit="0" codecName="Latin1" x="0" debugPath="C:\dropbox\microbuilder\code\lpc1343\lpc1343_codebase_git\drivers\sensors\ina219\ina219.c" y="115" path="C:\dropbox\microbuilder\code\lpc1343\lpc1343_codebase_git\drivers\sensors\ina219\ina219.c" left="0" selected="0" name="unnamed" top="81" />
- <SessionOpenFile useTextEdit="1" useBinaryEdit="0" codecName="Latin1" x="0" debugPath="C:\Dropbox\microBuilder\Code\LPC1343\LPC1343_CodeBase_GIT\drivers\sensors\ina219\ina219.h" y="133" path="C:\Dropbox\microBuilder\Code\LPC1343\LPC1343_CodeBase_GIT\drivers\sensors\ina219\ina219.h" left="0" selected="0" name="unnamed" top="117" />
- <SessionOpenFile useTextEdit="1" useBinaryEdit="0" codecName="Latin1" x="0" debugPath="C:\Dropbox\microBuilder\Code\LPC1343\LPC1343_CodeBase_GIT\core\cmd\cmd.c" y="314" path="C:\Dropbox\microBuilder\Code\LPC1343\LPC1343_CodeBase_GIT\core\cmd\cmd.c" left="0" selected="0" name="unnamed" top="270" />
- <SessionOpenFile useTextEdit="1" useBinaryEdit="0" codecName="Latin1" x="72" debugPath="C:\Dropbox\microBuilder\Code\LPC1343\LPC1343_CodeBase_GIT\drivers\dac\mcp4725\mcp4725.c" y="43" path="C:\Dropbox\microBuilder\Code\LPC1343\LPC1343_CodeBase_GIT\drivers\dac\mcp4725\mcp4725.c" left="0" selected="0" name="unnamed" top="30" />
- <SessionOpenFile useTextEdit="1" useBinaryEdit="0" codecName="Latin1" x="0" debugPath="C:\Dropbox\microBuilder\Code\LPC1343\LPC1343_CodeBase_GIT\core\i2c\i2c.c" y="0" path="C:\Dropbox\microBuilder\Code\LPC1343\LPC1343_CodeBase_GIT\core\i2c\i2c.c" left="0" selected="0" name="unnamed" top="351" />
- <SessionOpenFile useTextEdit="1" useBinaryEdit="0" codecName="Latin1" x="0" debugPath="C:\Dropbox\microBuilder\Code\LPC1343\LPC1343_CodeBase_GIT\core\i2c\i2c.h" y="92" path="C:\Dropbox\microBuilder\Code\LPC1343\LPC1343_CodeBase_GIT\core\i2c\i2c.h" left="0" selected="0" name="unnamed" top="54" />
+ <SessionOpenFile useTextEdit="1" useBinaryEdit="0" codecName="Latin1" x="0" debugPath="C:\Dropbox\microBuilder\Code\LPC1343\LPC1343_CodeBase_GIT\main.c" y="8" path="C:\Dropbox\microBuilder\Code\LPC1343\LPC1343_CodeBase_GIT\main.c" left="0" selected="1" name="unnamed" top="0" />
</Files>
- <ARMCrossStudioWindow activeProject="LPC1343_CodeBase" autoConnectTarget="SEGGER J-Link" debugSearchFileMap="" fileDialogInitialDirectory="C:\Dropbox\microBuilder\Code\LPC1343\LPC1343_CodeBase_GIT\drivers\dac\mcp4901" fileDialogDefaultFilter="*.c" autoConnectCapabilities="388991" debugSearchPath="" buildConfiguration="THUMB Flash Release" />
+ <ARMCrossStudioWindow activeProject="LPC1343_CodeBase" autoConnectTarget="SEGGER J-Link" debugSearchFileMap="" fileDialogInitialDirectory="C:\Dropbox\microBuilder\Code\LPC1343\LPC1343_CodeBase_GIT\drivers\sensors\ina219" fileDialogDefaultFilter="" autoConnectCapabilities="388991" debugSearchPath="" buildConfiguration="THUMB Flash Release" />
</session>
dir == gpioDirection_Output ? (*gpiodir |= (1 << bitPos)) : (*gpiodir &= ~(1 << bitPos));
}
-/**************************************************************************/
-/*!
- @brief Gets the value for a specific port pin
-
- @param[in] portNum
- The port number (0..3)
- @param[in] bitPos
- The bit position (0..31)
-
- @return The current value for the specified port pin (0..1)
-*/
-/**************************************************************************/
-uint32_t gpioGetValue (uint32_t portNum, uint32_t bitPos)
-{
- if (!_gpioInitialised) gpioInit();
-
- uint32_t value = 0;
-
- switch (portNum)
- {
- case 0:
- value = (GPIO_GPIO0DATA & (1 << bitPos)) ? 1 : 0;
- break;
- case 1:
- value = (GPIO_GPIO1DATA & (1 << bitPos)) ? 1 : 0;
- break;
- case 2:
- value = (GPIO_GPIO2DATA & (1 << bitPos)) ? 1 : 0;
- break;
- case 3:
- value = (GPIO_GPIO3DATA & (1 << bitPos)) ? 1 : 0;
- break;
- default:
- break;
- }
-
- return value;
-}
-
-/**************************************************************************/
-/*!
- @brief Sets the value for a specific port pin (only relevant when a
- pin is configured as output).
-
- @param[in] portNum
- The port number (0..3)
- @param[in] bitPos
- The bit position (0..31)
- @param[in] bitValue
- The value to set for the specified bit (0..1). 0 will set
- the pin low and 1 will set the pin high.
-*/
-/**************************************************************************/
-inline void gpioSetValue (const uint32_t portNum, const uint32_t bitPos, const uint32_t bitVal)
-{
- if (!_gpioInitialised) gpioInit();
-
- // Take advantage of the fact the GPIO registers are bit-banded
- (*(pREG32 ((GPIO_GPIO0_BASE + (portNum << 16)) + ((1 << bitPos) << 2)))) = bitVal ? 0xFFF : 0;
-}
-
/**************************************************************************/
/*!
@brief Sets the interrupt sense, event, etc.
void gpioInit ( void );
void gpioSetDir ( uint32_t portNum, uint32_t bitPos, gpioDirection_t dir );
-uint32_t gpioGetValue ( uint32_t portNum, uint32_t bitPos );
-extern void gpioSetValue ( const uint32_t portNum, const uint32_t bitPos, const uint32_t bitVal );
void gpioSetInterrupt ( uint32_t portNum, uint32_t bitPos, gpioInterruptSense_t sense, gpioInterruptEdge_t edge, gpioInterruptEvent_t event );
void gpioIntEnable ( uint32_t portNum, uint32_t bitPos );
void gpioIntDisable ( uint32_t portNum, uint32_t bitPos );
void gpioIntClear ( uint32_t portNum, uint32_t bitPos );
void gpioSetPullup ( volatile uint32_t *ioconRegister, gpioPullupMode_t mode );
+/* Inline Functions */
+INLINE uint32_t gpioGetValue ( const uint32_t portNum, const uint32_t bitPos ) INLINE_POST;
+INLINE void gpioSetValue ( const uint32_t portNum, const uint32_t bitPos, const uint32_t bitVal) INLINE_POST;
+
+/**************************************************************************/
+/*!
+ @brief Gets the value for a specific port pin
+
+ @param[in] portNum
+ The port number (0..3)
+ @param[in] bitPos
+ The bit position (0..31)
+
+ @return The current value for the specified port pin (0..1)
+*/
+/**************************************************************************/
+INLINE uint32_t gpioGetValue (uint32_t portNum, uint32_t bitPos)
+{
+ // Take advantage of the fact the GPIO registers are bit-banded
+ return (*(pREG32 ((GPIO_GPIO0_BASE + (portNum << 16)) + ((1 << bitPos) << 2)))) & (1 << bitPos) ? 1 : 0;
+}
+
+/**************************************************************************/
+/*!
+ @brief Sets the value for a specific port pin (only relevant when a
+ pin is configured as output).
+
+ @param[in] portNum
+ The port number (0..3)
+ @param[in] bitPos
+ The bit position (0..31)
+ @param[in] bitValue
+ The value to set for the specified bit (0..1). 0 will set
+ the pin low and 1 will set the pin high.
+*/
+/**************************************************************************/
+INLINE void gpioSetValue (uint32_t portNum, uint32_t bitPos, uint32_t bitVal)
+{
+ // Take advantage of the fact the GPIO registers are bit-banded
+ (*(pREG32 ((GPIO_GPIO0_BASE + (portNum << 16)) + ((1 << bitPos) << 2)))) = bitVal ? 0xFFF : 0;
+}
+
#endif
\ No newline at end of file
gpioSetValue(SSP0_CSPORT, SSP0_CSPIN, 1);
gpioSetPullup(&IOCON_PIO0_2, gpioPullupMode_Inactive); // Board has external pull-up
- /* If SSP0CLKDIV = DIV1 -- (PCLK / (CPSDVSR � [SCR+1])) = (72,000,000 / (2 x [8 + 1])) = 4.0 MHz */
+ /* If SSP0CLKDIV = DIV1 -- (PCLK / (CPSDVSR * [SCR+1])) = (72,000,000 / (2 x [8 + 1])) = 4.0 MHz */
uint32_t configReg = ( SSP_SSP0CR0_DSS_8BIT // Data size = 8-bit
| SSP_SSP0CR0_FRF_SPI // Frame format = SPI
| SSP_SSP0CR0_SCR_8); // Serial clock rate = 8
// Request the current value from the DAC
uint8_t status = 0;
uint16_t value = 0;
- mcp472ReadConfig(&status, &value);
+ mcp4725ReadConfig(&status, &value);
@endcode
Pointer to hold the output value of the 12-bit DAC
*/
/**************************************************************************/
-void mcp472ReadConfig( uint8_t *status, uint16_t *value )
+void mcp4725ReadConfig( uint8_t *status, uint16_t *value )
{
if (!_mcp4725Initialised) mcp4725Init();
int mcp4725Init();
void mcp4725SetVoltage( uint16_t output, bool writeEEPROM );
-void mcp472ReadConfig( uint8_t *status, uint16_t *value );
+void mcp4725ReadConfig( uint8_t *status, uint16_t *value );
#endif
\ No newline at end of file
#include <stdint.h>
#include <stdbool.h>
+#ifndef ASM
+# define ASM __asm volatile
+#endif
+
+#ifndef INLINE
+# if __GNUC__ && !__GNUC_STDC_INLINE__
+# define INLINE extern inline
+# else
+# define INLINE inline
+# endif
+#endif
+
+// GCC does not inline any functions when not optimizing unless you specify
+// the 'always_inline' attribute for the function
+#ifndef INLINE_POST
+# define INLINE_POST __attribute__((always_inline))
+#endif
+
// Stay compatible with ugly "windows" style
#define BOOL bool