![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
sleep library for cortex m0
Fork of cortexm0sleepmodes by
pca9865.h@0:e8a124690cda, 2013-09-27 (annotated)
- Committer:
- asifahmad
- Date:
- Fri Sep 27 18:13:20 2013 +0000
- Revision:
- 0:e8a124690cda
sleep
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
asifahmad | 0:e8a124690cda | 1 | /**************************************************************************/ |
asifahmad | 0:e8a124690cda | 2 | /*! |
asifahmad | 0:e8a124690cda | 3 | @file pca9685.h |
asifahmad | 0:e8a124690cda | 4 | @author K. Townsend (microBuilder.eu) |
asifahmad | 0:e8a124690cda | 5 | |
asifahmad | 0:e8a124690cda | 6 | @section LICENSE |
asifahmad | 0:e8a124690cda | 7 | |
asifahmad | 0:e8a124690cda | 8 | Software License Agreement (BSD License) |
asifahmad | 0:e8a124690cda | 9 | |
asifahmad | 0:e8a124690cda | 10 | Copyright (c) 2012 K. Townsend |
asifahmad | 0:e8a124690cda | 11 | All rights reserved. |
asifahmad | 0:e8a124690cda | 12 | |
asifahmad | 0:e8a124690cda | 13 | Redistribution and use in source and binary forms, with or without |
asifahmad | 0:e8a124690cda | 14 | modification, are permitted provided that the following conditions are met: |
asifahmad | 0:e8a124690cda | 15 | 1. Redistributions of source code must retain the above copyright |
asifahmad | 0:e8a124690cda | 16 | notice, this list of conditions and the following disclaimer. |
asifahmad | 0:e8a124690cda | 17 | 2. Redistributions in binary form must reproduce the above copyright |
asifahmad | 0:e8a124690cda | 18 | notice, this list of conditions and the following disclaimer in the |
asifahmad | 0:e8a124690cda | 19 | documentation and/or other materials provided with the distribution. |
asifahmad | 0:e8a124690cda | 20 | 3. Neither the name of the copyright holders nor the |
asifahmad | 0:e8a124690cda | 21 | names of its contributors may be used to endorse or promote products |
asifahmad | 0:e8a124690cda | 22 | derived from this software without specific prior written permission. |
asifahmad | 0:e8a124690cda | 23 | |
asifahmad | 0:e8a124690cda | 24 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY |
asifahmad | 0:e8a124690cda | 25 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
asifahmad | 0:e8a124690cda | 26 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
asifahmad | 0:e8a124690cda | 27 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY |
asifahmad | 0:e8a124690cda | 28 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
asifahmad | 0:e8a124690cda | 29 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
asifahmad | 0:e8a124690cda | 30 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
asifahmad | 0:e8a124690cda | 31 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
asifahmad | 0:e8a124690cda | 32 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
asifahmad | 0:e8a124690cda | 33 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
asifahmad | 0:e8a124690cda | 34 | */ |
asifahmad | 0:e8a124690cda | 35 | /**************************************************************************/ |
asifahmad | 0:e8a124690cda | 36 | #ifndef _PCA9685_H_ |
asifahmad | 0:e8a124690cda | 37 | #define _PCA9685_H_ |
asifahmad | 0:e8a124690cda | 38 | |
asifahmad | 0:e8a124690cda | 39 | #ifdef __cplusplus |
asifahmad | 0:e8a124690cda | 40 | extern "C" { |
asifahmad | 0:e8a124690cda | 41 | #endif |
asifahmad | 0:e8a124690cda | 42 | |
asifahmad | 0:e8a124690cda | 43 | #include "projectconfig.h" |
asifahmad | 0:e8a124690cda | 44 | #include "core/i2c/i2c.h" |
asifahmad | 0:e8a124690cda | 45 | |
asifahmad | 0:e8a124690cda | 46 | #define PCA9685_ADDRESS (0x40<<1) // 1000000 |
asifahmad | 0:e8a124690cda | 47 | #define PCA9685_READBIT (0x01) |
asifahmad | 0:e8a124690cda | 48 | |
asifahmad | 0:e8a124690cda | 49 | enum |
asifahmad | 0:e8a124690cda | 50 | { |
asifahmad | 0:e8a124690cda | 51 | PCA9685_REG_SUBADR1 = 0x02, |
asifahmad | 0:e8a124690cda | 52 | PCA9685_REG_SUBADR2 = 0x03, |
asifahmad | 0:e8a124690cda | 53 | PCA9685_REG_SUBADR3 = 0x04, |
asifahmad | 0:e8a124690cda | 54 | PCA9685_REG_MODE1 = 0x00, |
asifahmad | 0:e8a124690cda | 55 | PCA9685_REG_PRESCALE = 0xFE, |
asifahmad | 0:e8a124690cda | 56 | PCA9685_REG_LED0_ON_L = 0x06, |
asifahmad | 0:e8a124690cda | 57 | PCA9685_REG_LED0_ON_H = 0x07, |
asifahmad | 0:e8a124690cda | 58 | PCA9685_REG_LED0_OFF_L = 0x08, |
asifahmad | 0:e8a124690cda | 59 | PCA9685_REG_LED0_OFF_H = 0x09, |
asifahmad | 0:e8a124690cda | 60 | PCA9685_REG_ALLLED_ON_L = 0xFA, |
asifahmad | 0:e8a124690cda | 61 | PCA9685_REG_ALLLED_ON_H = 0xFB, |
asifahmad | 0:e8a124690cda | 62 | PCA9685_REG_ALLLED_OFF_L = 0xFC, |
asifahmad | 0:e8a124690cda | 63 | PCA9685_REG_ALLLED_OFF_H = 0xFD |
asifahmad | 0:e8a124690cda | 64 | }; |
asifahmad | 0:e8a124690cda | 65 | |
asifahmad | 0:e8a124690cda | 66 | error_t pca9685Init (uint8_t address); |
asifahmad | 0:e8a124690cda | 67 | error_t pca9685SetFrequency (uint16_t freqHz); |
asifahmad | 0:e8a124690cda | 68 | error_t pca9685SetPWM (uint16_t channel, uint16_t on, uint16_t off); |
asifahmad | 0:e8a124690cda | 69 | |
asifahmad | 0:e8a124690cda | 70 | #ifdef __cplusplus |
asifahmad | 0:e8a124690cda | 71 | } |
asifahmad | 0:e8a124690cda | 72 | #endif |
asifahmad | 0:e8a124690cda | 73 | |
asifahmad | 0:e8a124690cda | 74 | #endif |