// Setup inline void LED_setup() { // Register Scan CLI dictionary CLI_registerDictionary( ledCLIDict, ledCLIDictName ); // Initialize I2C I2C_setup(); // Zero out Frame Registers // This needs to be done before disabling the hardware shutdown (or the leds will do undefined things) LED_zeroPages( 0x0B, 1, 0x00, 0x0C ); // Control Registers // Disable Hardware shutdown of ISSI chip (pull high) GPIOB_PDDR |= (1<<16); PORTB_PCR16 = PORT_PCR_SRE | PORT_PCR_DSE | PORT_PCR_MUX(1); GPIOB_PSOR |= (1<<16); // Clear LED Pages LED_zeroPages( 0x00, 8, 0x00, 0xB4 ); // LED Registers // Enable LEDs based upon mask LED_sendPage( (uint8_t*)LED_ledEnableMask1, sizeof( LED_ledEnableMask1 ), 0 ); // Set default brightness LED_sendPage( (uint8_t*)LED_defaultBrightness1, sizeof( LED_defaultBrightness1 ), 0 ); // Do not disable software shutdown of ISSI chip unless current is high enough // Require at least 150 mA // May be enabled/disabled at a later time if ( Output_current_available() >= 150 ) { // Disable Software shutdown of ISSI chip LED_writeReg( 0x0A, 0x01, 0x0B ); } }
// Setup inline void LED_setup() { // Register Scan CLI dictionary CLI_registerDictionary( ledCLIDict, ledCLIDictName ); // Initialize I2C I2C_setup(); // Zero out Frame Registers // This needs to be done before disabling the hardware shutdown (or the leds will do undefined things) LED_zeroPages( 0x0B, 1, 0x00, 0x0C ); // Control Registers // Disable Hardware shutdown of ISSI chip (pull high) GPIOB_PDDR |= (1<<16); PORTB_PCR16 = PORT_PCR_SRE | PORT_PCR_DSE | PORT_PCR_MUX(1); GPIOB_PSOR |= (1<<16); // Clear LED Pages LED_zeroPages( 0x00, 8, 0x00, 0xB4 ); // LED Registers // Enable LEDs based upon mask LED_sendPage( (uint8_t*)LED_ledEnableMask, sizeof( LED_ledEnableMask ), 0 ); // Disable Software shutdown of ISSI chip LED_writeReg( 0x0A, 0x01, 0x0B ); }
// Setup inline void LED_setup() { I2C_setup(); // Zero out Frame Registers LED_zeroPages( 0x00, 8, 0xB3 ); // LED Registers LED_zeroPages( 0x0B, 1, 0x0C ); // Control Registers // Disable Hardware shutdown of ISSI chip (pull high) GPIOD_PDDR |= (1<<1); PORTD_PCR1 = PORT_PCR_SRE | PORT_PCR_DSE | PORT_PCR_MUX(1); GPIOD_PSOR |= (1<<1); }
// Zero control ISSI pages void LED_zeroControlPages() { for ( uint8_t ch = 0; ch < ISSI_Chips_define; ch++ ) { uint8_t addr = LED_ChannelMapping[ ch ].addr; uint8_t bus = LED_ChannelMapping[ ch ].bus; LED_zeroPages( bus, addr, ISSI_ConfigPage, 1, 0x00, ISSI_ConfigPageLength ); // Control Registers } }
void cliFunc_ledStart( char* args ) { print( NL ); // No \r\n by default after the command is entered LED_zeroPages( 0x0B, 1, 0x00, 0x0C ); // Control Registers //LED_zeroPages( 0x00, 8, 0x00, 0xB4 ); // LED Registers LED_writeReg( 0x0A, 0x01, 0x0B ); LED_sendPage( (uint8_t*)LED_ledEnableMask1, sizeof( LED_ledEnableMask1 ), 0 ); }
void cliFunc_ledZero( char* args ) { print( NL ); // No \r\n by default after the command is entered LED_zeroPages( 0x00, 8, 0xB3 ); }
void LED_reset() { // Force PixelMap to stop during reset Pixel_FrameState = FrameState_Sending; // Disable FPS by default LED_displayFPS = 0; // Enable Hardware shutdown (pull low) GPIO_Ctrl( hardware_shutdown_pin, GPIO_Type_DriveSetup, GPIO_Config_Pullup ); GPIO_Ctrl( hardware_shutdown_pin, GPIO_Type_DriveLow, GPIO_Config_Pullup ); delay_us(50); #if ISSI_Chip_31FL3733_define == 1 || ISSI_Chip_31FL3736_define == 1 // Reset I2C bus GPIO_Ctrl( iirst_pin, GPIO_Type_DriveSetup, GPIO_Config_Pullup ); GPIO_Ctrl( iirst_pin, GPIO_Type_DriveHigh, GPIO_Config_Pullup ); delay_us(50); GPIO_Ctrl( iirst_pin, GPIO_Type_DriveLow, GPIO_Config_Pullup ); #endif // Disable Hardware shutdown of ISSI chips (pull high) if ( LED_enable && LED_enable_current ) { GPIO_Ctrl( hardware_shutdown_pin, GPIO_Type_DriveHigh, GPIO_Config_Pullup ); } // Clear LED Pages // Enable LEDs based upon mask for ( uint8_t ch = 0; ch < ISSI_Chips_define; ch++ ) { uint8_t addr = LED_ChannelMapping[ ch ].addr; uint8_t bus = LED_ChannelMapping[ ch ].bus; #if ISSI_Chip_31FL3733_define == 1 || ISSI_Chip_31FL3736_define == 1 // POR (Power-on-Reset) // Clears all registers to default value (i.e. zeros) LED_readReg( bus, addr, 0x11, ISSI_ConfigPage ); // Set the enable mask LED_sendPage( bus, addr, (uint16_t*)&LED_ledEnableMask[ ch ], sizeof( LED_EnableBuffer ) / 2, 0 ); #else // Clear LED control pages LED_zeroPages( bus, addr, 0x00, ISSI_LEDPages, 0x00, ISSI_PageLength ); // LED Registers // Copy enable mask to send buffer for ( uint8_t reg = 0; reg < LED_EnableBufferLength; reg++ ) { LED_pageBuffer[ ch ].ledctrl[ reg ] = LED_ledEnableMask[ ch ].buffer[ reg ]; } #endif } // Reset global brightness LED_brightness = settings.brightness; #if ISSI_Chip_31FL3733_define == 1 || ISSI_Chip_31FL3736_define == 1 // Enable pull-up and pull-down anti-ghosting resistors // Set global brightness control for ( uint8_t ch = 0; ch < ISSI_Chips_define; ch++ ) { uint8_t addr = LED_ChannelMapping[ ch ].addr; uint8_t bus = LED_ChannelMapping[ ch ].bus; LED_writeReg( bus, addr, 0x01, LED_brightness, ISSI_ConfigPage ); LED_writeReg( bus, addr, 0x0F, 0x07, ISSI_ConfigPage ); // Pull-up LED_writeReg( bus, addr, 0x10, 0x07, ISSI_ConfigPage ); // Pull-down } #elif ISSI_Chip_31FL3732_define == 1 // Set global brightness control for ( uint8_t ch = 0; ch < ISSI_Chips_define; ch++ ) { uint8_t addr = LED_ChannelMapping[ ch ].addr; uint8_t bus = LED_ChannelMapping[ ch ].bus; LED_writeReg( bus, addr, 0x04, LED_brightness, ISSI_ConfigPage ); } #endif // Setup ISSI frame and sync modes; then disable software shutdown for ( uint8_t ch = 0; ch < ISSI_Chips_define; ch++ ) { uint8_t addr = LED_ChannelMapping[ ch ].addr; uint8_t bus = LED_ChannelMapping[ ch ].bus; #if ISSI_Chip_31FL3733_define == 1 || ISSI_Chip_31FL3736_define == 1 // Enable master sync for the last chip and disable software shutdown // XXX (HaaTa); The last chip is used as it is the last chip all of the frame data is sent to // This is imporant as it may take more time to send the packet than the ISSI chip can handle // between frames. if ( ch == ISSI_Chips_define - 1 ) { LED_writeReg( bus, addr, 0x00, 0x41, ISSI_ConfigPage ); } // Slave sync for the rest and disable software shutdown else { LED_writeReg( bus, addr, 0x00, 0x81, ISSI_ConfigPage ); } #elif ISSI_Chip_31FL3732_define == 1 // Enable master sync for the first chip if ( ch == 0 ) { LED_writeReg( bus, addr, 0x00, 0x40, ISSI_ConfigPage ); } // Slave sync for the rest else { LED_writeReg( bus, addr, 0x00, 0x80, ISSI_ConfigPage ); } // Disable Software shutdown of ISSI chip LED_writeReg( bus, addr, 0x0A, 0x01, ISSI_ConfigPage ); #else // Set MODE to Picture Frame LED_writeReg( bus, addr, 0x00, 0x00, ISSI_ConfigPage ); // Disable Software shutdown of ISSI chip LED_writeReg( bus, addr, 0x0A, 0x01, ISSI_ConfigPage ); #endif } // Force PixelMap to be ready for the next frame Pixel_FrameState = FrameState_Update; // Un-pause ISSI processing LED_pause = 0; }
void LED_reset() { // Force PixelMap to stop during reset Pixel_FrameState = FrameState_Sending; // Disable FPS by default LED_displayFPS = 0; #if ISSI_Chip_31FL3733_define == 1 // Reset I2C bus GPIOC_PSOR |= (1<<5); delay_us(200); GPIOC_PCOR |= (1<<5); #endif // Clear LED Pages // Enable LEDs based upon mask for ( uint8_t ch = 0; ch < ISSI_Chips_define; ch++ ) { uint8_t addr = LED_ChannelMapping[ ch ].addr; uint8_t bus = LED_ChannelMapping[ ch ].bus; #if ISSI_Chip_31FL3733_define == 1 // POR (Power-on-Reset) // Clears all registers to default value (i.e. zeros) LED_readReg( bus, addr, 0x11, ISSI_ConfigPage ); #else // Clear LED control pages LED_zeroPages( bus, addr, 0x00, ISSI_LEDPages, 0x00, ISSI_PageLength ); // LED Registers #endif // Set the enable mask LED_sendPage( bus, addr, (uint16_t*)&LED_ledEnableMask[ ch ], sizeof( LED_EnableBuffer ) / 2, 0 ); } #if ISSI_Chip_31FL3733_define == 1 // Enable pull-up and pull-down anti-ghosting resistors // Set global brightness control for ( uint8_t ch = 0; ch < ISSI_Chips_define; ch++ ) { uint8_t addr = LED_ChannelMapping[ ch ].addr; uint8_t bus = LED_ChannelMapping[ ch ].bus; LED_writeReg( bus, addr, 0x01, LED_brightness, ISSI_ConfigPage ); LED_writeReg( bus, addr, 0x0F, 0x07, ISSI_ConfigPage ); // Pull-up LED_writeReg( bus, addr, 0x10, 0x07, ISSI_ConfigPage ); // Pull-down } #elif ISSI_Chip_31FL3732_define == 1 // Set global brightness control for ( uint8_t ch = 0; ch < ISSI_Chips_define; ch++ ) { uint8_t addr = LED_ChannelMapping[ ch ].addr; uint8_t bus = LED_ChannelMapping[ ch ].bus; LED_writeReg( bus, addr, 0x04, LED_brightness, ISSI_ConfigPage ); } #endif // Setup ISSI frame and sync modes; then disable software shutdown for ( uint8_t ch = 0; ch < ISSI_Chips_define; ch++ ) { uint8_t addr = LED_ChannelMapping[ ch ].addr; uint8_t bus = LED_ChannelMapping[ ch ].bus; #if ISSI_Chip_31FL3733_define == 1 // Enable master sync for the first chip and disable software shutdown if ( ch == 0 ) { LED_writeReg( bus, addr, 0x00, 0x41, ISSI_ConfigPage ); } // Slave sync for the rest and disable software shutdown else { LED_writeReg( bus, addr, 0x00, 0x81, ISSI_ConfigPage ); } #elif ISSI_Chip_31FL3732_define == 1 // Enable master sync for the first chip if ( ch == 0 ) { LED_writeReg( bus, addr, 0x00, 0x40, ISSI_ConfigPage ); } // Slave sync for the rest else { LED_writeReg( bus, addr, 0x00, 0x80, ISSI_ConfigPage ); } // Disable Software shutdown of ISSI chip LED_writeReg( bus, addr, 0x0A, 0x01, ISSI_ConfigPage ); #else // Set MODE to Picture Frame LED_writeReg( bus, addr, 0x00, 0x00, ISSI_ConfigPage ); // Disable Software shutdown of ISSI chip LED_writeReg( bus, addr, 0x0A, 0x01, ISSI_ConfigPage ); #endif } // Force PixelMap to be ready for the next frame Pixel_FrameState = FrameState_Update; // Un-pause ISSI processing LED_pause = 0; }