bug fixes
This commit is contained in:
parent
dca0fe9bcb
commit
153f4ac508
@ -1,8 +1,8 @@
|
||||
/**
|
||||
* These arguments were used when this file was generated. They will be automatically applied on subsequent loads
|
||||
* via the GUI or CLI. Run CLI with '--help' for additional information on how to override these arguments.
|
||||
* @cliArgs --board "/ti/boards/CC3220S_LAUNCHXL" --product "simplelink_cc32xx_sdk@4_20_00_07"
|
||||
* @versions {"data":"2020052512","timestamp":"2020052512","tool":"1.5.0+1397","templates":"2020052512"}
|
||||
* @cliArgs --board "/ti/boards/CC3220S_LAUNCHXL" --product "simplelink_cc32xx_sdk@4.30.00.06"
|
||||
* @versions {"data":"2020090214","timestamp":"2020090214","tool":"1.6.0+1543","templates":"2020090214"}
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -11,23 +11,40 @@
|
||||
const DriverLib = scripting.addModule("/ti/devices/DriverLib");
|
||||
const Board = scripting.addModule("/ti/drivers/Board");
|
||||
const DMA = scripting.addModule("/ti/drivers/DMA");
|
||||
const GPIO = scripting.addModule("/ti/drivers/GPIO", {}, false);
|
||||
const GPIO1 = GPIO.addInstance();
|
||||
const I2C = scripting.addModule("/ti/drivers/I2C", {}, false);
|
||||
const I2C1 = I2C.addInstance();
|
||||
const PWM = scripting.addModule("/ti/drivers/PWM", {}, false);
|
||||
const PWM1 = PWM.addInstance();
|
||||
const Power = scripting.addModule("/ti/drivers/Power");
|
||||
const SPI = scripting.addModule("/ti/drivers/SPI");
|
||||
const SPI1 = SPI.addInstance();
|
||||
const Watchdog = scripting.addModule("/ti/drivers/Watchdog");
|
||||
const Watchdog1 = Watchdog.addInstance();
|
||||
|
||||
/**
|
||||
* Write custom configuration values to the imported modules.
|
||||
*/
|
||||
GPIO1.$name = "CONF_GPIO_NOODSTOP";
|
||||
GPIO1.interruptTrigger = "Falling Edge";
|
||||
GPIO1.pull = "Pull Up";
|
||||
GPIO1.mode = "Dynamic";
|
||||
GPIO1.callbackFunction = "noodstop_noodstopISR";
|
||||
|
||||
I2C1.$name = "CONFIG_I2C_0";
|
||||
I2C1.$hardware = system.deviceData.board.components.LP_I2C;
|
||||
I2C1.i2c.sdaPin.$assign = "boosterpack.10";
|
||||
I2C1.i2c.sclPin.$assign = "boosterpack.9";
|
||||
|
||||
PWM1.$name = "CONFIG_PWM_0";
|
||||
PWM1.$hardware = system.deviceData.board.components.LED_RED;
|
||||
|
||||
Power.ioRetentionShutdown = ["GRP_1"];
|
||||
Power.parkPins.$name = "ti_drivers_power_PowerCC32XXPins0";
|
||||
|
||||
SPI1.$name = "CONFIG_SPI_MASTER";
|
||||
|
||||
Watchdog1.$name = "CONFIG_WATCHDOG_0";
|
||||
Watchdog1.watchdog.$assign = "WATCHDOG0";
|
||||
|
||||
@ -36,4 +53,13 @@ Watchdog1.watchdog.$assign = "WATCHDOG0";
|
||||
* version of the tool will not impact the pinmux you originally saw. These lines can be completely deleted in order to
|
||||
* re-solve from scratch.
|
||||
*/
|
||||
I2C1.i2c.$suggestSolution = "I2C0";
|
||||
GPIO1.gpioPin.$suggestSolution = "boosterpack.4";
|
||||
I2C1.i2c.$suggestSolution = "I2C0";
|
||||
PWM1.timer.$suggestSolution = "Timer2";
|
||||
PWM1.timer.pwmPin.$suggestSolution = "boosterpack.29";
|
||||
SPI1.spi.$suggestSolution = "SPI0";
|
||||
SPI1.spi.sclkPin.$suggestSolution = "boosterpack.7";
|
||||
SPI1.spi.misoPin.$suggestSolution = "boosterpack.14";
|
||||
SPI1.spi.mosiPin.$suggestSolution = "boosterpack.15";
|
||||
SPI1.spi.dmaRxChannel.$suggestSolution = "UDMA_CH30";
|
||||
SPI1.spi.dmaTxChannel.$suggestSolution = "UDMA_CH31";
|
||||
@ -16,7 +16,7 @@ typedef struct {
|
||||
bool overheeat;
|
||||
bool overload;
|
||||
bool overspeed;
|
||||
} initAandrijving;
|
||||
} noodstop;
|
||||
|
||||
typedef struct {
|
||||
packetID_t id;
|
||||
@ -67,4 +67,4 @@ union {
|
||||
|
||||
void comm_spi();
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
#include "global.h"
|
||||
#include "communicatie.h"
|
||||
|
||||
#define SPI_PACKET_LENGTH 4
|
||||
|
||||
extern pthread_t createSimplePTread(int prio, void * fn);
|
||||
|
||||
unsigned char ReciveBuffer[SPI_PACKET_LENGTH];
|
||||
unsigned char TransmitBuffer[SPI_PACKET_LENGTH];
|
||||
@ -28,7 +28,7 @@ void comm_spi(){
|
||||
SPI_Params_init(&spiParams);
|
||||
spiParams.frameFormat = SPI_POL0_PHA0; // mode0
|
||||
spiParams.bitRate = 1E6; // 1 MHz
|
||||
masterSpi = SPI_open(CONFIG_SPI_MASTER, &spiParams);
|
||||
SPI_Handle masterSpi = SPI_open(CONFIG_SPI_MASTER, &spiParams);
|
||||
if (masterSpi == NULL) {
|
||||
// Display_printf(display, 0, 0, "Error initializing master SPI\n");
|
||||
while (1);
|
||||
@ -37,10 +37,10 @@ void comm_spi(){
|
||||
}
|
||||
|
||||
// create transaction
|
||||
SPI_Transaction transaction;
|
||||
transaction.count = SPI_PACKET_LENGTH;
|
||||
transaction.txBuf = (void *) TransmitBuffer;
|
||||
transaction.rxBuf = (void *) ReciveBuffer;
|
||||
SPI_Transaction spiTransaction;
|
||||
spiTransaction.count = SPI_PACKET_LENGTH;
|
||||
spiTransaction.txBuf = (void *) TransmitBuffer;
|
||||
spiTransaction.rxBuf = (void *) ReciveBuffer;
|
||||
|
||||
// start the loop
|
||||
TransmitBuffer[0] = 0;
|
||||
@ -65,25 +65,25 @@ void comm_spi(){
|
||||
|
||||
// do the transaction
|
||||
//TODO: set the CS
|
||||
SPI_transaction(masterSpi, &transaction);
|
||||
SPI_transaction(masterSpi, &spiTransaction);
|
||||
|
||||
// read the data out the recive buffer
|
||||
switch (ReciveBuffer[0]){
|
||||
case SPIPARM_maxVermogen:
|
||||
uint8_t *maxVermogen = &ReciveBuffer[1];
|
||||
noodstop_setMaxVermogen(*maxVermogen);
|
||||
uint8_t maxVermogen = ReciveBuffer[2];
|
||||
noodstop_setMaxVermogen(maxVermogen);
|
||||
break;
|
||||
case SPIPARM_maxSnelheid:
|
||||
uint16_t *maxSnelheid = &ReciveBuffer[1];
|
||||
noodstop_setMaxSnelheid(*maxSnelheid);
|
||||
uint16_t maxSnelheid = ReciveBuffer[2] + ReciveBuffer[3]*0x100; // convert littelendien
|
||||
noodstop_setMaxSnelheid(maxSnelheid);
|
||||
break;
|
||||
case SPIPARM_maxTempratuur:
|
||||
uint8_t *maxTemptratuur = &ReciveBuffer[1];
|
||||
noodstop_setMaxTemptratuur(*maxTemptratuur);
|
||||
uint8_t maxTemptratuur = &ReciveBuffer[2];
|
||||
noodstop_setMaxTemptratuur(maxTemptratuur);
|
||||
break;
|
||||
case SPIPARM_setpoint:
|
||||
uint8_t *setpoint = &ReciveBuffer[1];
|
||||
mppt_setpoint(*setpoint);
|
||||
uint8_t setpoint = &ReciveBuffer[2];
|
||||
mppt_setpoint(setpoint);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
#ifndef GLOBALS_H
|
||||
#define GLOBALS_H
|
||||
|
||||
#include <pthread.h>
|
||||
#include "ti_drivers_config.h"
|
||||
|
||||
enum {
|
||||
@ -16,4 +17,6 @@ enum {
|
||||
EXT_NOODSTOP
|
||||
} Status;
|
||||
|
||||
#endif
|
||||
pthread_t createSimplePTread(int prio, void * fn);
|
||||
|
||||
#endif
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user