Arduino Project Libraries  0.00
Stock and random Arduino Libraries
bcm2835.h File Reference
#include <stdint.h>
Include dependency graph for bcm2835.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define BCM2835_VERSION   10050 /* Version 1.50 */
 
#define HIGH   0x1
 
#define LOW   0x0
 
#define BCM2835_CORE_CLK_HZ   250000000
 
#define BMC2835_RPI2_DT_FILENAME   "/proc/device-tree/soc/ranges"
 
#define BMC2835_RPI2_DT_PERI_BASE_ADDRESS_OFFSET   4
 
#define BMC2835_RPI2_DT_PERI_SIZE_OFFSET   8
 
#define BCM2835_PERI_BASE   0x20000000
 
#define BCM2835_PERI_SIZE   0x01000000
 
#define BCM2835_ST_BASE   0x3000
 
#define BCM2835_GPIO_PADS   0x100000
 
#define BCM2835_CLOCK_BASE   0x101000
 
#define BCM2835_GPIO_BASE   0x200000
 
#define BCM2835_SPI0_BASE   0x204000
 
#define BCM2835_BSC0_BASE   0x205000
 
#define BCM2835_GPIO_PWM   0x20C000
 
#define BCM2835_BSC1_BASE   0x804000
 
#define BCM2835_PAGE_SIZE   (4*1024)
 
#define BCM2835_BLOCK_SIZE   (4*1024)
 
#define BCM2835_GPFSEL0   0x0000
 
#define BCM2835_GPFSEL1   0x0004
 
#define BCM2835_GPFSEL2   0x0008
 
#define BCM2835_GPFSEL3   0x000c
 
#define BCM2835_GPFSEL4   0x0010
 
#define BCM2835_GPFSEL5   0x0014
 
#define BCM2835_GPSET0   0x001c
 
#define BCM2835_GPSET1   0x0020
 
#define BCM2835_GPCLR0   0x0028
 
#define BCM2835_GPCLR1   0x002c
 
#define BCM2835_GPLEV0   0x0034
 
#define BCM2835_GPLEV1   0x0038
 
#define BCM2835_GPEDS0   0x0040
 
#define BCM2835_GPEDS1   0x0044
 
#define BCM2835_GPREN0   0x004c
 
#define BCM2835_GPREN1   0x0050
 
#define BCM2835_GPFEN0   0x0058
 
#define BCM2835_GPFEN1   0x005c
 
#define BCM2835_GPHEN0   0x0064
 
#define BCM2835_GPHEN1   0x0068
 
#define BCM2835_GPLEN0   0x0070
 
#define BCM2835_GPLEN1   0x0074
 
#define BCM2835_GPAREN0   0x007c
 
#define BCM2835_GPAREN1   0x0080
 
#define BCM2835_GPAFEN0   0x0088
 
#define BCM2835_GPAFEN1   0x008c
 
#define BCM2835_GPPUD   0x0094
 
#define BCM2835_GPPUDCLK0   0x0098
 
#define BCM2835_GPPUDCLK1   0x009c
 
#define BCM2835_PADS_GPIO_0_27   0x002c
 
#define BCM2835_PADS_GPIO_28_45   0x0030
 
#define BCM2835_PADS_GPIO_46_53   0x0034
 
#define BCM2835_PAD_PASSWRD   (0x5A << 24)
 
#define BCM2835_PAD_SLEW_RATE_UNLIMITED   0x10
 
#define BCM2835_PAD_HYSTERESIS_ENABLED   0x08
 
#define BCM2835_PAD_DRIVE_2mA   0x00
 
#define BCM2835_PAD_DRIVE_4mA   0x01
 
#define BCM2835_PAD_DRIVE_6mA   0x02
 
#define BCM2835_PAD_DRIVE_8mA   0x03
 
#define BCM2835_PAD_DRIVE_10mA   0x04
 
#define BCM2835_PAD_DRIVE_12mA   0x05
 
#define BCM2835_PAD_DRIVE_14mA   0x06
 
#define BCM2835_PAD_DRIVE_16mA   0x07
 
#define BCM2835_SPI0_CS   0x0000
 
#define BCM2835_SPI0_FIFO   0x0004
 
#define BCM2835_SPI0_CLK   0x0008
 
#define BCM2835_SPI0_DLEN   0x000c
 
#define BCM2835_SPI0_LTOH   0x0010
 
#define BCM2835_SPI0_DC   0x0014
 
#define BCM2835_SPI0_CS_LEN_LONG   0x02000000
 
#define BCM2835_SPI0_CS_DMA_LEN   0x01000000
 
