Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
DigitalOut.h
00001 #ifndef CPP_TO_PIGPIO_DIGITALOUT_HEADER 00002 #define CPP_TO_PIGPIO_DIGITALOUT_HEADER 00003 namespace CPPToPigpio{ 00004 00005 /** The DigitalOut interface is used to configure and control a digital output pin. 00006 */ 00007 class DigitalOut : public CPPToPigpio{ 00008 private: 00009 short _pinNumber; 00010 long long _lastWriteValue; 00011 friend class BusOut; 00012 public: 00013 00014 /** Create a DigitalOut connected to the specified pin 00015 * 00016 * @param pin DigitalOut pin to connect to 00017 */ 00018 DigitalOut(PinName pin); //Construct Digital Output without specifying level 00019 00020 /** Create a DigitalOut connected to the specified pin 00021 * 00022 * @param pin DigitalOut pin to connect to 00023 * @param value the initial pin value 00024 */ 00025 DigitalOut(PinName pin, int value); //Specify initial level for the pin 00026 00027 /** Create a DigitalOut connected to the specified pin 00028 * 00029 * @param pin DigitalOut pin to connect to 00030 */ 00031 DigitalOut(int pin); //Used for int args 00032 00033 /** Create a DigitalOut connected to the specified pin 00034 * 00035 * @param pin DigitalOut pin to connect to 00036 * @param value the initial pin value 00037 */ 00038 DigitalOut(int pin, int value); 00039 00040 /** Set the output, specified as 0 or 1 (int) 00041 * 00042 * @param value An integer specifying the pin output value, 00043 * 0 for logical 0, 1 (or any other non-zero value) for logical 1 00044 */ 00045 void write(int value); //Set the value of the output 00046 00047 /** Return the output setting, represented as 0 or 1 (int) 00048 * 00049 * @returns 00050 * an integer representing the output setting of the pin, 00051 * 0 for logical 0, 1 for logical 1 00052 */ 00053 int read(); //return the output setting 00054 00055 /** A shorthand for read() 00056 * \sa DigitalOut::read() 00057 */ 00058 operator int(); 00059 00060 /** A shorthand for write() 00061 * \sa DigitalOut::write() 00062 */ 00063 DigitalOut & operator=(int); 00064 00065 /** A shorthand for write() 00066 * \sa DigitalOut::write() 00067 */ 00068 DigitalOut & operator=(DigitalOut &rhs); 00069 00070 /** Deconstructor 00071 */ 00072 ~DigitalOut(); 00073 }; 00074 } 00075 #endif
Generated on Tue Jul 12 2022 14:39:23 by
