SlideShare ist ein Scribd-Unternehmen logo
1 von 5
Downloaden Sie, um offline zu lesen
Can the below code be modified per these requirements? Call your state machine every 500000
us. Continuously blink SOS in Morse code on the green and red LEDs. If a button is pushed,
toggle the message between SOS and OK. Pushing the button in the middle of a message should
NOT change the message until it is complete. For example, if you push the button while the O in
SOS is being blinked out, the message will not change to OK until after the SOS message is
completed.
The following guidance will help provide a base for the functionality you are creating: Dot =
red LED on for 500ms Dash = green LED on for 1500ms 3*500ms between characters (both
LEDs off) 7*500ms between words (both LEDs off), for example SOS 3500ms SOS
* ======== gpiointerrupt.c ========
*/
#include
#include
/* Driver Header files */
#include
#include
/* Driver configuration */
#include "ti_drivers_config.h"
/* Morse Code for SOS */
#define SOS "***---***"
/* Morse Code for OK */
#define OK "-.-.-"
int SOS_state = 0;
int OK_state = 0;
int is_SOS = 1;
/* LED Blink Timer Callback */
void timerCallback(Timer_Handle myHandle, int_fast16_t status) {
if(is_SOS){
// Blink SOS
switch(SOS_state){
case 0:
GPIO_write(CONFIG_GPIO_LED_0, CONFIG_GPIO_LED_ON);
GPIO_write(CONFIG_GPIO_LED_1, CONFIG_GPIO_LED_OFF);
break;
case 1:
GPIO_write(CONFIG_GPIO_LED_0, CONFIG_GPIO_LED_OFF);
GPIO_write(CONFIG_GPIO_LED_1, CONFIG_GPIO_LED_ON);
break;
case 2:
GPIO_write(CONFIG_GPIO_LED_0, CONFIG_GPIO_LED_ON);
GPIO_write(CONFIG_GPIO_LED_1, CONFIG_GPIO_LED_OFF);
break;
default:
break;
}
SOS_state++;
if(SOS_state >= strlen(SOS)){
SOS_state = 0;
}
}else{
// Blink OK
switch(OK_state){
case 0:
GPIO_write(CONFIG_GPIO_LED_0, CONFIG_GPIO_LED_ON);
GPIO_write(CONFIG_GPIO_LED_1, CONFIG_GPIO_LED_OFF);
break;
case 1:
GPIO_write(CONFIG_GPIO_LED_0, CONFIG_GPIO_LED_OFF);
GPIO_write(CONFIG_GPIO_LED_1, CONFIG_GPIO_LED_ON);
break;
case 2:
GPIO_write(CONFIG_GPIO_LED_0, CONFIG_GPIO_LED_OFF);
GPIO_write(CONFIG_GPIO_LED_1, CONFIG_GPIO_LED_ON);
break;
case 3:
GPIO_write(CONFIG_GPIO_LED_0, CONFIG_GPIO_LED_ON);
GPIO_write(CONFIG_GPIO_LED_1, CONFIG_GPIO_LED_OFF);
break;
default:
break;
}
OK_state++;
if(OK_state >= strlen(OK)){
OK_state = 0;
}
}
}
/*
* ======== gpioButtonFxn0 ========
* Callback function for the GPIO interrupt on CONFIG_GPIO_BUTTON_0.
*
* Note: GPIO interrupts are cleared prior to invoking callbacks.
*/
void gpioButtonFxn0(uint_least8_t index) {
/* Toggle message between SOS and OK */
is_SOS = !is_SOS;
}
/*
* ======== mainThread ========
*/
void *mainThread(void *arg0) {
/* Call driver init functions */
GPIO_init();
/* Configure the LED and button pins */
GPIO_setConfig(CONFIG_GPIO_LED_0, GPIO_CFG_OUT_STD |
GPIO_CFG_OUT_LOW);
GPIO_setConfig(CONFIG_GPIO_LED_1, GPIO_CFG_OUT_STD |
GPIO_CFG_OUT_LOW);
GPIO_setConfig(CONFIG_GPIO_BUTTON_0, GPIO_CFG_IN_PU |
GPIO_CFG_IN_INT_FALLING);
/* Turn on user LED */
GPIO_write(CONFIG_GPIO_LED_0, CONFIG_GPIO_LED_ON);
/* Install Button callback */
GPIO_setCallback(CONFIG_GPIO_BUTTON_0, gpioButtonFxn0);
/* Enable interrupts */
GPIO_enableInt(CONFIG_GPIO_BUTTON_0);
/*
* If more than one input pin is available for your device, interrupts
* will be enabled on CONFIG_GPIO_BUTTON1.
*/
if (CONFIG_GPIO_BUTTON_0 != CONFIG_GPIO_BUTTON_1)
{
/* Configure BUTTON1 pin */
GPIO_setConfig(CONFIG_GPIO_BUTTON_1, GPIO_CFG_IN_PU |
GPIO_CFG_IN_INT_FALLING);
/* Install Button callback */
GPIO_setCallback(CONFIG_GPIO_BUTTON_1, gpioButtonFxn0);
GPIO_enableInt(CONFIG_GPIO_BUTTON_1);
}
/* Initialize LED Blink Timer */
initTimer();
return (NULL);
}
/* Initialize LED Blink Timer */
void initTimer(void) {
Timer_Handle timer0;
Timer_Params params;
Timer_init();
Timer_Params_init(&params);
params.period = 500000;
params.periodUnits = Timer_PERIOD_US;
params.timerMode = Timer_CONTINUOUS_CALLBACK;
params.timerCallback = timerCallback;
timer0 = Timer_open(CONFIG_TIMER_0, &params);
if (timer0 == NULL)
{
/* Failed to initialized timer */
while (1)
{
}
}
if (Timer_start(timer0) == Timer_STATUS_ERROR)
{
/* Failed to start timer */
while (1)
{
}
}
}