#define BCM2835_SPI0_CS_CSPOL2   0x00800000
 
#define BCM2835_SPI0_CS_CSPOL1   0x00400000
 
#define BCM2835_SPI0_CS_CSPOL0   0x00200000
 
#define BCM2835_SPI0_CS_RXF   0x00100000
 
#define BCM2835_SPI0_CS_RXR   0x00080000
 
#define BCM2835_SPI0_CS_TXD   0x00040000
 
#define BCM2835_SPI0_CS_RXD   0x00020000
 
#define BCM2835_SPI0_CS_DONE   0x00010000
 
#define BCM2835_SPI0_CS_TE_EN   0x00008000
 
#define BCM2835_SPI0_CS_LMONO   0x00004000
 
#define BCM2835_SPI0_CS_LEN   0x00002000
 
#define BCM2835_SPI0_CS_REN   0x00001000
 
#define BCM2835_SPI0_CS_ADCS   0x00000800
 
#define BCM2835_SPI0_CS_INTR   0x00000400
 
#define BCM2835_SPI0_CS_INTD   0x00000200
 
#define BCM2835_SPI0_CS_DMAEN   0x00000100
 
#define BCM2835_SPI0_CS_TA   0x00000080
 
#define BCM2835_SPI0_CS_CSPOL   0x00000040
 
#define BCM2835_SPI0_CS_CLEAR   0x00000030
 
#define BCM2835_SPI0_CS_CLEAR_RX   0x00000020
 
#define BCM2835_SPI0_CS_CLEAR_TX   0x00000010
 
#define BCM2835_SPI0_CS_CPOL   0x00000008
 
#define BCM2835_SPI0_CS_CPHA   0x00000004
 
#define BCM2835_SPI0_CS_CS   0x00000003
 
#define BCM2835_SPI_SPEED_64MHZ   BCM2835_SPI_CLOCK_DIVIDER_4
 bcm2835SPISpeed Specifies the divider used to generate the SPI clock from the system clock. Figures below give the clock speed instead of clock divider. More...
 
#define BCM2835_SPI_SPEED_32MHZ   BCM2835_SPI_CLOCK_DIVIDER_8
 
#define BCM2835_SPI_SPEED_16MHZ   BCM2835_SPI_CLOCK_DIVIDER_16
 
#define BCM2835_SPI_SPEED_8MHZ   BCM2835_SPI_CLOCK_DIVIDER_32
 
#define BCM2835_SPI_SPEED_4MHZ   BCM2835_SPI_CLOCK_DIVIDER_64
 
#define BCM2835_SPI_SPEED_2MHZ   BCM2835_SPI_CLOCK_DIVIDER_128
 
#define BCM2835_SPI_SPEED_1MHZ   BCM2835_SPI_CLOCK_DIVIDER_256
 
#define BCM2835_SPI_SPEED_512KHZ   BCM2835_SPI_CLOCK_DIVIDER_512
 
#define BCM2835_SPI_SPEED_256KHZ   BCM2835_SPI_CLOCK_DIVIDER_1024
 
#define BCM2835_SPI_SPEED_128KHZ   BCM2835_SPI_CLOCK_DIVIDER_2048
 
#define BCM2835_SPI_SPEED_64KHZ   BCM2835_SPI_CLOCK_DIVIDER_4096
 
#define BCM2835_SPI_SPEED_32KHZ   BCM2835_SPI_CLOCK_DIVIDER_8192
 
#define BCM2835_SPI_SPEED_16KHZ   BCM2835_SPI_CLOCK_DIVIDER_16384
 
#define BCM2835_SPI_SPEED_8KHZ   BCM2835_SPI_CLOCK_DIVIDER_32768
 
#define BCM2835_BSC_C   0x0000
 
#define BCM2835_BSC_S   0x0004
 
#define BCM2835_BSC_DLEN   0x0008
 
#define BCM2835_BSC_A   0x000c
 
#define BCM2835_BSC_FIFO   0x0010
 
#define BCM2835_BSC_DIV   0x0014
 
#define BCM2835_BSC_DEL   0x0018
 
#define BCM2835_BSC_CLKT   0x001c
 
#define BCM2835_BSC_C_I2CEN   0x00008000
 
#define BCM2835_BSC_C_INTR   0x00000400
 
#define BCM2835_BSC_C_INTT   0x00000200
 
#define BCM2835_BSC_C_INTD   0x00000100
 
#define BCM2835_BSC_C_ST   0x00000080
 
#define BCM2835_BSC_C_CLEAR_1   0x00000020
 
#define BCM2835_BSC_C_CLEAR_2   0x00000010
 
#define BCM2835_BSC_C_READ   0x00000001
 
