99
1010namespace Components {
1111
12- const struct device * LoadSwitch::m_device = nullptr ;
1312// ----------------------------------------------------------------------
1413// Component construction and destruction
1514// ----------------------------------------------------------------------
@@ -23,34 +22,31 @@ LoadSwitch ::~LoadSwitch() {}
2322// ----------------------------------------------------------------------
2423
2524void LoadSwitch ::Reset_handler (FwIndexType portNum) {
26- gpio_pin_set (m_device, m_pinNum, 0 );
25+ this ->gpioSet_out (0 , Fw::Logic::LOW);
26+ this ->log_ACTIVITY_HI_StatusChanged (Fw::On::OFF);
27+ this ->tlmWrite_IsOn (Fw::On::OFF);
2728 k_sleep (K_MSEC (100 ));
28- gpio_pin_set (m_device, m_pinNum, 1 );
29+ this ->gpioSet_out (0 , Fw::Logic::HIGH);
30+ this ->log_ACTIVITY_HI_StatusChanged (Fw::On::ON);
31+ this ->tlmWrite_IsOn (Fw::On::ON);
2932}
3033
3134// ----------------------------------------------------------------------
3235// Handler implementations for commands
3336// ----------------------------------------------------------------------
3437
3538void LoadSwitch ::TURN_ON_cmdHandler (FwOpcodeType opCode, U32 cmdSeq) {
36- gpio_pin_set (m_device, m_pinNum, 1 );
39+ this -> gpioSet_out ( 0 , Fw::Logic::HIGH );
3740 this ->log_ACTIVITY_HI_StatusChanged (Fw::On::ON);
38- // I think some code needed to send this status to the port as well
41+ this -> tlmWrite_IsOn (Fw::On::ON);
3942 this ->cmdResponse_out (opCode, cmdSeq, Fw::CmdResponse::OK);
4043}
4144
4245void LoadSwitch ::TURN_OFF_cmdHandler (FwOpcodeType opCode, U32 cmdSeq) {
43- gpio_pin_set (m_device, m_pinNum, 0 );
46+ this -> gpioSet_out ( 0 , Fw::Logic::LOW );
4447 this ->log_ACTIVITY_HI_StatusChanged (Fw::On::OFF);
45- // I think some code needed to send this status to the port as well
48+ this -> tlmWrite_IsOn (Fw::On::OFF);
4649 this ->cmdResponse_out (opCode, cmdSeq, Fw::CmdResponse::OK);
4750}
4851
49- // This is meant to be used in Topology.cpp to configure the pin and device
50- void LoadSwitch ::pin_configuration (const struct device * device, uint8_t pinNum) {
51- this ->m_pinNum = pinNum;
52- this ->m_device = device;
53- gpio_pin_configure (m_device, m_pinNum, GPIO_OUTPUT_INACTIVE);
54- }
55-
5652} // namespace Components
0 commit comments