Weitere ähnliche Inhalte

Mehr von sales88

Caso de empresa Hamburguesa In-N-Out el valor del cliente a la an.pdf
Caso de empresa Hamburguesa In-N-Out el valor del cliente a la an.pdfCaso de empresa Hamburguesa In-N-Out el valor del cliente a la an.pdf
Caso de empresa Hamburguesa In-N-Out el valor del cliente a la an.pdfsales88
 
CASO 6.2 Algunos ciudadanos preocupados hicieron una cita para reu.pdf
CASO 6.2 Algunos ciudadanos preocupados hicieron una cita para reu.pdfCASO 6.2 Algunos ciudadanos preocupados hicieron una cita para reu.pdf
CASO 6.2 Algunos ciudadanos preocupados hicieron una cita para reu.pdfsales88
 
Caso de EstudioLiderazgo y Gesti�nLaura es directora asocia.pdf
Caso de EstudioLiderazgo y Gesti�nLaura es directora asocia.pdfCaso de EstudioLiderazgo y Gesti�nLaura es directora asocia.pdf
Caso de EstudioLiderazgo y Gesti�nLaura es directora asocia.pdfsales88
 
Caso de estudio Hacer que las alianzas estrat�gicas y las redes f.pdf
Caso de estudio Hacer que las alianzas estrat�gicas y las redes f.pdfCaso de estudio Hacer que las alianzas estrat�gicas y las redes f.pdf
Caso de estudio Hacer que las alianzas estrat�gicas y las redes f.pdfsales88
 
CASO DE ESTUDIO La cl�nica Mayo es uno de los nombres m�s respetad.pdf
CASO DE ESTUDIO La cl�nica Mayo es uno de los nombres m�s respetad.pdfCASO DE ESTUDIO La cl�nica Mayo es uno de los nombres m�s respetad.pdf
CASO DE ESTUDIO La cl�nica Mayo es uno de los nombres m�s respetad.pdfsales88
 
CASO DE ESTUDIO La �pera de Sydney es uno de los edificios ic�nico.pdf
CASO DE ESTUDIO La �pera de Sydney es uno de los edificios ic�nico.pdfCASO DE ESTUDIO La �pera de Sydney es uno de los edificios ic�nico.pdf
CASO DE ESTUDIO La �pera de Sydney es uno de los edificios ic�nico.pdfsales88
 
Caso de estudio Despu�s de luchar con la deuda y la fuerte compete.pdf
Caso de estudio Despu�s de luchar con la deuda y la fuerte compete.pdfCaso de estudio Despu�s de luchar con la deuda y la fuerte compete.pdf
Caso de estudio Despu�s de luchar con la deuda y la fuerte compete.pdfsales88
 
Caso cl�nicoSDRAPregunta 1.Dados sus s�ntomas de fatiga, disne.pdf
Caso cl�nicoSDRAPregunta 1.Dados sus s�ntomas de fatiga, disne.pdfCaso cl�nicoSDRAPregunta 1.Dados sus s�ntomas de fatiga, disne.pdf
Caso cl�nicoSDRAPregunta 1.Dados sus s�ntomas de fatiga, disne.pdfsales88
 