#define BCM2835_BSC_S_CLKT   0x00000200
 
#define BCM2835_BSC_S_ERR   0x00000100
 
#define BCM2835_BSC_S_RXF   0x00000080
 
#define BCM2835_BSC_S_TXE   0x00000040
 
#define BCM2835_BSC_S_RXD   0x00000020
 
#define BCM2835_BSC_S_TXD   0x00000010
 
#define BCM2835_BSC_S_RXR   0x00000008
 
#define BCM2835_BSC_S_TXW   0x00000004
 
#define BCM2835_BSC_S_DONE   0x00000002
 
#define BCM2835_BSC_S_TA   0x00000001
 
#define BCM2835_BSC_FIFO_SIZE   16
 
#define BCM2835_ST_CS   0x0000
 
#define BCM2835_ST_CLO   0x0004
 
#define BCM2835_ST_CHI   0x0008
 
#define BCM2835_PWM_CONTROL   0
 
#define BCM2835_PWM_STATUS   1
 
#define BCM2835_PWM_DMAC   2
 
#define BCM2835_PWM0_RANGE   4
 
#define BCM2835_PWM0_DATA   5
 
#define BCM2835_PWM_FIF1   6
 
#define BCM2835_PWM1_RANGE   8
 
#define BCM2835_PWM1_DATA   9
 
#define BCM2835_PWMCLK_CNTL   40
 
#define BCM2835_PWMCLK_DIV   41
 
#define BCM2835_PWM_PASSWRD   (0x5A << 24)
 
#define BCM2835_PWM1_MS_MODE   0x8000
 
#define BCM2835_PWM1_USEFIFO   0x2000
 
#define BCM2835_PWM1_REVPOLAR   0x1000
 
#define BCM2835_PWM1_OFFSTATE   0x0800
 
#define BCM2835_PWM1_REPEATFF   0x0400
 
#define BCM2835_PWM1_SERIAL   0x0200
 
#define BCM2835_PWM1_ENABLE   0x0100
 
#define BCM2835_PWM0_MS_MODE   0x0080
 
#define BCM2835_PWM_CLEAR_FIFO   0x0040
 
#define BCM2835_PWM0_USEFIFO   0x0020
 
#define BCM2835_PWM0_REVPOLAR   0x0010
 
#define BCM2835_PWM0_OFFSTATE   0x0008
 
#define BCM2835_PWM0_REPEATFF   0x0004
 
#define BCM2835_PWM0_SERIAL   0x0002
 
#define BCM2835_PWM0_ENABLE   0x0001
 
#define delay(x)   bcm2835_delay(x)
 
#define delayMicroseconds(x)   bcm2835_delayMicroseconds(x)
 
#define millis()   bcm2835_millis()
 

Enumerations

enum  bcm2835RegisterBase {
  BCM2835_REGBASE_ST = 1, BCM2835_REGBASE_GPIO = 2, BCM2835_REGBASE_PWM = 3, BCM2835_REGBASE_CLK = 4,
  BCM2835_REGBASE_PADS = 5, BCM2835_REGBASE_SPI0 = 6, BCM2835_REGBASE_BSC0 = 7, BCM2835_REGBASE_BSC1 = 8
}
 bcm2835RegisterBase Register bases for bcm2835_regbase() More...
 
enum  bcm2835FunctionSelect {
  BCM2835_GPIO_FSEL_INPT = 0x00, BCM2835_GPIO_FSEL_OUTP = 0x01, BCM2835_GPIO_FSEL_ALT0 = 0x04, BCM2835_GPIO_FSEL_ALT1 = 0x05,
  BCM2835_GPIO_FSEL_ALT2 = 0x06, BCM2835_GPIO_FSEL_ALT3 = 0x07, BCM2835_GPIO_FSEL_ALT4 = 0x03, BCM2835_GPIO_FSEL_ALT5 = 0x02,
  BCM2835_GPIO_FSEL_MASK = 0x07
}
 bcm2835PortFunction Port function select modes for bcm2835_gpio_fsel() More...
 
enum  bcm2835PUDControl { BCM2835_GPIO_PUD_OFF = 0x00, BCM2835_GPIO_PUD_DOWN = 0x01, BCM2835_GPIO_PUD_UP = 0x02 }
 bcm2835PUDControl Pullup/Pulldown defines for bcm2835_gpio_pud() More...
 
enum  bcm2835PadGroup { BCM2835_PAD_GROUP_GPIO_0_27 = 0, BCM2835_PAD_GROUP_GPIO_28_45 = 1, BCM2835_PAD_GROUP_GPIO_46_53 = 2 }
 bcm2835PadGroup Pad group specification for bcm2835_gpio_pad() More...
 
