* RETURN VALUE
* Upon successfull completion, returns the number of bytes read. On error, returns a negative
* integer equivalent to errors from glibc.
- * -EBADFD : Device not initialized (-77)
- * -EBUSY : Device or ressource Busy or Arbitration lost (-16)
- * -EAGAIN : Device already in use (-11)
- * -EINVAL : Invalid argument (no cmd_buf, or no inbuff when count > 0) (-22)
- * -EREMOTEIO : Device did not acknowledge (-121)
- * -EIO : Bad one: Illegal start or stop, or illegal state in i2c state machine (-5)
*/
int i2c_read(const void *cmd_buf, size_t cmd_size, const void* ctrl_buf, void* inbuff, size_t count)
{
* RETURN VALUE
* Upon successfull completion, returns the number of bytes written. On error, returns a negative
* integer equivalent to errors from glibc.
- * -EBADFD : Device not initialized
- * -EBUSY : Device or ressource Busy or Arbitration lost
- * -EAGAIN : Device already in use
- * -EINVAL : Invalid argument (buf)
- * -EREMOTEIO : Device did not acknowledge
- * -EIO : Bad one: Illegal start or stop, or illegal state in i2c state machine
*/
int i2c_write(const void *buf, size_t count, const void* ctrl_buf)
{
uart->regs->func.buffer = data;
}
}
+ /* FIXME : handle RX erors */
}
static void uart_check_tx(struct uart_device* uart, uint32_t intr)
#include "drivers/i2c.h"
#include "extdrv/eeprom.h"
+/* FIXME : All of this will have to be re-written with an eeprom definition structure
+ * This will have the address, bus number, and eeprom type, in order to remove the static
+ * variables and hardcoded bus number from this code.
+ */
/***************************************************************************** */
/* Read and Write for eeprom */
* RETURN VALUE
* Upon successfull completion, returns the number of bytes read. On error, returns a negative
* integer equivalent to errors from glibc.
- * -EFAULT : address above eeprom size
- * -EBADFD : Device not initialized
- * -EBUSY : Device or ressource Busy or Arbitration lost
- * -EAGAIN : Device already in use
- * -EINVAL : Invalid argument (buf)
- * -EREMOTEIO : Device did not acknowledge
- * -EIO : Bad one: Illegal start or stop, or illegal state in i2c state machine
*/
#define CMD_BUF_SIZE 4
int eeprom_read(uint8_t eeprom_addr, uint32_t offset, void *buf, size_t count)
* RETURN VALUE
* Upon successfull completion, returns the number of bytes written. On error, returns a negative
* integer equivalent to errors from glibc.
- * -EFAULT : address above eeprom size
- * -EBADFD : Device not initialized
- * -EBUSY : Device or ressource Busy or Arbitration lost
- * -EAGAIN : Device already in use
- * -EINVAL : Invalid argument (buf)
- * -EREMOTEIO : Device did not acknowledge
- * -EIO : Bad one: Illegal start or stop, or illegal state in i2c state machine
*/
#define CMD_SIZE_SMALL 2
#define CMD_SIZE_BIG 3
* Return value(s):
* Upon successfull completion, returns 0 and the temperature read is placed in the
* provided integers. On error, returns a negative integer equivalent to errors from glibc.
- * -EBADFD : I2C not initialized
- * -EBUSY : Device or ressource Busy or Arbitration lost
- * -EINVAL : Invalid argument (buf)
- * -ENODEV : No such device
- * -EREMOTEIO : Device did not acknowledge : Any device present ?
- * -EIO : Bad one: Illegal start or stop, or illegal state in i2c state machine
*/
#define CMD_BUF_SIZE 3
int tmp101_sensor_read(struct tmp101_sensor_config* conf, uint16_t* raw, int* deci_degrees)
* Return value :
* Upon successfull completion, returns 0. On error, returns a negative integer
* equivalent to errors from glibc.
- * -EBADFD : I2C not initialized
- * -EBUSY : Device or ressource Busy or Arbitration lost
- * -EINVAL : Invalid argument (buf)
- * -ENODEV : No such device
- * -EREMOTEIO : Device did not acknowledge : Any device present ?
- * -EIO : Bad one: Illegal start or stop, or illegal state in i2c state machine
*/
#define CONF_BUF_SIZE 4
int tmp101_sensor_config(struct tmp101_sensor_config* conf)
* of the micro-controller (for bootloaders, drivers, loadable RTOS tasks, ....)
*/
+/*******************************************************************************/
+/* Direct access to IAP function */
/* Erase some pages from the user information block.
- * Page numbers may be 0, 1 or 2 for the LPC1224.
+ * Page numbers may be 0, 1 or 2 for the LPC122x.
* Provide the same page number as start and end to erase a single page.
* Of course, end page number MUST be higher than (or equal to) start page number.
* There is no way to erase only parts of a page.
#define FREQ_SEL_IRC FREQ_SEL_12MHz
/* Main clock config
- * We use external crystal and PLL0
+ * We use internal RC and PLL0
* Note that during PLL lock wait we are running on internal RC
*/
void clock_config(uint32_t freq_sel);
#define LPC_GPIO_REGS(x) ((struct lpc_gpio *) (LPC_AHB_BASE + (0x10000 * (x))))
+
+/***************************************************************************** */
/* Public access to GPIO setup */
#define GPIO_DIR_IN 0
LEVEL_LOW,
};
-/* GPIO Interrupts */
-/* Add a callback on a GPIO interrupt.
- * This call will configure the GPIO (call to config_pio()), set it as input and
- * activate the interrupt on the given 'sense' event. use the gpio_interrupt_senses
- * enum for 'sense' values.
- * The callback will receive the pin number as argument (but not the port number).
- * Note :
- * The interrupt hanlers are not efficient if the pin is not a low numbered one (require
- * 32 shifts + test for pin number 31).
- * Use them if you place the signals generating interrupts on low numbered pins.
- * When possible, get in touch with the people doing the electronic design, or change
- * the handlers in drivers/gpio.c
- */
-int set_gpio_callback(void (*callback) (uint32_t), const struct pio* gpio, uint8_t sense);
-void remove_gpio_callback(const struct pio* gpio);
-
/* GPIO Activation */
void gpio_on(void);
+
void gpio_off(void);
#define gpio_dir_in(gpio) \
void config_gpio(const struct pio* gpio, uint32_t mode, uint8_t dir, uint8_t ini_val);
+/* GPIO Interrupts */
+/* Add a callback on a GPIO interrupt.
+ * This call will configure the GPIO (call to config_pio()), set it as input and
+ * activate the interrupt on the given 'sense' event. use the gpio_interrupt_senses
+ * enum for 'sense' values.
+ * The callback will receive the pin number as argument (but not the port number).
+ * Note :
+ * The interrupt hanlers are not efficient if the pin is not a low numbered one (require
+ * 32 shifts + test for pin number 31).
+ * Use them if you place the signals generating interrupts on low numbered pins.
+ * When possible, get in touch with the people doing the electronic design, or change
+ * the handlers in drivers/gpio.c
+ */
+int set_gpio_callback(void (*callback) (uint32_t), const struct pio* gpio, uint8_t sense);
+
+void remove_gpio_callback(const struct pio* gpio);
+
+
+
+
#endif /* DRIVERS_GPIO_H */
* @author TI CC1101 library developed by Athanassios Mavrogeorgiadis (tmav Electronics)
* as template based on TI C8051 SOURCE CODE swrc021f
*
- * @section LICENSE
- *
* Copyright (c) 2010 ARM Limited
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
- * @section DESCRIPTION
- *
- * CC1101 Low-Power Sub-1 GHz RF Transceiver CC1101.
- *
* Datasheet:
*
* http://focus.ti.com/lit/ds/swrs061f/swrs061f.pdf
#include "lib/stdint.h"
+/* FIXME : All of this will have to be re-written with an eeprom definition structure */
+
/***************************************************************************** */
/* Read and Write for system eeprom */
/***************************************************************************** */
* RETURN VALUE
* Upon successfull completion, returns the number of bytes read. On error, returns a negative
* integer equivalent to errors from glibc.
- * -EFAULT : address above eeprom size
- * -EBADFD : Device not initialized
- * -EBUSY : Device or ressource Busy or Arbitration lost
- * -EAGAIN : Device already in use
- * -EINVAL : Invalid argument (buf)
- * -EREMOTEIO : Device did not acknowledge
- * -EIO : Bad one: Illegal start or stop, or illegal state in i2c state machine
*/
int eeprom_read(uint8_t eeprom_addr, uint32_t offset, void *buf, size_t count);
* RETURN VALUE
* Upon successfull completion, returns the number of bytes written. On error, returns a negative
* integer equivalent to errors from glibc.
- * -EFAULT : address above eeprom size
- * -EBADFD : Device not initialized
- * -EBUSY : Device or ressource Busy or Arbitration lost
- * -EAGAIN : Device already in use
- * -EINVAL : Invalid argument (buf)
- * -EREMOTEIO : Device did not acknowledge
- * -EIO : Bad one: Illegal start or stop, or illegal state in i2c state machine
*/
int eeprom_write(uint8_t eeprom_addr, uint32_t offset, const void *buf, size_t count);
/****************************************************************************
- * extdrv/temp.h
+ * extdrv/tmp101_temp_sensor.h
*
*
* Copyright 2012 Nathael Pajani <nathael.pajani@ed3l.fr>
/* Check the sensor presence, return 1 if found
* This is a basic check, it could be anything with the same address ...
- * addr: the sensor address on most significant bits.
*/
int tmp101_probe_sensor(struct tmp101_sensor_config* conf);
* Upon successfull completion, returns 0 and the temperature read is placed in the
* provided integer(s). On error, returns a negative integer equivalent to errors from
* glibc.
- * -EBADFD : I2C not initialized
- * -EBUSY : Device or ressource Busy or Arbitration lost
- * -EINVAL : Invalid argument (buf)
- * -ENODEV : No such device
- * -EREMOTEIO : Device did not acknowledge : Any device present ?
- * -EIO : Bad one: Illegal start or stop, or illegal state in i2c state machine
*/
int tmp101_sensor_read(struct tmp101_sensor_config* conf, uint16_t* raw, int* deci_degrees);
* Return value:
* Upon successfull completion, returns 0. On error, returns a negative integer
* equivalent to errors from glibc.
- * -EBADFD : I2C not initialized
- * -EBUSY : Device or ressource Busy or Arbitration lost
- * -EINVAL : Invalid argument (buf)
- * -ENODEV : No such device
- * -EREMOTEIO : Device did not acknowledge : Any device present ?
- * -EIO : Bad one: Illegal start or stop, or illegal state in i2c state machine
*/
int tmp101_sensor_config(struct tmp101_sensor_config* conf);
*/
int ws2812_set_pixel(uint16_t pixel_num, uint8_t red, uint8_t green, uint8_t blue);
-/* Read the value of a pixel (led) color from the data buffer (frame)
- * The returned value is the last value set using ws2812_set_pixel(), but not
- * necessarily the actual color of the led if ws2812_send_frame() has not been
- * called with a big enough value. It is the value that would be set when using
- * ws2812_send_frame() with 0 or with a value equal to or above the pixel number
- * in the ws2812_get_pixel() call.
- */
+/* Get a pixel (led) color from the data buffer */
int ws2812_get_pixel(uint16_t pixel_num, uint8_t* red, uint8_t* green, uint8_t* blue);
/* Clear the internal data buffer. */