Caso 21-3 Orden de prueba de deterioro Five Star Hotel Corporati.pdf
Caso 21-3 Orden de prueba de deterioro Five Star Hotel Corporati.pdfCaso 21-3 Orden de prueba de deterioro Five Star Hotel Corporati.pdf
Caso 21-3 Orden de prueba de deterioro Five Star Hotel Corporati.pdfsales88
 
Caso 6.2 Seguro Mar�timo Cl�usula Inchmaree Un barco pesquero c.pdf
Caso 6.2 Seguro Mar�timo Cl�usula Inchmaree Un barco pesquero c.pdfCaso 6.2 Seguro Mar�timo Cl�usula Inchmaree Un barco pesquero c.pdf
Caso 6.2 Seguro Mar�timo Cl�usula Inchmaree Un barco pesquero c.pdfsales88
 
Caso 3.1 Firma de contadores Moss y McAdams Bruce Palmer hab�a t.pdf
Caso 3.1 Firma de contadores Moss y McAdams Bruce Palmer hab�a t.pdfCaso 3.1 Firma de contadores Moss y McAdams Bruce Palmer hab�a t.pdf
Caso 3.1 Firma de contadores Moss y McAdams Bruce Palmer hab�a t.pdfsales88
 
Caso 2 (TV de Alta Definici�n La Gran Alianza) (1) Seg�n el caso .pdf
Caso 2 (TV de Alta Definici�n La Gran Alianza) (1) Seg�n el caso .pdfCaso 2 (TV de Alta Definici�n La Gran Alianza) (1) Seg�n el caso .pdf
Caso 2 (TV de Alta Definici�n La Gran Alianza) (1) Seg�n el caso .pdfsales88
 
Caso 1 (8 puntos) Miguel y Cinthia Leatch viven en Covington, Ten.pdf
Caso 1 (8 puntos) Miguel y Cinthia Leatch viven en Covington, Ten.pdfCaso 1 (8 puntos) Miguel y Cinthia Leatch viven en Covington, Ten.pdf
Caso 1 (8 puntos) Miguel y Cinthia Leatch viven en Covington, Ten.pdfsales88
 
Caso 1 Agmmaglobulinemia ligada al X 1. Bill fue testamento duran.pdf
Caso 1 Agmmaglobulinemia ligada al X 1. Bill fue testamento duran.pdfCaso 1 Agmmaglobulinemia ligada al X 1. Bill fue testamento duran.pdf
Caso 1 Agmmaglobulinemia ligada al X 1. Bill fue testamento duran.pdfsales88
 
Caso 1 Felipe R�os y Tiffany De Los Rios married filling jointl.pdf
Caso 1 Felipe R�os  y Tiffany De Los Rios married filling jointl.pdfCaso 1 Felipe R�os  y Tiffany De Los Rios married filling jointl.pdf
Caso 1 Felipe R�os y Tiffany De Los Rios married filling jointl.pdfsales88
 
Case studyData Protect and PrivacyHuman beings value their priva.pdf
Case studyData Protect and PrivacyHuman beings value their priva.pdfCase studyData Protect and PrivacyHuman beings value their priva.pdf
Case studyData Protect and PrivacyHuman beings value their priva.pdfsales88
 
CASE STUDY [30 Marks] Former Tongaat Hulett bosses in court for frau.pdf
CASE STUDY [30 Marks] Former Tongaat Hulett bosses in court for frau.pdfCASE STUDY [30 Marks] Former Tongaat Hulett bosses in court for frau.pdf
CASE STUDY [30 Marks] Former Tongaat Hulett bosses in court for frau.pdfsales88
 
case study Private Practice Implements Safeguards for Waiting .pdf
case study Private Practice Implements Safeguards for Waiting .pdfcase study Private Practice Implements Safeguards for Waiting .pdf
case study Private Practice Implements Safeguards for Waiting .pdfsales88
 
Case Study Liberty and the Elderly Patient Ronald is 71 years old..pdf
Case Study Liberty and the Elderly Patient Ronald is 71 years old..pdfCase Study Liberty and the Elderly Patient Ronald is 71 years old..pdf
Case Study Liberty and the Elderly Patient Ronald is 71 years old..pdfsales88
 
Case Study AMr. P tripped and broke her left hip while attempting.pdf
Case Study AMr. P tripped and broke her left hip while attempting.pdfCase Study AMr. P tripped and broke her left hip while attempting.pdf
Case Study AMr. P tripped and broke her left hip while attempting.pdfsales88
 