enum  RPiGPIOPin {
  RPI_GPIO_P1_03 = 0, RPI_GPIO_P1_05 = 1, RPI_GPIO_P1_07 = 4, RPI_GPIO_P1_08 = 14,
  RPI_GPIO_P1_10 = 15, RPI_GPIO_P1_11 = 17, RPI_GPIO_P1_12 = 18, RPI_GPIO_P1_13 = 21,
  RPI_GPIO_P1_15 = 22, RPI_GPIO_P1_16 = 23, RPI_GPIO_P1_18 = 24, RPI_GPIO_P1_19 = 10,
  RPI_GPIO_P1_21 = 9, RPI_GPIO_P1_22 = 25, RPI_GPIO_P1_23 = 11, RPI_GPIO_P1_24 = 8,
  RPI_GPIO_P1_26 = 7, RPI_V2_GPIO_P1_03 = 2, RPI_V2_GPIO_P1_05 = 3, RPI_V2_GPIO_P1_07 = 4,
  RPI_V2_GPIO_P1_08 = 14, RPI_V2_GPIO_P1_10 = 15, RPI_V2_GPIO_P1_11 = 17, RPI_V2_GPIO_P1_12 = 18,
  RPI_V2_GPIO_P1_13 = 27, RPI_V2_GPIO_P1_15 = 22, RPI_V2_GPIO_P1_16 = 23, RPI_V2_GPIO_P1_18 = 24,
  RPI_V2_GPIO_P1_19 = 10, RPI_V2_GPIO_P1_21 = 9, RPI_V2_GPIO_P1_22 = 25, RPI_V2_GPIO_P1_23 = 11,
  RPI_V2_GPIO_P1_24 = 8, RPI_V2_GPIO_P1_26 = 7, RPI_V2_GPIO_P1_29 = 5, RPI_V2_GPIO_P1_31 = 6,
  RPI_V2_GPIO_P1_32 = 12, RPI_V2_GPIO_P1_33 = 13, RPI_V2_GPIO_P1_35 = 19, RPI_V2_GPIO_P1_36 = 16,
  RPI_V2_GPIO_P1_37 = 26, RPI_V2_GPIO_P1_38 = 20, RPI_V2_GPIO_P1_40 = 21, RPI_V2_GPIO_P5_03 = 28,
  RPI_V2_GPIO_P5_04 = 29, RPI_V2_GPIO_P5_05 = 30, RPI_V2_GPIO_P5_06 = 31, RPI_BPLUS_GPIO_J8_03 = 2,
  RPI_BPLUS_GPIO_J8_05 = 3, RPI_BPLUS_GPIO_J8_07 = 4, RPI_BPLUS_GPIO_J8_08 = 14, RPI_BPLUS_GPIO_J8_10 = 15,
  RPI_BPLUS_GPIO_J8_11 = 17, RPI_BPLUS_GPIO_J8_12 = 18, RPI_BPLUS_GPIO_J8_13 = 27, RPI_BPLUS_GPIO_J8_15 = 22,
  RPI_BPLUS_GPIO_J8_16 = 23, RPI_BPLUS_GPIO_J8_18 = 24, RPI_BPLUS_GPIO_J8_19 = 10, RPI_BPLUS_GPIO_J8_21 = 9,
  RPI_BPLUS_GPIO_J8_22 = 25, RPI_BPLUS_GPIO_J8_23 = 11, RPI_BPLUS_GPIO_J8_24 = 8, RPI_BPLUS_GPIO_J8_26 = 7,
  RPI_BPLUS_GPIO_J8_29 = 5, RPI_BPLUS_GPIO_J8_31 = 6, RPI_BPLUS_GPIO_J8_32 = 12, RPI_BPLUS_GPIO_J8_33 = 13,
  RPI_BPLUS_GPIO_J8_35 = 19, RPI_BPLUS_GPIO_J8_36 = 16, RPI_BPLUS_GPIO_J8_37 = 26, RPI_BPLUS_GPIO_J8_38 = 20,
  RPI_BPLUS_GPIO_J8_40 = 21
}
 GPIO Pin Numbers. More...
 
enum  bcm2835SPIBitOrder { BCM2835_SPI_BIT_ORDER_LSBFIRST = 0, BCM2835_SPI_BIT_ORDER_MSBFIRST = 1 }
 bcm2835SPIBitOrder SPI Bit order Specifies the SPI data bit ordering for bcm2835_spi_setBitOrder() More...
 
