Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#MCUXpresso IDE
#Mon Sep 25 11:51:01 CDT 2023
product.name=MCUXpresso IDE v11.7.0 [Build 9198] [2023-01-17]
product.version=11.7.0
product.build=9198
2 changes: 2 additions & 0 deletions Firmware/project_1/.mcuxpressoide_packages_support/readme.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
This folder is automatically created and contains the SDK part support for the IDE
*** DO NOT REMOVE OR MODIFY, YOUR CHANGES WILL BE OVERWRITTEN ON SDK REFRESH ***
6 changes: 4 additions & 2 deletions Firmware/project_1/inc/pins.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
#define P_LED3 P0_6
#define P_LED4 P0_7
// PROJECT 1 - You can define a pin macro here

#define P_LED5 P0_4
#define P_POT P0_2
/*
* COMMON PIN OBJECT DECLARATIONS
*/
Expand All @@ -36,11 +37,12 @@ extern DigitalOut led2;
extern DigitalOut led3;
extern DigitalOut led4;
// PROJECT 1 - You can declare a DigitalOut object here
extern DigitalOut led5;

/*
* BOARD SPECIFIC PINS
*/

extern AnalogIn potentiometer;

/*
* BOARD SPECIFIC PIN OBJECT DECLARATIONS
Expand Down
12 changes: 10 additions & 2 deletions Firmware/project_1/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

#include <mbed.h>
// PROJECT 1 - Include something here!
#include "pins.h"
#include "setup.h"
#include "peripherals.h"
#include "can_struct.h"
#include "CAN/can_id.h"
Expand Down Expand Up @@ -81,7 +83,7 @@ int main() {
bool shutdown = false;
// Main functionality
while (!shutdown) {

float volt = potentiometer;
//on time overflow all callbacks will happen and timing reset to 0. Might be needed for other functions that rely on timing.
bool overflow;
uint32_t now = common.loopTime(&timing, &overflow);
Expand All @@ -96,8 +98,14 @@ int main() {
}

//task 1
if(timing.tickThreshold(last_task_1_time, TASK_1_RATE_US)){
//if(timing.tickThreshold(last_task_1_time, TASK_1_RATE_US)){
//PROJECT 1 - add code here to actually make the LED blink
if(timing.tickThreshold(last_task_1_time, TASK_1_RATE_US/((volt + .01) * 100))){
if(led5.read() == 0){
led5.write(1);
} else {
led5.write(0);
}
}


Expand Down
3 changes: 2 additions & 1 deletion Firmware/project_1/src/pins.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* PIN OBJECT INSTANTIATIONS
*/


AnalogIn potentiometer(P_POT);

/*
* COMMON PIN OBJECT INSTANTIATIONS
Expand All @@ -23,3 +23,4 @@ DigitalOut led2(P_LED2);
DigitalOut led3(P_LED3);
DigitalOut led4(P_LED4);
// PROJECT 1 - You can instantiate your DigitalOut object here
DigitalOut led5(P_LED5);
Loading