Mehr von sales88 (20)

Caso de empresa Hamburguesa In-N-Out el valor del cliente a la an.pdf
Caso de empresa Hamburguesa In-N-Out el valor del cliente a la an.pdfCaso de empresa Hamburguesa In-N-Out el valor del cliente a la an.pdf
Caso de empresa Hamburguesa In-N-Out el valor del cliente a la an.pdf
 
CASO 6.2 Algunos ciudadanos preocupados hicieron una cita para reu.pdf
CASO 6.2 Algunos ciudadanos preocupados hicieron una cita para reu.pdfCASO 6.2 Algunos ciudadanos preocupados hicieron una cita para reu.pdf
CASO 6.2 Algunos ciudadanos preocupados hicieron una cita para reu.pdf
 
Caso de EstudioLiderazgo y Gesti�nLaura es directora asocia.pdf
Caso de EstudioLiderazgo y Gesti�nLaura es directora asocia.pdfCaso de EstudioLiderazgo y Gesti�nLaura es directora asocia.pdf
Caso de EstudioLiderazgo y Gesti�nLaura es directora asocia.pdf
 
Caso de estudio Hacer que las alianzas estrat�gicas y las redes f.pdf
Caso de estudio Hacer que las alianzas estrat�gicas y las redes f.pdfCaso de estudio Hacer que las alianzas estrat�gicas y las redes f.pdf
Caso de estudio Hacer que las alianzas estrat�gicas y las redes f.pdf
 
CASO DE ESTUDIO La cl�nica Mayo es uno de los nombres m�s respetad.pdf
CASO DE ESTUDIO La cl�nica Mayo es uno de los nombres m�s respetad.pdfCASO DE ESTUDIO La cl�nica Mayo es uno de los nombres m�s respetad.pdf
CASO DE ESTUDIO La cl�nica Mayo es uno de los nombres m�s respetad.pdf
 
CASO DE ESTUDIO La �pera de Sydney es uno de los edificios ic�nico.pdf
CASO DE ESTUDIO La �pera de Sydney es uno de los edificios ic�nico.pdfCASO DE ESTUDIO La �pera de Sydney es uno de los edificios ic�nico.pdf
CASO DE ESTUDIO La �pera de Sydney es uno de los edificios ic�nico.pdf
 
Caso de estudio Despu�s de luchar con la deuda y la fuerte compete.pdf
Caso de estudio Despu�s de luchar con la deuda y la fuerte compete.pdfCaso de estudio Despu�s de luchar con la deuda y la fuerte compete.pdf
Caso de estudio Despu�s de luchar con la deuda y la fuerte compete.pdf
 
Caso cl�nicoSDRAPregunta 1.Dados sus s�ntomas de fatiga, disne.pdf
Caso cl�nicoSDRAPregunta 1.Dados sus s�ntomas de fatiga, disne.pdfCaso cl�nicoSDRAPregunta 1.Dados sus s�ntomas de fatiga, disne.pdf
Caso cl�nicoSDRAPregunta 1.Dados sus s�ntomas de fatiga, disne.pdf
 
Caso 21-3 Orden de prueba de deterioro Five Star Hotel Corporati.pdf
Caso 21-3 Orden de prueba de deterioro Five Star Hotel Corporati.pdfCaso 21-3 Orden de prueba de deterioro Five Star Hotel Corporati.pdf
Caso 21-3 Orden de prueba de deterioro Five Star Hotel Corporati.pdf
 
Caso 6.2 Seguro Mar�timo Cl�usula Inchmaree Un barco pesquero c.pdf
Caso 6.2 Seguro Mar�timo Cl�usula Inchmaree Un barco pesquero c.pdfCaso 6.2 Seguro Mar�timo Cl�usula Inchmaree Un barco pesquero c.pdf
Caso 6.2 Seguro Mar�timo Cl�usula Inchmaree Un barco pesquero c.pdf
 
Caso 3.1 Firma de contadores Moss y McAdams Bruce Palmer hab�a t.pdf
Caso 3.1 Firma de contadores Moss y McAdams Bruce Palmer hab�a t.pdfCaso 3.1 Firma de contadores Moss y McAdams Bruce Palmer hab�a t.pdf
Caso 3.1 Firma de contadores Moss y McAdams Bruce Palmer hab�a t.pdf
 