enum  bcm2835SPIMode { BCM2835_SPI_MODE0 = 0, BCM2835_SPI_MODE1 = 1, BCM2835_SPI_MODE2 = 2, BCM2835_SPI_MODE3 = 3 }
 SPI Data mode Specify the SPI data mode to be passed to bcm2835_spi_setDataMode() More...
 
enum  bcm2835SPIChipSelect { BCM2835_SPI_CS0 = 0, BCM2835_SPI_CS1 = 1, BCM2835_SPI_CS2 = 2, BCM2835_SPI_CS_NONE = 3 }
 bcm2835SPIChipSelect Specify the SPI chip select pin(s) More...
 
enum  bcm2835SPIClockDivider {
  BCM2835_SPI_CLOCK_DIVIDER_65536 = 0, BCM2835_SPI_CLOCK_DIVIDER_32768 = 32768, BCM2835_SPI_CLOCK_DIVIDER_16384 = 16384, BCM2835_SPI_CLOCK_DIVIDER_8192 = 8192,
  BCM2835_SPI_CLOCK_DIVIDER_4096 = 4096, BCM2835_SPI_CLOCK_DIVIDER_2048 = 2048, BCM2835_SPI_CLOCK_DIVIDER_1024 = 1024, BCM2835_SPI_CLOCK_DIVIDER_512 = 512,
  BCM2835_SPI_CLOCK_DIVIDER_256 = 256, BCM2835_SPI_CLOCK_DIVIDER_128 = 128, BCM2835_SPI_CLOCK_DIVIDER_64 = 64, BCM2835_SPI_CLOCK_DIVIDER_32 = 32,
  BCM2835_SPI_CLOCK_DIVIDER_16 = 16, BCM2835_SPI_CLOCK_DIVIDER_8 = 8, BCM2835_SPI_CLOCK_DIVIDER_4 = 4, BCM2835_SPI_CLOCK_DIVIDER_2 = 2,
  BCM2835_SPI_CLOCK_DIVIDER_1 = 1
}
 bcm2835SPIClockDivider Specifies the divider used to generate the SPI clock from the system clock. Figures below give the divider, clock period and clock frequency. Clock divided is based on nominal base clock rate of 250MHz It is reported that (contrary to the documentation) any even divider may used. The frequencies shown for each divider have been confirmed by measurement. More...
 
enum  bcm2835I2CClockDivider { BCM2835_I2C_CLOCK_DIVIDER_2500 = 2500, BCM2835_I2C_CLOCK_DIVIDER_626 = 626, BCM2835_I2C_CLOCK_DIVIDER_150 = 150, BCM2835_I2C_CLOCK_DIVIDER_148 = 148 }
 bcm2835I2CClockDivider Specifies the divider used to generate the I2C clock from the system clock. Clock divided is based on nominal base clock rate of 250MHz More...
 
enum  bcm2835I2CReasonCodes { BCM2835_I2C_REASON_OK = 0x00, BCM2835_I2C_REASON_ERROR_NACK = 0x01, BCM2835_I2C_REASON_ERROR_CLKT = 0x02, BCM2835_I2C_REASON_ERROR_DATA = 0x04 }
 bcm2835I2CReasonCodes Specifies the reason codes for the bcm2835_i2c_write and bcm2835_i2c_read functions. More...
 
enum  bcm2835PWMClockDivider {
  BCM2835_PWM_CLOCK_DIVIDER_2048 = 2048, BCM2835_PWM_CLOCK_DIVIDER_1024 = 1024, BCM2835_PWM_CLOCK_DIVIDER_512 = 512, BCM2835_PWM_CLOCK_DIVIDER_256 = 256,
  BCM2835_PWM_CLOCK_DIVIDER_128 = 128, BCM2835_PWM_CLOCK_DIVIDER_64 = 64, BCM2835_PWM_CLOCK_DIVIDER_32 = 32, BCM2835_PWM_CLOCK_DIVIDER_16 = 16,
  BCM2835_PWM_CLOCK_DIVIDER_8 = 8, BCM2835_PWM_CLOCK_DIVIDER_4 = 4, BCM2835_PWM_CLOCK_DIVIDER_2 = 2, BCM2835_PWM_CLOCK_DIVIDER_1 = 1
}
 bcm2835PWMClockDivider Specifies the divider used to generate the PWM clock from the system clock. Figures below give the divider, clock period and clock frequency. Clock divided is based on nominal PWM base clock rate of 19.2MHz The frequencies shown for each divider have been confirmed by measurement More...
 

Functions

int bcm2835_init (void)
 
int bcm2835_close (void)
 
void bcm2835_set_debug (uint8_t debug)
 
unsigned int bcm2835_version (void)
 
