|
Programmable Clock with RTOS 0.0.1
Implementaiton of a programmable clock using RTOS with STM32GO microcontroller.
|
Implementation of state machine of LCD. More...
Data Structures | |
| struct | DisplayNode |
| Struct for store function for each state of event machine. More... | |
Functions | |
| static void | Display_Machine (APP_MsgTypeDef *DisplayMsg) |
| Initializate the State machine of Display. | |
| static Display_M | Time (APP_MsgTypeDef *DisplayMsg) |
| Display the current time on the LCD. | |
| static Display_M | Date (APP_MsgTypeDef *DisplayMsg) |
| Display the current Date on the LCD. | |
| static void | TimeString (char *string, uint8_t hours, uint8_t minutes, uint8_t seconds) |
| Function to convert time to a string representation. | |
| static void | DateString (char *string, uint8_t month, uint8_t day, uint16_t year, uint8_t weekday) |
| Function to convert date to a string representation. | |
| static char * | get_month (uint8_t month) |
| Get the abbreviation of the month. | |
| static Display_M | Alarm_A (APP_MsgTypeDef *DisplayMsg) |
| Prints the letter A. | |
| static Display_M | Alarm (APP_MsgTypeDef *DisplayMsg) |
| Prints the ALARM!!! | |
| static Display_M | Alarm_Clean (APP_MsgTypeDef *DisplayMsg) |
| Clean Alarm. | |
| static void | Display_Buzzer (TimerHandle_t pxTimer) |
| Function for sotware timer of the buzzer. | |
| static void | Display_1Mn_Buzzer (TimerHandle_t pxTimer) |
| Function for software timer for the 1mn of the alarm. | |
| void | Display_Init (void) |
| Initializate the LCD. | |
| void | Display_Task (void) |
| Display task function. | |
Variables | |
| LCD_HandleTypeDef | Hlcd |
| Variable for LCD configuration. | |
| SPI_HandleTypeDef | SpiHandle |
| Variable for SPI configuration. | |
| static TIM_HandleTypeDef | TimHandle |
| Strucuture that gives format to timer. | |
| uint8_t | buzzer_flag = 0 |
| Flag that will tell if the buzzer needs to be activated. | |
| uint8_t | buzzer = 0 |
| Flag that will tell if the buzzer needs to be activated. | |
| static TimerHandle_t | xTimerBuzzer |
| Struct for handling Software timer for the buzzer. | |
| static TimerHandle_t | xTimer1Mn_Buzzer |
| Struct for handling Software timer for 1mn for the buzzer. | |
Implementation of state machine of LCD.
In this file we are going to see the initialization of the lcd and the application
|
static |
Prints the ALARM!!!
< precompilation direcctive
This function prints ALARM!!! when the alarm has been activated. Furthermore, it indicates that the buzzer must be activated
| DisplayMsg | A pointer to the message structure containing state information |
< precompilation direcctive
< Buzzer state
< Buzzer state
< Brief description
|
static |
Prints the letter A.
< precompilation direcctive
This function prints the letter A when the alarm has been setted
| DisplayMsg | A pointer to the message structure containing state information |
< precompilation direcctive
|
static |
Clean Alarm.
< precompilation direcctive
This function prints stop and turn off before the one-minute lapse expire by receiving a new date, time, or alarm through the CAN bus
| DisplayMsg | A pointer to the message structure containing state information |
< precompilation direcctive
< Buzzer state
< Buzzer state
< The maximum amount of time
< The maximum amount of time
< Brief description
< The maximum amount of time
|
static |
Display the current Date on the LCD.
< precompilation direcctive
This function rettrieves the curren date from the Clockmsg structure and formats it as a string in the format 000,00 0000 00
| DisplayMsg | A pointer to the message structure containing state information |
< precompilation direcctive
|
static |
Function to convert date to a string representation.
< precompilation direcctive
This function takes time values for year, month, day, weekday and formats them into a string
| string | Pointer to a character buffer to store the formatted date |
| month | Month (1-12) |
| day | Day of the month (1-31) |
| year | Year |
| weekday | Weekday(0-6), where 0 is Sunday and 6 is Saturday |
< precompilation direcctive
< Position 0: First character of the month
< Position 0: First character of the month
< Position 1: Second character of the month
< Position 1: Second character of the month
< Position 2: First character of the month
< Position 2: First character of the month
< Position 4: Tens digits of the day
< Value for counter: 10
< Value for counter: 10
< Position 5: Ones digits of the day
< Value for counter: 10
< Position 7: Thousands digit of the year
< Value for counter: 1000
< Value for counter: 10
< Position 8: Hundreds digit of the year
< Value for counter: 100
< Value for counter: 10
< Position 9: Tens digit of the year
< Value for counter: 10
< Value for counter: 10
< Position 10: Ones digit of the year
< Value for counter: 10
< Position 12: First character of the week
< Value for counter: 0
< Position 13: Second character of the week
< Value for counter: 1
|
static |
Function for software timer for the 1mn of the alarm.
< precompilation direcctive
This function after 1mn the alarm will be desactivated either by the time or by other message
| pxTimer | Timer handler |
< precompilation direcctive
< Buzzer state
< The maximum amount of time
< Brief description
|
static |
Function for sotware timer of the buzzer.
< precompilation direcctive
| pxTimer | Timer handler |
This function with the help of the alarm that has been triggered, start to blink the LCD and making blink the buzzer
< precompilation direcctive
< Buzzer state
< Buzzer state
< Buzzer state
< Brief description
< Buzzer state
< Brief description
| void Display_Init | ( | void | ) |
Initializate the LCD.
This function gives the format of spi and initializate the lcd
< Brief description
< ID for timer used to update display
< The maximum amount of time
< ID for timer used to update display
< The maximum amount of time
|
static |
Initializate the State machine of Display.
This function initializes the state machine for the Display module. It sets up an array of state functions and transitions to the initial state
| DisplayMsg | A pointer to the message structure containing state information |
< Total states in event machine
| void Display_Task | ( | void | ) |
Display task function.
This function checks the queue of pending tasks every 100ms and process them calling the display machine
|
static |
Get the abbreviation of the month.
< precompilation direcctive
This function returns the abbreviation of a month given its number
| month | Month number (1-12) |
< precompilation direcctive
< Value for counter: 1
< Value for counter: 12
< Value for counter: 1
|
static |
Display the current time on the LCD.
< precompilation direcctive
This function rettrieves the curren time from the Clockmsg structure and formats it as a string in the format 00:00:00
| DisplayMsg | A pointer to the message structure containing state information |
< precompilation direcctive
|
static |
Function to convert time to a string representation.
< precompilation direcctive
This function takes time values for hours, minutes, seconds and formats them into a string
| string | Pointer to a character buffer to store the formatted time |
| hours | Hours in 24-hour format (0-23) |
| minutes | Minutes (0-59) |
| seconds | Seconds (0-59) |
< precompilation direcctive
< Position 7: Seconds ones digit
< Value for counter: 10
< Position 6: Seconds tens digit
< Value for counter: 10
< Position 5: Minutes ones digit
< Value for counter: 10
< Position 4: Minutes tens digit
< Value for counter: 10
< Position 3: Hours ones digit
< Value for counter: 10
< Position 1: Hours tens digit
< Value for counter: 10