Caso 2 (TV de Alta Definici�n La Gran Alianza) (1) Seg�n el caso .pdf
Caso 2 (TV de Alta Definici�n La Gran Alianza) (1) Seg�n el caso .pdfCaso 2 (TV de Alta Definici�n La Gran Alianza) (1) Seg�n el caso .pdf
Caso 2 (TV de Alta Definici�n La Gran Alianza) (1) Seg�n el caso .pdf
 
Caso 1 (8 puntos) Miguel y Cinthia Leatch viven en Covington, Ten.pdf
Caso 1 (8 puntos) Miguel y Cinthia Leatch viven en Covington, Ten.pdfCaso 1 (8 puntos) Miguel y Cinthia Leatch viven en Covington, Ten.pdf
Caso 1 (8 puntos) Miguel y Cinthia Leatch viven en Covington, Ten.pdf
 
Caso 1 Agmmaglobulinemia ligada al X 1. Bill fue testamento duran.pdf
Caso 1 Agmmaglobulinemia ligada al X 1. Bill fue testamento duran.pdfCaso 1 Agmmaglobulinemia ligada al X 1. Bill fue testamento duran.pdf
Caso 1 Agmmaglobulinemia ligada al X 1. Bill fue testamento duran.pdf
 
Caso 1 Felipe R�os y Tiffany De Los Rios married filling jointl.pdf
Caso 1 Felipe R�os  y Tiffany De Los Rios married filling jointl.pdfCaso 1 Felipe R�os  y Tiffany De Los Rios married filling jointl.pdf
Caso 1 Felipe R�os y Tiffany De Los Rios married filling jointl.pdf
 
Case studyData Protect and PrivacyHuman beings value their priva.pdf
Case studyData Protect and PrivacyHuman beings value their priva.pdfCase studyData Protect and PrivacyHuman beings value their priva.pdf
Case studyData Protect and PrivacyHuman beings value their priva.pdf
 
CASE STUDY [30 Marks] Former Tongaat Hulett bosses in court for frau.pdf
CASE STUDY [30 Marks] Former Tongaat Hulett bosses in court for frau.pdfCASE STUDY [30 Marks] Former Tongaat Hulett bosses in court for frau.pdf
CASE STUDY [30 Marks] Former Tongaat Hulett bosses in court for frau.pdf
 
case study Private Practice Implements Safeguards for Waiting .pdf
case study Private Practice Implements Safeguards for Waiting .pdfcase study Private Practice Implements Safeguards for Waiting .pdf
case study Private Practice Implements Safeguards for Waiting .pdf
 
Case Study Liberty and the Elderly Patient Ronald is 71 years old..pdf
Case Study Liberty and the Elderly Patient Ronald is 71 years old..pdfCase Study Liberty and the Elderly Patient Ronald is 71 years old..pdf
Case Study Liberty and the Elderly Patient Ronald is 71 years old..pdf
 
Case Study AMr. P tripped and broke her left hip while attempting.pdf
Case Study AMr. P tripped and broke her left hip while attempting.pdfCase Study AMr. P tripped and broke her left hip while attempting.pdf
Case Study AMr. P tripped and broke her left hip while attempting.pdf
 

Kürzlich hochgeladen

CHUYÊN ĐỀ ÔN THEO CÂU CHO HỌC SINH LỚP 12 ĐỂ ĐẠT ĐIỂM 5+ THI TỐT NGHIỆP THPT ...
CHUYÊN ĐỀ ÔN THEO CÂU CHO HỌC SINH LỚP 12 ĐỂ ĐẠT ĐIỂM 5+ THI TỐT NGHIỆP THPT ...CHUYÊN ĐỀ ÔN THEO CÂU CHO HỌC SINH LỚP 12 ĐỂ ĐẠT ĐIỂM 5+ THI TỐT NGHIỆP THPT ...
CHUYÊN ĐỀ ÔN THEO CÂU CHO HỌC SINH LỚP 12 ĐỂ ĐẠT ĐIỂM 5+ THI TỐT NGHIỆP THPT ...Nguyen Thanh Tu Collection
 
4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptx4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptxmary850239
 
DBMSArchitecture_QueryProcessingandOptimization.pdf
DBMSArchitecture_QueryProcessingandOptimization.pdfDBMSArchitecture_QueryProcessingandOptimization.pdf
DBMSArchitecture_QueryProcessingandOptimization.pdfChristalin Nelson
 
Grade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptxGrade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptxkarenfajardo43
 
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITWQ-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITWQuiz Club NITW
 