uint32_t * bcm2835_regbase (uint8_t regbase)
 
uint32_t bcm2835_peri_read (volatile uint32_t *paddr)
 
uint32_t bcm2835_peri_read_nb (volatile uint32_t *paddr)
 
void bcm2835_peri_write (volatile uint32_t *paddr, uint32_t value)
 
void bcm2835_peri_write_nb (volatile uint32_t *paddr, uint32_t value)
 
void bcm2835_peri_set_bits (volatile uint32_t *paddr, uint32_t value, uint32_t mask)
 
void bcm2835_gpio_fsel (uint8_t pin, uint8_t mode)
 
void bcm2835_gpio_set (uint8_t pin)
 
void bcm2835_gpio_clr (uint8_t pin)
 
void bcm2835_gpio_set_multi (uint32_t mask)
 
void bcm2835_gpio_clr_multi (uint32_t mask)
 
uint8_t bcm2835_gpio_lev (uint8_t pin)
 
uint8_t bcm2835_gpio_eds (uint8_t pin)
 
uint32_t bcm2835_gpio_eds_multi (uint32_t mask)
 
void bcm2835_gpio_set_eds (uint8_t pin)
 
void bcm2835_gpio_set_eds_multi (uint32_t mask)
 
void bcm2835_gpio_ren (uint8_t pin)
 
void bcm2835_gpio_clr_ren (uint8_t pin)
 
void bcm2835_gpio_fen (uint8_t pin)
 
void bcm2835_gpio_clr_fen (uint8_t pin)
 
void bcm2835_gpio_hen (uint8_t pin)
 
void bcm2835_gpio_clr_hen (uint8_t pin)
 
void bcm2835_gpio_len (uint8_t pin)
 
void bcm2835_gpio_clr_len (uint8_t pin)
 
void bcm2835_gpio_aren (uint8_t pin)
 
void bcm2835_gpio_clr_aren (uint8_t pin)
 
void bcm2835_gpio_afen (uint8_t pin)
 
void bcm2835_gpio_clr_afen (uint8_t pin)
 
void bcm2835_gpio_pud (uint8_t pud)
 
void bcm2835_gpio_pudclk (uint8_t pin, uint8_t on)
 
uint32_t bcm2835_gpio_pad (uint8_t group)
 
void bcm2835_gpio_set_pad (uint8_t group, uint32_t control)
 
void bcm2835_delay (unsigned int millis)
 
void bcm2835_delayMicroseconds (uint64_t micros)
 
unsigned int bcm2835_millis (void)
 Indicate the number of milliseconds since startup of PI This function is like the Arduino millis function. More...
 
void bcm2835_gpio_write (uint8_t pin, uint8_t on)
 
void bcm2835_gpio_write_multi (uint32_t mask, uint8_t on)
 
void bcm2835_gpio_write_mask (uint32_t value, uint32_t mask)
 
void bcm2835_gpio_set_pud (uint8_t pin, uint8_t pud)
 
int bcm2835_spi_begin (void)
 
void bcm2835_spi_end (void)
 
void bcm2835_spi_setBitOrder (uint8_t order)
 
void bcm2835_spi_setClockDivider (uint16_t divider)
 
void bcm2835_spi_setDataMode (uint8_t mode)
 
void bcm2835_spi_chipSelect (uint8_t cs)
 
void bcm2835_spi_setChipSelectPolarity (uint8_t cs, uint8_t active)
 
uint8_t bcm2835_spi_transfer (uint8_t value)
 
void bcm2835_spi_transfernb (char *tbuf, char *rbuf, uint32_t len)
 
void bcm2835_spi_transfern (char *buf, uint32_t len)
 
void bcm2835_spi_writenb (char *buf, uint32_t len)
 
int bcm2835_i2c_begin (void)
 
void bcm2835_i2c_end (void)
 
void bcm2835_i2c_setSlaveAddress (uint8_t addr)
 
void bcm2835_i2c_setClockDivider (uint16_t divider)
 
void bcm2835_i2c_set_baudrate (uint32_t baudrate)
 
uint8_t bcm2835_i2c_write (const char *buf, uint32_t len)
 
uint8_t bcm2835_i2c_read (char *buf, uint32_t len)
 
uint8_t bcm2835_i2c_read_register_rs (char *regaddr, char *buf, uint32_t len)
 
uint8_t bcm2835_i2c_write_read_rs (char *cmds, uint32_t cmds_len, char *buf, uint32_t buf_len)
 
uint64_t bcm2835_st_read (void)
 
void bcm2835_st_delay (uint64_t offset_micros, uint64_t micros)
 
