新手求教。我想在dali协议库里增加一些操作IO口的功能,比如按某个按键的时候,指定的IO口出个低电平,或者其他类似的功能,这样是否可行?但是现在死活都改不了电平状态,请大家指教一下。我在DALI_Init里加入了那4句操控PA2,设置断点可以进去,应该PA2要出个高电平吧,但是一直都是低电平,这是为什么?还有哪里需要设置些什么吗?
void DALI_Init(TDLightControlCallback LightControlFunction)
{
/* Pull-up Vdd pin for data output */
DALI_PULLUP_PORT->ODR |= (1<<DALI_PULLUP_PIN); //high level
DALI_PULLUP_PORT->DDR |= (1<<DALI_PULLUP_PIN); //output mode
DALI_PULLUP_PORT->CR1 |= (1<<DALI_PULLUP_PIN); //push-pull
DALI_PULLUP_PORT->CR2 |= (1<<DALI_PULLUP_PIN); //slow slope
GPIOA->DDR |= 1<<2;
GPIOA->CR1 |= 1<<2;
GPIOA->CR2 |= 1<<2;
GPIOA->ODR |= 1<<2;
/* button pin for data input */
DALI_BUTTON_PORT->DDR &= ~(1<<DALI_BUTTON_PIN); //input mode
DALI_BUTTON_PORT->ODR &= ~(1<<DALI_BUTTON_PIN); //low level
DALI_BUTTON_PORT->CR1 |= (1<<DALI_BUTTON_PIN); //pull-up
DALI_BUTTON_PORT->CR2 &= ~(1<<DALI_BUTTON_PIN); //interrupt disable on pin
|