Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ******************************************
- // Include section
- // system
- #include "project.h"
- // driver
- #include "display.h"
- #include "vti_as.h"
- // logic
- #include "trandi.h"
- #include "simpliciti.h"
- #include "user.h"
- #include "string.h"
- // ******************************************
- // Global Variable section
- struct trandi sTrandi;
- // ******************************************
- // Extern section
- // ******************************************
- // @fn reset_trandi
- // @brief Reset / INIT trandi data.
- // @param none
- // @return none
- // ******************************************
- void reset_trandi(void)
- {
- // Reset state is not active
- sTrandi.mode = TRANDI_MODE_OFF;
- strcpy(sTrandi.msg, (u8*)"works now ");
- }
- // ******************************************
- // @fn sx_trandi
- // @brief Button UP does nothing for now...
- // @param u8 line LINE2
- // @return none
- // ******************************************
- void sx_trandi(u8 line)
- {
- }
- // ******************************************
- // @fn display_trandi
- // @brief Display routine.
- // @param u8 line LINE1
- // u8 update DISPLAY_LINE_UPDATE_FULL, DISPLAY_LINE_CLEAR
- // @return none
- // ******************************************
- void display_trandi(u8 line, u8 update)
- {
- if (update == DISPLAY_LINE_UPDATE_FULL)
- {
- display_chars(LCD_SEG_L1_3_0, sTrandi.msg, SEG_ON);
- display_symbol(LCD_ICON_HEART, SEG_ON_BLINK_ON);
- // Set mode
- sTrandi.mode = TRANDI_MODE_ON;
- }
- else if (update == DISPLAY_LINE_UPDATE_PARTIAL)
- {
- display_chars(LCD_SEG_L1_3_0, sTrandi.msg, SEG_ON);
- }
- else if (update == DISPLAY_LINE_CLEAR)
- {
- display_symbol(LCD_ICON_HEART, SEG_OFF);
- reset_trandi();
- }
- }
- // ******************************************
- // @fn is_trandi_active
- // @brief Returns 1 if trandi module is currently active and needs doing random stuff.
- // @param none
- // @return u8 1 = trandi module needs random stuff
- // ******************************************
- u8 is_trandi_active(void)
- {
- return sTrandi.mode == TRANDI_MODE_ON;
- }
- void do_trandi_random(void)
- {
- // Move the text
- u8 firstElem = sTrandi.msg[0];
- u8 len = sizeof(sTrandi.msg) / sizeof(u8);
- u8 i;
- for(i = 0; i < len - 1; i++) sTrandi.msg[i] = sTrandi.msg[i+1];
- sTrandi.msg[len - 1] = firstElem;
- // Set display update flag
- display.flag.update_trandi = 1;
- }
Add Comment
Please, Sign In to add comment