void bcm2835_pwm_set_clock (uint32_t divisor)
 
void bcm2835_pwm_set_mode (uint8_t channel, uint8_t markspace, uint8_t enabled)
 
void bcm2835_pwm_set_range (uint8_t channel, uint32_t range)
 
void bcm2835_pwm_set_data (uint8_t channel, uint32_t data)
 

Variables

uint32_t * bcm2835_peripherals_base
 
uint32_t bcm2835_peripherals_size
 
uint32_t * bcm2835_peripherals
 
volatile uint32_t * bcm2835_st
 
volatile uint32_t * bcm2835_gpio
 
volatile uint32_t * bcm2835_pwm
 
volatile uint32_t * bcm2835_clk
 
volatile uint32_t * bcm2835_pads
 
volatile uint32_t * bcm2835_spi0
 
volatile uint32_t * bcm2835_bsc0
 
volatile uint32_t * bcm2835_bsc1
 

Macro Definition Documentation

◆ BCM2835_PWM0_DATA

#define BCM2835_PWM0_DATA   5

Definition at line 980 of file bcm2835.h.

◆ BCM2835_PWM0_ENABLE

#define BCM2835_PWM0_ENABLE   0x0001

Channel Enable

Definition at line 1005 of file bcm2835.h.

◆ BCM2835_PWM0_MS_MODE

#define BCM2835_PWM0_MS_MODE   0x0080

Run in Mark/Space mode

Definition at line 998 of file bcm2835.h.

◆ BCM2835_PWM0_OFFSTATE

#define BCM2835_PWM0_OFFSTATE   0x0008

Ouput Off state

Definition at line 1002 of file bcm2835.h.

◆ BCM2835_PWM0_RANGE

#define BCM2835_PWM0_RANGE   4

Definition at line 979 of file bcm2835.h.

◆ BCM2835_PWM0_REPEATFF

#define BCM2835_PWM0_REPEATFF   0x0004

Repeat last value if FIFO empty

Definition at line 1003 of file bcm2835.h.

◆ BCM2835_PWM0_REVPOLAR

#define BCM2835_PWM0_REVPOLAR   0x0010

Reverse polarity

Definition at line 1001 of file bcm2835.h.

◆ BCM2835_PWM0_SERIAL

#define BCM2835_PWM0_SERIAL   0x0002

Run in serial mode

Definition at line 1004 of file bcm2835.h.

◆ BCM2835_PWM0_USEFIFO

#define BCM2835_PWM0_USEFIFO   0x0020

Data from FIFO

Definition at line 1000 of file bcm2835.h.

◆ BCM2835_PWM1_DATA

#define BCM2835_PWM1_DATA   9

Definition at line 983 of file bcm2835.h.

◆ BCM2835_PWM1_ENABLE

#define BCM2835_PWM1_ENABLE   0x0100

Channel Enable

Definition at line 996 of file bcm2835.h.

◆ BCM2835_PWM1_MS_MODE

#define BCM2835_PWM1_MS_MODE   0x8000

Run in Mark/Space mode

Definition at line 990 of file bcm2835.h.

◆ BCM2835_PWM1_OFFSTATE

#define BCM2835_PWM1_OFFSTATE   0x0800

Ouput Off state

Definition at line 993 of file bcm2835.h.

◆ BCM2835_PWM1_RANGE

#define BCM2835_PWM1_RANGE   8

Definition at line 982 of file bcm2835.h.

◆ BCM2835_PWM1_REPEATFF

#define BCM2835_PWM1_REPEATFF   0x0400

Repeat last value if FIFO empty

Definition at line 994 of file bcm2835.h.

◆ BCM2835_PWM1_REVPOLAR

#define BCM2835_PWM1_REVPOLAR   0x1000

Reverse polarity

Definition at line 992 of file bcm2835.h.

◆ BCM2835_PWM1_SERIAL

#define BCM2835_PWM1_SERIAL   0x0200

Run in serial mode

Definition at line 995 of file bcm2835.h.

◆ BCM2835_PWM1_USEFIFO

#define BCM2835_PWM1_USEFIFO   0x2000

Data from FIFO

Definition at line 991 of file bcm2835.h.

◆ BCM2835_PWM_CLEAR_FIFO

#define BCM2835_PWM_CLEAR_FIFO   0x0040

Clear FIFO

Definition at line 999 of file bcm2835.h.

◆ BCM2835_PWM_CONTROL

#define BCM2835_PWM_CONTROL   0

Definition at line 976 of file bcm2835.h.

◆ BCM2835_PWM_DMAC

#define BCM2835_PWM_DMAC   2

