commit
43398065f8
@ -1,5 +1,5 @@
|
|||||||
#MCUXpresso IDE
|
#MCUXpresso IDE
|
||||||
#Tue Apr 04 17:46:16 EEST 2023
|
#Thu Apr 06 10:42:38 EEST 2023
|
||||||
product.name=MCUXpresso IDE v11.5.1 [Build 7266] [2022-04-13]
|
product.name=MCUXpresso IDE v11.5.1 [Build 7266] [2022-04-13]
|
||||||
product.version=11.5.1
|
product.version=11.5.1
|
||||||
product.build=7266
|
product.build=7266
|
||||||
|
|||||||
@ -47,6 +47,10 @@
|
|||||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_11u6x/inc}""/>
|
<listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_11u6x/inc}""/>
|
||||||
<listOptionValue builtIn="false" value=""${workspace_loc:/shoh/freertos}""/>
|
<listOptionValue builtIn="false" value=""${workspace_loc:/shoh/freertos}""/>
|
||||||
<listOptionValue builtIn="false" value=""${workspace_loc:/shoh/freertos/inc}""/>
|
<listOptionValue builtIn="false" value=""${workspace_loc:/shoh/freertos/inc}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/shoh/src/threads}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/shoh/src/threads/master}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/shoh/src/peripherals}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/shoh/src/FreeRTOSCPP}""/>
|
||||||
</option>
|
</option>
|
||||||
<option id="com.crt.advproject.cpp.misc.dialect.4036734" name="Language standard" superClass="com.crt.advproject.cpp.misc.dialect" useByScannerDiscovery="true" value="com.crt.advproject.misc.dialect.cpp17" valueType="enumerated"/>
|
<option id="com.crt.advproject.cpp.misc.dialect.4036734" name="Language standard" superClass="com.crt.advproject.cpp.misc.dialect" useByScannerDiscovery="true" value="com.crt.advproject.misc.dialect.cpp17" valueType="enumerated"/>
|
||||||
<inputType id="com.crt.advproject.compiler.cpp.input.2005422649" superClass="com.crt.advproject.compiler.cpp.input"/>
|
<inputType id="com.crt.advproject.compiler.cpp.input.2005422649" superClass="com.crt.advproject.compiler.cpp.input"/>
|
||||||
@ -74,6 +78,10 @@
|
|||||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_11u6x/inc}""/>
|
<listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_11u6x/inc}""/>
|
||||||
<listOptionValue builtIn="false" value=""${workspace_loc:/shoh/freertos}""/>
|
<listOptionValue builtIn="false" value=""${workspace_loc:/shoh/freertos}""/>
|
||||||
<listOptionValue builtIn="false" value=""${workspace_loc:/shoh/freertos/inc}""/>
|
<listOptionValue builtIn="false" value=""${workspace_loc:/shoh/freertos/inc}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/shoh/src/threads}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/shoh/src/threads/master}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/shoh/src/peripherals}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/shoh/src/FreeRTOSCPP}""/>
|
||||||
</option>
|
</option>
|
||||||
<option id="com.crt.advproject.c.misc.dialect.82852045" name="Language standard" superClass="com.crt.advproject.c.misc.dialect" useByScannerDiscovery="true" value="com.crt.advproject.misc.dialect.c17" valueType="enumerated"/>
|
<option id="com.crt.advproject.c.misc.dialect.82852045" name="Language standard" superClass="com.crt.advproject.c.misc.dialect" useByScannerDiscovery="true" value="com.crt.advproject.misc.dialect.c17" valueType="enumerated"/>
|
||||||
<inputType id="com.crt.advproject.compiler.input.765511076" superClass="com.crt.advproject.compiler.input"/>
|
<inputType id="com.crt.advproject.compiler.input.765511076" superClass="com.crt.advproject.compiler.input"/>
|
||||||
@ -89,6 +97,10 @@
|
|||||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_11u6x/inc}""/>
|
<listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_11u6x/inc}""/>
|
||||||
<listOptionValue builtIn="false" value=""${workspace_loc:/shoh/freertos}""/>
|
<listOptionValue builtIn="false" value=""${workspace_loc:/shoh/freertos}""/>
|
||||||
<listOptionValue builtIn="false" value=""${workspace_loc:/shoh/freertos/inc}""/>
|
<listOptionValue builtIn="false" value=""${workspace_loc:/shoh/freertos/inc}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/shoh/src/threads}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/shoh/src/threads/master}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/shoh/src/peripherals}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/shoh/src/FreeRTOSCPP}""/>
|
||||||
</option>
|
</option>
|
||||||
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.1836378919" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
|
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.1836378919" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
|
||||||
<inputType id="com.crt.advproject.assembler.input.339410672" name="Additional Assembly Source Files" superClass="com.crt.advproject.assembler.input"/>
|
<inputType id="com.crt.advproject.assembler.input.339410672" name="Additional Assembly Source Files" superClass="com.crt.advproject.assembler.input"/>
|
||||||
@ -181,6 +193,10 @@
|
|||||||
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="gnu.cpp.compiler.option.include.paths.722676070" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" useByScannerDiscovery="false" valueType="includePath">
|
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="gnu.cpp.compiler.option.include.paths.722676070" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" useByScannerDiscovery="false" valueType="includePath">
|
||||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_11u68/inc}""/>
|
<listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_11u68/inc}""/>
|
||||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_11u6x/inc}""/>
|
<listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_11u6x/inc}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/shoh/src/threads}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/shoh/src/threads/master}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/shoh/src/peripherals}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/shoh/src/FreeRTOSCPP}""/>
|
||||||
</option>
|
</option>
|
||||||
<inputType id="com.crt.advproject.compiler.cpp.input.903614193" superClass="com.crt.advproject.compiler.cpp.input"/>
|
<inputType id="com.crt.advproject.compiler.cpp.input.903614193" superClass="com.crt.advproject.compiler.cpp.input"/>
|
||||||
</tool>
|
</tool>
|
||||||
@ -205,6 +221,10 @@
|
|||||||
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="gnu.c.compiler.option.include.paths.1942745624" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" useByScannerDiscovery="false" valueType="includePath">
|
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="gnu.c.compiler.option.include.paths.1942745624" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" useByScannerDiscovery="false" valueType="includePath">
|
||||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_11u68/inc}""/>
|
<listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_11u68/inc}""/>
|
||||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_11u6x/inc}""/>
|
<listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_11u6x/inc}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/shoh/src/threads}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/shoh/src/threads/master}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/shoh/src/peripherals}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/shoh/src/FreeRTOSCPP}""/>
|
||||||
</option>
|
</option>
|
||||||
<option id="com.crt.advproject.c.misc.dialect.1008527937" name="Language standard" superClass="com.crt.advproject.c.misc.dialect" useByScannerDiscovery="true" value="com.crt.advproject.misc.dialect.c17" valueType="enumerated"/>
|
<option id="com.crt.advproject.c.misc.dialect.1008527937" name="Language standard" superClass="com.crt.advproject.c.misc.dialect" useByScannerDiscovery="true" value="com.crt.advproject.misc.dialect.c17" valueType="enumerated"/>
|
||||||
<inputType id="com.crt.advproject.compiler.input.246185412" superClass="com.crt.advproject.compiler.input"/>
|
<inputType id="com.crt.advproject.compiler.input.246185412" superClass="com.crt.advproject.compiler.input"/>
|
||||||
@ -220,6 +240,10 @@
|
|||||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_11u6x/inc}""/>
|
<listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_11u6x/inc}""/>
|
||||||
<listOptionValue builtIn="false" value=""${workspace_loc:/shoh/freertos}""/>
|
<listOptionValue builtIn="false" value=""${workspace_loc:/shoh/freertos}""/>
|
||||||
<listOptionValue builtIn="false" value=""${workspace_loc:/shoh/freertos/inc}""/>
|
<listOptionValue builtIn="false" value=""${workspace_loc:/shoh/freertos/inc}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/shoh/src/threads}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/shoh/src/threads/master}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/shoh/src/peripherals}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/shoh/src/FreeRTOSCPP}""/>
|
||||||
</option>
|
</option>
|
||||||
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.1117166373" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
|
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.1117166373" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
|
||||||
<inputType id="com.crt.advproject.assembler.input.2071009798" name="Additional Assembly Source Files" superClass="com.crt.advproject.assembler.input"/>
|
<inputType id="com.crt.advproject.assembler.input.2071009798" name="Additional Assembly Source Files" superClass="com.crt.advproject.assembler.input"/>
|
||||||
@ -276,31 +300,31 @@
|
|||||||
</storageModule>
|
</storageModule>
|
||||||
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
|
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
|
||||||
<storageModule moduleId="com.crt.config">
|
<storageModule moduleId="com.crt.config">
|
||||||
<projectStorage><?xml version="1.0" encoding="UTF-8"?>
|
<projectStorage><?xml version="1.0" encoding="UTF-8"?>
|
||||||
<TargetConfig>
|
<TargetConfig>
|
||||||
<Properties property_2="LPC11U6x_256K.cfx" property_3="NXP" property_4="LPC11U68" property_count="5" version="100300"/>
|
<Properties property_2="LPC11U6x_256K.cfx" property_3="NXP" property_4="LPC11U68" property_count="5" version="100300"/>
|
||||||
<infoList vendor="NXP">
|
<infoList vendor="NXP">
|
||||||
<info chip="LPC11U68" flash_driver="LPC11U6x_256K.cfx" match_id="0x0" name="LPC11U68" stub="crt_emu_cm3_gen">
|
<info chip="LPC11U68" flash_driver="LPC11U6x_256K.cfx" match_id="0x0" name="LPC11U68" stub="crt_emu_cm3_gen">
|
||||||
<chip>
|
<chip>
|
||||||
<name>LPC11U68</name>
|
<name>LPC11U68</name>
|
||||||
<family>LPC11U6x</family>
|
<family>LPC11U6x</family>
|
||||||
<vendor>NXP (formerly Philips)</vendor>
|
<vendor>NXP (formerly Philips)</vendor>
|
||||||
<reset board="None" core="Real" sys="Real"/>
|
<reset board="None" core="Real" sys="Real"/>
|
||||||
<clock changeable="TRUE" freq="12MHz" is_accurate="TRUE"/>
|
<clock changeable="TRUE" freq="12MHz" is_accurate="TRUE"/>
|
||||||
<memory can_program="true" id="Flash" is_ro="true" type="Flash"/>
|
<memory can_program="true" id="Flash" is_ro="true" type="Flash"/>
|
||||||
<memory id="RAM" type="RAM"/>
|
<memory id="RAM" type="RAM"/>
|
||||||
<memory id="Periph" is_volatile="true" type="Peripheral"/>
|
<memory id="Periph" is_volatile="true" type="Peripheral"/>
|
||||||
<memoryInstance derived_from="Flash" id="MFlash256" location="0x0" size="0x40000"/>
|
<memoryInstance derived_from="Flash" id="MFlash256" location="0x0" size="0x40000"/>
|
||||||
<memoryInstance derived_from="RAM" id="Ram0_32" location="0x10000000" size="0x8000"/>
|
<memoryInstance derived_from="RAM" id="Ram0_32" location="0x10000000" size="0x8000"/>
|
||||||
<memoryInstance derived_from="RAM" id="Ram1_2" location="0x20000000" size="0x800"/>
|
<memoryInstance derived_from="RAM" id="Ram1_2" location="0x20000000" size="0x800"/>
|
||||||
<memoryInstance derived_from="RAM" id="Ram2USB_2" location="0x20004000" size="0x800"/>
|
<memoryInstance derived_from="RAM" id="Ram2USB_2" location="0x20004000" size="0x800"/>
|
||||||
</chip>
|
</chip>
|
||||||
<processor>
|
<processor>
|
||||||
<name gcc_name="cortex-m0">Cortex-M0</name>
|
<name gcc_name="cortex-m0">Cortex-M0</name>
|
||||||
<family>Cortex-M</family>
|
<family>Cortex-M</family>
|
||||||
</processor>
|
</processor>
|
||||||
</info>
|
</info>
|
||||||
</infoList>
|
</infoList>
|
||||||
</TargetConfig></projectStorage>
|
</TargetConfig></projectStorage>
|
||||||
</storageModule>
|
</storageModule>
|
||||||
<storageModule moduleId="com.crt.advproject">
|
<storageModule moduleId="com.crt.advproject">
|
||||||
|
|||||||
@ -3,8 +3,8 @@
|
|||||||
#include "FreeRTOS.h"
|
#include "FreeRTOS.h"
|
||||||
#include "task.h"
|
#include "task.h"
|
||||||
#include <cr_section_macros.h>
|
#include <cr_section_macros.h>
|
||||||
#include "FreeRTOSCPP/Kernel.hpp"
|
#include "Kernel.hpp"
|
||||||
#include "threads/master/Master.h"
|
#include "Master.h"
|
||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -61,4 +61,3 @@ DigitalIoPin::write (bool value)
|
|||||||
assert (!(_io._input));
|
assert (!(_io._input));
|
||||||
Chip_GPIO_SetPinState (LPC_GPIO, _io._port, _io._pin, ((_io._invert) ? !value : value));
|
Chip_GPIO_SetPinState (LPC_GPIO, _io._port, _io._pin, ((_io._invert) ? !value : value));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -7,6 +7,10 @@
|
|||||||
|
|
||||||
#include <EEPROMWrapper.h>
|
#include <EEPROMWrapper.h>
|
||||||
|
|
||||||
|
// Remove this when code will be reworked.
|
||||||
|
#ifndef EEPROMWRAPPER_NOT_FIXED
|
||||||
|
// Remove this when code will be reworked.
|
||||||
|
|
||||||
EEPROM_Wrapper::EEPROM_Wrapper ()
|
EEPROM_Wrapper::EEPROM_Wrapper ()
|
||||||
{
|
{
|
||||||
/* Enable EEPROM clock and reset EEPROM controller */
|
/* Enable EEPROM clock and reset EEPROM controller */
|
||||||
@ -93,3 +97,7 @@ EEPROM_Wrapper::write_to (uint32_t addr, void *data, uint32_t size_of_data)
|
|||||||
e_memcpy (data, buffer, size_of_data);
|
e_memcpy (data, buffer, size_of_data);
|
||||||
eeprom_use (buffer, addr, size_of_data, WRITE);
|
eeprom_use (buffer, addr, size_of_data, WRITE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Remove this when code will be reworked.
|
||||||
|
#endif /* EEPROMWRAPPER_NOT_FIXED */
|
||||||
|
// Remove this when code will be reworked.
|
||||||
|
|||||||
@ -8,6 +8,12 @@
|
|||||||
#ifndef EEPROMWRAPPER_H_
|
#ifndef EEPROMWRAPPER_H_
|
||||||
#define EEPROMWRAPPER_H_
|
#define EEPROMWRAPPER_H_
|
||||||
|
|
||||||
|
// Remove this when code will be reworked.
|
||||||
|
#define EEPROMWRAPPER_NOT_FIXED
|
||||||
|
#ifndef EEPROMWRAPPER_NOT_FIXED
|
||||||
|
// Remove this when code will be reworked.
|
||||||
|
|
||||||
|
|
||||||
#include "FreeRTOS.h"
|
#include "FreeRTOS.h"
|
||||||
#include "task.h"
|
#include "task.h"
|
||||||
#include "chip.h"
|
#include "chip.h"
|
||||||
@ -80,4 +86,8 @@ private:
|
|||||||
uint8_t buffer[EEPROM_MAX_BUFER_SIZE] = { 0 };
|
uint8_t buffer[EEPROM_MAX_BUFER_SIZE] = { 0 };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Remove this when code will be reworked.
|
||||||
|
#endif /* EEPROMWRAPPER_NOT_FIXED */
|
||||||
|
// Remove this when code will be reworked.
|
||||||
|
|
||||||
#endif /* EEPROMWRAPPER_H_ */
|
#endif /* EEPROMWRAPPER_H_ */
|
||||||
|
|||||||
@ -43,12 +43,22 @@
|
|||||||
I2C::I2C (const I2C_config &cfg) : device (nullptr)
|
I2C::I2C (const I2C_config &cfg) : device (nullptr)
|
||||||
{
|
{
|
||||||
// if(cfg.device_number == 0) {
|
// if(cfg.device_number == 0) {
|
||||||
device = LPC_I2C0;
|
this->device = LPC_I2C0;
|
||||||
// board init must have been called before the pins can be configured
|
|
||||||
Chip_IOCON_PinMuxSet (LPC_IOCON, 0, 22, IOCON_DIGMODE_EN | cfg.i2c_mode);
|
/*
|
||||||
Chip_IOCON_PinMuxSet (LPC_IOCON, 0, 23, IOCON_DIGMODE_EN | cfg.i2c_mode);
|
Pins
|
||||||
Chip_SWM_EnableFixedPin (SWM_FIXED_I2C0_SCL);
|
The pin requires an external pull-up to provide output functionality.
|
||||||
Chip_SWM_EnableFixedPin (SWM_FIXED_I2C0_SDA);
|
When power is switched off, this pin is floating and does not disturb the I2C lines.
|
||||||
|
|
||||||
|
I2C0_SCL (0, 4). (Available for Fast Mode Plus)
|
||||||
|
I2C1_SCL (0, 7), (1, 11), (1, 30). (Not open-drain)
|
||||||
|
I2C0_SDA (0, 5). (Available for Fast Mode Plus)
|
||||||
|
I2C1_SDA (1, 3), (1, 14), (1, 24). (Not open-drain)
|
||||||
|
*/
|
||||||
|
//Manual: Table 83 & 90
|
||||||
|
Chip_SYSCTL_PeriphReset(RESET_I2C0);
|
||||||
|
Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 4, IOCON_FUNC1 | IOCON_DIGMODE_EN | cfg.i2c_mode);
|
||||||
|
Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 5, IOCON_FUNC1 | IOCON_DIGMODE_EN | cfg.i2c_mode);
|
||||||
//}
|
//}
|
||||||
// else {
|
// else {
|
||||||
// currently we support only I2C number 0
|
// currently we support only I2C number 0
|
||||||
@ -58,23 +68,21 @@ I2C::I2C (const I2C_config &cfg) : device (nullptr)
|
|||||||
{
|
{
|
||||||
/* Enable I2C clock and reset I2C peripheral - the boot ROM does not
|
/* Enable I2C clock and reset I2C peripheral - the boot ROM does not
|
||||||
do this */
|
do this */
|
||||||
Chip_I2C_Init (LPC_I2C0);
|
Chip_I2CM_Init(this->device);
|
||||||
|
|
||||||
/* Setup clock rate for I2C */
|
/* Setup clock rate for I2C */
|
||||||
Chip_I2C_SetClockDiv (LPC_I2C0, cfg.clock_divider);
|
//No clock divider requiered?
|
||||||
|
|
||||||
/* Setup I2CM transfer rate */
|
/* Setup I2CM transfer rate */
|
||||||
Chip_I2CM_SetBusSpeed (LPC_I2C0, cfg.speed);
|
//Bus speed (Determines required amount of clockcyckles for LOW and HIGH signals itself)
|
||||||
|
Chip_I2CM_SetBusSpeed(this->device, cfg.speed);
|
||||||
|
|
||||||
/* Enable Master Mode */
|
/* Enable Master Mode */
|
||||||
Chip_I2CM_Enable (LPC_I2C0);
|
//Enabled by Chip_I2CM_SendStart()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
I2C::~I2C ()
|
I2C::~I2C () {}
|
||||||
{
|
|
||||||
// TODO Auto-generated destructor stub
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
I2C::write (uint8_t devAddr, uint8_t *txBuffPtr, uint16_t txSize)
|
I2C::write (uint8_t devAddr, uint8_t *txBuffPtr, uint16_t txSize)
|
||||||
@ -95,8 +103,7 @@ I2C::transaction (uint8_t devAddr, uint8_t *txBuffPtr, uint16_t txSize,
|
|||||||
I2CM_XFER_T i2cmXferRec;
|
I2CM_XFER_T i2cmXferRec;
|
||||||
|
|
||||||
// make sure that master is idle
|
// make sure that master is idle
|
||||||
while (!Chip_I2CM_IsMasterPending (LPC_I2C0))
|
while (Chip_I2CM_StateChanged(this->device) == 0);
|
||||||
;
|
|
||||||
|
|
||||||
/* Setup I2C transfer record */
|
/* Setup I2C transfer record */
|
||||||
i2cmXferRec.slaveAddr = devAddr;
|
i2cmXferRec.slaveAddr = devAddr;
|
||||||
@ -106,7 +113,7 @@ I2C::transaction (uint8_t devAddr, uint8_t *txBuffPtr, uint16_t txSize,
|
|||||||
i2cmXferRec.txBuff = txBuffPtr;
|
i2cmXferRec.txBuff = txBuffPtr;
|
||||||
i2cmXferRec.rxBuff = rxBuffPtr;
|
i2cmXferRec.rxBuff = rxBuffPtr;
|
||||||
|
|
||||||
I2CM_XferBlocking (LPC_I2C0, &i2cmXferRec);
|
I2CM_XferBlocking (this->device, &i2cmXferRec);
|
||||||
// Chip_I2CM_XferBlocking returns before stop condition is fully completed
|
// Chip_I2CM_XferBlocking returns before stop condition is fully completed
|
||||||
// therefore we need to wait for master to be idle when doing back-to-back
|
// therefore we need to wait for master to be idle when doing back-to-back
|
||||||
// transactions (see beginning of the function)
|
// transactions (see beginning of the function)
|
||||||
@ -136,7 +143,8 @@ I2C::I2CM_XferBlocking (LPC_I2C_T *pI2C, I2CM_XFER_T *xfer)
|
|||||||
/* set the transfer status as busy */
|
/* set the transfer status as busy */
|
||||||
xfer->status = I2CM_STATUS_BUSY;
|
xfer->status = I2CM_STATUS_BUSY;
|
||||||
/* Clear controller state. */
|
/* Clear controller state. */
|
||||||
Chip_I2CM_ClearStatus (pI2C, I2C_STAT_MSTRARBLOSS | I2C_STAT_MSTSTSTPERR);
|
Chip_I2CM_ResetControl(pI2C);
|
||||||
|
|
||||||
/* Write Address and RW bit to data register */
|
/* Write Address and RW bit to data register */
|
||||||
// Chip_I2CM_WriteByte(pI2C, (xfer->slaveAddr << 1) | (xfer->txSz == 0)); //
|
// Chip_I2CM_WriteByte(pI2C, (xfer->slaveAddr << 1) | (xfer->txSz == 0)); //
|
||||||
// original NXP version
|
// original NXP version
|
||||||
@ -150,7 +158,7 @@ I2C::I2CM_XferBlocking (LPC_I2C_T *pI2C, I2CM_XFER_T *xfer)
|
|||||||
while (ret == 0)
|
while (ret == 0)
|
||||||
{
|
{
|
||||||
/* wait for status change interrupt */
|
/* wait for status change interrupt */
|
||||||
while (!Chip_I2CM_IsMasterPending (pI2C))
|
while (Chip_I2CM_StateChanged(pI2C) == 0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
/* call state change handler */
|
/* call state change handler */
|
||||||
|
|||||||
@ -9,6 +9,7 @@
|
|||||||
#define I2C_H_
|
#define I2C_H_
|
||||||
|
|
||||||
#include "chip.h"
|
#include "chip.h"
|
||||||
|
#include "board.h"
|
||||||
|
|
||||||
struct I2C_config {
|
struct I2C_config {
|
||||||
unsigned int device_number;
|
unsigned int device_number;
|
||||||
|
|||||||
@ -1,5 +1,10 @@
|
|||||||
#include "LiquidCrystal.h"
|
#include "LiquidCrystal.h"
|
||||||
|
|
||||||
|
// Remove this when code will be reworked.
|
||||||
|
#ifndef LiquidCrystal_NOT_FIXED
|
||||||
|
// Remove this when code will be reworked.
|
||||||
|
|
||||||
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include "chip.h"
|
#include "chip.h"
|
||||||
|
|
||||||
@ -287,3 +292,6 @@ void LiquidCrystal::write4bits(uint8_t value) {
|
|||||||
pulseEnable();
|
pulseEnable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Remove this when code will be reworked.
|
||||||
|
#endif /* LiquidCrystal_NOT_FIXED */
|
||||||
|
// Remove this when code will be reworked.
|
||||||
|
|||||||
@ -1,6 +1,10 @@
|
|||||||
#ifndef LiquidCrystal_h
|
#ifndef LiquidCrystal_h
|
||||||
#define LiquidCrystal_h
|
#define LiquidCrystal_h
|
||||||
|
|
||||||
|
// Remove this when code will be reworked.
|
||||||
|
#define LiquidCrystal_NOT_FIXED
|
||||||
|
#ifndef LiquidCrystal_NOT_FIXED
|
||||||
|
// Remove this when code will be reworked.
|
||||||
|
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <string>
|
#include <string>
|
||||||
@ -94,4 +98,8 @@ private:
|
|||||||
uint8_t _numlines,_currline;
|
uint8_t _numlines,_currline;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
// Remove this when code will be reworked.
|
||||||
|
#endif /* LiquidCrystal_NOT_FIXED */
|
||||||
|
// Remove this when code will be reworked.
|
||||||
|
|
||||||
|
#endif /* LiquidCrystal_h */
|
||||||
|
|||||||
@ -9,6 +9,10 @@
|
|||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include "LpcUart.h"
|
#include "LpcUart.h"
|
||||||
|
|
||||||
|
// Remove this when code will be reworked.
|
||||||
|
#ifndef LPCUART_NOT_FIXED
|
||||||
|
// Remove this when code will be reworked.
|
||||||
|
|
||||||
|
|
||||||
static LpcUart *u0;
|
static LpcUart *u0;
|
||||||
static LpcUart *u1;
|
static LpcUart *u1;
|
||||||
@ -313,3 +317,7 @@ bool LpcUart::txempty()
|
|||||||
|
|
||||||
return (RingBuffer_GetCount(&txring) == 0);
|
return (RingBuffer_GetCount(&txring) == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Remove this when code will be reworked.
|
||||||
|
#endif /* LPCUART_NOT_FIXED */
|
||||||
|
// Remove this when code will be reworked.
|
||||||
|
|||||||
@ -8,6 +8,12 @@
|
|||||||
#ifndef LPCUART_H_
|
#ifndef LPCUART_H_
|
||||||
#define LPCUART_H_
|
#define LPCUART_H_
|
||||||
|
|
||||||
|
// Remove this when code will be reworked.
|
||||||
|
#define LPCUART_NOT_FIXED
|
||||||
|
#ifndef LPCUART_NOT_FIXED
|
||||||
|
// Remove this when code will be reworked.
|
||||||
|
|
||||||
|
|
||||||
#include "chip.h"
|
#include "chip.h"
|
||||||
#include "FreeRTOS.h"
|
#include "FreeRTOS.h"
|
||||||
#include "task.h"
|
#include "task.h"
|
||||||
@ -69,4 +75,8 @@ private:
|
|||||||
Fmutex write_mutex;
|
Fmutex write_mutex;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Remove this when code will be reworked.
|
||||||
|
#endif /* LPCUART_NOT_FIXED */
|
||||||
|
// Remove this when code will be reworked.
|
||||||
|
|
||||||
#endif /* LPCUART_H_ */
|
#endif /* LPCUART_H_ */
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user