Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement GPIO TOGGLE #73

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions bsp/bsp_gpio.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ inline void gpio_outclr_bulk(int port, uint32_t mask) {
PORT->Group[port].OUTCLR.reg = mask;
}

inline void gpio_toggle_bulk(int port, uint32_t mask) {
PORT->Group[port].OUTTGL.reg = mask;
}

void gpio_pullenset_bulk(uint32_t mask, uint8_t port = 0);

void gpio_pullenclr_bulk(uint32_t mask, uint8_t port = 0);
Expand Down
18 changes: 18 additions & 0 deletions source/Delegate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,24 @@ QState Delegate::Started(Delegate * const me, QEvt const * const e) {

break;
}
case SEESAW_GPIO_BULK_TOGGLE: {
uint8_t pins[4];
fifo->Read(pins, 4);
len-=4;

uint32_t combined = ((uint32_t)pins[0] << 24) | ((uint32_t)pins[1] << 16) | ((uint32_t)pins[2] << 8) | (uint32_t)pins[3];
gpio_toggle_bulk(PORTA, combined & CONFIG_GPIO_A_MASK);
#ifdef HAS_PORTB
if(len > 0){
fifo->Read(pins, 4);
len-=4;

uint32_t combined = ((uint32_t)pins[0] << 24) | ((uint32_t)pins[1] << 16) | ((uint32_t)pins[2] << 8) | (uint32_t)pins[3];
gpio_toggle_bulk(PORTB, combined & CONFIG_GPIO_B_MASK);
}
#endif
break;
}
case SEESAW_GPIO_INTENSET: {
uint8_t pins[4];
fifo->Read(pins, 4);
Expand Down
Loading