Definition at line 978 of file bcm2835.h.

◆ BCM2835_PWM_FIF1

#define BCM2835_PWM_FIF1   6

Definition at line 981 of file bcm2835.h.

◆ BCM2835_PWM_PASSWRD

#define BCM2835_PWM_PASSWRD   (0x5A << 24)

Password to enable setting PWM clock

Definition at line 988 of file bcm2835.h.

◆ BCM2835_PWM_STATUS

#define BCM2835_PWM_STATUS   1

Definition at line 977 of file bcm2835.h.

◆ BCM2835_PWMCLK_CNTL

#define BCM2835_PWMCLK_CNTL   40

Definition at line 986 of file bcm2835.h.

◆ BCM2835_PWMCLK_DIV

#define BCM2835_PWMCLK_DIV   41

Definition at line 987 of file bcm2835.h.

◆ BCM2835_VERSION

#define BCM2835_VERSION   10050 /* Version 1.50 */

Definition at line 461 of file bcm2835.h.

◆ delay

#define delay (   x)    bcm2835_delay(x)

Definition at line 1031 of file bcm2835.h.

◆ delayMicroseconds

#define delayMicroseconds (   x)    bcm2835_delayMicroseconds(x)

Definition at line 1032 of file bcm2835.h.

◆ millis

#define millis (   void)    bcm2835_millis()

Definition at line 1033 of file bcm2835.h.

Enumeration Type Documentation

◆ bcm2835PWMClockDivider

bcm2835PWMClockDivider Specifies the divider used to generate the PWM clock from the system clock. Figures below give the divider, clock period and clock frequency. Clock divided is based on nominal PWM base clock rate of 19.2MHz The frequencies shown for each divider have been confirmed by measurement

Enumerator
BCM2835_PWM_CLOCK_DIVIDER_2048 

2048 = 9.375kHz

BCM2835_PWM_CLOCK_DIVIDER_1024 

1024 = 18.75kHz

BCM2835_PWM_CLOCK_DIVIDER_512 

512 = 37.5kHz

BCM2835_PWM_CLOCK_DIVIDER_256 

256 = 75kHz

BCM2835_PWM_CLOCK_DIVIDER_128 

128 = 150kHz

BCM2835_PWM_CLOCK_DIVIDER_64 

64 = 300kHz

BCM2835_PWM_CLOCK_DIVIDER_32 

32 = 600.0kHz

BCM2835_PWM_CLOCK_DIVIDER_16 

16 = 1.2MHz

BCM2835_PWM_CLOCK_DIVIDER_8 

8 = 2.4MHz

BCM2835_PWM_CLOCK_DIVIDER_4 

4 = 4.8MHz

BCM2835_PWM_CLOCK_DIVIDER_2 

2 = 9.6MHz, fastest you can get

BCM2835_PWM_CLOCK_DIVIDER_1 

1 = 4.6875kHz, same as divider 4096

Definition at line 1013 of file bcm2835.h.

1014 {
1015  BCM2835_PWM_CLOCK_DIVIDER_2048 = 2048, /*!< 2048 = 9.375kHz */
1016  BCM2835_PWM_CLOCK_DIVIDER_1024 = 1024, /*!< 1024 = 18.75kHz */
1017  BCM2835_PWM_CLOCK_DIVIDER_512 = 512, /*!< 512 = 37.5kHz */
1018  BCM2835_PWM_CLOCK_DIVIDER_256 = 256, /*!< 256 = 75kHz */
1019  BCM2835_PWM_CLOCK_DIVIDER_128 = 128, /*!< 128 = 150kHz */
1020  BCM2835_PWM_CLOCK_DIVIDER_64 = 64, /*!< 64 = 300kHz */
1021  BCM2835_PWM_CLOCK_DIVIDER_32 = 32, /*!< 32 = 600.0kHz */
1022  BCM2835_PWM_CLOCK_DIVIDER_16 = 16, /*!< 16 = 1.2MHz */
1023  BCM2835_PWM_CLOCK_DIVIDER_8 = 8, /*!< 8 = 2.4MHz */
1024  BCM2835_PWM_CLOCK_DIVIDER_4 = 4, /*!< 4 = 4.8MHz */
1025  BCM2835_PWM_CLOCK_DIVIDER_2 = 2, /*!< 2 = 9.6MHz, fastest you can get */
1026  BCM2835_PWM_CLOCK_DIVIDER_1 = 1 /*!< 1 = 4.6875kHz, same as divider 4096 */
bcm2835PWMClockDivider
bcm2835PWMClockDivider Specifies the divider used to generate the PWM clock from the system clock...
Definition: bcm2835.h:1013