Skip to content
Snippets Groups Projects
Commit d291eece authored by schneider's avatar schneider
Browse files

chore(display,portexpander): style

parent b4c549e5
No related branches found
No related tags found
No related merge requests found
Pipeline #1462 passed
...@@ -19,7 +19,6 @@ const gpio_cfg_t DEV_DC_PIN = {PORT_1, PIN_6, GPIO_FUNC_OUT, GPIO_PAD_NONE}; ...@@ -19,7 +19,6 @@ const gpio_cfg_t DEV_DC_PIN = {PORT_1, PIN_6, GPIO_FUNC_OUT, GPIO_PAD_NONE};
#define DUTY_CYCLE 20 // (%) #define DUTY_CYCLE 20 // (%)
#define PWM_TIMER MXC_TMR4 // must change PORT_PWM and PIN_PWM if changed #define PWM_TIMER MXC_TMR4 // must change PORT_PWM and PIN_PWM if changed
/***** Functions *****/ /***** Functions *****/
void PWM_Output(void) void PWM_Output(void)
{ {
......
...@@ -27,23 +27,26 @@ void portexpander_init(void) ...@@ -27,23 +27,26 @@ void portexpander_init(void)
detected = true; detected = true;
// Set _all_ outputs to open-drain to support the high side p-channel transistors. // Set _all_ outputs to open-drain to support the high side p-channel transistors.
command[0] = 0x4F; command[1] = 0x01; command[0] = 0x4F;
command[1] = 0x01;
I2C_MasterWrite(MXC_I2C1_BUS0, addr << 1, command, 2, 0); I2C_MasterWrite(MXC_I2C1_BUS0, addr << 1, command, 2, 0);
// Enable outputs for the transistors, the LED and the LCD reset // Enable outputs for the transistors, the LED and the LCD reset
command[0] = 0x03; command[1] = 0x68; command[0] = 0x03;
command[1] = 0x68;
I2C_MasterWrite(MXC_I2C1_BUS0, addr << 1, command, 2, 0); I2C_MasterWrite(MXC_I2C1_BUS0, addr << 1, command, 2, 0);
// Set outputs to high (i.e. open-drain) // Set outputs to high (i.e. open-drain)
output_state = 0x97; output_state = 0x97;
command[0] = 0x01; command[1] = output_state; command[0] = 0x01;
command[1] = output_state;
I2C_MasterWrite(MXC_I2C1_BUS0, addr << 1, command, 2, 0); I2C_MasterWrite(MXC_I2C1_BUS0, addr << 1, command, 2, 0);
// Turn on LEDs // Turn on LEDs
// TODO: only turn on LEDs if value != 0,0,0 && dim > 0 // TODO: only turn on LEDs if value != 0,0,0 && dim > 0
command[0] = 0x01; command[1] = 0x90; command[0] = 0x01;
command[1] = 0x90;
I2C_MasterWrite(MXC_I2C1_BUS0, addr << 1, command, 2, 0); I2C_MasterWrite(MXC_I2C1_BUS0, addr << 1, command, 2, 0);
} }
uint8_t portexpander_get(void) uint8_t portexpander_get(void)
...@@ -77,7 +80,8 @@ void portexpander_set(uint8_t pin, uint8_t value) ...@@ -77,7 +80,8 @@ void portexpander_set(uint8_t pin, uint8_t value)
output_state &= ~(1 << pin); output_state &= ~(1 << pin);
} }
command[0] = 0x01; command[1] = output_state; command[0] = 0x01;
command[1] = output_state;
I2C_MasterWrite(MXC_I2C1_BUS0, addr << 1, command, 2, 0); I2C_MasterWrite(MXC_I2C1_BUS0, addr << 1, command, 2, 0);
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment