Skip to content
Permalink
Browse files
Merge pull request #3 from aa9863/Session3
Session3
  • Loading branch information
aa9863 committed Mar 5, 2024
2 parents eab1f1c + e1a1cde commit 21bc4128eb7fe377547d536026e0a744a6a67358
Show file tree
Hide file tree
Showing 33 changed files with 537 additions and 25 deletions.
@@ -13,8 +13,8 @@ platform = ststm32
board = nucleo_f401re
framework = mbed

[env:nucleo_f746zg]
platform = ststm32
board = nucleo_f746zg
framework = mbed
;[env:nucleo_f746zg]
;platform = ststm32
;board = nucleo_f746zg
;framework = mbed

@@ -5,7 +5,6 @@ int buttonState;

// Hander Function for our Buton Press
void handler(){
printf("Update Button State\n");
buttonState = !buttonState;
}

@@ -16,7 +15,8 @@ int main() {
DigitalOut ledOne(LED1);

//Setup the User Buton as an Input
InterruptIn theButton(USER_BUTTON);
//InterruptIn theButton(USER_BUTTON);
InterruptIn theButton(BUTTON1);

//Bind the interupt to a function
theButton.rise(&handler);
@@ -13,8 +13,8 @@ platform = ststm32
board = nucleo_f401re
framework = mbed

[env:nucleo_f746zg]
platform = ststm32
board = nucleo_f746zg
framework = mbed
;[env:nucleo_f746zg]
;platform = ststm32
;board = nucleo_f746zg
;framework = mbed

@@ -39,7 +39,6 @@ int buttonState;

// Hander Function for our Buton Press
void handler(){
printf("Update Button State\n");
buttonState = !buttonState;

}
@@ -49,7 +48,7 @@ int main() {
// put your setup code here, to run once:

//Setup the User Buton as an Input
InterruptIn theButton(USER_BUTTON);
InterruptIn theButton(BUTTON1);

//Bind the interupt to a function
theButton.rise(&handler);
@@ -8,12 +8,13 @@
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html

[env:nucleo_f746zg]
platform = ststm32
board = nucleo_f746zg
framework = mbed

[env:nucleo_f401re]
platform = ststm32
board = nucleo_f401re
framework = mbed
framework = mbed

;[env:nucleo_f746zg]
;platform = ststm32
;board = nucleo_f746zg
;framework = mbed

@@ -7,7 +7,9 @@ int main() {
DigitalOut ledOne(LED1);

//Setup the User Buton as an Input
DigitalIn theButton(USER_BUTTON);
//DigitalIn theButton(USER_BUTTON);
// Its possible this has been remapped to BUTTON1
DigitalIn theButton(BUTTON1);

// Variable to hold button State
int buttonState;
File renamed without changes.
@@ -0,0 +1,83 @@
/* Bootloader */
mbed-os/features/FEATURE_BOOTLOADER/*

/* BLE */
mbed-os/connectivity/drivers/ble/*
mbed-os/connectivity/FEATURE_BLE/*

/* Cellular */
mbed-os/connectivity/cellular/*
mbed-os/connectivity/drivers/cellular/*
mbed-os/connectivity/netsocket/source/Cellular*.*

/* Device Key */
mbed-os/drivers/device_key/*

/* Experimental */
mbed-os/platform/FEATURE_EXPERIMENTAL_API/*

/* FPGA */
mbed-os/features/frameworks/COMPONENT_FPGA_CI_TEST_SHIELD/*

/* Greentea client */
mbed-os/features/frameworks/greentea-client/*

/* LORAWAN */
mbed-os/connectivity/drivers/lora/*
mbed-os/connectivity/lorawan/*

/* LWIP */
mbed-os/connectivity/drivers/emac/*
mbed-os/connectivity/lwipstack/*

/* Mbed-client-cli */
mbed-os/features/frameworks/mbed-client-cli/*

/* MBED TLS */
mbed-os/connectivity/drivers/mbedtls/*
mbed-os/connectivity/mbedtls/*

/* Nanostack */
mbed-os/connectivity/drivers/emac/*
mbed-os/connectivity/libraries/mbed-coap/*
mbed-os/connectivity/libraries/nanostack-libservice/*
mbed-os/connectivity/libraries/ppp/*
mbed-os/connectivity/nanostack/*

/* Netsocket */
mbed-os/connectivity/drivers/emac/*
mbed-os/connectivity/netsocket/*
mbed-os/connectivity/libraries/mbed-coap/*
mbed-os/connectivity/libraries/ppp/*

/* NFC */
mbed-os/connectivity/drivers/nfc/*
mbed-os/connectivity/nfc/*

/* RF */
/*mbed-os/connectivity/drivers/802.15.4_RF/* */

/* Storage */
mbed-os/storage/filesystem/*
mbed-os/storage/kvstore/*
mbed-os/storage/platform/*

/* Tests */
mbed-os/platform/tests/*
mbed-os/TEST_APPS/*
mbed-os/TESTS/*
mbed-os/UNITTESTS/*

/* Unity */
mbed-os/features/frameworks/unity/*

/* Utest */
mbed-os/features/frameworks/utest/*

/* USB */
mbed-os/drivers/usb/source/*
mbed-os/hal/usb/source/*
mbed-os/hal/usb/TARGET_Templates/*

/* WiFi */
mbed-os/connectivity/drivers/wifi/*
File renamed without changes.
File renamed without changes.
@@ -12,3 +12,9 @@
platform = ststm32
board = nucleo_f401re
framework = mbed

;[env:nucleo_f746zg]
;platform = ststm32
;board = nucleo_f746zg
;framework = mbed

@@ -0,0 +1,38 @@
/* cpp file to go with the header.
In here we define all the program logic,
matching the function signatures in the header file.
NOTE: We just include functionality here.
Class variables etc come from the header file.
*/

#include "flasher.h"
#include "mbed.h"


// Define our constructor
Flasher::Flasher(PinName thePin, int startState) : theLed(thePin){
state = startState;
}

// Define Flash Functionality.
void Flasher::flash(){
if (state == 0){
theLed = 1;
thread_sleep_for(1000);
theLed = 0;
thread_sleep_for(1000);
}
else {
theLed = 1;
thread_sleep_for(5000);
theLed = 0;
thread_sleep_for(5000);
}
}

void Flasher::set_state(int the_state){
state = the_state;
}

@@ -0,0 +1,40 @@
/*
This is the headerfile for our class.
It contains details of the class and all its methods.
This includes definitions, and the function signatures.
It is used by the compiler to link code from class files, into our main program.
*/

// Avoid the compiler including code every time it is imported
#ifndef FLASHER_H
#define FLASHER_H

// We Will need mbed for definitions of DigitalOut etc.
#include <mbed.h>

// Here we define the class structure, and variables
class Flasher{
// Variables
private:
DigitalOut theLed;
int state;


/*
We then define the method sigantures here.
NOTE: We just define the signatures, the code code in the corrisponding .c file
*/
public:
// Constructor. NOTE: We dont include the definition list here
Flasher(PinName thePin, int startState);

// Public Methods
void flash(); //Our standard Flash
void set_state(int the_state); //Setter method for the state
};

#endif
@@ -0,0 +1,40 @@
#include <mbed.h>
#include <flasher.h>


// Global Flasher Object
Flasher theFlasher(LED2, 0);

// Variable to hold button State, this needs to be globally avaialable
int buttonState;

// Hander Function for our Buton Press
void handler(){
buttonState = !buttonState;
theFlasher.set_state(buttonState);
}

int main() {

// put your setup code here, to run once:

//Setup the User Buton as an Input
InterruptIn theButton(BUTTON1);

//Bind the interupt to a function
theButton.rise(&handler);




while(1) {
// put your main code here, to run repeatedly:

//Print the State of our button
printf("Button State is %d\n", buttonState);

theFlasher.flash();


}
}
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,83 @@
/* Bootloader */
mbed-os/features/FEATURE_BOOTLOADER/*

/* BLE */
mbed-os/connectivity/drivers/ble/*
mbed-os/connectivity/FEATURE_BLE/*

/* Cellular */
mbed-os/connectivity/cellular/*
mbed-os/connectivity/drivers/cellular/*
mbed-os/connectivity/netsocket/source/Cellular*.*

/* Device Key */
mbed-os/drivers/device_key/*

/* Experimental */
mbed-os/platform/FEATURE_EXPERIMENTAL_API/*

/* FPGA */
mbed-os/features/frameworks/COMPONENT_FPGA_CI_TEST_SHIELD/*

/* Greentea client */
mbed-os/features/frameworks/greentea-client/*

/* LORAWAN */
mbed-os/connectivity/drivers/lora/*
mbed-os/connectivity/lorawan/*

/* LWIP */
mbed-os/connectivity/drivers/emac/*
mbed-os/connectivity/lwipstack/*

/* Mbed-client-cli */
mbed-os/features/frameworks/mbed-client-cli/*

/* MBED TLS */
mbed-os/connectivity/drivers/mbedtls/*
mbed-os/connectivity/mbedtls/*

/* Nanostack */
mbed-os/connectivity/drivers/emac/*
mbed-os/connectivity/libraries/mbed-coap/*
mbed-os/connectivity/libraries/nanostack-libservice/*
mbed-os/connectivity/libraries/ppp/*
mbed-os/connectivity/nanostack/*

/* Netsocket */
mbed-os/connectivity/drivers/emac/*
mbed-os/connectivity/netsocket/*
mbed-os/connectivity/libraries/mbed-coap/*
mbed-os/connectivity/libraries/ppp/*

/* NFC */
mbed-os/connectivity/drivers/nfc/*
mbed-os/connectivity/nfc/*

/* RF */
/*mbed-os/connectivity/drivers/802.15.4_RF/* */

/* Storage */
mbed-os/storage/filesystem/*
mbed-os/storage/kvstore/*
mbed-os/storage/platform/*

/* Tests */
mbed-os/platform/tests/*
mbed-os/TEST_APPS/*
mbed-os/TESTS/*
mbed-os/UNITTESTS/*

/* Unity */
mbed-os/features/frameworks/unity/*

/* Utest */
mbed-os/features/frameworks/utest/*

/* USB */
mbed-os/drivers/usb/source/*
mbed-os/hal/usb/source/*
mbed-os/hal/usb/TARGET_Templates/*

/* WiFi */
mbed-os/connectivity/drivers/wifi/*
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 21bc412

Please sign in to comment.