Shark introduction Morphology and its behaviour characteristics
Shark introduction Morphology and its behaviour characteristicsShark introduction Morphology and its behaviour characteristics
Shark introduction Morphology and its behaviour characteristicsArubSultan
 
An Overview of the Calendar App in Odoo 17 ERP
An Overview of the Calendar App in Odoo 17 ERPAn Overview of the Calendar App in Odoo 17 ERP
An Overview of the Calendar App in Odoo 17 ERPCeline George
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - I-LEARN SMART WORLD - CẢ NĂM - CÓ FILE NGHE (BẢN...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - I-LEARN SMART WORLD - CẢ NĂM - CÓ FILE NGHE (BẢN...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - I-LEARN SMART WORLD - CẢ NĂM - CÓ FILE NGHE (BẢN...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - I-LEARN SMART WORLD - CẢ NĂM - CÓ FILE NGHE (BẢN...Nguyen Thanh Tu Collection
 
CLASSIFICATION OF ANTI - CANCER DRUGS.pptx
CLASSIFICATION OF ANTI - CANCER DRUGS.pptxCLASSIFICATION OF ANTI - CANCER DRUGS.pptx
CLASSIFICATION OF ANTI - CANCER DRUGS.pptxAnupam32727
 
6 ways Samsung’s Interactive Display powered by Android changes the classroom
6 ways Samsung’s Interactive Display powered by Android changes the classroom6 ways Samsung’s Interactive Display powered by Android changes the classroom
6 ways Samsung’s Interactive Display powered by Android changes the classroomSamsung Business USA
 
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...DhatriParmar
 
Objectives n learning outcoms - MD 20240404.pptx
Objectives n learning outcoms - MD 20240404.pptxObjectives n learning outcoms - MD 20240404.pptx
Objectives n learning outcoms - MD 20240404.pptxMadhavi Dharankar
 
4.9.24 School Desegregation in Boston.pptx
4.9.24 School Desegregation in Boston.pptx4.9.24 School Desegregation in Boston.pptx
4.9.24 School Desegregation in Boston.pptxmary850239
 
4.9.24 Social Capital and Social Exclusion.pptx
4.9.24 Social Capital and Social Exclusion.pptx4.9.24 Social Capital and Social Exclusion.pptx
4.9.24 Social Capital and Social Exclusion.pptxmary850239
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (GLOB...
BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (GLOB...BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (GLOB...
BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (GLOB...Nguyen Thanh Tu Collection
 
PART 1 - CHAPTER 1 - CELL THE FUNDAMENTAL UNIT OF LIFE
PART 1 - CHAPTER 1 - CELL THE FUNDAMENTAL UNIT OF LIFEPART 1 - CHAPTER 1 - CELL THE FUNDAMENTAL UNIT OF LIFE
PART 1 - CHAPTER 1 - CELL THE FUNDAMENTAL UNIT OF LIFEMISSRITIMABIOLOGYEXP
 

Kürzlich hochgeladen (20)

CHUYÊN ĐỀ ÔN THEO CÂU CHO HỌC SINH LỚP 12 ĐỂ ĐẠT ĐIỂM 5+ THI TỐT NGHIỆP THPT ...
CHUYÊN ĐỀ ÔN THEO CÂU CHO HỌC SINH LỚP 12 ĐỂ ĐẠT ĐIỂM 5+ THI TỐT NGHIỆP THPT ...CHUYÊN ĐỀ ÔN THEO CÂU CHO HỌC SINH LỚP 12 ĐỂ ĐẠT ĐIỂM 5+ THI TỐT NGHIỆP THPT ...
CHUYÊN ĐỀ ÔN THEO CÂU CHO HỌC SINH LỚP 12 ĐỂ ĐẠT ĐIỂM 5+ THI TỐT NGHIỆP THPT ...
 
Chi-Square Test Non Parametric Test Categorical Variable
Chi-Square Test Non Parametric Test Categorical VariableChi-Square Test Non Parametric Test Categorical Variable
Chi-Square Test Non Parametric Test Categorical Variable
 
4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptx4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptx
 
DBMSArchitecture_QueryProcessingandOptimization.pdf
DBMSArchitecture_QueryProcessingandOptimization.pdfDBMSArchitecture_QueryProcessingandOptimization.pdf
DBMSArchitecture_QueryProcessingandOptimization.pdf
 
Grade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptxGrade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptx
 
CARNAVAL COM MAGIA E EUFORIA _
CARNAVAL COM MAGIA E EUFORIA            _CARNAVAL COM MAGIA E EUFORIA            _
CARNAVAL COM MAGIA E EUFORIA _
 
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITWQ-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
 
Shark introduction Morphology and its behaviour characteristics
Shark introduction Morphology and its behaviour characteristicsShark introduction Morphology and its behaviour characteristics
Shark introduction Morphology and its behaviour characteristics
 
An Overview of the Calendar App in Odoo 17 ERP
An Overview of the Calendar App in Odoo 17 ERPAn Overview of the Calendar App in Odoo 17 ERP
An Overview of the Calendar App in Odoo 17 ERP
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - I-LEARN SMART WORLD - CẢ NĂM - CÓ FILE NGHE (BẢN...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - I-LEARN SMART WORLD - CẢ NĂM - CÓ FILE NGHE (BẢN...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - I-LEARN SMART WORLD - CẢ NĂM - CÓ FILE NGHE (BẢN...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - I-LEARN SMART WORLD - CẢ NĂM - CÓ FILE NGHE (BẢN...
 
CLASSIFICATION OF ANTI - CANCER DRUGS.pptx
CLASSIFICATION OF ANTI - CANCER DRUGS.pptxCLASSIFICATION OF ANTI - CANCER DRUGS.pptx
CLASSIFICATION OF ANTI - CANCER DRUGS.pptx
 
prashanth updated resume 2024 for Teaching Profession
prashanth updated resume 2024 for Teaching Professionprashanth updated resume 2024 for Teaching Profession
prashanth updated resume 2024 for Teaching Profession
 
6 ways Samsung’s Interactive Display powered by Android changes the classroom
6 ways Samsung’s Interactive Display powered by Android changes the classroom6 ways Samsung’s Interactive Display powered by Android changes the classroom
6 ways Samsung’s Interactive Display powered by Android changes the classroom
 
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...
 
Objectives n learning outcoms - MD 20240404.pptx
Objectives n learning outcoms - MD 20240404.pptxObjectives n learning outcoms - MD 20240404.pptx
Objectives n learning outcoms - MD 20240404.pptx
 
Faculty Profile prashantha K EEE dept Sri Sairam college of Engineering
Faculty Profile prashantha K EEE dept Sri Sairam college of EngineeringFaculty Profile prashantha K EEE dept Sri Sairam college of Engineering
Faculty Profile prashantha K EEE dept Sri Sairam college of Engineering
 
4.9.24 School Desegregation in Boston.pptx
4.9.24 School Desegregation in Boston.pptx4.9.24 School Desegregation in Boston.pptx
4.9.24 School Desegregation in Boston.pptx
 
4.9.24 Social Capital and Social Exclusion.pptx
4.9.24 Social Capital and Social Exclusion.pptx4.9.24 Social Capital and Social Exclusion.pptx
4.9.24 Social Capital and Social Exclusion.pptx
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (GLOB...
BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (GLOB...BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (GLOB...
BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (GLOB...
 
PART 1 - CHAPTER 1 - CELL THE FUNDAMENTAL UNIT OF LIFE
PART 1 - CHAPTER 1 - CELL THE FUNDAMENTAL UNIT OF LIFEPART 1 - CHAPTER 1 - CELL THE FUNDAMENTAL UNIT OF LIFE
PART 1 - CHAPTER 1 - CELL THE FUNDAMENTAL UNIT OF LIFE
 

Can the below code be modified per these requirements � Call your s.pdf

  • 1. Can the below code be modified per these requirements? Call your state machine every 500000 us. Continuously blink SOS in Morse code on the green and red LEDs. If a button is pushed, toggle the message between SOS and OK. Pushing the button in the middle of a message should NOT change the message until it is complete. For example, if you push the button while the O in SOS is being blinked out, the message will not change to OK until after the SOS message is completed. The following guidance will help provide a base for the functionality you are creating: Dot = red LED on for 500ms Dash = green LED on for 1500ms 3*500ms between characters (both LEDs off) 7*500ms between words (both LEDs off), for example SOS 3500ms SOS * ======== gpiointerrupt.c ======== */ #include #include /* Driver Header files */ #include #include /* Driver configuration */ #include "ti_drivers_config.h" /* Morse Code for SOS */ #define SOS "***---***" /* Morse Code for OK */ #define OK "-.-.-" int SOS_state = 0; int OK_state = 0; int is_SOS = 1; /* LED Blink Timer Callback */ void timerCallback(Timer_Handle myHandle, int_fast16_t status) { if(is_SOS){ // Blink SOS switch(SOS_state){ case 0: GPIO_write(CONFIG_GPIO_LED_0, CONFIG_GPIO_LED_ON); GPIO_write(CONFIG_GPIO_LED_1, CONFIG_GPIO_LED_OFF); break; case 1:
  • 2. GPIO_write(CONFIG_GPIO_LED_0, CONFIG_GPIO_LED_OFF); GPIO_write(CONFIG_GPIO_LED_1, CONFIG_GPIO_LED_ON); break; case 2: GPIO_write(CONFIG_GPIO_LED_0, CONFIG_GPIO_LED_ON); GPIO_write(CONFIG_GPIO_LED_1, CONFIG_GPIO_LED_OFF); break; default: break; } SOS_state++; if(SOS_state >= strlen(SOS)){ SOS_state = 0; } }else{ // Blink OK switch(OK_state){ case 0: GPIO_write(CONFIG_GPIO_LED_0, CONFIG_GPIO_LED_ON); GPIO_write(CONFIG_GPIO_LED_1, CONFIG_GPIO_LED_OFF); break; case 1: GPIO_write(CONFIG_GPIO_LED_0, CONFIG_GPIO_LED_OFF); GPIO_write(CONFIG_GPIO_LED_1, CONFIG_GPIO_LED_ON); break; case 2: GPIO_write(CONFIG_GPIO_LED_0, CONFIG_GPIO_LED_OFF); GPIO_write(CONFIG_GPIO_LED_1, CONFIG_GPIO_LED_ON); break; case 3: GPIO_write(CONFIG_GPIO_LED_0, CONFIG_GPIO_LED_ON); GPIO_write(CONFIG_GPIO_LED_1, CONFIG_GPIO_LED_OFF); break; default: break; }
  • 3. OK_state++; if(OK_state >= strlen(OK)){ OK_state = 0; } } } /* * ======== gpioButtonFxn0 ======== * Callback function for the GPIO interrupt on CONFIG_GPIO_BUTTON_0. * * Note: GPIO interrupts are cleared prior to invoking callbacks. */ void gpioButtonFxn0(uint_least8_t index) { /* Toggle message between SOS and OK */ is_SOS = !is_SOS; } /* * ======== mainThread ======== */ void *mainThread(void *arg0) { /* Call driver init functions */ GPIO_init(); /* Configure the LED and button pins */ GPIO_setConfig(CONFIG_GPIO_LED_0, GPIO_CFG_OUT_STD | GPIO_CFG_OUT_LOW); GPIO_setConfig(CONFIG_GPIO_LED_1, GPIO_CFG_OUT_STD | GPIO_CFG_OUT_LOW); GPIO_setConfig(CONFIG_GPIO_BUTTON_0, GPIO_CFG_IN_PU | GPIO_CFG_IN_INT_FALLING); /* Turn on user LED */ GPIO_write(CONFIG_GPIO_LED_0, CONFIG_GPIO_LED_ON); /* Install Button callback */ GPIO_setCallback(CONFIG_GPIO_BUTTON_0, gpioButtonFxn0); /* Enable interrupts */ GPIO_enableInt(CONFIG_GPIO_BUTTON_0); /*
  • 4. * If more than one input pin is available for your device, interrupts * will be enabled on CONFIG_GPIO_BUTTON1. */ if (CONFIG_GPIO_BUTTON_0 != CONFIG_GPIO_BUTTON_1) { /* Configure BUTTON1 pin */ GPIO_setConfig(CONFIG_GPIO_BUTTON_1, GPIO_CFG_IN_PU | GPIO_CFG_IN_INT_FALLING); /* Install Button callback */ GPIO_setCallback(CONFIG_GPIO_BUTTON_1, gpioButtonFxn0); GPIO_enableInt(CONFIG_GPIO_BUTTON_1); } /* Initialize LED Blink Timer */ initTimer(); return (NULL); } /* Initialize LED Blink Timer */ void initTimer(void) { Timer_Handle timer0; Timer_Params params; Timer_init(); Timer_Params_init(&params); params.period = 500000; params.periodUnits = Timer_PERIOD_US; params.timerMode = Timer_CONTINUOUS_CALLBACK; params.timerCallback = timerCallback; timer0 = Timer_open(CONFIG_TIMER_0, &params); if (timer0 == NULL) { /* Failed to initialized timer */ while (1) { } } if (Timer_start(timer0) == Timer_STATUS_ERROR) {
  • 5. /* Failed to start timer */ while (1) { } } }