/*====================================================================================================*/
int main( void )
{
  uint8_t test = 0x01;

  GPIO_Config();
  SF595_Config();

  while(1) {

    for(test = 0x01; test < 0x80; test = test << 1) {
      LED_G_Toggle;
      SF595_SendByte(~test);
      Delay_10ms(5);
    }
    LED_G_Reset;
    for(test = 0x80; test > 0x01; test = test >> 1) {
      LED_B_Toggle;
      SF595_SendByte(~test);
      Delay_10ms(5);
    }
    LED_B_Reset;

    LED_R_Toggle;
    if(KEY_BO_Read == 1)
      SF595_Cmd(ENABLE);
    if(KEY_WU_Read == 1)
      SF595_Cmd(DISABLE);
  }
}
示例#2
0
/*====================================================================================================*/
int main( void )
{
  uint8_t Count = 0;
  uint8_t State = 0;

  GPIO_Config();
  SF595_Config();
  SF595_Init();

  while(1) {
    nrf_gpio_pin_toggle(LED_1);
    nrf_gpio_pin_toggle(LED_2);
    Delay_10ms(10);

    Count++;

    switch(State) {

        case 0:
          if (Count == 8) {
            SF595_Shift(0);
            State = 1;
          }
          else {
            SF595_Shift(0);
          }
          break;

        case 1:
          if (Count == 16) {
            SF595_Shift(1);
            State = 2;
          }
          else {
            SF595_Shift(1);
          }
          break;

        case 2:
          for(; State>0; State--) {
            SF595_SendByte(0x00);
            Delay_100ms(2);
            SF595_SendByte(0xFF);
            Delay_100ms(2);
          }
          Count = 0;
          break;
    }
  }
}