You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

58 lines
1.4 KiB
C

// comment inline
/*This is a multipleline comments
Line 2
Line 3*/
/*Gerardo Marx
30th June 2026
GPIOs management with dual CPUs
----------------
CPU1: GPIO22 and GPIO97 using bitfield approach
CPU2: GPIO52 using driverlib approach
|-----------|
| |
|GPIO22 |
| |
| ---- |
|GPIO97 |
| |
|GPIO52 |
|-----------|
*/
// Libraries and includes
#include "F28x_Project.h"
#include "driverlib.h" //???
#include "device.h"
// Variables and definitions
// main
void main(void){
// 1: Init system
InitSysCtrl();
// 2: Configure GPIOs
EALLOW; //enable GPIO config
// 2.1 GPIO22
GpioCtrlRegs.GPAGMUX2.bit.GPIO22 = 0; //pin as gpio
GpioCtrlRegs.GPADIR.bit.GPIO22 = 1; // configure as output
GpioCtrlRegs.GPACSEL3.bit.GPIO22 = 0; // cpu1
// 2.2 GPIO97
GpioCtrlRegs.GPDGMUX1.bit.GPIO97 = 0; //pin as gpio
GpioCtrlRegs.GPDDIR.bit.GPIO97 = 1; // configure as output
GpioCtrlRegs.GPDCSEL1.bit.GPIO97 = 0; //cpu1
// 2.3 GPIO52
GpioCtrlRegs.GPBGMUX2.bit.GPIO52 = 0; //pin as gpio
GpioCtrlRegs.GPBDIR.bit.GPIO52 = 1; // configure as output
GpioCtrlRegs.GPBCSEL3.bit.GPIO52 = 2; //cpu2
// 3: Change state of the GPIOs
GpioDataRegs.GPASET.bit.GPIO22 = 1; // set logical 1
GpioDataRegs.GPDSET.bit.GPIO97 = 1; // set logical 1
// 4: Enter into the infinite loop
}