add softi2c , test failed

This commit is contained in:
2025-11-17 21:31:48 +08:00
parent 8acb95d566
commit 73733da6dd
6 changed files with 366 additions and 273 deletions

View File

@@ -11,6 +11,7 @@
*/
const GPIO = scripting.addModule("/ti/driverlib/GPIO", {}, false);
const GPIO1 = GPIO.addInstance();
const GPIO2 = GPIO.addInstance();
const I2C = scripting.addModule("/ti/driverlib/I2C", {}, false);
const I2C1 = I2C.addInstance();
const PWM = scripting.addModule("/ti/driverlib/PWM", {}, false);
@@ -59,6 +60,19 @@ Board.peripheral.$assign = "DEBUGSS";
Board.peripheral.swclkPin.$assign = "PA20";
Board.peripheral.swdioPin.$assign = "PA19";
GPIO2.$name = "SOFT_I2C";
GPIO2.port = "PORTA";
GPIO2.portSegment = "Lower";
GPIO2.associatedPins.create(2);
GPIO2.associatedPins[0].initialValue = "SET";
GPIO2.associatedPins[0].$name = "CLK";
GPIO2.associatedPins[0].ioStructure = "HS";
GPIO2.associatedPins[0].pin.$assign = "PA13";
GPIO2.associatedPins[1].initialValue = "SET";
GPIO2.associatedPins[1].ioStructure = "HS";
GPIO2.associatedPins[1].$name = "SDA";
GPIO2.associatedPins[1].pin.$assign = "PA14";
I2C1.$name = "I2C_1";
I2C1.advAnalogGlitchFilter = "DISABLED";
I2C1.basicEnableController = true;
@@ -100,9 +114,9 @@ TIMER1.$name = "TIMER_0";
TIMER1.timerClkDiv = 8;
TIMER1.timerMode = "PERIODIC";
TIMER1.timerClkPrescale = 8;
TIMER1.interrupts = ["ZERO"];
TIMER1.timerClkSrc = "LFCLK";
TIMER1.timerPeriod = "1";
TIMER1.interrupts = ["ZERO"];
TIMER1.timerPeriod = "2";
TIMER1.peripheral.$assign = "TIMG0";
UART1.$name = "UART_0";
@@ -114,6 +128,7 @@ UART1.txFifoThreshold = "DL_UART_TX_FIFO_LEVEL_ONE_ENTRY";
UART1.enabledDMATXTriggers = "DL_UART_DMA_INTERRUPT_TX";
UART1.enabledInterrupts = ["DMA_DONE_RX"];
UART1.enabledDMARXTriggers = "DL_UART_DMA_INTERRUPT_RX";
UART1.interruptPriority = "1";
UART1.peripheral.$assign = "UART0";
UART1.peripheral.rxPin.$assign = "PA11";
UART1.peripheral.txPin.$assign = "PA10";