int main() {


    int x = 0;
    
    init_hardware();
    
    init_spi();
    init_nrf();///////////////
    while(1)
    { 
        
        
        x++;
        if(x==10000)
        {        
            x = 0;
            LED2 = !LED2;
            LED1 = !LED1;
            
            tx_mode();
            txdat[0] = 'A';
            txdat[1] = '1';
            TXpayload (txdat);
            
        }
    }
    
    
}
void ST7540_transmit(uint8_t temp){
    //Set the appropriate flags and transmit
    tx_mode();
    ss_clear();
    spi_transmit(temp);
    ss_set();
    rx_mode();
}
void ST7540_setup(){
    reg_acc();
    tx_mode();
    
    while ((PIN_SPI  &   (1<<SCK))!=0);
    
    ss_clear();
    //Send configuration bytes to ST7540 control register
    spi_transmit(0x13);
    spi_transmit(0xB2);
    spi_transmit(0x32);
    ss_set();
}