Fix test for when to update battery and fan state, hold SCI_N for longer
This commit is contained in:
parent
11c15c2291
commit
d16ecc6129
@ -97,7 +97,10 @@ void main(void) {
|
||||
|
||||
INFO("System76 EC board '%s', version '%s'\n", board(), version());
|
||||
|
||||
uint32_t last_time = 0;
|
||||
for(main_cycle = 0; ; main_cycle++) {
|
||||
uint32_t time = time_get();
|
||||
|
||||
// Handle power states
|
||||
power_event();
|
||||
// Scans keyboard and sends keyboard packets
|
||||
@ -109,7 +112,8 @@ void main(void) {
|
||||
// Checks for keyboard/mouse packets from host
|
||||
kbc_event(&KBC);
|
||||
// Only run the following once a second
|
||||
if (time_get() % 1000 == 0) {
|
||||
if (last_time > time || (time - last_time) >= 1000) {
|
||||
last_time = time;
|
||||
// Updates fan status and temps
|
||||
peci_event();
|
||||
// Updates battery status
|
||||
|
@ -26,11 +26,14 @@ void pmc_sci_interrupt(void) {
|
||||
*(SCI_N.control) = GPIO_OUT;
|
||||
|
||||
// Delay T_HOLD (value assumed)
|
||||
delay_us(1);
|
||||
delay_us(65);
|
||||
|
||||
// Stop SCI interrupt
|
||||
*(SCI_N.control) = GPIO_IN;
|
||||
gpio_set(&SCI_N, true);
|
||||
|
||||
// Delay T_HOLD (value assumed)
|
||||
delay_us(65);
|
||||
}
|
||||
|
||||
bool pmc_sci(struct Pmc * pmc, uint8_t sci) {
|
||||
|
@ -97,7 +97,10 @@ void main(void) {
|
||||
|
||||
INFO("System76 EC board '%s', version '%s'\n", board(), version());
|
||||
|
||||
uint32_t last_time = 0;
|
||||
for(main_cycle = 0; ; main_cycle++) {
|
||||
uint32_t time = time_get();
|
||||
|
||||
// Handle power states
|
||||
power_event();
|
||||
// Scans keyboard and sends keyboard packets
|
||||
@ -109,7 +112,8 @@ void main(void) {
|
||||
// Checks for keyboard/mouse packets from host
|
||||
kbc_event(&KBC);
|
||||
// Only run the following once a second
|
||||
if (time_get() % 1000 == 0) {
|
||||
if (last_time > time || (time - last_time) >= 1000) {
|
||||
last_time = time;
|
||||
// Updates fan status and temps
|
||||
peci_event();
|
||||
// Updates battery status
|
||||
|
@ -26,11 +26,14 @@ void pmc_sci_interrupt(void) {
|
||||
*(SCI_N.control) = GPIO_OUT;
|
||||
|
||||
// Delay T_HOLD (value assumed)
|
||||
delay_us(1);
|
||||
delay_us(65);
|
||||
|
||||
// Stop SCI interrupt
|
||||
*(SCI_N.control) = GPIO_IN;
|
||||
gpio_set(&SCI_N, true);
|
||||
|
||||
// Delay T_HOLD (value assumed)
|
||||
delay_us(65);
|
||||
}
|
||||
|
||||
bool pmc_sci(struct Pmc * pmc, uint8_t sci) {
|
||||
|
@ -99,7 +99,10 @@ void main(void) {
|
||||
|
||||
INFO("System76 EC board '%s', version '%s'\n", board(), version());
|
||||
|
||||
uint32_t last_time = 0;
|
||||
for(main_cycle = 0; ; main_cycle++) {
|
||||
uint32_t time = time_get();
|
||||
|
||||
// Handle power states
|
||||
power_event();
|
||||
// Scans keyboard and sends keyboard packets
|
||||
@ -111,7 +114,8 @@ void main(void) {
|
||||
// Checks for keyboard/mouse packets from host
|
||||
kbc_event(&KBC);
|
||||
// Only run the following once a second
|
||||
if (time_get() % 1000 == 0) {
|
||||
if (last_time > time || (time - last_time) >= 1000) {
|
||||
last_time = time;
|
||||
// Updates fan status and temps
|
||||
peci_event();
|
||||
// Updates battery status
|
||||
|
@ -26,11 +26,14 @@ void pmc_sci_interrupt(void) {
|
||||
*(SCI_N.control) = GPIO_OUT;
|
||||
|
||||
// Delay T_HOLD (value assumed)
|
||||
delay_us(1);
|
||||
delay_us(65);
|
||||
|
||||
// Stop SCI interrupt
|
||||
*(SCI_N.control) = GPIO_IN;
|
||||
gpio_set(&SCI_N, true);
|
||||
|
||||
// Delay T_HOLD (value assumed)
|
||||
delay_us(65);
|
||||
}
|
||||
|
||||
bool pmc_sci(struct Pmc * pmc, uint8_t sci) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user