aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Navigation/UsersAndRolesNavigationManager.cs
blob: b56962df75105ce5d28f21605f73a301c413fb9e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Tango.Logging;
using Tango.MachineStudio.Common.Navigation;
using Tango.MachineStudio.UsersAndRoles.Views;

namespace Tango.MachineStudio.UsersAndRoles.Navigation
{
    public class UsersAndRolesNavigationManager
    {
        private LogManager LogManager = LogManager.Default;

        public void NavigateTo(UsersAndRolesNavigationView view)
        {
            LogManager.Log(String.Format("Navigating to view {0}...", view.ToString()));
            MainView.Instance.TransitionControl.NavigateTo(view.ToString());
        }
    }
}
nual typedef struct { uint32_t m_port; uint32_t m_pin; } GPIOIntPortMap; static GPIOIntPortMap portMap[NUM_OF_GPIO_INT] = { #ifdef EVALUATION_BOARD {GPIO_PORTG_BASE, GPIO_INT_PIN_0}, // Dispenser LSW 1 {GPIO_PORTG_BASE, GPIO_INT_PIN_1}, // Dispenser LSW 2 {GPIO_PORTP_BASE, GPIO_INT_PIN_4}, // Dispenser LSW 3 {GPIO_PORTP_BASE, GPIO_INT_PIN_5}, // Dispenser LSW 4 {GPIO_PORTQ_BASE, GPIO_INT_PIN_7}, // Dispenser LSW 5 {GPIO_PORTS_BASE, GPIO_INT_PIN_0}, // Dispenser LSW 6 {GPIO_PORTS_BASE, GPIO_INT_PIN_3}, // Screw LSW {GPIO_PORTD_BASE, GPIO_INT_PIN_1}, // Start Manual Btn {GPIO_PORTJ_BASE, GPIO_INT_PIN_3}, // End Manual Btn {GPIO_PORTE_BASE, GPIO_INT_PIN_4}, // {GPIO_PORTH_BASE, GPIO_INT_PIN_5}, // {GPIO_PORTP_BASE, GPIO_INT_PIN_0}, // {GPIO_PORTQ_BASE, GPIO_INT_PIN_5}, // #endif }; typedef struct { bool m_isEnabled; GPIOInt_t m_param; GPIOIntCallback m_callback; }PortConfig_t; static PortConfig_t gpio_configuration[MAX_NUM_OF_REGISTRED_CALLBACKS]; bool PollGPIO (uint8_t index) { unsigned long ulStatus = ROM_GPIOPinRead(portMap[index].m_port, portMap[index].m_pin); if ( ulStatus) { return true; } return false; } //******************************************************************************************************************** //genneral interrupt handler for all GPIO's //******************************************************************************************************************** void IntGPIO(UArg arg0) { uint32_t port = (uint32_t)arg0; unsigned long ulStatus = ROM_GPIOIntStatus(port, true); uint8_t index; for (index = 0; index < MAX_NUM_OF_REGISTRED_CALLBACKS; ++index) { GPIOInt_t gpioInt = gpio_configuration[index].m_param; if (gpio_configuration[index].m_isEnabled && (portMap[gpioInt].m_port == port) && (portMap[gpioInt].m_pin & ulStatus)) { gpio_configuration[index].m_callback(gpio_configuration[index].m_param); } } // // Clear all the pin interrupts that are set // ROM_GPIOIntClear(port, ulStatus); } //******************************************************************************************************************** void GPIOInit(void) { uint8_t index; for (index = 0; index < MAX_NUM_OF_REGISTRED_CALLBACKS; ++index) { gpio_configuration[index].m_isEnabled = false; } } //******************************************************************************************************************** void GPIOEnableInterrupt(GPIOInt_t gpioInt, GPIOIntCallback callBack, uint32_t type) { uint8_t index; for (index = 0; index < MAX_NUM_OF_REGISTRED_CALLBACKS; ++index) { if (!gpio_configuration[index].m_isEnabled) { gpio_configuration[index].m_isEnabled = true; gpio_configuration[index].m_param = gpioInt; gpio_configuration[index].m_callback = callBack; ROM_GPIOIntTypeSet(portMap[gpioInt].m_port,portMap[gpioInt].m_pin, type); ROM_GPIOIntClear(portMap[gpioInt].m_port,portMap[gpioInt].m_pin); ROM_GPIOIntEnable(portMap[gpioInt].m_port,portMap[gpioInt].m_pin); return; } else { if ((gpio_configuration[index].m_param == gpioInt) && (gpio_configuration[index].m_callback == callBack)) { return; } } } } //******************************************************************************************************************** void GPIODisableInterrupt(GPIOInt_t gpioInt,GPIOIntCallback callBack) { uint8_t index; for (index = 0; index < MAX_NUM_OF_REGISTRED_CALLBACKS; ++index) { if (gpio_configuration[index].m_isEnabled && (gpio_configuration[index].m_param == gpioInt) && (gpio_configuration[index].m_callback == callBack)) { ROM_GPIOIntDisable(portMap[gpioInt].m_port,portMap[gpioInt].m_pin); ROM_GPIOIntClear(portMap[gpioInt].m_port,portMap[gpioInt].m_pin); gpio_configuration[index].m_isEnabled = false; return; } } }