Skip to content

Commit

Permalink
the RGB-led-ring implementation is halted till the selection of prope…
Browse files Browse the repository at this point in the history
…r IC
  • Loading branch information
musalman709 committed Nov 18, 2020
1 parent 487b995 commit 353fe08
Showing 1 changed file with 79 additions and 79 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,85 +10,85 @@
namespace argos {

/****************************************/
enum GLEDsRegisters {
// REGISTER ADDRESSES
MODE1 0x00 /**< Mode Register 1 */
MODE2 0x01 /**< Mode Register 2 */
//LED0
LED0_ON_L 0x06 /**< LED0 on tick, low byte*/
LED0_ON_H 0x07 /**< LED0 on tick, high byte*/
LED0_OFF_L 0x08 /**< LED0 off tick, low byte */
LED0_OFF_H 0x09 /**< LED0 off tick, high byte */
// etc all 16: LED15_OFF_H 0x45
ALLLED_ON_L 0xFA /**< load all the LEDn_ON registers, low */
ALLLED_ON_H 0xFB /**< load all the LEDn_ON registers, high */
ALLLED_OFF_L 0xFC /**< load all the LEDn_OFF registers, low */
ALLLED_OFF_H 0xFD /**< load all the LEDn_OFF registers,high */
PRESCALE 0xFE /**< Prescaler for PWM output frequency */
TESTMODE 0xFF /**< defines the test mode to be entered */

// MODE1 bits
MODE1_ALLCAL 0x01 /**< respond to LED All Call I2C-bus address */
MODE1_SUB3 0x02 /**< respond to I2C-bus subaddress 3 */
MODE1_SUB2 0x04 /**< respond to I2C-bus subaddress 2 */
MODE1_SUB1 0x08 /**< respond to I2C-bus subaddress 1 */
MODE1_SLEEP 0x10 /**< Low power mode. Oscillator off */
MODE1_AI 0x20 /**< Auto-Increment enabled */
MODE1_EXTCLK 0x40 /**< Use EXTCLK pin clock */
MODE1_RESTART 0x80 /**< Restart enabled */
// MODE2 bits
MODE2_OUTNE_0 0x01 /**< Active LOW output enable input */
MODE2_OUTNE_1 0x02 /**< Active LOW output enable input - high impedience */
MODE2_OUTDRV 0x04 /**< totem pole structure vs open-drain */
MODE2_OCH 0x08 /**< Outputs change on ACK vs STOP */
MODE2_INVRT 0x10 /**< Output logic state inverted */

I2C_ADDRESS 0x40 /**< Default PCA9685 I2C Slave Address */
FREQUENCY_OSCILLATOR 25000000 /**< Int. osc. frequency in datasheet */

PRESCALE_MIN 3 /**< minimum prescale value */
PRESCALE_MAX 255 /**< maximum prescale value */

};

/*******************
*********************/

CRealEPuckQuadRGBLEDsActuator::CRealEPuckQuadRGBLEDsActuator() {

m_tDeviceStream = OpenDevice(I2C_ADDRESS);

}

/****************************************/
/****************************************/

CRealEPuckQuadRGBLEDsActuator::~CRealEPuckQuadRGBLEDsActuator() {

SetColors(CColor::BLACK);
SendData();
CloseDevice(m_tDeviceStream);

}

/****************************************/
/****************************************/

void CRealEPuckQuadRGBLEDsActuator::SendData() {

SInt8 nData[9];
nData[0] = m_tLEDSettings[2].GetRed();
nData[1] = m_tLEDSettings[2].GetGreen();
nData[2] = m_tLEDSettings[2].GetBlue();
nData[3] = m_tLEDSettings[1].GetRed();
nData[4] = m_tLEDSettings[1].GetGreen();
nData[5] = m_tLEDSettings[1].GetBlue();
nData[6] = m_tLEDSettings[0].GetRed();
nData[7] = m_tLEDSettings[0].GetGreen();
nData[8] = m_tLEDSettings[0].GetBlue();
WriteData(m_tDeviceStream, nData, 9);

}
// enum GLEDsRegisters {
// // REGISTER ADDRESSES
// MODE1 0x00 /**< Mode Register 1 */
// MODE2 0x01 /**< Mode Register 2 */
// //LED0
// LED0_ON_L 0x06 /**< LED0 on tick, low byte*/
// LED0_ON_H 0x07 /**< LED0 on tick, high byte*/
// LED0_OFF_L 0x08 /**< LED0 off tick, low byte */
// LED0_OFF_H 0x09 /**< LED0 off tick, high byte */
// // etc all 16: LED15_OFF_H 0x45
// ALLLED_ON_L 0xFA /**< load all the LEDn_ON registers, low */
// ALLLED_ON_H 0xFB /**< load all the LEDn_ON registers, high */
// ALLLED_OFF_L 0xFC /**< load all the LEDn_OFF registers, low */
// ALLLED_OFF_H 0xFD /**< load all the LEDn_OFF registers,high */
// PRESCALE 0xFE /**< Prescaler for PWM output frequency */
// TESTMODE 0xFF /**< defines the test mode to be entered */
//
// // MODE1 bits
// MODE1_ALLCAL 0x01 /**< respond to LED All Call I2C-bus address */
// MODE1_SUB3 0x02 /**< respond to I2C-bus subaddress 3 */
// MODE1_SUB2 0x04 /**< respond to I2C-bus subaddress 2 */
// MODE1_SUB1 0x08 /**< respond to I2C-bus subaddress 1 */
// MODE1_SLEEP 0x10 /**< Low power mode. Oscillator off */
// MODE1_AI 0x20 /**< Auto-Increment enabled */
// MODE1_EXTCLK 0x40 /**< Use EXTCLK pin clock */
// MODE1_RESTART 0x80 /**< Restart enabled */
// // MODE2 bits
// MODE2_OUTNE_0 0x01 /**< Active LOW output enable input */
// MODE2_OUTNE_1 0x02 /**< Active LOW output enable input - high impedience */
// MODE2_OUTDRV 0x04 /**< totem pole structure vs open-drain */
// MODE2_OCH 0x08 /**< Outputs change on ACK vs STOP */
// MODE2_INVRT 0x10 /**< Output logic state inverted */
//
// I2C_ADDRESS 0x40 /**< Default PCA9685 I2C Slave Address */
// FREQUENCY_OSCILLATOR 25000000 /**< Int. osc. frequency in datasheet */
//
// PRESCALE_MIN 3 /**< minimum prescale value */
// PRESCALE_MAX 255 /**< maximum prescale value */
//
// };
//
// /*******************
// *********************/
//
// CRealEPuckQuadRGBLEDsActuator::CRealEPuckQuadRGBLEDsActuator() {
//
// m_tDeviceStream = OpenDevice(I2C_ADDRESS);
//
// }
//
// /****************************************/
// /****************************************/
//
// CRealEPuckQuadRGBLEDsActuator::~CRealEPuckQuadRGBLEDsActuator() {
//
// SetColors(CColor::BLACK);
// SendData();
// CloseDevice(m_tDeviceStream);
//
// }
//
// /****************************************/
// /****************************************/
//
// void CRealEPuckQuadRGBLEDsActuator::SendData() {
//
// SInt8 nData[9];
// nData[0] = m_tLEDSettings[2].GetRed();
// nData[1] = m_tLEDSettings[2].GetGreen();
// nData[2] = m_tLEDSettings[2].GetBlue();
// nData[3] = m_tLEDSettings[1].GetRed();
// nData[4] = m_tLEDSettings[1].GetGreen();
// nData[5] = m_tLEDSettings[1].GetBlue();
// nData[6] = m_tLEDSettings[0].GetRed();
// nData[7] = m_tLEDSettings[0].GetGreen();
// nData[8] = m_tLEDSettings[0].GetBlue();
// WriteData(m_tDeviceStream, nData, 9);
//
// }

/****************************************/
/****************************************/
Expand Down

0 comments on commit 353fe08

Please sign in to comment.